{"version":3,"file":"use-basic-date-table.js","sources":["../../../../../../../packages/components/date-picker/src/composables/use-basic-date-table.ts"],"sourcesContent":["import { computed, nextTick, ref, unref, watch } from 'vue'\nimport dayjs from 'dayjs'\nimport { flatten } from 'lodash-unified'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { castArray } from '@element-plus/utils'\nimport { buildPickerTable } from '../utils'\n\nimport type { SetupContext } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type { DateCell } from '../date-picker.type'\nimport type {\n BasicDateTableEmits,\n BasicDateTableProps,\n} from '../props/basic-date-table'\n\nconst isNormalDay = (type = '') => {\n return ['normal', 'today'].includes(type)\n}\n\nexport const useBasicDateTable = (\n props: BasicDateTableProps,\n emit: SetupContext['emit']\n) => {\n const { lang } = useLocale()\n const tbodyRef = ref()\n const currentCellRef = ref()\n // data\n const lastRow = ref()\n const lastColumn = ref()\n const tableRows = ref([[], [], [], [], [], []])\n\n let focusWithClick = false\n\n // todo better way to get Day.js locale object\n const firstDayOfWeek = (props.date as any).$locale().weekStart || 7\n const WEEKS_CONSTANT = props.date\n .locale('en')\n .localeData()\n .weekdaysShort()\n .map((_) => _.toLowerCase())\n\n const offsetDay = computed(() => {\n // Sunday 7(0), cal the left and right offset days, 3217654, such as Monday is -1, the is to adjust the position of the first two rows of dates\n return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek\n })\n\n const startDate = computed(() => {\n const startDayOfMonth = props.date.startOf('month')\n return startDayOfMonth.subtract(startDayOfMonth.day() || 7, 'day')\n })\n\n const WEEKS = computed(() => {\n return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(\n firstDayOfWeek,\n firstDayOfWeek + 7\n )\n })\n\n const hasCurrent = computed(() => {\n return flatten(unref(rows)).some((row) => {\n return row.isCurrent\n })\n })\n\n const days = computed(() => {\n const startOfMonth = props.date.startOf('month')\n const startOfMonthDay = startOfMonth.day() || 7 // day of first day\n const dateCountOfMonth = startOfMonth.daysInMonth()\n\n const dateCountOfLastMonth = startOfMonth.subtract(1, 'month').daysInMonth()\n\n return {\n startOfMonthDay,\n dateCountOfMonth,\n dateCountOfLastMonth,\n }\n })\n\n const selectedDate = computed(() => {\n return props.selectionMode === 'dates'\n ? (castArray(props.parsedValue) as Dayjs[])\n : ([] as Dayjs[])\n })\n\n // Return value indicates should the counter be incremented\n type CellCoordinate = { columnIndex: number; rowIndex: number }\n type CellMeta = CellCoordinate & {\n count: number\n }\n const setDateText = (\n cell: DateCell,\n { count, rowIndex, columnIndex }: CellMeta\n ): boolean => {\n const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } =\n unref(days)\n const offset = unref(offsetDay)\n if (rowIndex >= 0 && rowIndex <= 1) {\n const numberOfDaysFromPreviousMonth =\n startOfMonthDay + offset < 0\n ? 7 + startOfMonthDay + offset\n : startOfMonthDay + offset\n\n if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {\n cell.text = count\n return true\n } else {\n cell.text =\n dateCountOfLastMonth -\n (numberOfDaysFromPreviousMonth - (columnIndex % 7)) +\n 1 +\n rowIndex * 7\n cell.type = 'prev-month'\n }\n } else {\n if (count <= dateCountOfMonth) {\n cell.text = count\n } else {\n cell.text = count - dateCountOfMonth\n cell.type = 'next-month'\n }\n return true\n }\n return false\n }\n\n const setCellMetadata = (\n cell: DateCell,\n { columnIndex, rowIndex }: CellCoordinate,\n count: number\n ) => {\n const { disabledDate, cellClassName } = props\n const _selectedDate = unref(selectedDate)\n const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex })\n\n const cellDate = cell.dayjs!.toDate()\n cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, 'day'))\n cell.isSelected = !!cell.selected\n cell.isCurrent = isCurrent(cell)\n cell.disabled = disabledDate?.(cellDate)\n cell.customClass = cellClassName?.(cellDate)\n return shouldIncrement\n }\n\n const setRowMetadata = (row: DateCell[]) => {\n if (props.selectionMode === 'week') {\n const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6]\n const isActive = isWeekActive(row[start + 1])\n row[start].inRange = isActive\n row[start].start = isActive\n row[end].inRange = isActive\n row[end].end = isActive\n }\n }\n\n const rows = computed(() => {\n const { minDate, maxDate, rangeState, showWeekNumber } = props\n\n const offset = unref(offsetDay)\n const rows_ = unref(tableRows)\n const dateUnit = 'day'\n let count = 1\n\n if (showWeekNumber) {\n for (let rowIndex = 0; rowIndex < 6; rowIndex++) {\n if (!rows_[rowIndex][0]) {\n rows_[rowIndex][0] = {\n type: 'week',\n text: unref(startDate)\n .add(rowIndex * 7 + 1, dateUnit)\n .week(),\n }\n }\n }\n }\n\n buildPickerTable({ row: 6, column: 7 }, rows_, {\n startDate: minDate,\n columnIndexOffset: showWeekNumber ? 1 : 0,\n nextEndDate:\n rangeState.endDate ||\n maxDate ||\n (rangeState.selecting && minDate) ||\n null,\n now: dayjs().locale(unref(lang)).startOf(dateUnit),\n unit: dateUnit,\n relativeDateGetter: (idx: number) =>\n unref(startDate).add(idx - offset, dateUnit),\n setCellMetadata: (...args) => {\n if (setCellMetadata(...args, count)) {\n count += 1\n }\n },\n\n setRowMetadata,\n })\n\n return rows_\n })\n\n watch(\n () => props.date,\n async () => {\n if (unref(tbodyRef)?.contains(document.activeElement)) {\n await nextTick()\n await focus()\n // currentCellRef.value?.focus()\n }\n }\n )\n\n const focus = async () => unref(currentCellRef)?.focus()\n\n const isCurrent = (cell: DateCell): boolean => {\n return (\n props.selectionMode === 'date' &&\n isNormalDay(cell.type) &&\n cellMatchesDate(cell, props.parsedValue as Dayjs)\n )\n }\n\n const cellMatchesDate = (cell: DateCell, date: Dayjs) => {\n if (!date) return false\n return dayjs(date)\n .locale(unref(lang))\n .isSame(props.date.date(Number(cell.text)), 'day')\n }\n\n const getDateOfCell = (row: number, column: number) => {\n const offsetFromStart =\n row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay)\n return unref(startDate).add(offsetFromStart, 'day')\n }\n\n const handleMouseMove = (event: MouseEvent) => {\n if (!props.rangeState.selecting) return\n\n let target = event.target as HTMLElement\n if (target.tagName === 'SPAN') {\n target = target.parentNode?.parentNode as HTMLElement\n }\n if (target.tagName === 'DIV') {\n target = target.parentNode as HTMLElement\n }\n if (target.tagName !== 'TD') return\n\n const row = (target.parentNode as HTMLTableRowElement).rowIndex - 1\n const column = (target as HTMLTableCellElement).cellIndex\n\n // can not select disabled date\n if (unref(rows)[row][column].disabled) return\n\n // only update rangeState when mouse moves to a new cell\n // this avoids frequent Date object creation and improves performance\n if (row !== unref(lastRow) || column !== unref(lastColumn)) {\n lastRow.value = row\n lastColumn.value = column\n emit('changerange', {\n selecting: true,\n endDate: getDateOfCell(row, column),\n })\n }\n }\n\n const isSelectedCell = (cell: DateCell) => {\n return (\n (!unref(hasCurrent) && cell?.text === 1 && cell.type === 'normal') ||\n cell.isCurrent\n )\n }\n\n const handleFocus = (event: FocusEvent) => {\n if (focusWithClick || unref(hasCurrent) || props.selectionMode !== 'date')\n return\n handlePickDate(event, true)\n }\n\n const handleMouseDown = (event: MouseEvent) => {\n const target = (event.target as HTMLElement).closest('td')\n if (!target) return\n focusWithClick = true\n }\n\n const handleMouseUp = (event: MouseEvent) => {\n const target = (event.target as HTMLElement).closest('td')\n if (!target) return\n focusWithClick = false\n }\n\n const handleRangePick = (newDate: Dayjs) => {\n if (!props.rangeState.selecting || !props.minDate) {\n emit('pick', { minDate: newDate, maxDate: null })\n emit('select', true)\n } else {\n if (newDate >= props.minDate) {\n emit('pick', { minDate: props.minDate, maxDate: newDate })\n } else {\n emit('pick', { minDate: newDate, maxDate: props.minDate })\n }\n emit('select', false)\n }\n }\n\n const handleWeekPick = (newDate: Dayjs) => {\n const weekNumber = newDate.week()\n const value = `${newDate.year()}w${weekNumber}`\n emit('pick', {\n year: newDate.year(),\n week: weekNumber,\n value,\n date: newDate.startOf('week'),\n })\n }\n\n const handleDatesPick = (newDate: Dayjs, selected: boolean) => {\n const newValue = selected\n ? castArray(props.parsedValue).filter(\n (d) => d?.valueOf() !== newDate.valueOf()\n )\n : castArray(props.parsedValue).concat([newDate])\n emit('pick', newValue)\n }\n\n const handlePickDate = (\n event: FocusEvent | MouseEvent,\n isKeyboardMovement = false\n ) => {\n const target = (event.target as HTMLElement).closest('td')\n\n if (!target) return\n\n const row = (target.parentNode as HTMLTableRowElement).rowIndex - 1\n const column = (target as HTMLTableCellElement).cellIndex\n const cell = unref(rows)[row][column]\n\n if (cell.disabled || cell.type === 'week') return\n\n const newDate = getDateOfCell(row, column)\n\n switch (props.selectionMode) {\n case 'range': {\n handleRangePick(newDate)\n break\n }\n case 'date': {\n emit('pick', newDate, isKeyboardMovement)\n break\n }\n case 'week': {\n handleWeekPick(newDate)\n break\n }\n case 'dates': {\n handleDatesPick(newDate, !!cell.selected)\n break\n }\n default: {\n break\n }\n }\n }\n\n const isWeekActive = (cell: DateCell) => {\n if (props.selectionMode !== 'week') return false\n let newDate = props.date.startOf('day')\n\n if (cell.type === 'prev-month') {\n newDate = newDate.subtract(1, 'month')\n }\n\n if (cell.type === 'next-month') {\n newDate = newDate.add(1, 'month')\n }\n\n newDate = newDate.date(Number.parseInt(cell.text as any, 10))\n\n if (props.parsedValue && !Array.isArray(props.parsedValue)) {\n const dayOffset = ((props.parsedValue.day() - firstDayOfWeek + 7) % 7) - 1\n const weekDate = props.parsedValue.subtract(dayOffset, 'day')\n return weekDate.isSame(newDate, 'day')\n }\n return false\n }\n\n return {\n WEEKS,\n rows,\n tbodyRef,\n currentCellRef,\n\n // cellMatchesDate,\n // getDateOfCell,\n focus,\n isCurrent,\n isWeekActive,\n isSelectedCell,\n\n handlePickDate,\n handleMouseUp,\n handleMouseDown,\n handleMouseMove,\n handleFocus,\n }\n}\n\nexport const useBasicDateTableDOM = (\n props: BasicDateTableProps,\n {\n isCurrent,\n isWeekActive,\n }: Pick, 'isCurrent' | 'isWeekActive'>\n) => {\n const ns = useNamespace('date-table')\n const { t } = useLocale()\n\n const tableKls = computed(() => [\n ns.b(),\n { 'is-week-mode': props.selectionMode === 'week' },\n ])\n\n const tableLabel = computed(() => t('el.datepicker.dateTablePrompt'))\n const weekLabel = computed(() => t('el.datepicker.week'))\n\n const getCellClasses = (cell: DateCell) => {\n const classes: string[] = []\n if (isNormalDay(cell.type) && !cell.disabled) {\n classes.push('available')\n if (cell.type === 'today') {\n classes.push('today')\n }\n } else {\n classes.push(cell.type!)\n }\n\n if (isCurrent(cell)) {\n classes.push('current')\n }\n\n if (\n cell.inRange &&\n (isNormalDay(cell.type) || props.selectionMode === 'week')\n ) {\n classes.push('in-range')\n\n if (cell.start) {\n classes.push('start-date')\n }\n\n if (cell.end) {\n classes.push('end-date')\n }\n }\n\n if (cell.disabled) {\n classes.push('disabled')\n }\n\n if (cell.selected) {\n classes.push('selected')\n }\n\n if (cell.customClass) {\n classes.push(cell.customClass)\n }\n\n return classes.join(' ')\n }\n\n const getRowKls = (cell: DateCell) => [\n ns.e('row'),\n { current: isWeekActive(cell) },\n ]\n\n return {\n tableKls,\n tableLabel,\n weekLabel,\n\n getCellClasses,\n getRowKls,\n t,\n }\n}\n"],"names":["useLocale","ref","computed","flatten","unref","castArray","buildPickerTable","dayjs","watch","nextTick","useNamespace"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,MAAM,WAAW,GAAG,CAAC,IAAI,GAAG,EAAE,KAAK;AACnC,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AACU,MAAC,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK;AAClD,EAAE,MAAM,EAAE,IAAI,EAAE,GAAGA,eAAS,EAAE,CAAC;AAC/B,EAAE,MAAM,QAAQ,GAAGC,OAAG,EAAE,CAAC;AACzB,EAAE,MAAM,cAAc,GAAGA,OAAG,EAAE,CAAC;AAC/B,EAAE,MAAM,OAAO,GAAGA,OAAG,EAAE,CAAC;AACxB,EAAE,MAAM,UAAU,GAAGA,OAAG,EAAE,CAA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