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

44 lines
1.4 KiB
TypeScript
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';
2020-10-14 15:12:51 +00:00
import { App, DefineComponent, defineComponent } from 'vue';
type DatePickerPropstypes = typeof DatePickerProps;
2018-03-15 13:40:34 +00:00
2020-10-14 15:12:51 +00:00
const DatePicker: DefineComponent<DatePickerPropstypes> = defineComponent<DatePickerPropstypes>(
wrapPicker(
{
...createPicker(VcCalendar as any, DatePickerProps),
name: 'ADatePicker',
} as any,
DatePickerProps,
'date',
) as any,
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(
2020-10-14 15:12:51 +00:00
{ ...createPicker(MonthCalendar as any, MonthPickerProps), name: 'AMonthPicker' } as any,
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, {
2020-10-14 15:12:51 +00:00
RangePicker: wrapPicker(RangePicker as any, RangePickerProps, 'date'),
2018-03-15 13:40:34 +00:00
MonthPicker,
2020-10-14 15:12:51 +00:00
WeekPicker: wrapPicker(WeekPicker as any, WeekPickerProps, 'week'),
2019-01-12 03:33:27 +00:00
});
2018-03-15 13:40:34 +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
};
2019-01-12 03:33:27 +00:00
export default DatePicker;