{"version":3,"file":"row.js","sources":["../../../../../../../packages/components/table-v2/src/renderers/row.tsx"],"sourcesContent":["import { Row } from '../components'\nimport { tryCall } from '../utils'\n\nimport type {\n ComponentInternalInstance,\n FunctionalComponent,\n UnwrapNestedRefs,\n} from 'vue'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\nimport type { UseTableReturn } from '../use-table'\nimport type { TableV2Props } from '../table'\nimport type { TableGridRowSlotParams } from '../table-grid'\n\ntype RowRendererProps = TableGridRowSlotParams &\n Pick<\n TableV2Props,\n | 'expandColumnKey'\n | 'estimatedRowHeight'\n | 'rowProps'\n | 'rowClass'\n | 'rowKey'\n | 'rowEventHandlers'\n > &\n UnwrapNestedRefs<\n Pick<\n UseTableReturn,\n | 'depthMap'\n | 'expandedRowKeys'\n | 'hasFixedColumns'\n | 'onRowHovered'\n | 'onRowExpanded'\n | 'columnsStyles'\n >\n > & {\n ns: UseNamespaceReturn\n tableInstance: null | ComponentInternalInstance\n }\n\nconst RowRenderer: FunctionalComponent = (\n props,\n { slots }\n) => {\n const {\n columns,\n columnsStyles,\n depthMap,\n expandColumnKey,\n expandedRowKeys,\n estimatedRowHeight,\n hasFixedColumns,\n rowData,\n rowIndex,\n style,\n isScrolling,\n rowProps,\n rowClass,\n rowKey,\n rowEventHandlers,\n ns,\n onRowHovered,\n onRowExpanded,\n } = props\n\n const rowKls = tryCall(rowClass, { columns, rowData, rowIndex }, '')\n const additionalProps = tryCall(rowProps, {\n columns,\n rowData,\n rowIndex,\n })\n const _rowKey = rowData[rowKey]\n const depth = depthMap[_rowKey] || 0\n const canExpand = Boolean(expandColumnKey)\n const isFixedRow = rowIndex < 0\n const kls = [\n ns.e('row'),\n rowKls,\n {\n [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,\n [ns.is('expanded')]: canExpand && expandedRowKeys.includes(_rowKey),\n [ns.is('fixed')]: !depth && isFixedRow,\n [ns.is('customized')]: Boolean(slots.row),\n },\n ]\n\n const onRowHover = hasFixedColumns ? onRowHovered : undefined\n\n const _rowProps = {\n ...additionalProps,\n columns,\n columnsStyles,\n class: kls,\n depth,\n expandColumnKey,\n estimatedRowHeight: isFixedRow ? undefined : estimatedRowHeight,\n isScrolling,\n rowIndex,\n rowData,\n rowKey: _rowKey,\n rowEventHandlers,\n style,\n }\n\n const handlerMosueEnter = (e: MouseEvent) => {\n onRowHover?.({\n hovered: true,\n rowKey: _rowKey,\n event: e,\n rowData,\n rowIndex,\n })\n }\n\n const handlerMouseLeave = (e: MouseEvent) => {\n onRowHover?.({\n hovered: false,\n rowKey: _rowKey,\n event: e,\n rowData,\n rowIndex,\n })\n }\n\n return (\n \n {slots}\n \n )\n}\n\nexport default RowRenderer\n"],"names":["RowRenderer","slots","columns","columnsStyles","depthMap","expandColumnKey","expandedRowKeys","estimatedRowHeight","hasFixedColumns","rowData","rowIndex","style","isScrolling","rowProps","rowClass","rowKey","rowEventHandlers","ns","onRowExpanded","_rowKey","depth","canExpand","Boolean","isFixedRow","kls","e","is","class","handlerMosueEnter","onRowHover","hovered","event","handlerMouseLeave"],"mappings":";;;;;;;;;;;;;;AAsCA,CAAA,KAAMA;AAEFC,EAAAA,MAAAA;AAAF,IACG,OAAA;IACG,aAAA;IACJC,QADI;IAEJC,eAFI;IAGJC,eAHI;IAIJC,kBAJI;IAKJC,eALI;IAMJC,OANI;IAOJC,QAPI;IAQJC,KARI;IASJC,WATI;IAUJC,QAVI;IAWJC,QAXI;IAYJC,MAZI;IAaJC,gBAbI;IAcJC,EAdI;IAeJC,YAfI;IAgBJC,aAhBI;MAAA,KAAA,CAAA;AAkBJC,EAAAA,MAAAA,MAAAA,GAAAA,aAAAA,CAAAA,QAAAA,EAAAA;AAlBI,IAAA,OAAN;AAqBA,IAAA,OAAY;IAAuBhB,QAAF;KAAA,EAAA,CAAA,CAAA;AAAoBQ,EAAAA,MAAAA,eAAAA,GAAAA,aAAAA,CAAAA,QAAAA,EAAAA;IAA/B,OAAtB;AACA,IAAA,OAAqB;IACnBR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