1 line
26 KiB
JSON
1 line
26 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { useContext } from '@rc-component/context';\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport TableContext from \"../context/TableContext\";\nimport devRenderTimes from \"../hooks/useRenderTimes\";\nimport useCellRender from \"./useCellRender\";\nimport useHoverState from \"./useHoverState\";\nimport { useEvent } from 'rc-util';\nvar getTitleFromCellRenderChildren = function getTitleFromCellRenderChildren(_ref) {\n var ellipsis = _ref.ellipsis,\n rowType = _ref.rowType,\n children = _ref.children;\n var title;\n var ellipsisConfig = ellipsis === true ? {\n showTitle: true\n } : ellipsis;\n if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {\n if (typeof children === 'string' || typeof children === 'number') {\n title = children.toString();\n } else if ( /*#__PURE__*/React.isValidElement(children) && typeof children.props.children === 'string') {\n title = children.props.children;\n }\n }\n return title;\n};\nfunction Cell(props) {\n var _ref2, _ref3, _legacyCellProps$colS, _ref4, _ref5, _legacyCellProps$rowS, _additionalProps$titl, _classNames;\n if (process.env.NODE_ENV !== 'production') {\n devRenderTimes(props);\n }\n var Component = props.component,\n children = props.children,\n ellipsis = props.ellipsis,\n scope = props.scope,\n prefixCls = props.prefixCls,\n className = props.className,\n align = props.align,\n record = props.record,\n render = props.render,\n dataIndex = props.dataIndex,\n renderIndex = props.renderIndex,\n shouldCellUpdate = props.shouldCellUpdate,\n index = props.index,\n rowType = props.rowType,\n colSpan = props.colSpan,\n rowSpan = props.rowSpan,\n fixLeft = props.fixLeft,\n fixRight = props.fixRight,\n firstFixLeft = props.firstFixLeft,\n lastFixLeft = props.lastFixLeft,\n firstFixRight = props.firstFixRight,\n lastFixRight = props.lastFixRight,\n appendNode = props.appendNode,\n _props$additionalProp = props.additionalProps,\n additionalProps = _props$additionalProp === void 0 ? {} : _props$additionalProp,\n isSticky = props.isSticky;\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var _useContext = useContext(TableContext, ['supportSticky', 'allColumnsFixedLeft', 'rowHoverable']),\n supportSticky = _useContext.supportSticky,\n allColumnsFixedLeft = _useContext.allColumnsFixedLeft,\n rowHoverable = _useContext.rowHoverable;\n\n // ====================== Value =======================\n var _useCellRender = useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate),\n _useCellRender2 = _slicedToArray(_useCellRender, 2),\n childNode = _useCellRender2[0],\n legacyCellProps = _useCellRender2[1];\n\n // ====================== Fixed =======================\n var fixedStyle = {};\n var isFixLeft = typeof fixLeft === 'number' && supportSticky;\n var isFixRight = typeof fixRight === 'number' && supportSticky;\n if (isFixLeft) {\n fixedStyle.position = 'sticky';\n fixedStyle.left = fixLeft;\n }\n if (isFixRight) {\n fixedStyle.position = 'sticky';\n fixedStyle.right = fixRight;\n }\n\n // ================ RowSpan & ColSpan =================\n var mergedColSpan = (_ref2 = (_ref3 = (_legacyCellProps$colS = legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.colSpan) !== null && _legacyCellProps$colS !== void 0 ? _legacyCellProps$colS : additionalProps.colSpan) !== null && _ref3 !== void 0 ? _ref3 : colSpan) !== null && _ref2 !== void 0 ? _ref2 : 1;\n var mergedRowSpan = (_ref4 = (_ref5 = (_legacyCellProps$rowS = legacyCellProps === null || legacyCellProps === vo
|