You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 lines
34 KiB

{"ast":null,"code":"import { defineComponent, getCurrentInstance, provide, computed, onBeforeUnmount, resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, withDirectives, createVNode, createCommentVNode, withCtx, createBlock, createTextVNode, toDisplayString, vShow } from 'vue';\nimport { debounce } from 'lodash-unified';\nimport { ElScrollbar } from '../../scrollbar/index.mjs';\nimport { createStore } from './store/helper.mjs';\nimport TableLayout from './table-layout.mjs';\nimport TableHeader from './table-header/index.mjs';\nimport TableBody from './table-body/index.mjs';\nimport TableFooter from './table-footer/index.mjs';\nimport useUtils from './table/utils-helper.mjs';\nimport { convertToRows } from './table-header/utils-helper.mjs';\nimport useStyle from './table/style-helper.mjs';\nimport useKeyRender from './table/key-render-helper.mjs';\nimport defaultProps from './table/defaults.mjs';\nimport { TABLE_INJECTION_KEY } from './tokens.mjs';\nimport { hColgroup } from './h-helper.mjs';\nimport { useScrollbar } from './composables/use-scrollbar.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport Mousewheel from '../../../directives/mousewheel/index.mjs';\nimport { useLocale } from '../../../hooks/use-locale/index.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nlet tableIdSeed = 1;\nconst _sfc_main = 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: [\"select\", \"select-all\", \"selection-change\", \"cell-mouse-enter\", \"cell-mouse-leave\", \"cell-contextmenu\", \"cell-click\", \"cell-dblclick\", \"row-click\", \"row-contextmenu\", \"row-dblclick\", \"header-click\", \"header-contextmenu\", \"sort-change\", \"filter-change\", \"current-change\", \"header-dragend\", \"expand-change\", \"scroll\"],\n setup(props) {\n const {\n t\n } = useLocale();\n const ns = useNamespace(\"table\");\n const table = getCurrentInstance();\n provide(TABLE_INJECTION_KEY, table);\n const store = createStore(table, props);\n table.store = store;\n const layout = new TableLayout({\n store: table.store,\n table,\n fit: props.fit,\n showHeader: props.showHeader\n });\n table.layout = layout;\n const isEmpty = computed(() => (store.states.data.value || []).length === 0);\n const {\n setCurrentRow,\n getSelectionRows,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n sort,\n updateKeyChildren\n } = useUtils(store);\n const {\n isHidden,\n renderExpanded,\n setDragVisible,\n isGroup,\n handleMouseLeave,\n handleHeaderFooterMousewheel,\n tableSize,\n emptyBlockStyle,\n handleFixedMousewheel,\n resizeProxyVisible,\n bodyWidth,\n resizeState,\n doLayout,\n tableBodyStyles,\n tableLayout,\n scrollbarViewStyle,\n scrollbarStyle\n } = useStyle(props, layout, store, table);\n const {\n scrollBarRef,\n scrollTo,\n setScrollLeft,\n setScrollTop\n } = useScrollbar();\n const debouncedUpdateLayout = debounce(doLayout, 50);\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 var _a;\n return (_a = props.sumText) != null ? _a : t(\"el.table.sumText\");\n });\n const computedEmptyText = computed(() => {\n var _a;\n return (_a = props.emptyText) != null ? _a : t(\"el.table.emptyText\");\n });\n const columns = computed(() => {\n return convertToRows(store.states.originColumns.value)[0];\n });\n useKeyRender(table);\n onBeforeUnmount(() => {\n debouncedUpdateLayout.cancel();\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 handleFixedMousewheel,\n setCurrentRow,\n getSelectionRows,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n doLayout,\n sort,\n updateKeyChildren,\n t,\n setDragVisible,\n context: table,\n computedSumText,\n computedEmptyText,\n tableLayout,\n scrollbarViewStyle,\n scrollbarStyle,\n scrollBarRef,\n scrollTo,\n setScrollLeft,\n setScrollTop,\n allowDragLastColumn: props.allowDragLastColumn\n };\n }\n});\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_hColgroup = resolveComponent(\"hColgroup\");\n const _component_table_header = resolveComponent(\"table-header\");\n const _component_table_body = resolveComponent(\"table-body\");\n const _component_table_footer = resolveComponent(\"table-footer\");\n const _component_el_scrollbar = resolveComponent(\"el-scrollbar\");\n const _directive_mousewheel = resolveDirective(\"mousewheel\");\n return openBlock(), createElementBlock(\"div\", {\n ref: \"tableWrapper\",\n class: normalizeClass([{\n [_ctx.ns.m(\"fit\")]: _ctx.fit,\n [_ctx.ns.m(\"striped\")]: _ctx.stripe,\n [_ctx.ns.m(\"border\")]: _ctx.border || _ctx.isGroup,\n [_ctx.ns.m(\"hidden\")]: _ctx.isHidden,\n [_ctx.ns.m(\"group\")]: _ctx.isGroup,\n [_ctx.ns.m(\"fluid-height\")]: _ctx.maxHeight,\n [_ctx.ns.m(\"scrollable-x\")]: _ctx.layout.scrollX.value,\n [_ctx.ns.m(\"scrollable-y\")]: _ctx.layout.scrollY.value,\n [_ctx.ns.m(\"enable-row-hover\")]: !_ctx.store.states.isComplex.value,\n [_ctx.ns.m(\"enable-row-transition\")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,\n \"has-footer\": _ctx.showSummary\n }, _ctx.ns.m(_ctx.tableSize), _ctx.className, _ctx.ns.b(), _ctx.ns.m(`layout-${_ctx.tableLayout}`)]),\n style: normalizeStyle(_ctx.style),\n \"data-prefix\": _ctx.ns.namespace.value,\n onMouseleave: _ctx.handleMouseLeave\n }, [createElementVNode(\"div\", {\n class: normalizeClass(_ctx.ns.e(\"inner-wrapper\"))\n }, [createElementVNode(\"div\", {\n ref: \"hiddenColumns\",\n class: \"hidden-columns\"\n }, [renderSlot(_ctx.$slots, \"default\")], 512), _ctx.showHeader && _ctx.tableLayout === \"fixed\" ? withDirectives((openBlock(), createElementBlock(\"div\", {\n key: 0,\n ref: \"headerWrapper\",\n class: normalizeClass(_ctx.ns.e(\"header-wrapper\"))\n }, [createElementVNode(\"table\", {\n ref: \"tableHeader\",\n class: normalizeClass(_ctx.ns.e(\"header\")),\n style: normalizeStyle(_ctx.tableBodyStyles),\n border: \"0\",\n cellpadding: \"0\",\n cellspacing: \"0\"\n }, [createVNode(_component_hColgroup, {\n columns: _ctx.store.states.columns.value,\n \"table-layout\": _ctx.tableLayout\n }, null, 8, [\"columns\", \"table-layout\"]), createVNode(_component_table_header, {\n ref: \"tableHeaderRef\",\n border: _ctx.border,\n \"default-sort\": _ctx.defaultSort,\n store: _ctx.store,\n \"append-filter-panel-to\": _ctx.appendFilterPanelTo,\n \"allow-drag-last-column\": _ctx.allowDragLastColumn,\n onSetDragVisible: _ctx.setDragVisible\n }, null, 8, [\"border\", \"default-sort\", \"store\", \"append-filter-panel-to\", \"allow-drag-last-column\", \"onSetDragVisible\"])], 6)], 2)), [[_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode(\"v-if\", true), createElementVNode(\"div\", {\n ref: \"bodyWrapper\",\n class: normalizeClass(_ctx.ns.e(\"body-wrapper\"))\n }, [createVNode(_component_el_scrollbar, {\n ref: \"scrollBarRef\",\n \"view-style\": _ctx.scrollbarViewStyle,\n \"wrap-style\": _ctx.scrollbarStyle,\n always: _ctx.scrollbarAlwaysOn,\n tabindex: _ctx.scrollbarTabindex,\n onScroll: $event => _ctx.$emit(\"scroll\", $event)\n }, {\n default: withCtx(() => [createElementVNode(\"table\", {\n ref: \"tableBody\",\n class: normalizeClass(_ctx.ns.e(\"body\")),\n cellspacing: \"0\",\n cellpadding: \"0\",\n border: \"0\",\n style: normalizeStyle({\n width: _ctx.bodyWidth,\n tableLayout: _ctx.tableLayout\n })\n }, [createVNode(_component_hColgroup, {\n columns: _ctx.store.states.columns.value,\n \"table-layout\": _ctx.tableLayout\n }, null, 8, [\"columns\", \"table-layout\"]), _ctx.showHeader && _ctx.tableLayout === \"auto\" ? (openBlock(), createBlock(_component_table_header, {\n key: 0,\n ref: \"tableHeaderRef\",\n class: normalizeClass(_ctx.ns.e(\"body-header\")),\n border: _ctx.border,\n \"default-sort\": _ctx.defaultSort,\n store: _ctx.store,\n \"append-filter-panel-to\": _ctx.appendFilterPanelTo,\n onSetDragVisible: _ctx.setDragVisible\n }, null, 8, [\"class\", \"border\", \"default-sort\", \"store\", \"append-filter-panel-to\", \"onSetDragVisible\"])) : createCommentVNode(\"v-if\", true), createVNode(_component_table_body, {\n context: _ctx.context,\n highlight: _ctx.highlightCurrentRow,\n \"row-class-name\": _ctx.rowClassName,\n \"tooltip-effect\": _ctx.tooltipEffect,\n \"tooltip-options\": _ctx.tooltipOptions,\n \"row-style\": _ctx.rowStyle,\n store: _ctx.store,\n stripe: _ctx.stripe\n }, null, 8, [\"context\", \"highlight\", \"row-class-name\", \"tooltip-effect\", \"tooltip-options\", \"row-style\", \"store\", \"stripe\"]), _ctx.showSummary && _ctx.tableLayout === \"auto\" ? (openBlock(), createBlock(_component_table_footer, {\n key: 1,\n class: normalizeClass(_ctx.ns.e(\"body-footer\")),\n border: _ctx.border,\n \"default-sort\": _ctx.defaultSort,\n store: _ctx.store,\n \"sum-text\": _ctx.computedSumText,\n \"summary-method\": _ctx.summaryMethod\n }, null, 8, [\"class\", \"border\", \"default-sort\", \"store\", \"sum-text\", \"summary-method\"])) : createCommentVNode(\"v-if\", true)], 6), _ctx.isEmpty ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n ref: \"emptyBlock\",\n style: normalizeStyle(_ctx.emptyBlockStyle),\n class: normalizeClass(_ctx.ns.e(\"empty-block\"))\n }, [createElementVNode(\"span\", {\n class: normalizeClass(_ctx.ns.e(\"empty-text\"))\n }, [renderSlot(_ctx.$slots, \"empty\", {}, () => [createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)])], 2)], 6)) : createCommentVNode(\"v-if\", true), _ctx.$slots.append ? (openBlock(), createElementBlock(\"div\", {\n key: 1,\n ref: \"appendWrapper\",\n class: normalizeClass(_ctx.ns.e(\"append-wrapper\"))\n }, [renderSlot(_ctx.$slots, \"append\")], 2)) : createCommentVNode(\"v-if\", true)]),\n _: 3\n }, 8, [\"view-style\", \"wrap-style\", \"always\", \"tabindex\", \"onScroll\"])], 2), _ctx.showSummary && _ctx.tableLayout === \"fixed\" ? withDirectives((openBlock(), createElementBlock(\"div\", {\n key: 1,\n ref: \"footerWrapper\",\n class: normalizeClass(_ctx.ns.e(\"footer-wrapper\"))\n }, [createElementVNode(\"table\", {\n class: normalizeClass(_ctx.ns.e(\"footer\")),\n cellspacing: \"0\",\n cellpadding: \"0\",\n border: \"0\",\n style: normalizeStyle(_ctx.tableBodyStyles)\n }, [createVNode(_component_hColgroup, {\n columns: _ctx.store.states.columns.value,\n \"table-layout\": _ctx.tableLayout\n }, null, 8, [\"columns\", \"table-layout\"]), createVNode(_component_table_footer, {\n border: _ctx.border,\n \"default-sort\": _ctx.defaultSort,\n store: _ctx.store,\n \"sum-text\": _ctx.computedSumText,\n \"summary-method\": _ctx.summaryMethod\n }, null, 8, [\"border\", \"default-sort\", \"store\", \"sum-text\", \"summary-method\"])], 6)], 2)), [[vShow, !_ctx.isEmpty], [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode(\"v-if\", true), _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock(\"div\", {\n key: 2,\n class: normalizeClass(_ctx.ns.e(\"border-left-patch\"))\n }, null, 2)) : createCommentVNode(\"v-if\", true)], 2), withDirectives(createElementVNode(\"div\", {\n ref: \"resizeProxy\",\n class: normalizeClass(_ctx.ns.e(\"column-resize-proxy\"))\n }, null, 2), [[vShow, _ctx.resizeProxyVisible]])], 46, [\"data-prefix\", \"onMouseleave\"]);\n}\nvar Table = /* @__PURE__ */_export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__file\", \"table.vue\"]]);\nexport { Table as default };","map":{"version":3,"names":["tableIdSeed","_sfc_main","defineComponent","name","directives","Mousewheel","components","TableHeader","TableBody","TableFooter","ElScrollbar","hColgroup","props","defaultProps","emits","setup","t","useLocale","ns","useNamespace","table","getCurrentInstance","provide","TABLE_INJECTION_KEY","store","createStore","layout","TableLayout","fit","showHeader","isEmpty","computed","states","data","value","length","setCurrentRow","getSelectionRows","toggleRowSelection","clearSelection","clearFilter","toggleAllSelection","toggleRowExpansion","clearSort","sort","updateKeyChildren","useUtils","isHidden","renderExpanded","setDragVisible","isGroup","handleMouseLeave","handleHeaderFooterMousewheel","tableSize","emptyBlockStyle","handleFixedMousewheel","resizeProxyVisible","bodyWidth","resizeState","doLayout","tableBodyStyles","tableLayout","scrollbarViewStyle","scrollbarStyle","useStyle","scrollBarRef","scrollTo","setScrollLeft","setScrollTop","useScrollbar","debouncedUpdateLayout","debounce","tableId","namespace","state","computedSumText","_a","sumText","computedEmptyText","emptyText","columns","convertToRows","originColumns","useKeyRender","onBeforeUnmount","cancel","context","allowDragLastColumn","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_component_hColgroup","resolveComponent","_component_table_header","_component_table_body","_component_table_footer","_component_el_scrollbar","_directive_mousewheel","resolveDirective","openBlock","createElementBlock","ref","class","normalizeClass","m","stripe","border","maxHeight","scrollX","scrollY","isComplex","showSummary","className","b","style","normalizeStyle","onMouseleave","createElementVNode","e","renderSlot","$slots","withDirectives","cellpadding","cellspacing","createVNode","defaultSort","appendFilterPanelTo","onSetDragVisible","createCommentVNode","always","scrollbarAlwaysOn","onScroll","$event","$emit","default","withCtx","createBlock","rowClassName","tooltipEffect","tooltipOptions","rowStyle","key","createTextVNode","toDisplayString","append","_","summaryMethod","Table","_export_sfc"],"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 :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 @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=\"tooltipEffect\"\n :tooltip-options=\"tooltipOptions\"\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\">\n// @ts-nocheck\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 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 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 handleFixedMousewheel,\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 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 handleFixedMousewheel,\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 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":";;;;;;;;;;;;;;;;;;;;AAwMA,IAAIA,WAAc;AAClB,MAAKC,SAAA,GAAaC,eAAa;EAC7BC,IAAM;EACNC,UAAY;IACVC;EAAA,CACF;EACAC,UAAY;IACVC,WAAA;IACAC,SAAA;IACAC,WAAA;IACAC,WAAA;IACAC;EAAA,CACF;EACAC,KAAO,EAAAC,YAAA;EACPC,KAAO,GACL,UACA,cACA,oBACA,oBACA,oBACA,oBACA,cACA,iBACA,aACA,mBACA,gBACA,gBACA,sBACA,eACA,iBACA,k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