1 line
6.1 KiB
JSON
1 line
6.1 KiB
JSON
{"ast":null,"code":"import { useMemo } from 'react';\nimport { devUseWarning } from '../../_util/warning';\nfunction getFilledItem(rowItem, rowRestCol, span) {\n let clone = rowItem;\n let exceed = false;\n if (span === undefined || span > rowRestCol) {\n clone = Object.assign(Object.assign({}, rowItem), {\n span: rowRestCol\n });\n exceed = span !== undefined;\n }\n return [clone, exceed];\n}\n// Calculate the sum of span in a row\nfunction getCalcRows(rowItems, mergedColumn) {\n const rows = [];\n let tmpRow = [];\n let rowRestCol = mergedColumn;\n let exceed = false;\n rowItems.filter(n => n).forEach((rowItem, index) => {\n const span = rowItem === null || rowItem === void 0 ? void 0 : rowItem.span;\n const mergedSpan = span || 1;\n // Additional handle last one\n if (index === rowItems.length - 1) {\n const [item, itemExceed] = getFilledItem(rowItem, rowRestCol, span);\n exceed = exceed || itemExceed;\n tmpRow.push(item);\n rows.push(tmpRow);\n return;\n }\n if (mergedSpan < rowRestCol) {\n rowRestCol -= mergedSpan;\n tmpRow.push(rowItem);\n } else {\n const [item, itemExceed] = getFilledItem(rowItem, rowRestCol, mergedSpan);\n exceed = exceed || itemExceed;\n tmpRow.push(item);\n rows.push(tmpRow);\n rowRestCol = mergedColumn;\n tmpRow = [];\n }\n });\n return [rows, exceed];\n}\nconst useRow = (mergedColumn, items) => {\n const [rows, exceed] = useMemo(() => getCalcRows(items, mergedColumn), [items, mergedColumn]);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Descriptions');\n process.env.NODE_ENV !== \"production\" ? warning(!exceed, 'usage', 'Sum of column `span` in a line not match `column` of Descriptions.') : void 0;\n }\n return rows;\n};\nexport default useRow;","map":{"version":3,"names":["useMemo","devUseWarning","getFilledItem","rowItem","rowRestCol","span","clone","exceed","undefined","Object","assign","getCalcRows","rowItems","mergedColumn","rows","tmpRow","filter","n","forEach","index","mergedSpan","length","item","itemExceed","push","useRow","items","process","env","NODE_ENV","warning"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/descriptions/hooks/useRow.js"],"sourcesContent":["import { useMemo } from 'react';\nimport { devUseWarning } from '../../_util/warning';\nfunction getFilledItem(rowItem, rowRestCol, span) {\n let clone = rowItem;\n let exceed = false;\n if (span === undefined || span > rowRestCol) {\n clone = Object.assign(Object.assign({}, rowItem), {\n span: rowRestCol\n });\n exceed = span !== undefined;\n }\n return [clone, exceed];\n}\n// Calculate the sum of span in a row\nfunction getCalcRows(rowItems, mergedColumn) {\n const rows = [];\n let tmpRow = [];\n let rowRestCol = mergedColumn;\n let exceed = false;\n rowItems.filter(n => n).forEach((rowItem, index) => {\n const span = rowItem === null || rowItem === void 0 ? void 0 : rowItem.span;\n const mergedSpan = span || 1;\n // Additional handle last one\n if (index === rowItems.length - 1) {\n const [item, itemExceed] = getFilledItem(rowItem, rowRestCol, span);\n exceed = exceed || itemExceed;\n tmpRow.push(item);\n rows.push(tmpRow);\n return;\n }\n if (mergedSpan < rowRestCol) {\n rowRestCol -= mergedSpan;\n tmpRow.push(rowItem);\n } else {\n const [item, itemExceed] = getFilledItem(rowItem, rowRestCol, mergedSpan);\n exceed = exceed || itemExceed;\n tmpRow.push(item);\n rows.push(tmpRow);\n rowRestCol = mergedColumn;\n tmpRow = [];\n }\n });\n return [rows, exceed];\n}\nconst useRow = (mergedColumn, items) => {\n const [rows, exceed] = useMemo(() => getCalcRows(items, mergedColumn), [items, mergedColumn]);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Descriptions');\n process.env.NODE_ENV !== \"production\" ? warning(!exceed, 'usage', 'Sum of column `span` in a line not match `column` of Descriptions.') : void 0;\n }\n return rows;\n};\nexport default useRow;"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,aAAaA,CAACC,OAAO,EAAEC,UAAU,EAAEC,IAAI,EAAE;EAChD,IAAIC,KAAK,GAAGH,OAAO;EACnB,IAAII,MAAM,GAAG,KAA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