{"version":3,"file":"table-v2.mjs","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