You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.7 KiB
46 lines
1.7 KiB
3 years ago
|
import type { Dayjs } from 'dayjs';
|
||
|
import type { App } from 'vue';
|
||
|
import dayjsGenerateConfig from '../vc-picker/generate/dayjs';
|
||
|
import type {
|
||
|
PickerProps,
|
||
|
PickerDateProps,
|
||
|
RangePickerProps as BaseRangePickerProps,
|
||
|
} from './generatePicker';
|
||
|
import generatePicker from './generatePicker';
|
||
|
import type { ExtraDatePickerProps, ExtraRangePickerProps } from './generatePicker/props';
|
||
|
|
||
|
export type DatePickerProps = PickerProps<Dayjs> & ExtraDatePickerProps<Dayjs>;
|
||
|
export type MonthPickerProps = Omit<PickerDateProps<Dayjs>, 'picker'> & ExtraDatePickerProps<Dayjs>;
|
||
|
export type WeekPickerProps = Omit<PickerDateProps<Dayjs>, 'picker'> & ExtraDatePickerProps<Dayjs>;
|
||
|
export type RangePickerProps = BaseRangePickerProps<Dayjs> & ExtraRangePickerProps<Dayjs>;
|
||
|
|
||
|
const { DatePicker, WeekPicker, MonthPicker, YearPicker, TimePicker, QuarterPicker, RangePicker } =
|
||
|
generatePicker<Dayjs>(dayjsGenerateConfig);
|
||
|
|
||
|
DatePicker.WeekPicker = WeekPicker;
|
||
|
DatePicker.MonthPicker = MonthPicker;
|
||
|
DatePicker.YearPicker = YearPicker;
|
||
|
DatePicker.RangePicker = RangePicker;
|
||
|
DatePicker.TimePicker = TimePicker;
|
||
|
DatePicker.QuarterPicker = QuarterPicker;
|
||
|
|
||
|
/* istanbul ignore next */
|
||
|
DatePicker.install = function (app: App) {
|
||
|
app.component(DatePicker.name, DatePicker);
|
||
|
app.component(RangePicker.name, RangePicker);
|
||
|
app.component(MonthPicker.name, MonthPicker);
|
||
|
app.component(WeekPicker.name, WeekPicker);
|
||
|
app.component(QuarterPicker.name, QuarterPicker);
|
||
|
return app;
|
||
|
};
|
||
|
|
||
|
export { RangePicker, WeekPicker, MonthPicker, QuarterPicker };
|
||
|
|
||
|
export default DatePicker as typeof DatePicker &
|
||
|
Plugin & {
|
||
|
readonly RangePicker: typeof RangePicker;
|
||
|
readonly MonthPicker: typeof MonthPicker;
|
||
|
readonly WeekPicker: typeof WeekPicker;
|
||
|
readonly QuarterPicker: typeof QuarterPicker;
|
||
|
};
|