diff --git a/src/mixins/treeselectMixin.js b/src/mixins/treeselectMixin.js index a7e8e6ca..11cd6a7f 100644 --- a/src/mixins/treeselectMixin.js +++ b/src/mixins/treeselectMixin.js @@ -6,7 +6,6 @@ import { onlyOnLeftClick, scrollIntoView, isNaN, isPromise, once, identity, constant, createMap, - assign, quickDiff, getLast, includes, find, removeFromArray, } from '../utils' @@ -973,9 +972,10 @@ export default { // It could be useful for async search mode. this.forest.selectedNodeIds.forEach(id => { if (!prevNodeMap[id]) return - const fallbackNode = assign({}, prevNodeMap[id], { + const fallbackNode = { + ...prevNodeMap[id], isFallbackNode: true, - }) + } this.$set(this.forest.nodeMap, id, fallbackNode) }) }, @@ -1330,7 +1330,10 @@ export default { }, enhancedNormalizer(raw) { - return assign({}, raw, this.normalizer(raw, this.getInstanceId())) + return { + ...raw, + ...this.normalizer(raw, this.getInstanceId()), + } }, normalize(parentNode, nodes, prevNodeMap) { @@ -1347,7 +1350,8 @@ export default { const isLeaf = !isBranch const isDisabled = !!node.isDisabled || (!this.flat && !isRootNode && parentNode.isDisabled) const isNew = !!node.isNew - const lowerCased = this.matchKeys.reduce((prev, key) => assign(prev, { + const lowerCased = this.matchKeys.reduce((prev, key) => ({ + ...prev, [key]: stringifyOptionPropValue(node[key]).toLocaleLowerCase(), }), {}) const nestedSearchLabel = isRootNode @@ -1418,8 +1422,7 @@ export default { if (prev.isBranch && normalized.isBranch) { normalized.isExpanded = prev.isExpanded normalized.isExpandedOnSearch = prev.isExpandedOnSearch - normalized.isPending = prev.isPending - normalized.loadingChildrenError = prev.loadingChildrenError + normalized.childrenStates = { ...prev.childrenStates } } } diff --git a/src/utils.js b/src/utils.js index 75bfdefd..6e355909 100644 --- a/src/utils.js +++ b/src/utils.js @@ -101,23 +101,6 @@ function copy(obj, key, value) { } } -function hasOwn(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key) -} - -export function assign(target, ...sources) { - for (let i = 0; i < sources.length; i++) { - const source = sources[i] - for (const key in source) { - // istanbul ignore else - if (hasOwn(source, key)) { - target[key] = source[key] - } - } - } - return target -} - export function deepExtend(target, source) { if (isPlainObject(source)) { const keys = Object.keys(source)