UNPKG

@opensig/opendesign

Version:

266 lines (265 loc) 7.14 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); require("../input/index.js"); require("../select/index.js"); require("../time-picker/index.js"); const types$2 = require("../time-picker/types.js"); const types = require("../input/types.js"); const types$1 = require("../select/types.js"); const { placeholder, inputId, disabled, readonly, size, round, color, variant } = types.inputProps; const { noResponsive, optionTitle } = types$1.selectProps; const basePickerProps = { placeholder, inputId, disabled, readonly, size, round, color, variant, noResponsive, optionTitle }; const popupPickerProps = { /** * @zh-CN 选项触发方式 * @en-US Option trigger method. * @default 'click' */ trigger: { type: String, default: "click" }, /** * @zh-CN 弹出框位置 * @en-US Popup position. * @default 'bl' */ popupPosition: { type: String, default: "bl" }, /** * @zh-CN 弹出框挂载容器 * @en-US Popup wrapper. * @default 'body' */ popupWrapper: { type: [String, Object], default: "body" }, /** * @zh-CN 是否在结束选择时,卸载所有选项 * @en-US Whether to unmount all options when ending the selection. * @default true */ unmountOnHide: { type: Boolean, default: true }, /** * @zh-CN 过渡名称 * @en-US Transition name. */ transition: { type: String } }; const dateConstraintProps = { /** * @zh-CN 禁用日期的判断函数 * @en-US Function to specify the dates that cannot be selected. */ disabledDate: { type: Function, default: void 0 }, /** * @zh-CN 禁用月份的判断函数,month 为 0-indexed(0=一月,11=十二月) * @en-US Function to specify the months that cannot be selected. month is 0-indexed (0=January, 11=December). */ disabledMonth: { type: Function, default: void 0 }, /** * @zh-CN 禁用年份的判断函数 * @en-US Function to specify the years that cannot be selected. */ disabledYear: { type: Function, default: void 0 }, /** * @zh-CN 最小可选日期(Date、格式字符串或时间戳) * @en-US Minimum selectable date (Date object, formatted string or timestamp). */ minDate: { type: [Date, String, Number], default: void 0 }, /** * @zh-CN 最大可选日期(Date、格式字符串或时间戳) * @en-US Maximum selectable date (Date object, formatted string or timestamp). */ maxDate: { type: [Date, String, Number], default: void 0 }, /** * @zh-CN 每周起始日,0=周日,1=周一,...,6=周六 * @en-US Day start of week. 0=Sunday, 1=Monday, ..., 6=Saturday. * @default 1 */ dayStartOfWeek: { type: Number, default: 1 } }; const { hourStep, minuteStep, secondStep, disabledHours, disabledMinutes, disabledSeconds, minTime, maxTime } = types$2.timePickerProps; const timeConstraintProps = { hourStep, minuteStep, secondStep, disabledHours, disabledMinutes, disabledSeconds, minTime, maxTime }; const formatProps = { /** * @zh-CN 输入和显示日期格式,支持dayjs的format允许的值 * @en-US Input and display date format. Support valid dayjs format param. * @default 'YYYY-MM-DD' */ format: { type: String, default: "YYYY/MM/DD" }, /** * @zh-CN 绑定值日期格式,支持dayjs的format允许的值, 'x' 代表时间戳 * @en-US Bound Date format. Support valid dayjs format param. 'x' as timestamp */ valueFormat: { type: String, default: "x" }, /** * @zh-CN 支持快速清除 * @en-US Support quick clearing. */ clearable: { type: Boolean } }; const yearPickerProps = { ...basePickerProps, ...popupPickerProps, ...formatProps, format: { type: String, default: "YYYY" }, disabledYear: dateConstraintProps.disabledYear, /** * @zh-CN 当返回值只有年、月份或日期时,补全细节时间戳的默认值 * @en-US When the return value only contains year, month, or date, populate the timestamp with default values for the missing time components. */ defaultValue: { type: Date, default: () => /* @__PURE__ */ new Date("1970/01/01 00:00:00") } }; const monthPickerProps = { ...yearPickerProps, format: { type: String, default: "YYYY/MM" }, disabledMonth: dateConstraintProps.disabledMonth, disabledYear: dateConstraintProps.disabledYear }; const datePickerProps = { ...monthPickerProps, format: { type: String, default: "YYYY/MM/DD" }, disabledDate: dateConstraintProps.disabledDate, minDate: dateConstraintProps.minDate, maxDate: dateConstraintProps.maxDate, dayStartOfWeek: dateConstraintProps.dayStartOfWeek }; const dateTimePickerProps = { ...datePickerProps, ...timeConstraintProps, format: { type: String, default: "YYYY/MM/DD HH:mm:ss" } }; const rangeExtraProps = { /** * @zh-CN 开始日期占位文本 * @en-US Placeholder for start date input. */ placeholderStart: { type: String, default: void 0 }, /** * @zh-CN 结束日期占位文本 * @en-US Placeholder for end date input. */ placeholderEnd: { type: String, default: void 0 } }; const yearRangePickerProps = { ...yearPickerProps, defaultValue: { type: Array, default: () => [/* @__PURE__ */ new Date("1970/01/01 00:00:00"), /* @__PURE__ */ new Date("1970/12/31 23:59:59")] }, ...rangeExtraProps }; const monthRangePickerProps = { ...monthPickerProps, defaultValue: { type: Array, default: () => [/* @__PURE__ */ new Date("1970/01/01 00:00:00"), /* @__PURE__ */ new Date("1970/12/31 23:59:59")] }, ...rangeExtraProps }; const dateRangePickerProps = { ...datePickerProps, /** * @zh-CN 当返回值只有年、月份或日期时,补全细节时间戳的默认值 * @en-US When the return value only contains year, month, or date, populate the timestamp with default values for the missing time components. */ defaultValue: { type: Array, default: () => [/* @__PURE__ */ new Date("1970/01/01 00:00:00"), /* @__PURE__ */ new Date("1970/12/31 23:59:59")] }, ...rangeExtraProps }; const dateTimeRangePickerProps = { ...dateTimePickerProps, defaultValue: { type: Array, default: () => [/* @__PURE__ */ new Date("1970/01/01 00:00:00"), /* @__PURE__ */ new Date("1970/12/31 23:59:59")] }, ...rangeExtraProps, format: { type: String, default: "YYYY/MM/DD HH:mm:ss" } }; exports.basePickerProps = basePickerProps; exports.dateConstraintProps = dateConstraintProps; exports.datePickerProps = datePickerProps; exports.dateRangePickerProps = dateRangePickerProps; exports.dateTimePickerProps = dateTimePickerProps; exports.dateTimeRangePickerProps = dateTimeRangePickerProps; exports.monthPickerProps = monthPickerProps; exports.monthRangePickerProps = monthRangePickerProps; exports.popupPickerProps = popupPickerProps; exports.timeConstraintProps = timeConstraintProps; exports.yearPickerProps = yearPickerProps; exports.yearRangePickerProps = yearRangePickerProps;