1 line
6.6 KiB
JSON
1 line
6.6 KiB
JSON
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { fillFieldNames } from \"rc-tree/es/utils/treeUtil\";\nconst RECORD_NONE = 0;\nconst RECORD_START = 1;\nconst RECORD_END = 2;\nfunction traverseNodesKey(treeData, callback, fieldNames) {\n const {\n key: fieldKey,\n children: fieldChildren\n } = fieldNames;\n function processNode(dataNode) {\n const key = dataNode[fieldKey];\n const children = dataNode[fieldChildren];\n if (callback(key, dataNode) !== false) {\n traverseNodesKey(children || [], callback, fieldNames);\n }\n }\n treeData.forEach(processNode);\n}\n/** 计算选中范围,只考虑expanded情况以优化性能 */\nexport function calcRangeKeys(_ref) {\n let {\n treeData,\n expandedKeys,\n startKey,\n endKey,\n fieldNames\n } = _ref;\n const keys = [];\n let record = RECORD_NONE;\n if (startKey && startKey === endKey) {\n return [startKey];\n }\n if (!startKey || !endKey) {\n return [];\n }\n function matchKey(key) {\n return key === startKey || key === endKey;\n }\n traverseNodesKey(treeData, key => {\n if (record === RECORD_END) {\n return false;\n }\n if (matchKey(key)) {\n // Match test\n keys.push(key);\n if (record === RECORD_NONE) {\n record = RECORD_START;\n } else if (record === RECORD_START) {\n record = RECORD_END;\n return false;\n }\n } else if (record === RECORD_START) {\n // Append selection\n keys.push(key);\n }\n return expandedKeys.includes(key);\n }, fillFieldNames(fieldNames));\n return keys;\n}\nexport function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {\n const restKeys = _toConsumableArray(keys);\n const nodes = [];\n traverseNodesKey(treeData, (key, node) => {\n const index = restKeys.indexOf(key);\n if (index !== -1) {\n nodes.push(node);\n restKeys.splice(index, 1);\n }\n return !!restKeys.length;\n }, fillFieldNames(fieldNames));\n return nodes;\n}","map":{"version":3,"names":["_toConsumableArray","fillFieldNames","RECORD_NONE","RECORD_START","RECORD_END","traverseNodesKey","treeData","callback","fieldNames","key","fieldKey","children","fieldChildren","processNode","dataNode","forEach","calcRangeKeys","_ref","expandedKeys","startKey","endKey","keys","record","matchKey","push","includes","convertDirectoryKeysToNodes","restKeys","nodes","node","index","indexOf","splice","length"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/tree/utils/dictUtil.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { fillFieldNames } from \"rc-tree/es/utils/treeUtil\";\nconst RECORD_NONE = 0;\nconst RECORD_START = 1;\nconst RECORD_END = 2;\nfunction traverseNodesKey(treeData, callback, fieldNames) {\n const {\n key: fieldKey,\n children: fieldChildren\n } = fieldNames;\n function processNode(dataNode) {\n const key = dataNode[fieldKey];\n const children = dataNode[fieldChildren];\n if (callback(key, dataNode) !== false) {\n traverseNodesKey(children || [], callback, fieldNames);\n }\n }\n treeData.forEach(processNode);\n}\n/** 计算选中范围,只考虑expanded情况以优化性能 */\nexport function calcRangeKeys(_ref) {\n let {\n treeData,\n expandedKeys,\n startKey,\n endKey,\n fieldNames\n } = _ref;\n const keys = [];\n let record = RECORD_NONE;\n if (startKey && startKey === endKey) {\n return [startKey];\n }\n if (!startKey || !endKey) {\n return [];\n }\n function matchKey(key) {\n return key === startKey || key === endKey;\n }\n traverseNodesKey(treeData, key => {\n if (record === RECORD_END) {\n return false;\n }\n if (matchKey(key)) {\n // Match test\n keys.push(key);\n if (record === RECORD_NONE) {\n record = RECORD_START;\n } else if (record === RECORD_START) {\n record = RECORD_END;\n return false;\n }\n } else if (record === RECORD_START) {\n // Append selection\n keys.push(key);\n }\n return expandedKeys.includes(key);\n }, fillFieldNames(fieldNames));\n return keys;\n}\nexport function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {\n const restKeys = _toConsumableArray(keys);\n const nodes = [];\n traverseNodesKey(treeData, (key, node) => {\n const index = restKeys.indexOf(key);\n if (index !== -1) {\n nodes.push(node);\n restKeys.splice(index, 1);\n }\n return !!restKeys.length;\n }, fillFieldNames(fieldNames));\n return nodes;\n}"],"mappings":"AAAA,OAAO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