UNPKG

yanzhen-design-vue

Version:

25 lines (24 loc) 733 B
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const vue = require("vue"); const utils = require("../utils.cjs"); function useEntities(options, fieldNames) { const entities = vue.computed(() => { return utils.convertDataToEntities(options.value, { fieldNames: fieldNames.value, initWrapper: (wrapper) => { return { ...wrapper, pathKeyEntities: {} }; }, processEntity: (wrapper, entity) => { const pathKey = entity.node[fieldNames.value.value]; wrapper.pathKeyEntities[pathKey] = entity; entity.key = pathKey; } }).pathKeyEntities; }); return entities; } exports.useEntities = useEntities;