ant-design-vue/components/date-picker/index.js

38 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import VcCalendar from '../vc-calendar';
import MonthCalendar from '../vc-calendar/src/MonthCalendar';
import createPicker from './createPicker';
import wrapPicker from './wrapPicker';
import RangePicker from './RangePicker';
import WeekPicker from './WeekPicker';
import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './interface';
import Base from '../base';
2018-03-15 13:40:34 +00:00
2019-01-12 03:33:27 +00:00
const DatePicker = wrapPicker(
{ ...createPicker(VcCalendar, DatePickerProps()), name: 'ADatePicker' },
DatePickerProps(),
2019-05-28 03:37:38 +00:00
'date',
2019-01-12 03:33:27 +00:00
);
2018-03-15 13:40:34 +00:00
2019-01-12 03:33:27 +00:00
const MonthPicker = wrapPicker(
{ ...createPicker(MonthCalendar, MonthPickerProps()), name: 'AMonthPicker' },
MonthPickerProps(),
2019-04-20 04:34:24 +00:00
'month',
2019-01-12 03:33:27 +00:00
);
2018-03-15 13:40:34 +00:00
Object.assign(DatePicker, {
2019-04-20 04:34:24 +00:00
RangePicker: wrapPicker(RangePicker, RangePickerProps(), 'date'),
2018-03-15 13:40:34 +00:00
MonthPicker,
2019-04-20 04:34:24 +00:00
WeekPicker: wrapPicker(WeekPicker, WeekPickerProps(), 'week'),
2019-01-12 03:33:27 +00:00
});
2018-03-15 13:40:34 +00:00
/* istanbul ignore next */
2019-01-12 03:33:27 +00:00
DatePicker.install = function(Vue) {
Vue.use(Base);
2019-01-12 03:33:27 +00:00
Vue.component(DatePicker.name, DatePicker);
Vue.component(DatePicker.RangePicker.name, DatePicker.RangePicker);
Vue.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker);
Vue.component(DatePicker.WeekPicker.name, DatePicker.WeekPicker);
};
2019-01-12 03:33:27 +00:00
export default DatePicker;