1 line
8.0 KiB
JSON
1 line
8.0 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"label\", \"children\", \"key\", \"type\"];\nimport * as React from 'react';\nimport Divider from \"../Divider\";\nimport MenuItem from \"../MenuItem\";\nimport MenuItemGroup from \"../MenuItemGroup\";\nimport SubMenu from \"../SubMenu\";\nimport { parseChildren } from \"./commonUtil\";\nfunction convertItemsToNodes(list, components) {\n var MergedMenuItem = components.item,\n MergedMenuItemGroup = components.group,\n MergedSubMenu = components.submenu,\n MergedDivider = components.divider;\n return (list || []).map(function (opt, index) {\n if (opt && _typeof(opt) === 'object') {\n var _ref = opt,\n label = _ref.label,\n children = _ref.children,\n key = _ref.key,\n type = _ref.type,\n restProps = _objectWithoutProperties(_ref, _excluded);\n var mergedKey = key !== null && key !== void 0 ? key : \"tmp-\".concat(index);\n\n // MenuItemGroup & SubMenuItem\n if (children || type === 'group') {\n if (type === 'group') {\n // Group\n return /*#__PURE__*/React.createElement(MergedMenuItemGroup, _extends({\n key: mergedKey\n }, restProps, {\n title: label\n }), convertItemsToNodes(children, components));\n }\n\n // Sub Menu\n return /*#__PURE__*/React.createElement(MergedSubMenu, _extends({\n key: mergedKey\n }, restProps, {\n title: label\n }), convertItemsToNodes(children, components));\n }\n\n // MenuItem & Divider\n if (type === 'divider') {\n return /*#__PURE__*/React.createElement(MergedDivider, _extends({\n key: mergedKey\n }, restProps));\n }\n return /*#__PURE__*/React.createElement(MergedMenuItem, _extends({\n key: mergedKey\n }, restProps), label);\n }\n return null;\n }).filter(function (opt) {\n return opt;\n });\n}\nexport function parseItems(children, items, keyPath, components) {\n var childNodes = children;\n var mergedComponents = _objectSpread({\n divider: Divider,\n item: MenuItem,\n group: MenuItemGroup,\n submenu: SubMenu\n }, components);\n if (items) {\n childNodes = convertItemsToNodes(items, mergedComponents);\n }\n return parseChildren(childNodes, keyPath);\n}","map":{"version":3,"names":["_objectSpread","_extends","_objectWithoutProperties","_typeof","_excluded","React","Divider","MenuItem","MenuItemGroup","SubMenu","parseChildren","convertItemsToNodes","list","components","MergedMenuItem","item","MergedMenuItemGroup","group","MergedSubMenu","submenu","MergedDivider","divider","map","opt","index","_ref","label","children","key","type","restProps","mergedKey","concat","createElement","title","filter","parseItems","items","keyPath","childNodes","mergedComponents"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-menu/es/utils/nodeUtil.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"label\", \"children\", \"key\", \"type\"];\nimport * as React from 'react';\nimport Divider from \"../Divider\";\nimport MenuItem from \"../MenuItem\";\nimport MenuItemGroup from \"../MenuItemGroup\";\nimport SubMenu from \"../SubMenu\";\nimport { parseChildren } from \"./commonUtil\";\nfunction convertItemsToNodes(list, components) {\n var MergedMenuItem = components.item,\n MergedMenuItemGroup = components.group,\n MergedSubMenu = components.submenu,\n MergedDivider = components.divider;\n return (list || [])
|