PromoCursed/node_modules/.cache/babel-loader/d14e86b1ed95f0ab679f2fb941ab935ebd3e0e8b1e5a136e370377e1e2e218fb.json

1 line
10 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import { useContext } from '@rc-component/context';\nimport * as React from 'react';\nimport PerfContext from \"../context/PerfContext\";\nimport TableContext, { responseImmutable } from \"../context/TableContext\";\nimport useFlattenRecords from \"../hooks/useFlattenRecords\";\nimport devRenderTimes from \"../hooks/useRenderTimes\";\nimport { getColumnsKey } from \"../utils/valueUtil\";\nimport BodyRow from \"./BodyRow\";\nimport ExpandedRow from \"./ExpandedRow\";\nimport MeasureRow from \"./MeasureRow\";\nfunction Body(props) {\n if (process.env.NODE_ENV !== 'production') {\n devRenderTimes(props);\n }\n var data = props.data,\n measureColumnWidth = props.measureColumnWidth;\n var _useContext = useContext(TableContext, ['prefixCls', 'getComponent', 'onColumnResize', 'flattenColumns', 'getRowKey', 'expandedKeys', 'childrenColumnName', 'emptyNode']),\n prefixCls = _useContext.prefixCls,\n getComponent = _useContext.getComponent,\n onColumnResize = _useContext.onColumnResize,\n flattenColumns = _useContext.flattenColumns,\n getRowKey = _useContext.getRowKey,\n expandedKeys = _useContext.expandedKeys,\n childrenColumnName = _useContext.childrenColumnName,\n emptyNode = _useContext.emptyNode;\n var flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey);\n\n // =================== Performance ====================\n var perfRef = React.useRef({\n renderWithProps: false\n });\n\n // ====================== Render ======================\n var WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');\n var trComponent = getComponent(['body', 'row'], 'tr');\n var tdComponent = getComponent(['body', 'cell'], 'td');\n var thComponent = getComponent(['body', 'cell'], 'th');\n var rows;\n if (data.length) {\n rows = flattenData.map(function (item, idx) {\n var record = item.record,\n indent = item.indent,\n renderIndex = item.index;\n var key = getRowKey(record, idx);\n return /*#__PURE__*/React.createElement(BodyRow, {\n key: key,\n rowKey: key,\n record: record,\n index: idx,\n renderIndex: renderIndex,\n rowComponent: trComponent,\n cellComponent: tdComponent,\n scopeCellComponent: thComponent,\n getRowKey: getRowKey,\n indent: indent\n });\n });\n } else {\n rows = /*#__PURE__*/React.createElement(ExpandedRow, {\n expanded: true,\n className: \"\".concat(prefixCls, \"-placeholder\"),\n prefixCls: prefixCls,\n component: trComponent,\n cellComponent: tdComponent,\n colSpan: flattenColumns.length,\n isEmpty: true\n }, emptyNode);\n }\n var columnsKey = getColumnsKey(flattenColumns);\n return /*#__PURE__*/React.createElement(PerfContext.Provider, {\n value: perfRef.current\n }, /*#__PURE__*/React.createElement(WrapperComponent, {\n className: \"\".concat(prefixCls, \"-tbody\")\n }, measureColumnWidth && /*#__PURE__*/React.createElement(MeasureRow, {\n prefixCls: prefixCls,\n columnsKey: columnsKey,\n onColumnResize: onColumnResize\n }), rows));\n}\nif (process.env.NODE_ENV !== 'production') {\n Body.displayName = 'Body';\n}\nexport default responseImmutable(Body);","map":{"version":3,"names":["useContext","React","PerfContext","TableContext","responseImmutable","useFlattenRecords","devRenderTimes","getColumnsKey","BodyRow","ExpandedRow","MeasureRow","Body","props","process","env","NODE_ENV","data","measureColumnWidth","_useContext","prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode","flattenData","perfRef","useRef","renderWithProps","WrapperComponent","trComponent","tdComponent","thComponent","rows","length","map","item","idx","record","indent","renderIndex","index","key","createElement","rowKey","rowComponent","cellComponent","scopeCellComponent","expanded","className","concat","component","colSpan","isEmpty","columnsKey","Provider","value","current","displayName"],"sources":["C:/Users/Ари<EFBFBD>