PromoCursed/node_modules/.cache/babel-loader/3c2f0e0885caa33b3febaab80da8a5d374aa5534e5264988a0e515932f9dca7b.json
2024-08-20 23:25:37 +04:00

1 line
5.6 KiB
JSON

{"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 useOptions;"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,qBAAqB,QAAQ,qBAAqB;;AAE3D;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,SAASA,UAAUA,CAACC,OAAO,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,eAAe,EAAE;EACrG,OAAOP,KAAK,CAACQ,OAAO,CAAC,YAAY;IAC/B,IAAIC,aAAa,GAAGN,OAAO;IAC3B,IAAIO,cAAc,GAAG,CAACP,OAAO;IAC7B,IAAIO,cAAc,EAAE;MAClBD,aAAa,GAAGR,qBAAqB,CAACG,QAAQ,CAAC;IACjD;IACA,IAAIO,YAAY,GAAG,IAAIC,GAA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