PromoCursed/node_modules/.cache/babel-loader/3c2f0e0885caa33b3febaab80da8a5d374aa5534e5264988a0e515932f9dca7b.json

1 line
5.6 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\n\n/**\n * Parse `children` to `options` if `options` is not provided.\n * Then flatten the `options`.\n */\nvar useOptions = function useOptions(options, children, fieldNames, optionFilterProp, optionLabelProp) {\n return React.useMemo(function () {\n var mergedOptions = options;\n var childrenAsData = !options;\n if (childrenAsData) {\n mergedOptions = convertChildrenToData(children);\n }\n var valueOptions = new Map();\n var labelOptions = new Map();\n var setLabelOptions = function setLabelOptions(labelOptionsMap, option, key) {\n if (key && typeof key === 'string') {\n labelOptionsMap.set(option[key], option);\n }\n };\n var dig = function dig(optionList) {\n var isChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n // for loop to speed up collection speed\n for (var i = 0; i < optionList.length; i += 1) {\n var option = optionList[i];\n if (!option[fieldNames.options] || isChildren) {\n valueOptions.set(option[fieldNames.value], option);\n setLabelOptions(labelOptions, option, fieldNames.label);\n // https://github.com/ant-design/ant-design/issues/35304\n setLabelOptions(labelOptions, option, optionFilterProp);\n setLabelOptions(labelOptions, option, optionLabelProp);\n } else {\n dig(option[fieldNames.options], true);\n }\n }\n };\n dig(mergedOptions);\n return {\n options: mergedOptions,\n valueOptions: valueOptions,\n labelOptions: labelOptions\n };\n }, [options, children, fieldNames, optionFilterProp, optionLabelProp]);\n};\nexport default useOptions;","map":{"version":3,"names":["React","convertChildrenToData","useOptions","options","children","fieldNames","optionFilterProp","optionLabelProp","useMemo","mergedOptions","childrenAsData","valueOptions","Map","labelOptions","setLabelOptions","labelOptionsMap","option","key","set","dig","optionList","isChildren","arguments","length","undefined","i","value","label"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-select/es/hooks/useOptions.js"],"sourcesContent":["import * as React from 'react';\nimport { convertChildrenToData } from \"../utils/legacyUtil\";\n\n/**\n * Parse `children` to `options` if `options` is not provided.\n * Then flatten the `options`.\n */\nvar useOptions = function useOptions(options, children, fieldNames, optionFilterProp, optionLabelProp) {\n return React.useMemo(function () {\n var mergedOptions = options;\n var childrenAsData = !options;\n if (childrenAsData) {\n mergedOptions = convertChildrenToData(children);\n }\n var valueOptions = new Map();\n var labelOptions = new Map();\n var setLabelOptions = function setLabelOptions(labelOptionsMap, option, key) {\n if (key && typeof key === 'string') {\n labelOptionsMap.set(option[key], option);\n }\n };\n var dig = function dig(optionList) {\n var isChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n // for loop to speed up collection speed\n for (var i = 0; i < optionList.length; i += 1) {\n var option = optionList[i];\n if (!option[fieldNames.options] || isChildren) {\n valueOptions.set(option[fieldNames.value], option);\n setLabelOptions(labelOptions, option, fieldNames.label);\n // https://github.com/ant-design/ant-design/issues/35304\n setLabelOptions(labelOptions, option, optionFilterProp);\n setLabelOptions(labelOptions, option, optionLabelProp);\n } else {\n dig(option[fieldNames.options], true);\n }\n }\n };\n dig(mergedOptions);\n return {\n options: mergedOptions,\n valueOptions: valueOptions,\n labelOptions: labelOptions\n };\n }, [options, children, fieldNames, optionFilterProp, optionLabelProp]);\n};\nexport default useO