{"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 \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","onRowExpanded","onRowsRendered","onScroll","onVerticalScroll","useTable","cache","cellProps","estimatedRowHeight","expandColumnKey","fixedData","headerHeight","headerClass","headerProps","headerCellProps","sortBy","sortState","rowHeight","rowClass","rowEventHandlers","rowKey","rowProps","scrollbarAlwaysOn","indentSize","iconSize","useIsScrolling","vScrollbarSize","width","class","columns","unref","height","scrollbarStartGap","scrollbarEndGap","_data","style","ns","_colum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