{"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\">\nimport {\n  computed,\n  defineComponent,\n  getCurrentInstance,\n  onBeforeUnmount,\n  provide,\n} from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { Mousewheel } 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 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 defaultProps from './table/defaults'\nimport { TABLE_INJECTION_KEY } from './tokens'\nimport { hColgroup } from './h-helper'\nimport { useScrollbar } from './composables/use-scrollbar'\n\nimport type { Table } from './table/defaults'\n\nlet tableIdSeed = 1\nexport default defineComponent({\n  name: 'ElTable',\n  directives: {\n    Mousewheel,\n  },\n  components: {\n    TableHeader,\n    TableBody,\n    TableFooter,\n    ElScrollbar,\n    hColgroup,\n  },\n  props: defaultProps,\n  emits: [\n    'select',\n    'select-all',\n    'selection-change',\n    'cell-mouse-enter',\n    'cell-mouse-leave',\n    'cell-contextmenu',\n    'cell-click',\n    'cell-dblclick',\n    'row-click',\n    'row-contextmenu',\n    'row-dblclick',\n    'header-click',\n    'header-contextmenu',\n    'sort-change',\n    'filter-change',\n    'current-change',\n    'header-dragend',\n    'expand-change',\n    'scroll',\n  ],\n  setup(props) {\n    type Row = (typeof props.data)[number]\n    const { t } = useLocale()\n    const ns = useNamespace('table')\n    const globalConfig = useGlobalConfig('table')\n    const table = getCurrentInstance() as Table<Row>\n    provide(TABLE_INJECTION_KEY, table)\n    const store = createStore<Row>(table, props)\n    table.store = store\n    const layout = new TableLayout<Row>({\n      store: table.store,\n      table,\n      fit: props.fit,\n      showHeader: props.showHeader,\n    })\n    table.layout = layout\n\n    const isEmpty = computed(() => (store.states.data.value || []).length === 0)\n\n    /**\n     * open functions\n     */\n    const {\n      setCurrentRow,\n      getSelectionRows,\n      toggleRowSelection,\n      clearSelection,\n      clearFilter,\n      toggleAllSelection,\n      toggleRowExpansion,\n      clearSort,\n      sort,\n      updateKeyChildren,\n    } = useUtils<Row>(store)\n    const {\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<Row>(props, layout, store, table)\n\n    const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } =\n      useScrollbar()\n\n    const debouncedUpdateLayout = debounce(doLayout, 50)\n\n    const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`\n    table.tableId = tableId\n    table.state = {\n      isGroup,\n      resizeState,\n      doLayout,\n      debouncedUpdateLayout,\n    }\n    const computedSumText = computed(\n      () => props.sumText ?? t('el.table.sumText')\n    )\n\n    const computedEmptyText = computed(() => {\n      return props.emptyText ?? t('el.table.emptyText')\n    })\n\n    const computedTooltipEffect = computed(\n      () => props.tooltipEffect ?? globalConfig.value?.tooltipEffect\n    )\n\n    const computedTooltipOptions = computed(\n      () => props.tooltipOptions ?? globalConfig.value?.tooltipOptions\n    )\n\n    const columns = computed(() => {\n      return convertToRows(store.states.originColumns.value)[0]\n    })\n\n    useKeyRender(table)\n\n    onBeforeUnmount(() => {\n      debouncedUpdateLayout.cancel()\n    })\n\n    return {\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: table,\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  },\n})\n</script>\n"],"mappings":";;;;;;;CA6BW,KAAI;CAAgB,OAAM;;;;;;;;;qBA5BnC,mBAwKM,OAAA;EAvKJ,KAAI;EACH,OAAK,eAAA;GAAA;KAAqB,KAAA,GAAG,EAAC,MAAA,GAAU,KAAA;KAAc,KAAA,GAAG,EAAC,UAAA,GAAc,KAAA;KAAiB,KAAA,GAAG,EAAC,SAAA,GAAa,KAAA,UAAU,KAAA;KAAkB,KAAA,GAAG,EAAC,SAAA,GAAa,KAAA;KAAmB,KAAA,GAAG,EAAC,QAAA,GAAY,KAAA;KAAkB,KAAA,GAAG,EAAC,eAAA,GAAmB,KAAA;KAAoB,KAAA,GAAG,EAAC,eAAA,GAAmB,KAAA,OAAO,QAAQ;KAAgB,KAAA,GAAG,EAAC,eAAA,GAAmB,KAAA,OAAO,QAAQ;KAAgB,KAAA,GAAG,EAAC,mBAAA,GAAA,CAAwB,KAAA,MAAM,OAAO,UAAU;KAAgB,KAAA,GAAG,EAAC,wBAAA,IAAuC,KAAA,MAAM,OAAO,KAAK,SAAK,EAAA,EAAQ,WAAM,MAAqB,KAAA,MAAM,OAAO,KAAK,SAAK,EAAA,EAAQ,SAAM;IAAA,cAA8B,KAAA;IAAA;GAA4B,KAAA,GAAG,EAAE,KAAA,UAAS;GAAS,KAAA;GAAiB,KAAA,GAAG,GAAC;GAAU,KAAA,GAAG,EAAC,UAAW,KAAA,cAAW;GA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