{"version":3,"file":"table-v2.js","sources":["../../../../../../packages/components/table-v2/src/table-v2.tsx"],"sourcesContent":["// @ts-nocheck\nimport { defineComponent, provide, unref } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useTable } from './use-table'\nimport { TableV2InjectionKey } from './tokens'\nimport { tableV2Props } from './table'\n// renderers\nimport MainTable from './renderers/main-table'\nimport LeftTable from './renderers/left-table'\nimport RightTable from './renderers/right-table'\nimport Row from './renderers/row'\nimport Cell from './renderers/cell'\nimport Header from './renderers/header'\nimport HeaderCell from './renderers/header-cell'\nimport Footer from './renderers/footer'\nimport Empty from './renderers/empty'\nimport Overlay from './renderers/overlay'\n\nimport type { TableGridRowSlotParams } from './table-grid'\nimport type { ScrollStrategy } from './composables/use-scrollbar'\nimport type {\n TableV2HeaderRendererParams,\n TableV2HeaderRowCellRendererParams,\n TableV2RowCellRenderParam,\n} from './components'\n\nconst COMPONENT_NAME = 'ElTableV2'\n\nconst TableV2 = defineComponent({\n name: COMPONENT_NAME,\n props: tableV2Props,\n setup(props, { slots, expose }) {\n const ns = useNamespace('table-v2')\n\n const {\n columnsStyles,\n fixedColumnsOnLeft,\n fixedColumnsOnRight,\n mainColumns,\n mainTableHeight,\n fixedTableHeight,\n leftTableWidth,\n rightTableWidth,\n data,\n depthMap,\n expandedRowKeys,\n hasFixedColumns,\n mainTableRef,\n leftTableRef,\n rightTableRef,\n isDynamic,\n isResetting,\n isScrolling,\n\n bodyWidth,\n emptyStyle,\n rootStyle,\n headerWidth,\n footerHeight,\n\n showEmpty,\n\n // exposes\n scrollTo,\n scrollToLeft,\n scrollToTop,\n scrollToRow,\n\n getRowHeight,\n onColumnSorted,\n onRowHeightChange,\n onRowHovered,\n onRowExpanded,\n onRowsRendered,\n onScroll,\n onVerticalScroll,\n } = useTable(props)\n\n expose({\n /**\n * @description scroll to a given position\n * @params params {{ scrollLeft?: number, scrollTop?: number }} where to scroll to.\n */\n scrollTo,\n /**\n * @description scroll to a given position horizontally\n * @params scrollLeft {Number} where to scroll to.\n */\n scrollToLeft,\n /**\n * @description scroll to a given position vertically\n * @params scrollTop { Number } where to scroll to.\n */\n scrollToTop,\n /**\n * @description scroll to a given row\n * @params row {Number} which row to scroll to\n * @params @optional strategy {ScrollStrategy} use what strategy to scroll to\n */\n scrollToRow,\n })\n\n provide(TableV2InjectionKey, {\n ns,\n isResetting,\n isScrolling,\n })\n\n return () => {\n const {\n cache,\n cellProps,\n estimatedRowHeight,\n expandColumnKey,\n fixedData,\n headerHeight,\n headerClass,\n headerProps,\n headerCellProps,\n sortBy,\n sortState,\n rowHeight,\n rowClass,\n rowEventHandlers,\n rowKey,\n rowProps,\n scrollbarAlwaysOn,\n indentSize,\n iconSize,\n useIsScrolling,\n vScrollbarSize,\n width,\n } = props\n\n const _data = unref(data)\n\n const mainTableProps = {\n cache,\n class: ns.e('main'),\n columns: unref(mainColumns),\n data: _data,\n fixedData,\n estimatedRowHeight,\n bodyWidth: unref(bodyWidth) + vScrollbarSize,\n headerHeight,\n headerWidth: unref(headerWidth),\n height: unref(mainTableHeight),\n mainTableRef,\n rowKey,\n rowHeight,\n scrollbarAlwaysOn,\n scrollbarStartGap: 2,\n scrollbarEndGap: vScrollbarSize,\n useIsScrolling,\n width,\n getRowHeight,\n onRowsRendered,\n onScroll,\n }\n\n const leftColumnsWidth = unref(leftTableWidth)\n const _fixedTableHeight = unref(fixedTableHeight)\n\n const leftTableProps = {\n cache,\n class: ns.e('left'),\n columns: unref(fixedColumnsOnLeft),\n data: _data,\n estimatedRowHeight,\n leftTableRef,\n rowHeight,\n bodyWidth: leftColumnsWidth,\n headerWidth: leftColumnsWidth,\n headerHeight,\n height: _fixedTableHeight,\n rowKey,\n scrollbarAlwaysOn,\n scrollbarStartGap: 2,\n scrollbarEndGap: vScrollbarSize,\n useIsScrolling,\n width: leftColumnsWidth,\n getRowHeight,\n onScroll: onVerticalScroll,\n }\n\n const rightColumnsWidth = unref(rightTableWidth)\n const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize\n\n const rightTableProps = {\n cache,\n class: ns.e('right'),\n columns: unref(fixedColumnsOnRight),\n data: _data,\n estimatedRowHeight,\n rightTableRef,\n rowHeight,\n bodyWidth: rightColumnsWidthWithScrollbar,\n headerWidth: rightColumnsWidthWithScrollbar,\n headerHeight,\n height: _fixedTableHeight,\n rowKey,\n scrollbarAlwaysOn,\n scrollbarStartGap: 2,\n scrollbarEndGap: vScrollbarSize,\n width: rightColumnsWidthWithScrollbar,\n style: `--${unref(\n ns.namespace\n )}-table-scrollbar-size: ${vScrollbarSize}px`,\n useIsScrolling,\n getRowHeight,\n onScroll: onVerticalScroll,\n }\n const _columnsStyles = unref(columnsStyles)\n\n const tableRowProps = {\n ns,\n depthMap: unref(depthMap),\n columnsStyles: _columnsStyles,\n expandColumnKey,\n expandedRowKeys: unref(expandedRowKeys),\n estimatedRowHeight,\n hasFixedColumns: unref(hasFixedColumns),\n rowProps,\n rowClass,\n rowKey,\n rowEventHandlers,\n onRowHovered,\n onRowExpanded,\n onRowHeightChange,\n }\n\n const tableCellProps = {\n cellProps,\n expandColumnKey,\n indentSize,\n iconSize,\n rowKey,\n expandedRowKeys: unref(expandedRowKeys),\n ns,\n }\n\n const tableHeaderProps = {\n ns,\n headerClass,\n headerProps,\n columnsStyles: _columnsStyles,\n }\n\n const tableHeaderCellProps = {\n ns,\n\n sortBy,\n sortState,\n headerCellProps,\n onColumnSorted,\n }\n\n const tableSlots = {\n row: (props: TableGridRowSlotParams) => (\n \n {{\n row: slots.row,\n cell: (props: TableV2RowCellRenderParam) =>\n slots.cell ? (\n \n {slots.cell(props)}\n \n ) : (\n \n ),\n }}\n \n ),\n header: (props: TableV2HeaderRendererParams) => (\n
\n {{\n header: slots.header,\n cell: (props: TableV2HeaderRowCellRendererParams) =>\n slots['header-cell'] ? (\n \n {slots['header-cell'](props)}\n \n ) : (\n \n ),\n }}\n
\n ),\n }\n\n const rootKls = [\n props.class,\n ns.b(),\n ns.e('root'),\n {\n [ns.is('dynamic')]: unref(isDynamic),\n },\n ]\n\n const footerProps = {\n class: ns.e('footer'),\n style: unref(footerHeight),\n }\n\n return (\n
\n {tableSlots}\n {tableSlots}\n {tableSlots}\n {slots.footer && (\n \n )}\n {unref(showEmpty) && (\n \n {{ default: slots.empty }}\n \n )}\n {slots.overlay && (\n \n {{ default: slots.overlay }}\n \n )}\n
\n )\n }\n },\n})\n\nexport default TableV2\n\nexport type TableV2Instance = InstanceType & {\n /**\n * @description scroll to a given position\n * @params params {{ scrollLeft?: number, scrollTop?: number }} where to scroll to.\n */\n scrollTo: (param: { scrollLeft?: number; scrollTop?: number }) => void\n /**\n * @description scroll to a given position horizontally\n * @params scrollLeft {Number} where to scroll to.\n */\n scrollToLeft: (scrollLeft: number) => void\n /**\n * @description scroll to a given position vertically\n * @params scrollTop { Number } where to scroll to.\n */\n scrollToTop: (scrollTop: number) => void\n /**\n * @description scroll to a given row\n * @params row {Number} which row to scroll to\n * @params strategy {ScrollStrategy} use what strategy to scroll to\n */\n scrollToRow(row: number, strategy?: ScrollStrategy): void\n}\n"],"names":["Empty","Overlay","_isVNode","COMPONENT_NAME","TableV2","name","props","expose","columnsStyles","fixedColumnsOnLeft","fixedColumnsOnRight","mainColumns","mainTableHeight","fixedTableHeight","leftTableWidth","rightTableWidth","data","depthMap","expandedRowKeys","hasFixedColumns","mainTableRef","leftTableRef","rightTableRef","isDynamic","isResetting","isScrolling","bodyWidth","emptyStyle","rootStyle","headerWidth","footerHeight","showEmpty","scrollTo","scrollToLeft","scrollToTop","scrollToRow","getRowHeight","onColumnSorted","useTable","onRowExpanded","onRowsRendered","onScroll","onVerticalScroll","TableV2InjectionKey","unref","cache","cellProps","estimatedRowHeight","expandColumnKey","fixedData","headerHeight","headerClass","headerProps","headerCellProps","sortBy","sortState","rowHeight","rowClass","rowEventHandlers","rowKey","rowProps","scrollbarAlwaysOn","indentSize","iconSize","useIsScrolling","vScrollbarSize","width","class","columns","height","scrollbarStartGap","scrollbarEndGap","_data","style","ns","_columnsStyles","_createVNode","Cell","_mergeProps","onRowHeightChange","Header","HeaderCell","row","cell","LeftTable","slots","Footer","header"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,SAAOA,SAAW,EAAlB;AACA,EAAOC,OAAAA,aAAP,UAAA,IAAA,MAAA,CAAA,SAAA,CAAA,QAAA,CAAA,IAAA,CAAA,CAAA,CAAA,KAAA,iBAAA,IAAA,CAAAC,WAAA,CAAA,CAAA,CAAA,CAAA;;;;;;AAUA,EAAMC,KAAAA,CAAAA,KAAAA,EAAAA;AAEN,IAAMC,KAAAA;AACJC,IAAAA,MAD8B;AAE9BC,GAAAA,EAAAA;;IACK;MAAQ,aAAA;AAASC,MAAAA,kBAAAA;AAAT,MAAmB,mBAAA;AAC9B,MAAA,WAAuB;MAEjB,eAAA;MACJC,gBADI;MAEJC,cAFI;MAGJC,eAHI;MAIJC,IAJI;MAKJC,QALI;MAMJC,eANI;MAOJC,eAPI;MAQJC,YARI;MASJC,YATI;MAUJC,aAVI;MAWJC,SAXI;MAYJC,WAZI;MAaJC,WAbI;MAcJC,SAdI;MAeJC,UAfI;MAgBJC,SAhBI;MAiBJC,WAjBI;MAkBJC,YAlBI;MAoBJC,SApBI;MAqBJC,QArBI;MAsBJC,YAtBI;MAuBJC,WAvBI;MAwBJC,WAxBI;MA0BJC,YA1BI;AA4BJ,MAAA,cAAA;MACAC,iBA7BI;MA8BJC,YA9BI;MA+BJC,aA/BI;MAgCJC,cAhCI;MAkCJC,QAlCI;MAmCJC,gBAnCI;QAAAC,iBAAA,CAAA,KAAA,CAAA,CAAA;UAAA,CAAA;MAsCJC,QAtCI;MAuCJC,YAvCI;MAwCJC,WAxCI;AAyCJC,MAAAA,WAAAA;KACEJ,CAAAA,CAAAA;AAEJ/B,IAAAA,WAAO,CAAAoC,0BAAA,EAAA;AACL,MAAA,EAAA;AACN,MAAA,WAAA;AACA,MAAA,WAAA;AACA,KAAA,CAAA,CAAA;WAJW,MAAA;;AAML,QAAA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