{"version":3,"file":"use-month-range-header.js","sources":["../../../../../../../packages/components/date-picker/src/composables/use-month-range-header.ts"],"sourcesContent":["import { computed } from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport type { Ref, ToRef } from 'vue'\nimport type { Dayjs } from 'dayjs'\n\nexport const useMonthRangeHeader = ({\n unlinkPanels,\n leftDate,\n rightDate,\n}: {\n unlinkPanels: ToRef\n leftDate: Ref\n rightDate: Ref\n}) => {\n const { t } = useLocale()\n const leftPrevYear = () => {\n leftDate.value = leftDate.value.subtract(1, 'year')\n if (!unlinkPanels.value) {\n rightDate.value = rightDate.value.subtract(1, 'year')\n }\n }\n\n const rightNextYear = () => {\n if (!unlinkPanels.value) {\n leftDate.value = leftDate.value.add(1, 'year')\n }\n rightDate.value = rightDate.value.add(1, 'year')\n }\n\n const leftNextYear = () => {\n leftDate.value = leftDate.value.add(1, 'year')\n }\n\n const rightPrevYear = () => {\n rightDate.value = rightDate.value.subtract(1, 'year')\n }\n const leftLabel = computed(() => {\n return `${leftDate.value.year()} ${t('el.datepicker.year')}`\n })\n\n const rightLabel = computed(() => {\n return `${rightDate.value.year()} ${t('el.datepicker.year')}`\n })\n\n const leftYear = computed(() => {\n return leftDate.value.year()\n })\n\n const rightYear = computed(() => {\n return rightDate.value.year() === leftDate.value.year()\n ? leftDate.value.year() + 1\n : rightDate.value.year()\n })\n\n return {\n leftPrevYear,\n rightNextYear,\n leftNextYear,\n rightPrevYear,\n leftLabel,\n rightLabel,\n leftYear,\n rightYear,\n }\n}\n"],"names":["useLocale","computed"],"mappings":";;;;;;;;AAEY,MAAC,mBAAmB,GAAG,CAAC;AACpC,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,SAAS;AACX,CAAC,KAAK;AACN,EAAE,MAAM,EAAE,CAAC,EAAE,GAAGA,eAAS,EAAE,CAAC;AAC5B,EAAE,MAAM,YAAY,GAAG,MAAM;AAC7B,IAAI,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,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