UNPKG

hongluan-ui

Version:
77 lines (74 loc) 2.45 kB
import { defineComponent, ref, provide, computed, createVNode, mergeProps } from 'vue'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat.js'; import '../../../hooks/index.mjs'; import { DEFAULT_FORMATS_TIME } from './constants.mjs'; import _sfc_main$2 from './common/picker.mjs'; import _sfc_main$1 from './time-picker-com/panel-time-pick.mjs'; import _sfc_main from './time-picker-com/panel-time-range.mjs'; import { timePickerDefaultProps } from './common/props.mjs'; import { useConsistentProp } from '../../../hooks/use-consistent-prop/index.mjs'; dayjs.extend(customParseFormat); var TimePicker = defineComponent({ name: "TimePicker", install: null, props: { ...timePickerDefaultProps, isRange: { type: Boolean, default: false } }, emits: ["update:modelValue"], setup(props, ctx) { const commonPicker = ref(); const [type, Panel] = props.isRange ? ["timerange", _sfc_main] : ["time", _sfc_main$1]; const modelUpdater = (value) => ctx.emit("update:modelValue", value); provide("PopperOptions", props.popperOptions); ctx.expose({ focus: (e) => { var _a; (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e); }, blur: (e) => { var _a; (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e); }, handleOpen: () => { var _a; (_a = commonPicker.value) == null ? void 0 : _a.handleOpen(); }, handleClose: () => { var _a; (_a = commonPicker.value) == null ? void 0 : _a.handleClose(); }, popperPaneRef: computed(() => { var _a; return (_a = commonPicker.value) == null ? void 0 : _a.popperPaneRef; }) }); return () => { var _a; const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME; const { size, disabled, fill } = useConsistentProp(); return createVNode(_sfc_main$2, mergeProps(props, { "ref": commonPicker, "type": type, "format": format, "size": size.value, "disabled": disabled.value, "fill": fill.value, "onUpdate:modelValue": modelUpdater }), { default: (props2) => createVNode(Panel, props2, null), icon: ctx.slots.icon }); }; } }); export { TimePicker as default }; //# sourceMappingURL=time-picker.mjs.map