element-plus
Version:
A Component Library for Vue 3
265 lines (264 loc) • 5.97 kB
JavaScript
import { buildProps, definePropType } from "../../../../utils/vue/props/runtime.mjs";
import { useSizeProp } from "../../../../hooks/use-size/index.mjs";
import { useEmptyValuesProps } from "../../../../hooks/use-empty-values/index.mjs";
import { useAriaProps } from "../../../../hooks/use-aria/index.mjs";
import { useTooltipContentProps } from "../../../tooltip/src/content.mjs";
import { disabledTimeListsProps } from "../props/shared.mjs";
import { CircleClose } from "@element-plus/icons-vue";
import { placements } from "@popperjs/core";
//#region ../../packages/components/time-picker/src/common/props.ts
const timePickerDefaultProps = buildProps({
/**
* @description this prop decides if the date picker panel pops up when the input is focused
*/
automaticDropdown: {
type: Boolean,
default: true
},
/**
* @description same as `id` in native input
*/
id: { type: definePropType([Array, String]) },
/**
* @description same as `name` in native input
*/
name: { type: definePropType([Array, String]) },
/**
* @description custom class name for TimePicker's dropdown
*/
popperClass: useTooltipContentProps.popperClass,
/**
* @description custom style for TimePicker's dropdown
*/
popperStyle: useTooltipContentProps.popperStyle,
/**
* @description format of the displayed value in the input box
*/
format: String,
/**
* @description optional, format of binding value. If not specified, the binding value will be a Date object
*/
valueFormat: String,
/**
* @description optional, format of the date displayed in input's inner panel
*/
dateFormat: String,
/**
* @description optional, format of the time displayed in input's inner panel
*/
timeFormat: String,
/**
* @description type of the picker
*/
type: {
type: String,
default: ""
},
/**
* @description whether to show clear button
*/
clearable: {
type: Boolean,
default: true
},
/**
* @description Custom clear icon component
*/
clearIcon: {
type: definePropType([String, Object]),
default: CircleClose
},
/**
* @description whether the input is editable
*/
editable: {
type: Boolean,
default: true
},
/**
* @description Whether to auto-fill the input with the current time on focus when no value is selected.
*/
saveOnBlur: {
type: Boolean,
default: true
},
/**
* @description Custom prefix icon component
*/
prefixIcon: {
type: definePropType([String, Object]),
default: ""
},
/**
* @description size of Input
*/
size: useSizeProp,
/**
* @description whether TimePicker is read only
*/
readonly: Boolean,
/**
* @description whether TimePicker is disabled
*/
disabled: {
type: Boolean,
default: void 0
},
/**
* @description placeholder in non-range mode
*/
placeholder: {
type: String,
default: ""
},
/**
* @description [popper.js](https://popper.js.org/docs/v2/) parameters
*/
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
/**
* @description binding value, if it is an array, the length should be 2
*/
modelValue: {
type: definePropType([
Date,
Array,
String,
Number
]),
default: ""
},
/**
* @description range separator
*/
rangeSeparator: {
type: String,
default: "-"
},
/**
* @description placeholder for the start date in range mode
*/
startPlaceholder: String,
/**
* @description placeholder for the end date in range mode
*/
endPlaceholder: String,
/**
* @description optional, default date of the calendar
*/
defaultValue: { type: definePropType([Date, Array]) },
/**
* @description optional, the time value to use when selecting date range
*/
defaultTime: { type: definePropType([Date, Array]) },
/**
* @description whether to pick a time range
*/
isRange: Boolean,
...disabledTimeListsProps,
/**
* @description a function determining if a date is disabled with that date as its parameter. Should return a Boolean
*/
disabledDate: { type: Function },
/**
* @description set custom className
*/
cellClassName: { type: Function },
/**
* @description an object array to set shortcut options
*/
shortcuts: {
type: Array,
default: () => []
},
/**
* @description whether to pick time using arrow buttons
*/
arrowControl: Boolean,
/**
* @description input tabindex
*/
tabindex: {
type: definePropType([String, Number]),
default: 0
},
/**
* @description whether to trigger form validation
*/
validateEvent: {
type: Boolean,
default: true
},
/**
* @description unlink two date-panels in range-picker
*/
unlinkPanels: Boolean,
/**
* @description show only one panel in range-picker
*/
singlePanel: Boolean,
/**
* @description position of dropdown
*/
placement: {
type: definePropType(String),
values: placements,
default: "bottom"
},
/**
* @description list of possible positions for dropdown
*/
fallbackPlacements: {
type: definePropType(Array),
default: [
"bottom",
"top",
"right",
"left"
]
},
...useEmptyValuesProps,
...useAriaProps(["ariaLabel"]),
/**
* @description whether to show the now button
*/
showNow: {
type: Boolean,
default: true
},
/**
* @description whether to show footer
*/
showConfirm: {
type: Boolean,
default: true
},
/**
* @description whether to show footer
*/
showFooter: {
type: Boolean,
default: true
},
/**
* @description whether to show the number of the calendar week
*/
showWeekNumber: Boolean
});
const timePickerRangeTriggerProps = buildProps({
id: { type: definePropType(Array) },
name: { type: definePropType(Array) },
modelValue: { type: definePropType([Array, String]) },
startPlaceholder: String,
endPlaceholder: String,
disabled: Boolean
});
/**
* @deprecated Use `timePickerRangeTriggerProps` instead. This will be removed in future versions.
*/
const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
//#endregion
export { timePickerDefaultProps, timePickerRangeTriggerProps, timePickerRngeTriggerProps };
//# sourceMappingURL=props.mjs.map