PromoCursed/node_modules/.cache/babel-loader/9e63713e0c0424a369e0b63547213e3b98808361924921d4133c17ddaa81e5fb.json

1 line
7.6 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nimport isEqual from \"rc-util/es/isEqual\";\nimport getValue from \"rc-util/es/utils/get\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport PerfContext from \"../context/PerfContext\";\nimport { validateValue } from \"../utils/valueUtil\";\nimport { useImmutableMark } from \"../context/TableContext\";\nfunction isRenderCell(data) {\n return data && _typeof(data) === 'object' && !Array.isArray(data) && ! /*#__PURE__*/React.isValidElement(data);\n}\nexport default function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {\n // TODO: Remove this after next major version\n var perfRecord = React.useContext(PerfContext);\n var mark = useImmutableMark();\n\n // ======================== Render ========================\n var retData = useMemo(function () {\n if (validateValue(children)) {\n return [children];\n }\n var path = dataIndex === null || dataIndex === undefined || dataIndex === '' ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex];\n var value = getValue(record, path);\n\n // Customize render node\n var returnChildNode = value;\n var returnCellProps = undefined;\n if (render) {\n var renderData = render(value, record, renderIndex);\n if (isRenderCell(renderData)) {\n if (process.env.NODE_ENV !== 'production') {\n warning(false, '`columns.render` return cell props is deprecated with perf issue, please use `onCell` instead.');\n }\n returnChildNode = renderData.children;\n returnCellProps = renderData.props;\n perfRecord.renderWithProps = true;\n } else {\n returnChildNode = renderData;\n }\n }\n return [returnChildNode, returnCellProps];\n }, [\n // Force update deps\n mark,\n // Normal deps\n record, children, dataIndex, render, renderIndex], function (prev, next) {\n if (shouldCellUpdate) {\n var _prev = _slicedToArray(prev, 2),\n prevRecord = _prev[1];\n var _next = _slicedToArray(next, 2),\n nextRecord = _next[1];\n return shouldCellUpdate(nextRecord, prevRecord);\n }\n\n // Legacy mode should always update\n if (perfRecord.renderWithProps) {\n return true;\n }\n return !isEqual(prev, next, true);\n });\n return retData;\n}","map":{"version":3,"names":["_slicedToArray","_typeof","useMemo","isEqual","getValue","warning","React","PerfContext","validateValue","useImmutableMark","isRenderCell","data","Array","isArray","isValidElement","useCellRender","record","dataIndex","renderIndex","children","render","shouldCellUpdate","perfRecord","useContext","mark","retData","path","undefined","value","returnChildNode","returnCellProps","renderData","process","env","NODE_ENV","props","renderWithProps","prev","next","_prev","prevRecord","_next","nextRecord"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-table/es/Cell/useCellRender.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nimport isEqual from \"rc-util/es/isEqual\";\nimport getValue from \"rc-util/es/utils/get\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport PerfContext from \"../context/PerfContext\";\nimport { validateValue } from \"../utils/valueUtil\";\nimport { useImmutableMark } from \"../context/TableContext\";\nfunction isRenderCell(data) {\n return data && _typeof(data) === 'object' && !Array.isArray(data) && ! /*#__PURE__*/React.isValidElement(data);\n}\nexport default function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {\n // TODO: Remove this after next major version\n var perfRecord = React.useContext(PerfContext);\n var mark = useImmutableMark(