UNPKG

ant-design-vue

Version:

An enterprise-class UI design language and Vue-based implementation

28 lines (26 loc) 1.07 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { convertDataToEntities } from '../../vc-tree/utils/treeUtil'; import { VALUE_SPLIT } from '../utils/commonUtil'; import { computed } from 'vue'; /** Lazy parse options data into conduct-able info to avoid perf issue in single mode */ export default (function (options, fieldNames) { var entities = computed(function () { return convertDataToEntities(options.value, { fieldNames: fieldNames.value, initWrapper: function initWrapper(wrapper) { return _extends(_extends({}, wrapper), { pathKeyEntities: {} }); }, processEntity: function processEntity(entity, wrapper) { var pathKey = entity.nodes.map(function (node) { return node[fieldNames.value.value]; }).join(VALUE_SPLIT); wrapper.pathKeyEntities[pathKey] = entity; // Overwrite origin key. // this is very hack but we need let conduct logic work with connect path entity.key = pathKey; } }).pathKeyEntities; }); return entities; });