{"version":3,"file":"body.vue2.mjs","sources":["../../../../../../../../packages/components/date-picker/src/panels/layout/body.vue"],"sourcesContent":["<script lang=\"ts\">\n  import { defineComponent } from 'vue'\n  import type { PropType } from 'vue'\n  import { getNamespace } from '../../../../../utils/global-config'\n  import type { DateCell } from '../../types'\n  export default defineComponent({\n    name: 'PanelBody',\n    props: {\n      rows: {\n        type: Array as PropType<DateCell[][]>,\n        default: () => []\n      }\n    },\n    emits: ['onCellClick', 'onCellRowClick', 'onCellMouseenter', 'onCellRowMouseenter'],\n    setup(props, { emit }) {\n      const ns = getNamespace('date-picker')\n      const handleCell = (cell: DateCell) => {\n        if (cell.isDisabled) return\n        emit('onCellClick', cell)\n      }\n\n      const handleCellRowClick = (row: DateCell[]) => {\n        if (isRowDisabled(row)) return\n        emit('onCellRowClick', row)\n      }\n\n      const handleCellMouseenter = (cell: DateCell) => {\n        if (cell.isDisabled) return\n        emit('onCellMouseenter', cell)\n      }\n\n      const handleCellRowMouseenter = (row: DateCell[]) => {\n        if (isRowDisabled(row)) return\n        emit('onCellRowMouseenter', row)\n      }\n\n      const isRowDisabled = (row: DateCell[]) => {\n        const exist = row.some((cell) => cell.isDisabled)\n        if (exist) {\n          return 'is-disabled'\n        }\n      }\n\n      return {\n        ns,\n        handleCell,\n        handleCellRowClick,\n        handleCellMouseenter,\n        handleCellRowMouseenter,\n        isRowDisabled\n      }\n    }\n  })\n</script>\n\n<template>\n  <div :class=\"[`${ns}__body`]\">\n    <div\n      v-for=\"(row, rowIndex) in rows\"\n      :key=\"rowIndex\"\n      :class=\"[`${ns}__cell-row`, isRowDisabled(row)]\"\n      @mouseenter=\"handleCellRowMouseenter(row)\"\n      @click=\"handleCellRowClick(row)\"\n    >\n      <div\n        v-for=\"cell in row\"\n        :key=\"cell.value\"\n        :class=\"[\n          `${ns}__cell`,\n          {\n            'is-cur': cell.isCur,\n            'is-prev': cell.isPrev,\n            'is-next': cell.isNext,\n            'is-select': cell.isSelect,\n            'is-now': cell.isNow,\n            'is-range': cell.isRange,\n            'is-range-start': cell.isRangeStart,\n            'is-range-end': cell.isRangeEnd,\n            'is-disabled': cell.isDisabled\n          }\n        ]\"\n        @click=\"handleCell(cell)\"\n        @mouseenter=\"handleCellMouseenter(cell)\"\n      >\n        <slot name=\"cell\" v-bind=\"{ cell }\">\n          <span :class=\"[`${ns}__cell-text`]\">\n            {{ cell.label }}\n          </span>\n        </slot>\n      </div>\n    </div>\n  </div>\n</template>\n"],"names":[],"mappings":";;;AAKE,gBAAe,eAAgB,CAAA;AAAA,EAC7B,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA,KAAA;AAAA,MACN,OAAA,EAAS,MAAM,EAAC;AAAA,KAClB;AAAA,GACF;AAAA,EACA,KAAO,EAAA,CAAC,aAAe,EAAA,gBAAA,EAAkB,oBAAoB,qBAAqB,CAAA;AAAA,EAClF,KAAM,CAAA,KAAA,EAAO,EAAE,IAAA,EAAQ,EAAA;AACrB,IAAM,MAAA,EAAA,GAAK,aAAa,aAAa,CAAA,CAAA;AACrC,IAAM,MAAA,UAAA,GAAa,CAAC,IAAmB,KAAA;AACrC,MAAA,IAAI,IAAK,CAAA,UAAA;AAAY,QAAA,OAAA;AACrB,MAAA,IAAA,CAAK,eAAe,IAAI,CAAA,CAAA;AAAA,KAC1B,CAAA;AAEA,IAAM,MAAA,kBAAA,GAAqB,CAAC,GAAoB,KAAA;AAC9C,MAAA,IAAI,cAAc,GAAG,CAAA;AAAG,QAAA,OAAA;AACxB,MAAA,IAAA,CAAK,kBAAkB,GAAG,CAAA,CAAA;AAAA,KAC5B,CAAA;AAEA,IAAM,MAAA,oBAAA,GAAuB,CAAC,IAAmB,KAAA;AAC/C,MAAA,IAAI,IAAK,CAAA,UAAA;AAAY,QAAA,OAAA;AACrB,MAAA,IAAA,CAAK,oBAAoB,IAAI,CAAA,CAAA;AAAA,KAC/B,CAAA;AAEA,IAAM,MAAA,uB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