{"version":3,"file":"row.mjs","names":["Row","tryCall","_isSlot","s","Object","prototype","toString","call","_isVNode","RowRenderer","props","slots","columns","columnsStyles","depthMap","expandColumnKey","expandedRowKeys","estimatedRowHeight","hasFixedColumns","rowData","rowIndex","style","isScrolling","rowProps","rowClass","rowKey","rowEventHandlers","ns","onRowHovered","onRowExpanded","rowKls","additionalProps","_rowKey","depth","canExpand","Boolean","isFixedRow","kls","e","is","includes","row","onRowHover","undefined","_rowProps","class","handlerMouseEnter","hovered","event","handlerMouseLeave","_createVNode","_mergeProps","default"],"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?: ComponentInternalInstance\n  }\n\nconst RowRenderer: FunctionalComponent<RowRendererProps> = (\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    ns.is('expanded', canExpand && expandedRowKeys.includes(_rowKey)),\n    ns.is('fixed', !depth && isFixedRow),\n    ns.is('customized', Boolean(slots.row)),\n    {\n      [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,\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 handlerMouseEnter = (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    <Row\n      {..._rowProps}\n      onRowExpand={onRowExpanded}\n      onMouseenter={handlerMouseEnter}\n      onMouseleave={handlerMouseLeave}\n      rowkey={_rowKey}\n    >\n      {slots}\n    </Row>\n  )\n}\n\nexport default RowRenderer\n"],"mappings":";;;;;AACkC,SAAAE,QAAAC,GAAA;AAAA,QAAA,OAAAA,MAAA,cAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,EAAA,KAAA,qBAAA,CAAAK,QAAAL,EAAA;;AAqClC,MAAMM,eACJC,OACA,EAAEC,YACC;CACH,MAAM,EACJC,SACAC,eACAC,UACAC,iBACAC,i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