{"version":3,"file":"date-picker.js","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 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 { useNamespace } from '@element-plus/hooks'\nimport {\n CommonPicker,\n DEFAULT_FORMATS_DATE,\n DEFAULT_FORMATS_DATEPICKER,\n} from '@element-plus/components/time-picker'\nimport { ROOT_PICKER_INJECTION_KEY } from './constants'\n\nimport { datePickerProps } from './props/date-picker'\nimport { getPanel } from './panel-utils'\nimport type { DatePickerExpose } from './instance'\n\ndayjs.extend(localeData)\ndayjs.extend(advancedFormat)\ndayjs.extend(customParseFormat)\ndayjs.extend(weekOfYear)\ndayjs.extend(weekYear)\ndayjs.extend(dayOfYear)\ndayjs.extend(isSameOrAfter)\ndayjs.extend(isSameOrBefore)\n\nexport default defineComponent({\n name: 'ElDatePicker',\n install: null,\n props: datePickerProps,\n emits: ['update:modelValue'],\n setup(props, { expose, emit, slots }) {\n const ns = useNamespace('picker-panel')\n\n provide('ElPopperOptions', reactive(toRef(props, 'popperOptions')))\n provide(ROOT_PICKER_INJECTION_KEY, {\n slots,\n pickerNs: ns,\n })\n\n const commonPicker = ref>()\n const refProps: DatePickerExpose = {\n focus: (focusStartInput = true) => {\n commonPicker.value?.focus(focusStartInput)\n },\n handleOpen: () => {\n commonPicker.value?.handleOpen()\n },\n handleClose: () => {\n commonPicker.value?.handleClose()\n },\n }\n\n expose(refProps)\n\n const onModelValueUpdated = (val: any) => {\n emit('update:modelValue', val)\n }\n\n return () => {\n // since props always have all defined keys on it, {format, ...props} will always overwrite format\n // pick props.format or provide default value here before spreading\n const format =\n props.format ??\n (DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE)\n\n const Component = getPanel(props.type)\n\n return (\n \n {{\n default: (scopedProps: /**FIXME: remove any type */ any) => (\n \n {{\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 \n ),\n 'range-separator': slots['range-separator'],\n }}\n \n )\n }\n },\n})\n"],"names":["dayjs","extend","localeData","advancedFormat","customParseFormat","weekOfYear","weekYear","dayOfYear","isSameOrAfter","isSameOrBefore","defineComponent","name","install","props","datePickerProps","emits","expose","emit","slots","useNamespace","provide","ROOT_PICKER_INJECTION_KEY","reactive","pickerNs","ref","commonPicker","focus","focusStartInput","handleOpen","handleClose","onModelValueUpdated","val","DEFAULT_FORMATS_DATEPICKER","DEFAULT_FORMATS_DATE","format","getPanel","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBAA,yBAAK,CAACC,MAAN,CAAaC,8BAAb,CAAA,CAAA;AACAF,yBAAK,CAACC,MAAN,CAAaE,kCAAb,CAAA,CAAA;AACAH,yBAAK,CAACC,MAAN,CAAaG,qCAAb,CAAA,CAAA;AACAJ,yBAAK,CAACC,MAAN,CAAaI,8BAAb,CAAA,CAAA;AACAL,yBAAK,CAACC,MAAN,CAAaK,4BAAb,CAAA,CAAA;AACAN,yBAAK,CAACC,MAAN,CAAaM,6BAAb,CAAA,CAAA;AACAP,yBAAK,CAACC,MAAN,CAAaO,iCAAb,CAAA,CAAA;AACAR,yBAAK,CAACC,MAAN,CAAaQ,kCAAb,CAAA,CAAA;AAEA,iBAAeC,mBAAe,CAAC;AAC7BC,EAAAA,IAAI,EAAE,cADuB;AAE7BC,EAAAA,OAAO,EAAE,IAFoB;AAG7BC,EAAAA,KAAK,EA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