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

1 line
7.8 KiB
JSON

{"ast":null,"code":"import { SEARCH_MARK } from \"../hooks/useSearchOptions\";\nexport var VALUE_SPLIT = '__RC_CASCADER_SPLIT__';\nexport var SHOW_PARENT = 'SHOW_PARENT';\nexport var SHOW_CHILD = 'SHOW_CHILD';\n\n/**\n * Will convert value to string, and join with `VALUE_SPLIT`\n */\nexport function toPathKey(value) {\n return value.join(VALUE_SPLIT);\n}\n\n/**\n * Batch convert value to string, and join with `VALUE_SPLIT`\n */\nexport function toPathKeys(value) {\n return value.map(toPathKey);\n}\nexport function toPathValueStr(pathKey) {\n return pathKey.split(VALUE_SPLIT);\n}\nexport function fillFieldNames(fieldNames) {\n var _ref = fieldNames || {},\n label = _ref.label,\n value = _ref.value,\n children = _ref.children;\n var val = value || 'value';\n return {\n label: label || 'label',\n value: val,\n key: val,\n children: children || 'children'\n };\n}\nexport function isLeaf(option, fieldNames) {\n var _option$isLeaf, _option;\n return (_option$isLeaf = option.isLeaf) !== null && _option$isLeaf !== void 0 ? _option$isLeaf : !((_option = option[fieldNames.children]) !== null && _option !== void 0 && _option.length);\n}\nexport function scrollIntoParentView(element) {\n var parent = element.parentElement;\n if (!parent) {\n return;\n }\n var elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.\n if (elementToParent - parent.scrollTop < 0) {\n parent.scrollTo({\n top: elementToParent\n });\n } else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {\n parent.scrollTo({\n top: elementToParent + element.offsetHeight - parent.offsetHeight\n });\n }\n}\nexport function getFullPathKeys(options, fieldNames) {\n return options.map(function (item) {\n var _item$SEARCH_MARK;\n return (_item$SEARCH_MARK = item[SEARCH_MARK]) === null || _item$SEARCH_MARK === void 0 ? void 0 : _item$SEARCH_MARK.map(function (opt) {\n return opt[fieldNames.value];\n });\n });\n}\nfunction isMultipleValue(value) {\n return Array.isArray(value) && Array.isArray(value[0]);\n}\nexport function toRawValues(value) {\n if (!value) {\n return [];\n }\n if (isMultipleValue(value)) {\n return value;\n }\n return (value.length === 0 ? [] : [value]).map(function (val) {\n return Array.isArray(val) ? val : [val];\n });\n}","map":{"version":3,"names":["SEARCH_MARK","VALUE_SPLIT","SHOW_PARENT","SHOW_CHILD","toPathKey","value","join","toPathKeys","map","toPathValueStr","pathKey","split","fillFieldNames","fieldNames","_ref","label","children","val","key","isLeaf","option","_option$isLeaf","_option","length","scrollIntoParentView","element","parent","parentElement","elementToParent","offsetTop","scrollTop","scrollTo","top","offsetHeight","getFullPathKeys","options","item","_item$SEARCH_MARK","opt","isMultipleValue","Array","isArray","toRawValues"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-cascader/es/utils/commonUtil.js"],"sourcesContent":["import { SEARCH_MARK } from \"../hooks/useSearchOptions\";\nexport var VALUE_SPLIT = '__RC_CASCADER_SPLIT__';\nexport var SHOW_PARENT = 'SHOW_PARENT';\nexport var SHOW_CHILD = 'SHOW_CHILD';\n\n/**\n * Will convert value to string, and join with `VALUE_SPLIT`\n */\nexport function toPathKey(value) {\n return value.join(VALUE_SPLIT);\n}\n\n/**\n * Batch convert value to string, and join with `VALUE_SPLIT`\n */\nexport function toPathKeys(value) {\n return value.map(toPathKey);\n}\nexport function toPathValueStr(pathKey) {\n return pathKey.split(VALUE_SPLIT);\n}\nexport function fillFieldNames(fieldNames) {\n var _ref = fieldNames || {},\n label = _ref.label,\n value = _ref.value,\n children = _ref.children;\n var val = value || 'value';\n return {\n label: label || 'label',\n value: val,\n key: val,\n children: children || 'children'\n };\n}\nexport function isLeaf(option, fieldNames) {\n var _option$isLeaf, _option;\n return (_option$isLeaf = option.isLeaf) !== null && _option$isLeaf !== void 0 ? _option$isLeaf : !((_option = option[fieldNames.children]) !== null && _option !== void 0 && _option.length);\n}\nexport function scrollIntoParentView(element) {\n var parent = element.parentElement;\n if (!parent) {\n return;\n }\n var elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.\n if (elementToParent - parent.scrollTop < 0) {\n parent.scrollTo({\n top: elementToParent\n });\n } else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {\n parent.scrollTo({\n top: elementToParent + element.offsetHeight - parent.offsetHeight\n });\n }\n}\nexport function getFullPathKeys(options, fieldNames) {\n return options.map(function (item) {\n var _item$SEARCH_MARK;\n return (_item$SEARCH_MARK = item[SEARCH_MARK]) === null || _item$SEARCH_MARK === void 0 ? void 0 : _item$SEARCH_MARK.map(function (opt) {\n return opt[fieldNames.value];\n });\n });\n}\nfunction isMultipleValue(value) {\n return Array.isArray(value) && Array.isArray(value[0]);\n}\nexport function toRawValues(value) {\n if (!value) {\n return [];\n }\n if (isMultipleValue(value)) {\n return value;\n }\n return (value.length === 0 ? [] : [value]).map(function (val) {\n return Array.isArray(val) ? val : [val];\n });\n}"],"mappings":"AAAA,SAASA,WAAW,QAAQ,2BAA2B;AACvD,OAAO,IAAIC,WAAW,GAAG,uBAAuB;AAChD,OAAO,IAAIC,WAAW,GAAG,aAAa;AACtC,OAAO,IAAIC,UAAU,GAAG,YAAY;;AAEpC;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,KAAK,EAAE;EAC/B,OAAOA,KAAK,CAACC,IAAI,CAACL,WAAW,CAAC;AAChC;;AAEA;AACA;AACA;AACA,OAAO,SAASM,UAAUA,CAACF,KAAK,EAAE;EAChC,OAAOA,KAAK,CAACG,GAAG,CAACJ,SAAS,CAAC;AAC7B;AACA,OAAO,SAASK,cAAcA,CAACC,OAAO,EAAE;EACtC,OAAOA,OAAO,CAACC,KAAK,CAACV,WAAW,CAAC;AACnC;AACA,OAAO,SAASW,cAAcA,CAACC,UAAU,EAAE;EACzC,IAAIC,IAAI,GAAGD,UAAU,IAAI,CAAC,CAAC;IACzBE,KAAK,GAAGD,IAAI,CAACC,KAAK;IAClBV,KAAK,GAAGS,IAAI,CAACT,KAAK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