element-plus
Version:
A Component Library for Vue 3
1 lines • 9.76 kB
Source Map (JSON)
{"version":3,"file":"props.mjs","names":[],"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 Whether to auto-fill the input with the current time on focus when no value is selected.\n */\n saveOnBlur: {\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 handleCancel?: () => 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"],"mappings":";;;;;;;;;;AAmCA,MAAa,yBAAyB,WAAW;CAI/C,mBAAmB;EACjB,MAAM;EACN,SAAS;EACV;CAID,IAAI,EACF,MAAM,eAAsC,CAAC,OAAO,OAAO,CAAC,EAC7D;CAID,MAAM,EACJ,MAAM,eAAsC,CAAC,OAAO,OAAO,CAAC,EAC7D;CAID,aAAa,uBAAuB;CAIpC,aAAa,uBAAuB;CAIpC,QAAQ;CAIR,aAAa;CAIb,YAAY;CAIZ,YAAY;CAIZ,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM,eAAmC,CAAC,QAAQ,OAAO,CAAC;EAC1D,SAAS;EACV;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM,eAAmC,CAAC,QAAQ,OAAO,CAAC;EAC1D,SAAS;EACV;CAID,MAAM;CAIN,UAAU;CAIV,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,aAAa;EACX,MAAM;EACN,SAAS;EACV;CAID,eAAe;EACb,MAAM,eAAiC,OAAO;EAC9C,gBAAgB,EAAE;EACnB;CAID,YAAY;EACV,MAAM,eAAsC;GAAC;GAAM;GAAO;GAAQ;GAAO,CAAC;EAC1E,SAAS;EACV;CAID,gBAAgB;EACd,MAAM;EACN,SAAS;EACV;CAID,kBAAkB;CAIlB,gBAAgB;CAIhB,cAAc,EACZ,MAAM,eAAoC,CAAC,MAAM,MAAM,CAAC,EACzD;CAID,aAAa,EACX,MAAM,eAAoC,CAAC,MAAM,MAAM,CAAC,EACzD;CAID,SAAS;CACT,GA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