{"version":3,"file":"table.mjs","names":[],"sources":["../../../../../../packages/components/table/src/table.vue"],"sourcesContent":["<template>\n  <div\n    ref=\"tableWrapper\"\n    :class=\"[\n      {\n        [ns.m('fit')]: fit,\n        [ns.m('striped')]: stripe,\n        [ns.m('border')]: border || isGroup,\n        [ns.m('hidden')]: isHidden,\n        [ns.m('group')]: isGroup,\n        [ns.m('fluid-height')]: maxHeight,\n        [ns.m('scrollable-x')]: layout.scrollX.value,\n        [ns.m('scrollable-y')]: layout.scrollY.value,\n        [ns.m('enable-row-hover')]: !store.states.isComplex.value,\n        [ns.m('enable-row-transition')]:\n          (store.states.data.value || []).length !== 0 &&\n          (store.states.data.value || []).length < 100,\n        'has-footer': showSummary,\n      },\n      ns.m(tableSize),\n      className,\n      ns.b(),\n      ns.m(`layout-${tableLayout}`),\n    ]\"\n    :style=\"style\"\n    :data-prefix=\"ns.namespace.value\"\n    @mouseleave=\"handleMouseLeave\"\n  >\n    <div ref=\"tableInnerWrapper\" :class=\"ns.e('inner-wrapper')\">\n      <div ref=\"hiddenColumns\" class=\"hidden-columns\">\n        <slot />\n      </div>\n      <div\n        v-if=\"showHeader && tableLayout === 'fixed'\"\n        ref=\"headerWrapper\"\n        v-mousewheel=\"handleHeaderFooterMousewheel\"\n        :class=\"ns.e('header-wrapper')\"\n      >\n        <table\n          ref=\"tableHeader\"\n          :class=\"ns.e('header')\"\n          :style=\"tableBodyStyles\"\n          border=\"0\"\n          cellpadding=\"0\"\n          cellspacing=\"0\"\n        >\n          <hColgroup\n            :columns=\"store.states.columns.value\"\n            :table-layout=\"tableLayout\"\n          />\n          <table-header\n            ref=\"tableHeaderRef\"\n            :border=\"border\"\n            :default-sort=\"defaultSort\"\n            :store=\"store\"\n            :append-filter-panel-to=\"appendFilterPanelTo\"\n            :allow-drag-last-column=\"allowDragLastColumn\"\n            @set-drag-visible=\"setDragVisible\"\n          />\n        </table>\n      </div>\n      <div ref=\"bodyWrapper\" :class=\"ns.e('body-wrapper')\">\n        <el-scrollbar\n          ref=\"scrollBarRef\"\n          :view-style=\"scrollbarViewStyle\"\n          :wrap-style=\"scrollbarStyle\"\n          :always=\"scrollbarAlwaysOn\"\n          :tabindex=\"scrollbarTabindex\"\n          :native=\"nativeScrollbar\"\n          @scroll=\"$emit('scroll', $event)\"\n        >\n          <table\n            ref=\"tableBody\"\n            :class=\"ns.e('body')\"\n            cellspacing=\"0\"\n            cellpadding=\"0\"\n            border=\"0\"\n            :style=\"{\n              width: bodyWidth,\n              tableLayout,\n            }\"\n          >\n            <hColgroup\n              :columns=\"store.states.columns.value\"\n              :table-layout=\"tableLayout\"\n            />\n            <table-header\n              v-if=\"showHeader && tableLayout === 'auto'\"\n              ref=\"tableHeaderRef\"\n              :class=\"ns.e('body-header')\"\n              :border=\"border\"\n              :default-sort=\"defaultSort\"\n              :store=\"store\"\n              :append-filter-panel-to=\"appendFilterPanelTo\"\n              @set-drag-visible=\"setDragVisible\"\n            />\n            <table-body\n              :context=\"context\"\n              :highlight=\"highlightCurrentRow\"\n              :row-class-name=\"rowClassName\"\n              :tooltip-effect=\"computedTooltipEffect\"\n              :tooltip-options=\"computedTooltipOptions\"\n              :row-style=\"rowStyle\"\n              :store=\"store\"\n              :stripe=\"stripe\"\n            />\n            <table-footer\n              v-if=\"showSummary && tableLayout === 'auto'\"\n              :class=\"ns.e('body-footer')\"\n              :border=\"border\"\n              :default-sort=\"defaultSort\"\n              :store=\"store\"\n              :sum-text=\"computedSumText\"\n              :summary-method=\"summaryMethod\"\n            />\n          </table>\n          <div\n            v-if=\"isEmpty\"\n            ref=\"emptyBlock\"\n            :style=\"emptyBlockStyle\"\n            :class=\"ns.e('empty-block')\"\n          >\n            <span :class=\"ns.e('empty-text')\">\n              <slot name=\"empty\">{{ computedEmptyText }}</slot>\n            </span>\n          </div>\n          <div\n            v-if=\"$slots.append\"\n            ref=\"appendWrapper\"\n            :class=\"ns.e('append-wrapper')\"\n          >\n            <slot name=\"append\" />\n          </div>\n        </el-scrollbar>\n      </div>\n      <div\n        v-if=\"showSummary && tableLayout === 'fixed'\"\n        v-show=\"!isEmpty\"\n        ref=\"footerWrapper\"\n        v-mousewheel=\"handleHeaderFooterMousewheel\"\n        :class=\"ns.e('footer-wrapper')\"\n      >\n        <table\n          :class=\"ns.e('footer')\"\n          cellspacing=\"0\"\n          cellpadding=\"0\"\n          border=\"0\"\n          :style=\"tableBodyStyles\"\n        >\n          <hColgroup\n            :columns=\"store.states.columns.value\"\n            :table-layout=\"tableLayout\"\n          />\n          <table-footer\n            :border=\"border\"\n            :default-sort=\"defaultSort\"\n            :store=\"store\"\n            :sum-text=\"computedSumText\"\n            :summary-method=\"summaryMethod\"\n          />\n        </table>\n      </div>\n      <div v-if=\"border || isGroup\" :class=\"ns.e('border-left-patch')\" />\n    </div>\n    <div\n      v-show=\"resizeProxyVisible\"\n      ref=\"resizeProxy\"\n      :class=\"ns.e('column-resize-proxy')\"\n    />\n  </div>\n</template>\n\n<script lang=\"ts\" setup generic=\"T extends DefaultRow = DefaultRow\">\nimport { computed, getCurrentInstance, onBeforeUnmount, provide } from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { Mousewheel as vMousewheel } from '@element-plus/directives'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { useGlobalConfig } from '@element-plus/components/config-provider'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport { createStore } from './store/helper'\nimport TableLayout from './table-layout'\nimport TableHeader from './table-header'\nimport TableBody from './table-body'\nimport TableFooter from './table-footer'\nimport { createTableId } from './util'\nimport useUtils from './table/utils-helper'\nimport { convertToRows } from './table-header/utils-helper'\nimport useStyle from './table/style-helper'\nimport useKeyRender from './table/key-render-helper'\nimport { TABLE_INJECTION_KEY } from './tokens'\nimport { hColgroup } from './h-helper'\nimport { useScrollbar } from './composables/use-scrollbar'\n\nimport type {\n  DefaultRow,\n  Table,\n  TableEmits,\n  TableProps,\n} from './table/defaults'\n\ndefineOptions({\n  name: 'ElTable',\n})\n\nconst props = withDefaults(defineProps<TableProps<T>>(), {\n  data: () => [],\n  fit: true,\n  showHeader: true,\n  selectOnIndeterminate: true,\n  indent: 16,\n  treeProps: () => ({\n    hasChildren: 'hasChildren',\n    children: 'children',\n    checkStrictly: false,\n  }),\n  style: () => ({}),\n  className: '',\n  tableLayout: 'fixed',\n  showOverflowTooltip: undefined,\n  scrollbarTabindex: undefined,\n  allowDragLastColumn: true,\n})\n\ndefineEmits<TableEmits<T>>()\n\nconst { t } = useLocale()\nconst ns = useNamespace('table')\nconst globalConfig = useGlobalConfig('table')\nconst table = getCurrentInstance() as Table<T>\nprovide(TABLE_INJECTION_KEY, table)\nconst store = createStore<T>(table, props)\ntable.store = store\nconst layout = new TableLayout<T>({\n  store: table.store,\n  table,\n  fit: props.fit,\n  showHeader: props.showHeader,\n})\ntable.layout = layout\n\nconst isEmpty = computed(() => (store.states.data.value || []).length === 0)\n\n/**\n * open functions\n */\nconst {\n  setCurrentRow,\n  getSelectionRows,\n  toggleRowSelection,\n  clearSelection,\n  clearFilter,\n  toggleAllSelection,\n  toggleRowExpansion,\n  clearSort,\n  sort,\n  updateKeyChildren,\n} = useUtils<T>(store)\nconst {\n  isHidden,\n  renderExpanded,\n  setDragVisible,\n  isGroup,\n  handleMouseLeave,\n  handleHeaderFooterMousewheel,\n  tableSize,\n  emptyBlockStyle,\n  resizeProxyVisible,\n  bodyWidth,\n  resizeState,\n  doLayout,\n  tableBodyStyles,\n  tableLayout,\n  scrollbarViewStyle,\n  scrollbarStyle,\n} = useStyle<T>(props, layout, store, table)\n\nconst { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar()\n\nconst debouncedUpdateLayout = debounce(doLayout, 50)\n\nconst tableId = createTableId(ns.namespace.value)\nconst context = table\ntable.tableId = tableId\ntable.state = {\n  isGroup,\n  resizeState,\n  doLayout,\n  debouncedUpdateLayout,\n}\nconst computedSumText = computed(() => props.sumText ?? t('el.table.sumText'))\n\nconst computedEmptyText = computed(() => {\n  return props.emptyText ?? t('el.table.emptyText')\n})\n\nconst computedTooltipEffect = computed(\n  () => props.tooltipEffect ?? globalConfig.value?.tooltipEffect\n)\n\nconst computedTooltipOptions = computed(\n  () => props.tooltipOptions ?? globalConfig.value?.tooltipOptions\n)\n\nconst columns = computed(() => {\n  return convertToRows(store.states.originColumns.value)[0]\n})\n\nuseKeyRender(table)\n\nonBeforeUnmount(() => {\n  debouncedUpdateLayout.cancel()\n})\n\ndefineExpose({\n  ns,\n  layout,\n  store,\n  columns,\n  handleHeaderFooterMousewheel,\n  handleMouseLeave,\n  tableId,\n  tableSize,\n  isHidden,\n  isEmpty,\n  renderExpanded,\n  resizeProxyVisible,\n  resizeState,\n  isGroup,\n  bodyWidth,\n  tableBodyStyles,\n  emptyBlockStyle,\n  debouncedUpdateLayout,\n  /**\n   * @description used in single selection Table, set a certain row selected. If called without any parameter, it will clear selection\n   */\n  setCurrentRow,\n  /**\n   * @description returns the currently selected rows\n   */\n  getSelectionRows,\n  /**\n   * @description used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected\n   */\n  toggleRowSelection,\n  /**\n   * @description used in multiple selection Table, clear user selection\n   */\n  clearSelection,\n  /**\n   * @description clear filters of the columns whose `columnKey` are passed in. If no params, clear all filters\n   */\n  clearFilter,\n  /**\n   * @description used in multiple selection Table, toggle select all and deselect all\n   */\n  toggleAllSelection,\n  /**\n   * @description used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter, you can directly set if this row is expanded or collapsed\n   */\n  toggleRowExpansion,\n  /**\n   * @description clear sorting, restore data to the original order\n   */\n  clearSort,\n  /**\n   * @description refresh the layout of Table. When the visibility of Table changes, you may need to call this method to get a correct layout\n   */\n  doLayout,\n  /**\n   * @description sort Table manually. Property `prop` is used to set sort column, property `order` is used to set sort order\n   */\n  sort,\n  /**\n   * @description used in lazy Table, must set `rowKey`, update key children\n   */\n  updateKeyChildren,\n  t,\n  setDragVisible,\n  context,\n  computedSumText,\n  computedEmptyText,\n  computedTooltipEffect,\n  computedTooltipOptions,\n  tableLayout,\n  scrollbarViewStyle,\n  scrollbarStyle,\n  scrollBarRef,\n  /**\n   * @description scrolls to a particular set of coordinates\n   */\n  scrollTo,\n  /**\n   * @description set horizontal scroll position\n   */\n  setScrollLeft,\n  /**\n   * @description set vertical scroll position\n   */\n  setScrollTop,\n  /**\n   * @description whether to allow drag the last column\n   */\n  allowDragLastColumn: props.allowDragLastColumn,\n})\n</script>\n"],"mappings":""}