You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
8.8 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, provide, reactive, toRef, ref, createVNode, mergeProps } from 'vue';\nimport dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js';\nimport advancedFormat from 'dayjs/plugin/advancedFormat.js';\nimport localeData from 'dayjs/plugin/localeData.js';\nimport weekOfYear from 'dayjs/plugin/weekOfYear.js';\nimport weekYear from 'dayjs/plugin/weekYear.js';\nimport dayOfYear from 'dayjs/plugin/dayOfYear.js';\nimport isSameOrAfter from 'dayjs/plugin/isSameOrAfter.js';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';\nimport '../../time-picker/index.mjs';\nimport { ROOT_PICKER_INJECTION_KEY } from './constants.mjs';\nimport { datePickerProps } from './props/date-picker.mjs';\nimport { getPanel } from './panel-utils.mjs';\nimport { DEFAULT_FORMATS_DATEPICKER, DEFAULT_FORMATS_DATE } from '../../time-picker/src/constants.mjs';\nimport CommonPicker from '../../time-picker/src/common/picker.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\ndayjs.extend(localeData);\ndayjs.extend(advancedFormat);\ndayjs.extend(customParseFormat);\ndayjs.extend(weekOfYear);\ndayjs.extend(weekYear);\ndayjs.extend(dayOfYear);\ndayjs.extend(isSameOrAfter);\ndayjs.extend(isSameOrBefore);\nvar DatePicker = defineComponent({\n name: \"ElDatePicker\",\n install: null,\n props: datePickerProps,\n emits: [\"update:modelValue\"],\n setup(props, {\n expose,\n emit,\n slots\n }) {\n const ns = useNamespace(\"picker-panel\");\n provide(\"ElPopperOptions\", reactive(toRef(props, \"popperOptions\")));\n provide(ROOT_PICKER_INJECTION_KEY, {\n slots,\n pickerNs: ns\n });\n const commonPicker = ref();\n const refProps = {\n focus: () => {\n var _a;\n (_a = commonPicker.value) == null ? void 0 : _a.focus();\n },\n blur: () => {\n var _a;\n (_a = commonPicker.value) == null ? void 0 : _a.blur();\n },\n handleOpen: () => {\n var _a;\n (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();\n },\n handleClose: () => {\n var _a;\n (_a = commonPicker.value) == null ? void 0 : _a.handleClose();\n }\n };\n expose(refProps);\n const onModelValueUpdated = val => {\n emit(\"update:modelValue\", val);\n };\n return () => {\n var _a;\n const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;\n const Component = getPanel(props.type);\n return createVNode(CommonPicker, mergeProps(props, {\n \"format\": format,\n \"type\": props.type,\n \"ref\": commonPicker,\n \"onUpdate:modelValue\": onModelValueUpdated\n }), {\n default: scopedProps => createVNode(Component, scopedProps, {\n \"prev-month\": slots[\"prev-month\"],\n \"next-month\": slots[\"next-month\"],\n \"prev-year\": slots[\"prev-year\"],\n \"next-year\": slots[\"next-year\"]\n }),\n \"range-separator\": slots[\"range-separator\"]\n });\n };\n }\n});\nexport { DatePicker as default };","map":{"version":3,"names":["dayjs","extend","localeData","advancedFormat","customParseFormat","weekOfYear","weekYear","dayOfYear","isSameOrAfter","isSameOrBefore","DatePicker","defineComponent","name","install","props","datePickerProps","emits","expose","emit","slots","ns","useNamespace","provide","reactive","toRef","ROOT_PICKER_INJECTION_KEY","pickerNs","commonPicker","ref","refProps","focus","_a","value","blur","handleOpen","handleClose","onModelValueUpdated","val","format","DEFAULT_FORMATS_DATEPICKER","type","DEFAULT_FORMATS_DATE","Component","getPanel","createVNode","CommonPicker","mergeProps","default","scopedProps"],"sources":["../../../../../../packages/components/date-picker/src/date-picker.tsx"],"sourcesContent":["import { defineComponent, provide, reactive, ref, toRef } from 'vue'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\nimport adva