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
62 KiB

1 month ago
  1. {"ast":null,"code":"import { defineComponent, inject, toRef, ref, watch, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, Fragment, renderList, toDisplayString, createCommentVNode, createVNode, withDirectives, withCtx, createBlock, createTextVNode } from 'vue';\nimport dayjs from 'dayjs';\nimport { ElButton } from '../../../button/index.mjs';\nimport { ElInput } from '../../../input/index.mjs';\nimport '../../../time-picker/index.mjs';\nimport { ElIcon } from '../../../icon/index.mjs';\nimport { ArrowRight, DArrowLeft, ArrowLeft, DArrowRight } from '@element-plus/icons-vue';\nimport { panelDateRangeProps } from '../props/panel-date-range.mjs';\nimport { useRangePicker } from '../composables/use-range-picker.mjs';\nimport { isValidRange, getDefaultValue } from '../utils.mjs';\nimport DateTable from './basic-date-table.mjs';\nimport _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';\nimport TimePickPanel from '../../../time-picker/src/time-picker-com/panel-time-pick.mjs';\nimport ClickOutside from '../../../../directives/click-outside/index.mjs';\nimport { useLocale } from '../../../../hooks/use-locale/index.mjs';\nimport { extractTimeFormat, extractDateFormat } from '../../../time-picker/src/utils.mjs';\nimport { isArray } from '@vue/shared';\nconst unit = \"month\";\nconst _sfc_main = /* @__PURE__ */defineComponent({\n __name: \"panel-date-range\",\n props: panelDateRangeProps,\n emits: [\"pick\", \"set-picker-option\", \"calendar-change\", \"panel-change\"],\n setup(__props, {\n emit\n }) {\n const props = __props;\n const pickerBase = inject(\"EP_PICKER_BASE\");\n const {\n disabledDate,\n cellClassName,\n defaultTime,\n clearable\n } = pickerBase.props;\n const format = toRef(pickerBase.props, \"format\");\n const shortcuts = toRef(pickerBase.props, \"shortcuts\");\n const defaultValue = toRef(pickerBase.props, \"defaultValue\");\n const {\n lang\n } = useLocale();\n const leftDate = ref(dayjs().locale(lang.value));\n const rightDate = ref(dayjs().locale(lang.value).add(1, unit));\n const {\n minDate,\n maxDate,\n rangeState,\n ppNs,\n drpNs,\n handleChangeRange,\n handleRangeConfirm,\n handleShortcutClick,\n onSelect,\n onReset,\n t\n } = useRangePicker(props, {\n defaultValue,\n leftDate,\n rightDate,\n unit,\n onParsedValueChanged\n });\n watch(() => props.visible, visible => {\n if (!visible && rangeState.value.selecting) {\n onReset(props.parsedValue);\n onSelect(false);\n }\n });\n const dateUserInput = ref({\n min: null,\n max: null\n });\n const timeUserInput = ref({\n min: null,\n max: null\n });\n const leftLabel = computed(() => {\n return `${leftDate.value.year()} ${t(\"el.datepicker.year\")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;\n });\n const rightLabel = computed(() => {\n return `${rightDate.value.year()} ${t(\"el.datepicker.year\")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;\n });\n const leftYear = computed(() => {\n return leftDate.value.year();\n });\n const leftMonth = computed(() => {\n return leftDate.value.month();\n });\n const rightYear = computed(() => {\n return rightDate.value.year();\n });\n const rightMonth = computed(() => {\n return rightDate.value.month();\n });\n const hasShortcuts = computed(() => !!shortcuts.value.length);\n const minVisibleDate = computed(() => {\n if (dateUserInput.value.min !== null) return dateUserInput.value.min;\n if (minDate.value) return minDate.value.format(dateFormat.value);\n return \"\";\n });\n const maxVisibleDate = computed(() => {\n if (dateUserInput.value.max !== null) return dateUserInput.value.max;\n if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(dateFormat.value);\n return \"\";\n });\n