1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"data\", \"index\", \"className\", \"rowKey\", \"style\", \"extra\", \"getHeight\"];\nimport { useContext } from '@rc-component/context';\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport Cell from \"../Cell\";\nimport TableContext, { responseImmutable } from \"../context/TableContext\";\nimport useRowInfo from \"../hooks/useRowInfo\";\nimport VirtualCell from \"./VirtualCell\";\nimport { StaticContext } from \"./context\";\nvar BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var data = props.data,\n index = props.index,\n className = props.className,\n rowKey = props.rowKey,\n style = props.style,\n extra = props.extra,\n getHeight = props.getHeight,\n restProps = _objectWithoutProperties(props, _excluded);\n var record = data.record,\n indent = data.indent,\n renderIndex = data.index;\n var _useContext = useContext(TableContext, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX']),\n scrollX = _useContext.scrollX,\n flattenColumns = _useContext.flattenColumns,\n prefixCls = _useContext.prefixCls,\n fixColumn = _useContext.fixColumn,\n componentWidth = _useContext.componentWidth;\n var _useContext2 = useContext(StaticContext, ['getComponent']),\n getComponent = _useContext2.getComponent;\n var rowInfo = useRowInfo(record, rowKey, index, indent);\n var RowComponent = getComponent(['body', 'row'], 'div');\n var cellComponent = getComponent(['body', 'cell'], 'div');\n\n // ========================== Expand ==========================\n var rowSupportExpand = rowInfo.rowSupportExpand,\n expanded = rowInfo.expanded,\n rowProps = rowInfo.rowProps,\n expandedRowRender = rowInfo.expandedRowRender,\n expandedRowClassName = rowInfo.expandedRowClassName;\n var expandRowNode;\n if (rowSupportExpand && expanded) {\n var expandContent = expandedRowRender(record, index, indent + 1, expanded);\n var computedExpandedRowClassName = expandedRowClassName === null || expandedRowClassName === void 0 ? void 0 : expandedRowClassName(record, index, indent);\n var additionalProps = {};\n if (fixColumn) {\n additionalProps = {\n style: _defineProperty({}, '--virtual-width', \"\".concat(componentWidth, \"px\"))\n };\n }\n var rowCellCls = \"\".concat(prefixCls, \"-expanded-row-cell\");\n expandRowNode = /*#__PURE__*/React.createElement(RowComponent, {\n className: classNames(\"\".concat(prefixCls, \"-expanded-row\"), \"\".concat(prefixCls, \"-expanded-row-level-\").concat(indent + 1), computedExpandedRowClassName)\n }, /*#__PURE__*/React.createElement(Cell, {\n component: cellComponent,\n prefixCls: prefixCls,\n className: classNames(rowCellCls, _defineProperty({}, \"\".concat(rowCellCls, \"-fixed\"), fixColumn)),\n additionalProps: additionalProps\n }, expandContent));\n }\n\n // ========================== Render ==========================\n var rowStyle = _objectSpread(_objectSpread({}, style), {}, {\n width: scrollX\n });\n if (extra) {\n rowStyle.position = 'absolute';\n rowStyle.pointerEvents = 'none';\n }\n var rowNode = /*#__PURE__*/React.createElement(RowComponent, _extends({}, rowProps, restProps, {\n \"data-row-key\": rowKey,\n ref: rowSupportExpand ? null : ref,\n className: classNames(className, \"\".concat(prefixCls, \"-row\"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, _defineProperty({}, \"\".concat(prefixCls, \"-row-extra\"), extra)),\n style: _objectSpread(_objectSpread({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style)\n }), flattenColumns.map(function (column, colIndex) {\n return /*#__PURE__*/Reac
|