1 line
7.4 KiB
JSON
1 line
7.4 KiB
JSON
|
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { toPathKey, toPathKeys } from \"../utils/commonUtil\";\nimport { formatStrategyValues } from \"../utils/treeUtil\";\nexport default function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {\n return function (valuePath) {\n if (!multiple) {\n triggerChange(valuePath);\n } else {\n // Prepare conduct required info\n var pathKey = toPathKey(valuePath);\n var checkedPathKeys = toPathKeys(checkedValues);\n var halfCheckedPathKeys = toPathKeys(halfCheckedValues);\n var existInChecked = checkedPathKeys.includes(pathKey);\n var existInMissing = missingCheckedValues.some(function (valueCells) {\n return toPathKey(valueCells) === pathKey;\n });\n\n // Do update\n var nextCheckedValues = checkedValues;\n var nextMissingValues = missingCheckedValues;\n if (existInMissing && !existInChecked) {\n // Missing value only do filter\n nextMissingValues = missingCheckedValues.filter(function (valueCells) {\n return toPathKey(valueCells) !== pathKey;\n });\n } else {\n // Update checked key first\n var nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(function (key) {\n return key !== pathKey;\n }) : [].concat(_toConsumableArray(checkedPathKeys), [pathKey]);\n var pathKeyEntities = getPathKeyEntities();\n\n // Conduction by selected or not\n var checkedKeys;\n if (existInChecked) {\n var _conductCheck = conductCheck(nextRawCheckedKeys, {\n checked: false,\n halfCheckedKeys: halfCheckedPathKeys\n }, pathKeyEntities);\n checkedKeys = _conductCheck.checkedKeys;\n } else {\n var _conductCheck2 = conductCheck(nextRawCheckedKeys, true, pathKeyEntities);\n checkedKeys = _conductCheck2.checkedKeys;\n }\n\n // Roll up to parent level keys\n var deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);\n nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);\n }\n triggerChange([].concat(_toConsumableArray(nextMissingValues), _toConsumableArray(nextCheckedValues)));\n }\n };\n}","map":{"version":3,"names":["_toConsumableArray","conductCheck","toPathKey","toPathKeys","formatStrategyValues","useSelect","multiple","triggerChange","checkedValues","halfCheckedValues","missingCheckedValues","getPathKeyEntities","getValueByKeyPath","showCheckedStrategy","valuePath","pathKey","checkedPathKeys","halfCheckedPathKeys","existInChecked","includes","existInMissing","some","valueCells","nextCheckedValues","nextMissingValues","filter","nextRawCheckedKeys","key","concat","pathKeyEntities","checkedKeys","_conductCheck","checked","halfCheckedKeys","_conductCheck2","deDuplicatedKeys"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-cascader/es/hooks/useSelect.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { toPathKey, toPathKeys } from \"../utils/commonUtil\";\nimport { formatStrategyValues } from \"../utils/treeUtil\";\nexport default function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {\n return function (valuePath) {\n if (!multiple) {\n triggerChange(valuePath);\n } else {\n // Prepare conduct required info\n var pathKey = toPathKey(valuePath);\n var checkedPathKeys = toPathKeys(checkedValues);\n var halfCheckedPathKeys = toPathKeys(halfCheckedValues);\n var existInChecked = checkedPathKeys.includes(pathKey);\n var existInMissing = missingCheckedValues.some(func
|