{"version":3,"file":"use-year-range-header.js","sources":["../../../../../../../packages/components/date-picker/src/composables/use-year-range-header.ts"],"sourcesContent":["import { computed } from 'vue'\nimport type { Ref, ToRef } from 'vue'\nimport type { Dayjs } from 'dayjs'\n\nexport const useYearRangeHeader = ({\n unlinkPanels,\n leftDate,\n rightDate,\n}: {\n unlinkPanels: ToRef\n leftDate: Ref\n rightDate: Ref\n}) => {\n const leftPrevYear = () => {\n leftDate.value = leftDate.value.subtract(10, 'year')\n if (!unlinkPanels.value) {\n rightDate.value = rightDate.value.subtract(10, 'year')\n }\n }\n\n const rightNextYear = () => {\n if (!unlinkPanels.value) {\n leftDate.value = leftDate.value.add(10, 'year')\n }\n rightDate.value = rightDate.value.add(10, 'year')\n }\n\n const leftNextYear = () => {\n leftDate.value = leftDate.value.add(10, 'year')\n }\n\n const rightPrevYear = () => {\n rightDate.value = rightDate.value.subtract(10, 'year')\n }\n\n const leftLabel = computed(() => {\n const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10\n return `${leftStartDate}-${leftStartDate + 9}`\n })\n\n const rightLabel = computed(() => {\n const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10\n return `${rightStartDate}-${rightStartDate + 9}`\n })\n\n const leftYear = computed(() => {\n const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9\n return leftEndDate\n })\n\n const rightYear = computed(() => {\n const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10\n return rightStartDate\n })\n\n return {\n leftPrevYear,\n rightNextYear,\n leftNextYear,\n rightPrevYear,\n leftLabel,\n rightLabel,\n leftYear,\n rightYear,\n }\n}\n"],"names":["computed"],"mappings":";;;;;;AACY,MAAC,kBAAkB,GAAG,CAAC;AACnC,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,SAAS;AACX,CAAC,KAAK;AACN,EAAE,MAAM,YAAY,GAAG,MAAM;AAC7B,IAAI,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC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