UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 3.25 kB
{"version":3,"file":"shared.mjs","sources":["../../../../../../../packages/components/date-picker/src/props/shared.ts"],"sourcesContent":["import { buildProps, definePropType, isArray } from '@element-plus/utils'\nimport { datePickTypes } from '@element-plus/constants'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type { DatePickType } from '@element-plus/constants'\n\nconst selectionModes = ['date', 'dates', 'year', 'month', 'week', 'range']\n\nexport type RangeState = {\n endDate: null | Dayjs\n selecting: boolean\n}\n\nexport const datePickerSharedProps = buildProps({\n disabledDate: {\n type: definePropType<(date: Date) => boolean>(Function),\n },\n date: {\n type: definePropType<Dayjs>(Object),\n required: true,\n },\n minDate: {\n type: definePropType<Dayjs | null>(Object),\n },\n maxDate: {\n type: definePropType<Dayjs | null>(Object),\n },\n parsedValue: {\n type: definePropType<Dayjs | Dayjs[]>([Object, Array]),\n },\n rangeState: {\n type: definePropType<RangeState>(Object),\n default: () => ({\n endDate: null,\n selecting: false,\n }),\n },\n} as const)\n\nexport const panelSharedProps = buildProps({\n type: {\n type: definePropType<DatePickType>(String),\n required: true,\n values: datePickTypes,\n },\n} as const)\n\nexport const panelRangeSharedProps = buildProps({\n unlinkPanels: Boolean,\n parsedValue: {\n type: definePropType<Dayjs[]>(Array),\n },\n} as const)\n\nexport const selectionModeWithDefault = (\n mode: typeof selectionModes[number]\n) => {\n return {\n type: String,\n values: selectionModes,\n default: mode,\n }\n}\n\nexport const rangePickerSharedEmits = {\n pick: (range: [Dayjs, Dayjs]) => isArray(range),\n}\n\nexport type RangePickerSharedEmits = typeof rangePickerSharedEmits\nexport type PanelRangeSharedProps = ExtractPropTypes<\n typeof panelRangeSharedProps\n>\n"],"names":[],"mappings":";;;;;;AAEA,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC/D,MAAC,qBAAq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