1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useContext } from '@rc-component/context';\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { getCellProps } from \"../Body/BodyRow\";\nimport Cell from \"../Cell\";\nimport { GridContext } from \"./context\";\n/**\n * Return the width of the column by `colSpan`.\n * When `colSpan` is `0` will be trade as `1`.\n */\nexport function getColumnWidth(colIndex, colSpan, columnsOffset) {\n var mergedColSpan = colSpan || 1;\n return columnsOffset[colIndex + mergedColSpan] - (columnsOffset[colIndex] || 0);\n}\nfunction VirtualCell(props) {\n var rowInfo = props.rowInfo,\n column = props.column,\n colIndex = props.colIndex,\n indent = props.indent,\n index = props.index,\n component = props.component,\n renderIndex = props.renderIndex,\n record = props.record,\n style = props.style,\n className = props.className,\n inverse = props.inverse,\n getHeight = props.getHeight;\n var render = column.render,\n dataIndex = column.dataIndex,\n columnClassName = column.className,\n colWidth = column.width;\n var _useContext = useContext(GridContext, ['columnsOffset']),\n columnsOffset = _useContext.columnsOffset;\n var _getCellProps = getCellProps(rowInfo, column, colIndex, indent, index),\n key = _getCellProps.key,\n fixedInfo = _getCellProps.fixedInfo,\n appendCellNode = _getCellProps.appendCellNode,\n additionalCellProps = _getCellProps.additionalCellProps;\n var cellStyle = additionalCellProps.style,\n _additionalCellProps$ = additionalCellProps.colSpan,\n colSpan = _additionalCellProps$ === void 0 ? 1 : _additionalCellProps$,\n _additionalCellProps$2 = additionalCellProps.rowSpan,\n rowSpan = _additionalCellProps$2 === void 0 ? 1 : _additionalCellProps$2;\n\n // ========================= ColWidth =========================\n // column width\n var startColIndex = colIndex - 1;\n var concatColWidth = getColumnWidth(startColIndex, colSpan, columnsOffset);\n\n // margin offset\n var marginOffset = colSpan > 1 ? colWidth - concatColWidth : 0;\n\n // ========================== Style ===========================\n var mergedStyle = _objectSpread(_objectSpread(_objectSpread({}, cellStyle), style), {}, {\n flex: \"0 0 \".concat(concatColWidth, \"px\"),\n width: \"\".concat(concatColWidth, \"px\"),\n marginRight: marginOffset,\n pointerEvents: 'auto'\n });\n\n // When `colSpan` or `rowSpan` is `0`, should skip render.\n var needHide = React.useMemo(function () {\n if (inverse) {\n return rowSpan <= 1;\n } else {\n return colSpan === 0 || rowSpan === 0 || rowSpan > 1;\n }\n }, [rowSpan, colSpan, inverse]);\n\n // 0 rowSpan or colSpan should not render\n if (needHide) {\n mergedStyle.visibility = 'hidden';\n } else if (inverse) {\n mergedStyle.height = getHeight === null || getHeight === void 0 ? void 0 : getHeight(rowSpan);\n }\n var mergedRender = needHide ? function () {\n return null;\n } : render;\n\n // ========================== Render ==========================\n var cellSpan = {};\n\n // Virtual should reset `colSpan` & `rowSpan`\n if (rowSpan === 0 || colSpan === 0) {\n cellSpan.rowSpan = 1;\n cellSpan.colSpan = 1;\n }\n return /*#__PURE__*/React.createElement(Cell, _extends({\n className: classNames(columnClassName, className),\n ellipsis: column.ellipsis,\n align: column.align,\n scope: column.rowScope,\n component: component,\n prefixCls: rowInfo.prefixCls,\n key: key,\n record: record,\n index: index,\n renderIndex: renderIndex,\n dataIndex: dataIndex,\n render: mergedRender,\n shouldCellUpdate: column.shouldCellUpdate\n }, fixedInfo, {\n appendNode: appendCellNode,\n additionalProps: _objectSpread(_objectSpread({}, additionalCellProps), {}, {\n style: mergedStyle\n }, cellSpan)\n }));\n}\nexport default VirtualCell;","map":{"version":3,"names":["_extends","_objectSpread","useContext","classNames","React","getCellProps","Cell","GridContext","getColumnWidth","colIndex","colSpan","columnsOffset","mergedColSpan","VirtualCell","props","rowInfo","column","indent","index","component","renderIndex","record","style","className","inverse","getHeight","render","dataIndex","columnClassName","colWidth","width","_useContext","_getCellProps","key","fixedInfo","appendCellNode","additionalCellProps","cellStyle","_additionalCellProps$","_additionalCellProps$2","rowSpan","startColIndex","concatColWidth","marginOffset","mergedStyle","flex","concat","marginRight","pointerEvents","needHide","useMemo","visibility","height","mergedRender","cellSpan","createElement","ellipsis","align","scope","rowScope","prefixCls","shouldCellUpdate","appendNode","additionalProps"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-table/es/VirtualTable/VirtualCell.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useContext } from '@rc-component/context';\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { getCellProps } from \"../Body/BodyRow\";\nimport Cell from \"../Cell\";\nimport { GridContext } from \"./context\";\n/**\n * Return the width of the column by `colSpan`.\n * When `colSpan` is `0` will be trade as `1`.\n */\nexport function getColumnWidth(colIndex, colSpan, columnsOffset) {\n var mergedColSpan = colSpan || 1;\n return columnsOffset[colIndex + mergedColSpan] - (columnsOffset[colIndex] || 0);\n}\nfunction VirtualCell(props) {\n var rowInfo = props.rowInfo,\n column = props.column,\n colIndex = props.colIndex,\n indent = props.indent,\n index = props.index,\n component = props.component,\n renderIndex = props.renderIndex,\n record = props.record,\n style = props.style,\n className = props.className,\n inverse = props.inverse,\n getHeight = props.getHeight;\n var render = column.render,\n dataIndex = column.dataIndex,\n columnClassName = column.className,\n colWidth = column.width;\n var _useContext = useContext(GridContext, ['columnsOffset']),\n columnsOffset = _useContext.columnsOffset;\n var _getCellProps = getCellProps(rowInfo, column, colIndex, indent, index),\n key = _getCellProps.key,\n fixedInfo = _getCellProps.fixedInfo,\n appendCellNode = _getCellProps.appendCellNode,\n additionalCellProps = _getCellProps.additionalCellProps;\n var cellStyle = additionalCellProps.style,\n _additionalCellProps$ = additionalCellProps.colSpan,\n colSpan = _additionalCellProps$ === void 0 ? 1 : _additionalCellProps$,\n _additionalCellProps$2 = additionalCellProps.rowSpan,\n rowSpan = _additionalCellProps$2 === void 0 ? 1 : _additionalCellProps$2;\n\n // ========================= ColWidth =========================\n // column width\n var startColIndex = colIndex - 1;\n var concatColWidth = getColumnWidth(startColIndex, colSpan, columnsOffset);\n\n // margin offset\n var marginOffset = colSpan > 1 ? colWidth - concatColWidth : 0;\n\n // ========================== Style ===========================\n var mergedStyle = _objectSpread(_objectSpread(_objectSpread({}, cellStyle), style), {}, {\n flex: \"0 0 \".concat(concatColWidth, \"px\"),\n width: \"\".concat(concatColWidth, \"px\"),\n marginRight: marginOffset,\n pointerEvents: 'auto'\n });\n\n // When `colSpan` or `rowSpan` is `0`, should skip render.\n var needHide = React.useMemo(function () {\n if (inverse) {\n return rowSpan <= 1;\n } else {\n return colSpan === 0 || rowSpan === 0 || rowSpan > 1;\n }\n }, [rowSpan, colSpan, inverse]);\n\n // 0 rowSpan or colSpan should not render\n if (needHide) {\n mergedStyle.visibility = 'hidden';\n } else if (inverse) {\n mergedStyle.height = getHeight === null || getHeight === void 0 ? void 0 : getHeight(rowSpan);\n }\n var mergedRender = needHide ? function () {\n return null;\n } : render;\n\n // ========================== Render ==========================\n var cellSpan = {};\n\n // Virtual should reset `colSpan` & `rowSpan`\n if (rowSpan === 0 || colSpan === 0) {\n cellSpan.rowSpan = 1;\n cellSpan.colSpan = 1;\n }\n return /*#__PURE__*/React.createElement(Cell, _extends({\n className: classNames(columnClassName, className),\n ellipsis: column.ellipsis,\n align: column.align,\n scope: column.rowScope,\n component: component,\n prefixCls: rowInfo.prefixCls,\n key: key,\n record: record,\n index: index,\n renderIndex: renderIndex,\n dataIndex: dataIndex,\n render: mergedRender,\n shouldCellUpdate: column.shouldCellUpdate\n }, fixedInfo, {\n appendNode: appendCellNode,\n additionalProps: _objectSpread(_objectSpread({}, additionalCellProps), {}, {\n style: mergedStyle\n }, cellSpan)\n }));\n}\nexport default VirtualCell;"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,aAAa,MAAM,0CAA0C;AACpE,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,iBAA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