{"version":3,"file":"date-table2.mjs","names":[],"sources":["../../../../../../packages/components/calendar/src/date-table.vue"],"sourcesContent":["<template>\n  <table\n    :class=\"[nsTable.b(), nsTable.is('range', isInRange)]\"\n    cellspacing=\"0\"\n    cellpadding=\"0\"\n  >\n    <thead v-if=\"!hideHeader\">\n      <tr>\n        <th v-for=\"day in weekDays\" :key=\"day\" scope=\"col\">{{ day }}</th>\n      </tr>\n    </thead>\n\n    <tbody>\n      <tr\n        v-for=\"(row, index) in rows\"\n        :key=\"index\"\n        :class=\"{\n          [nsTable.e('row')]: true,\n          [nsTable.em('row', 'hide-border')]: index === 0 && hideHeader,\n        }\"\n      >\n        <td\n          v-for=\"(cell, key) in row\"\n          :key=\"key\"\n          :class=\"getCellClass(cell)\"\n          @click=\"handlePickDay(cell)\"\n        >\n          <div :class=\"nsDay.b()\">\n            <slot name=\"date-cell\" :data=\"getSlotData(cell)\">\n              <span>{{ cell.text }}</span>\n            </slot>\n          </div>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useNamespace } from '@element-plus/hooks'\nimport { dateTableEmits } from './date-table'\nimport { useDateTable } from './use-date-table'\n\nimport type { CalendarDateCell, DateTableProps } from './date-table'\n\ndefineOptions({\n  name: 'DateTable',\n})\n\nconst props = defineProps<DateTableProps>()\nconst emit = defineEmits(dateTableEmits)\n\nconst {\n  isInRange,\n  now,\n  rows,\n  weekDays,\n  getFormattedDate,\n  handlePickDay,\n  getSlotData,\n} = useDateTable(props, emit)\n\nconst nsTable = useNamespace('calendar-table')\nconst nsDay = useNamespace('calendar-day')\n\nconst getCellClass = ({ text, type }: CalendarDateCell) => {\n  const classes: string[] = [type]\n  if (type === 'current') {\n    const date = getFormattedDate(text, type)\n    if (date.isSame(props.selectedDay, 'day')) {\n      classes.push(nsDay.is('selected'))\n    }\n    if (date.isSame(now, 'day')) {\n      classes.push(nsDay.is('today'))\n    }\n  }\n  return classes\n}\n\ndefineExpose({\n  /** @description toggle date panel */\n  getFormattedDate,\n})\n</script>\n"],"mappings":""}