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';
|
2020-10-15 05:39:17 +00:00
|
|
|
import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './props';
|
|
|
|
import { App, defineComponent } from 'vue';
|
|
|
|
import {
|
|
|
|
DatePickerDecorator,
|
|
|
|
DatePickerPropsTypes,
|
|
|
|
RangePickerPropsTypes,
|
|
|
|
MonthPickerPropsTypes,
|
|
|
|
WeekPickerPropsTypes,
|
|
|
|
} from './interface';
|
2018-03-15 13:40:34 +00:00
|
|
|
|
2020-10-15 05:39:17 +00:00
|
|
|
const DatePicker = defineComponent<DatePickerPropsTypes>(
|
2020-10-14 15:12:51 +00:00
|
|
|
wrapPicker(
|
|
|
|
{
|
|
|
|
...createPicker(VcCalendar as any, DatePickerProps),
|
|
|
|
name: 'ADatePicker',
|
|
|
|
} as any,
|
|
|
|
DatePickerProps,
|
|
|
|
'date',
|
2020-10-15 05:39:17 +00:00
|
|
|
),
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2018-03-15 13:40:34 +00:00
|
|
|
|
2020-10-15 05:39:17 +00:00
|
|
|
const MonthPicker = defineComponent<MonthPickerPropsTypes>(
|
|
|
|
wrapPicker(
|
|
|
|
{ ...createPicker(MonthCalendar as any, MonthPickerProps), name: 'AMonthPicker' } as any,
|
|
|
|
MonthPickerProps,
|
|
|
|
'month',
|
|
|
|
),
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2018-03-15 13:40:34 +00:00
|
|
|
|
|
|
|
Object.assign(DatePicker, {
|
2020-10-15 05:39:17 +00:00
|
|
|
RangePicker: defineComponent<RangePickerPropsTypes>(
|
|
|
|
wrapPicker(RangePicker as any, RangePickerProps, 'date'),
|
|
|
|
),
|
2018-03-15 13:40:34 +00:00
|
|
|
MonthPicker,
|
2020-10-15 05:39:17 +00:00
|
|
|
WeekPicker: defineComponent<WeekPickerPropsTypes>(
|
|
|
|
wrapPicker(WeekPicker as any, WeekPickerProps, 'week'),
|
|
|
|
),
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-03-15 13:40:34 +00:00
|
|
|
|
2018-09-19 05:21:57 +00:00
|
|
|
/* istanbul ignore next */
|
2020-10-14 15:12:51 +00:00
|
|
|
DatePicker.install = function(app: App) {
|
2020-07-22 09:47:08 +00:00
|
|
|
app.component(DatePicker.name, DatePicker);
|
|
|
|
app.component(DatePicker.RangePicker.name, DatePicker.RangePicker);
|
|
|
|
app.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker);
|
|
|
|
app.component(DatePicker.WeekPicker.name, DatePicker.WeekPicker);
|
2020-10-13 11:14:56 +00:00
|
|
|
return app;
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-09-19 05:21:57 +00:00
|
|
|
|
2020-10-15 05:39:17 +00:00
|
|
|
export default DatePicker as DatePickerDecorator;
|