element-plus
Version:
A Component Library for Vue 3
1 lines • 11.5 kB
Source Map (JSON)
{"version":3,"file":"props.mjs","sources":["../../../../../../../packages/components/time-picker/src/common/props.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport { buildProps, definePropType } from '@element-plus/utils'\nimport {\n useAriaProps,\n useEmptyValuesProps,\n useSizeProp,\n} from '@element-plus/hooks'\nimport { useTooltipContentProps } from '@element-plus/components/tooltip'\nimport { CircleClose } from '@element-plus/icons-vue'\nimport { disabledTimeListsProps } from '../props/shared'\n\nimport type { Component, ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type { Options } from '@popperjs/core'\nimport type { Dayjs } from 'dayjs'\nimport type { Placement } from '@element-plus/components/popper'\n\nexport type SingleOrRange<T> = T | [T, T]\nexport type DateModelType = number | string | Date\nexport type ModelValueType = DateModelType | number[] | string[] | Date[]\nexport type DayOrDays = SingleOrRange<Dayjs>\nexport type DateOrDates = SingleOrRange<Date>\nexport type UserInput = SingleOrRange<string | null>\nexport type GetDisabledHours = (role: string, comparingDate?: Dayjs) => number[]\nexport type GetDisabledMinutes = (\n hour: number,\n role: string,\n comparingDate?: Dayjs\n) => number[]\nexport type GetDisabledSeconds = (\n hour: number,\n minute: number,\n role: string,\n comparingDate?: Dayjs\n) => number[]\n\nexport const timePickerDefaultProps = buildProps({\n /**\n * @description this prop decides if the date picker panel pops up when the input is focused\n */\n automaticDropdown: {\n type: Boolean,\n default: true,\n },\n /**\n * @description same as `id` in native input\n */\n id: {\n type: definePropType<SingleOrRange<string>>([Array, String]),\n },\n /**\n * @description same as `name` in native input\n */\n name: {\n type: definePropType<SingleOrRange<string>>([Array, String]),\n },\n /**\n * @description custom class name for TimePicker's dropdown\n */\n popperClass: useTooltipContentProps.popperClass,\n /**\n * @description custom style for TimePicker's dropdown\n */\n popperStyle: useTooltipContentProps.popperStyle,\n /**\n * @description format of the displayed value in the input box\n */\n format: String,\n /**\n * @description optional, format of binding value. If not specified, the binding value will be a Date object\n */\n valueFormat: String,\n /**\n * @description optional, format of the date displayed in input's inner panel\n */\n dateFormat: String,\n /**\n * @description optional, format of the time displayed in input's inner panel\n */\n timeFormat: String,\n /**\n * @description type of the picker\n */\n type: {\n type: String,\n default: '',\n },\n /**\n * @description whether to show clear button\n */\n clearable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Custom clear icon component\n */\n clearIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: CircleClose,\n },\n /**\n * @description whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Custom prefix icon component\n */\n prefixIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: '',\n },\n /**\n * @description size of Input\n */\n size: useSizeProp,\n /**\n * @description whether TimePicker is read only\n */\n readonly: Boolean,\n /**\n * @description whether TimePicker is disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description placeholder in non-range mode\n */\n placeholder: {\n type: String,\n default: '',\n },\n /**\n * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n */\n popperOptions: {\n type: definePropType<Partial<Options>>(Object),\n default: () => ({}),\n },\n /**\n * @description binding value, if it is an array, the length should be 2\n */\n modelValue: {\n type: definePropType<ModelValueType | null>([Date, Array, String, Number]),\n default: '',\n },\n /**\n * @description range separator\n */\n rangeSeparator: {\n type: String,\n default: '-',\n },\n /**\n * @description placeholder for the start date in range mode\n */\n startPlaceholder: String,\n /**\n * @description placeholder for the end date in range mode\n */\n endPlaceholder: String,\n /**\n * @description optional, default date of the calendar\n */\n defaultValue: {\n type: definePropType<SingleOrRange<Date>>([Date, Array]),\n },\n /**\n * @description optional, the time value to use when selecting date range\n */\n defaultTime: {\n type: definePropType<SingleOrRange<Date>>([Date, Array]),\n },\n /**\n * @description whether to pick a time range\n */\n isRange: Boolean,\n ...disabledTimeListsProps,\n /**\n * @description a function determining if a date is disabled with that date as its parameter. Should return a Boolean\n */\n disabledDate: {\n type: Function,\n },\n /**\n * @description set custom className\n */\n cellClassName: {\n type: Function,\n },\n /**\n * @description an object array to set shortcut options\n */\n shortcuts: {\n type: Array,\n default: () => [],\n },\n /**\n * @description whether to pick time using arrow buttons\n */\n arrowControl: Boolean,\n /**\n * @description input tabindex\n */\n tabindex: {\n type: definePropType<string | number>([String, Number]),\n default: 0,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description unlink two date-panels in range-picker\n */\n unlinkPanels: Boolean,\n /**\n * @description position of dropdown\n */\n placement: {\n type: definePropType<Placement>(String),\n values: placements,\n default: 'bottom',\n },\n /**\n * @description list of possible positions for dropdown\n */\n fallbackPlacements: {\n type: definePropType<Placement[]>(Array),\n default: ['bottom', 'top', 'right', 'left'],\n },\n ...useEmptyValuesProps,\n ...useAriaProps(['ariaLabel']),\n /**\n * @description whether to show the now button\n */\n showNow: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether to show footer\n */\n showConfirm: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether to show footer\n */\n showFooter: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether to show the number of the calendar week\n */\n showWeekNumber: Boolean,\n} as const)\n\nexport type TimePickerDefaultProps = ExtractPropTypes<\n typeof timePickerDefaultProps\n>\nexport type TimePickerDefaultPropsPublic = ExtractPublicPropTypes<\n typeof timePickerDefaultProps\n>\n\nexport interface PickerOptions {\n isValidValue: (date: DayOrDays) => boolean\n handleKeydownInput: (event: KeyboardEvent) => void\n parseUserInput: (value: UserInput) => DayOrDays\n getRangeAvailableTime: (date: DayOrDays) => DayOrDays\n getDefaultValue: () => DayOrDays\n panelReady: boolean\n handleClear: () => void\n handleFocusPicker?: () => void\n}\n\nexport const timePickerRangeTriggerProps = buildProps({\n id: {\n type: definePropType<string[]>(Array),\n },\n name: {\n type: definePropType<string[]>(Array),\n },\n modelValue: {\n type: definePropType<UserInput>([Array, String]),\n },\n startPlaceholder: String,\n endPlaceholder: String,\n disabled: Boolean,\n} as const)\n\n/**\n * @deprecated Use `timePickerRangeTriggerProps` instead. This will be removed in future versions.\n */\nexport const timePickerRngeTriggerProps = timePickerRangeTriggerProps\n"],"names":[],"mappings":";;;;;;;;;AAmCO,MAAM,yBAAyB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAI/C,iBAAA,EAAmB;AAAA,IACjB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,EAAA,EAAI;AAAA,IACF,IAAA,EAAM,cAAA,CAAsC,CAAC,KAAA,EAAO,MAAM,CAAC;AAAA,GAC7D;AAAA;AAAA;AAAA;AAAA,EAIA,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,cAAA,CAAsC,CAAC,KAAA,EAAO,MAAM,CAAC;AAAA,GAC7D;AAAA;AAAA;AAAA;AAAA,EAIA,aAAa,sBAAA,CAAuB,WAAA;AAAA;AAAA;AAAA;AAAA,EAIpC,aAAa,sBAAA,CAAuB,WAAA;AAAA;AAAA;AAAA;AAAA,EAIpC,MAAA,EAAQ,MAAA;AAAA;AAAA;AAAA;AAAA,EAIR,WAAA,EAAa,MAAA;AAAA;AAAA;AAAA;AAAA,EAIb,UAAA,EAAY,MAAA;AAAA;AAAA;AAAA;AAAA,EAIZ,UAAA,EAAY,MAAA;AAAA;AAAA;AAAA;AAAA,EAIZ,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,SAAA,EAAW;AAAA,IACT,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,SAAA,EAAW;AAAA,IACT,IAAA,EAAM,cAAA,CAAmC,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,IACzD,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;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