PromoCursed/node_modules/.cache/babel-loader/0a7892572904ba22c306b547c95543aba72c4d817e6ab8171b2f719785d06ef9.json

1 line
5.0 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\nfunction parseSimpleTreeData(treeData, _ref) {\n var id = _ref.id,\n pId = _ref.pId,\n rootPId = _ref.rootPId;\n var keyNodes = {};\n var rootNodeList = [];\n\n // Fill in the map\n var nodeList = treeData.map(function (node) {\n var clone = _objectSpread({}, node);\n var key = clone[id];\n keyNodes[key] = clone;\n clone.key = clone.key || key;\n return clone;\n });\n\n // Connect tree\n nodeList.forEach(function (node) {\n var parentKey = node[pId];\n var parent = keyNodes[parentKey];\n\n // Fill parent\n if (parent) {\n parent.children = parent.children || [];\n parent.children.push(node);\n }\n\n // Fill root tree node\n if (parentKey === rootPId || !parent && rootPId === null) {\n rootNodeList.push(node);\n }\n });\n return rootNodeList;\n}\n\n/**\n * Convert `treeData` or `children` into formatted `treeData`.\n * Will not re-calculate if `treeData` or `children` not change.\n */\nexport default function useTreeData(treeData, children, simpleMode) {\n return React.useMemo(function () {\n if (treeData) {\n return simpleMode ? parseSimpleTreeData(treeData, _objectSpread({\n id: 'id',\n pId: 'pId',\n rootPId: null\n }, simpleMode !== true ? simpleMode : {})) : treeData;\n }\n return convertChildrenToData(children);\n }, [children, simpleMode, treeData]);\n}","map":{"version":3,"names":["_objectSpread","React","convertChildrenToData","parseSimpleTreeData","treeData","_ref","id","pId","rootPId","keyNodes","rootNodeList","nodeList","map","node","clone","key","forEach","parentKey","parent","children","push","useTreeData","simpleMode","useMemo"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-tree-select/es/hooks/useTreeData.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\nfunction parseSimpleTreeData(treeData, _ref) {\n var id = _ref.id,\n pId = _ref.pId,\n rootPId = _ref.rootPId;\n var keyNodes = {};\n var rootNodeList = [];\n\n // Fill in the map\n var nodeList = treeData.map(function (node) {\n var clone = _objectSpread({}, node);\n var key = clone[id];\n keyNodes[key] = clone;\n clone.key = clone.key || key;\n return clone;\n });\n\n // Connect tree\n nodeList.forEach(function (node) {\n var parentKey = node[pId];\n var parent = keyNodes[parentKey];\n\n // Fill parent\n if (parent) {\n parent.children = parent.children || [];\n parent.children.push(node);\n }\n\n // Fill root tree node\n if (parentKey === rootPId || !parent && rootPId === null) {\n rootNodeList.push(node);\n }\n });\n return rootNodeList;\n}\n\n/**\n * Convert `treeData` or `children` into formatted `treeData`.\n * Will not re-calculate if `treeData` or `children` not change.\n */\nexport default function useTreeData(treeData, children, simpleMode) {\n return React.useMemo(function () {\n if (treeData) {\n return simpleMode ? parseSimpleTreeData(treeData, _objectSpread({\n id: 'id',\n pId: 'pId',\n rootPId: null\n }, simpleMode !== true ? simpleMode : {})) : treeData;\n }\n return convertChildrenToData(children);\n }, [children, simpleMode, treeData]);\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,qBAAqB,QAAQ,qBAAqB;AAC3D,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,IAAI,EAAE;EAC3C,IAAIC,EAAE,GAAGD,IAAI,CAACC,EAAE;IACdC,GAAG,GAAGF,IAAI,CAACE,GAAG;IACdC,OAAO,GAAGH,IAAI,CAACG,OAAO;EACxB,IAAIC,QAAQ,GAAG,CAAC,CAAC;EACjB,IAAIC,YAAY,GAAG,EAAE;;EAErB;EACA,IAAIC,QAAQ,GAAGP,QAAQ,CAACQ,GAAG,CAAC,UAAUC,IAAI,EAAE;IAC1C,IAAIC,KAAK,GAAGd,aAAa,CAAC,CAAC,CAAC,EAAEa,IAAI,CAAC;IACnC,IAAIE,GAAG,GAAGD,KAAK,CAACR,EAAE,CAAC;IACnBG,QAAQ,CAACM,GAAG,CAAC,GAAGD,KAAK;IACrB