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AJM,CAAf","sourcesContent":["// Styles\nimport '../../stylus/components/_treeview.styl'\n\n// Types\nimport { VNode, VNodeChildrenArrayContents } from 'vue'\nimport { PropValidator } from 'vue/types/options'\n\n// Components\nimport VTreeviewNode, { VTreeviewNodeProps } from './VTreeviewNode'\n\n// Mixins\nimport Themeable from '../../mixins/themeable'\nimport { provide as RegistrableProvide } from '../../mixins/registrable'\n\n// Utils\nimport {\n arrayDiff,\n deepEqual,\n getObjectValueByPath\n} from '../../util/helpers'\nimport mixins from '../../util/mixins'\nimport { consoleWarn } from '../../util/console'\nimport {\n filterTreeItems,\n FilterTreeItemFunction,\n filterTreeItem\n} from './util/filterTreeItems'\n\ntype VTreeviewNodeInstance = InstanceType<typeof VTreeviewNode>\n\ntype NodeCache = Set<string | number>\ntype NodeArray = (string | number)[]\n\ntype NodeState = {\n parent: number | string | null\n children: (number | string)[]\n vnode: VTreeviewNodeInstance | null\n isActive: boolean\n isSelected: boolean\n isIndeterminate: boolean\n isOpen: boolean\n item: any\n}\n\nexport default mixins(\n RegistrableProvide('treeview'),\n Themeable\n /* @vue/component */\n).extend({\n name: 'v-treeview',\n\n provide (): object {\n return { treeview: this }\n },\n\n props: {\n active: {\n type: Array,\n default: () => ([])\n } as PropValidator<NodeArray>,\n items: {\n type: Array,\n default: () => ([])\n } as PropValidator<any[]>,\n hoverable: Boolean,\n multipleActive: Boolean,\n open: {\n type: Array,\n default: () => ([])\n } as PropValidator<NodeArray>,\n openAll: Boolean,\n returnObject: {\n type: Boolean,\n default: false // TODO: Should be true in next major\n },\n value: {\n type: Array,\n default: () => ([])\n } as PropValidator<NodeArray>,\n search: String,\n filter: Function as PropValidator<FilterTreeItemFunction>,\n ...VTreeviewNodeProps\n },\n\n data: () => ({\n nodes: {} as Record<string | number, NodeState>,\n selectedCache: new Set() as NodeCache,\n activeCache: new Set() as NodeCache,\n openCache: new Set() as NodeCache\n }),\n\n computed: {\n excludedItems (): Set<string | number> {\n const excluded = new Set<string|number>()\n\n if (!this.search) return excluded\n\n for (let i = 0; i < this.items.length; i++) {\n filterTreeItems(\n this.filter || filterTreeItem,\n this.items[i],\n this.search,\n this.itemKey,\n this.itemText,\n this.itemChildren,\n excluded\n )\n }\n\n return excluded\n }\n },\n\n watch: {\n items: {\n handler () {\n const oldKeys = Object.keys(this.nodes).map(k => getObjectValueByPath(this.nodes[k].item, this.itemKey))\n const newKeys = this.getKeys(this.items)\n const diff = arrayDiff(newKeys, oldKeys)\n\n // We only want to do stuff if items have changed\n if (!diff.length && newKeys.length < oldKeys.length) return\n\n // If nodes are removed we need to clear them from this.nodes\n diff.forEach(k => delete this.nodes[k])\n\n const oldSelectedCache = [...this.selectedCache]\n this.selectedCache = new Set()\n this.activeCache = new Set()\n this.openCache = new Set()\n this.buildTree(this.items)\n\n // Only emit selected if selection has changed\n // as a result of items changing. This fixes a\n // potential double emit when selecting a node\n // with dynamic children\n if (!deepEqual(oldSelectedCache, [...this.selectedCache])) this.emitSelected()\n },\n deep: true\n },\n active (value: (string | number | any)[]) {\n this.handleNodeCacheWatcher(value, this.activeCache, this.updateActive, this.emitActive)\n },\n value (value: (string | number | any)[]) {\n this.handleNodeCacheWatcher(value, this.selectedCache, this.updateSelected, this.emitSelected)\n },\n open (value: (string | number | any)[]) {\n this.handleNodeCacheWatcher(value, this.openCache, this.updateOpen, this.emitOpen)\n }\n },\n\n created () {\n this.buildTree(this.items)\n this.value.forEach(key => this.updateSelected(key, true))\n this.emitSelected()\n this.active.forEach(key => this.updateActive(key, true))\n this.emitActive()\n },\n\n mounted () {\n // Save the developer from themselves\n if (this.$slots.prepend || this.$slots.append) {\n consoleWarn('The prepend and append slots require a slot-scope attribute', this)\n }\n\n if (this.openAll) {\n this.updateAll(true)\n } else {\n this.open.forEach(key => this.updateOpen(key, true))\n this.emitOpen()\n }\n },\n\n methods: {\n /** @public */\n updateAll (value: boolean) {\n Object.keys(this.nodes).forEach(key => this.updateOpen(getObjectValueByPath(this.nodes[key].item, this.itemKey), value))\n this.emitOpen()\n },\n getKeys (items: any[], keys: any[] = []) {\n for (let i = 0; i < items.length; i++) {\n const key = getObjectValueByPath(items[i], this.itemKey)\n keys.push(key)\n const children = getObjectValueByPath(items[i], this.itemChildren)\n if (children) {\n keys.push(...this.getKeys(children))\n }\n }\n\n return keys\n },\n buildTree (items: any[], parent: (string | number | null) = null) {\n for (let i = 0; i < items.length; i++) {\n const item = items[i]\n const key = getObjectValueByPath(item, this.itemKey)\n const children = getObjectValueByPath(item, this.itemChildren, [])\n const oldNode = this.nodes.hasOwnProperty(key) ? this.nodes[key] : {\n isSelected: false, isIndeterminate: false, isActive: false, isOpen: false, vnode: null\n } as NodeState\n\n const node: any = {\n vnode: oldNode.vnode,\n parent,\n children: children.map((c: any) => getObjectValueByPath(c, this.itemKey)),\n item\n }\n\n this.buildTree(children, key)\n\n // This fixed bug with dynamic children resetting selected parent state\n if (!this.nodes.hasOwnProperty(key) && parent !== null && this.nodes.hasOwnProperty(parent)) {\n node.isSelected = this.nodes[parent].isSelected\n node.isIndeterminate = this.nodes[parent].isIndeterminate\n } else {\n node.isSelected = oldNode.isSelected\n node.isIndeterminate = oldNode.isIndeterminate\n }\n\n node.isActive = oldNode.isActive\n node.isOpen = oldNode.isOpen\n\n this.nodes[key] = !children.length ? node : this.calculateState(node, this.nodes)\n\n // Don't forget to rebuild cache\n if (this.nodes[key].isSelected) this.selectedCache.add(key)\n if (this.nodes[key].isActive) this.activeCache.add(key)\n if (this.nodes[key].isOpen) this.openCache.add(key)\n\n this.updateVnodeState(key)\n }\n },\n calculateState (node: NodeState, state: Record<string | number, NodeState>) {\n const counts = node.children.reduce((counts: number[], child: string | number) => {\n counts[0] += +Boolean(state[child].isSelected)\n counts[1] += +Boolean(state[child].isIndeterminate)\n return counts\n }, [0, 0])\n\n node.isSelected = !!node.children.length && counts[0] === node.children.length\n node.isIndeterminate = !node.isSelected && (counts[0] > 0 || counts[1] > 0)\n\n return node\n },\n emitOpen () {\n this.emitNodeCache('update:open', this.openCache)\n },\n emitSelected () {\n this.emitNodeCache('input', this.selectedCache)\n },\n emitActive () {\n this.emitNodeCache('update:active', this.activeCache)\n },\n emitNodeCache (event: string, cache: NodeCache) {\n this.$emit(event, this.returnObject ? [...cache].map(key => this.nodes[key].item) : [...cache])\n },\n handleNodeCacheWatcher (value: any[], cache: NodeCache, updateFn: Function, emitFn: Function) {\n value = this.returnObject ? value.map(v => getObjectValueByPath(v, this.itemKey)) : value\n const old = [...cache]\n if (deepEqual(old, value)) return\n\n old.forEach(key => updateFn(key, false))\n value.forEach(key => updateFn(key, true))\n\n emitFn()\n },\n getDescendants (key: string | number, descendants: NodeArray = []) {\n const children = this.nodes[key].children\n\n descendants.push(...children)\n\n for (let i = 0; i < children.length; i++) {\n descendants = this.getDescendants(children[i], descendants)\n }\n\n return descendants\n },\n getParents (key: string | number) {\n let parent = this.nodes[key].parent\n\n const parents = []\n while (parent !== null) {\n parents.push(parent)\n parent = this.nodes[parent].parent\n }\n\n return parents\n },\n register (node: VTreeviewNodeInstance) {\n const key = getObjectValueByPath(node.item, this.itemKey)\n this.nodes[key].vnode = node\n\n this.updateVnodeState(key)\n },\n unregister (node: VTreeviewNodeInstance) {\n const key = getObjectValueByPath(node.item, this.itemKey)\n if (this.nodes[key]) this.nodes[key].vnode = null\n },\n updateActive (key: string | number, isActive: boolean) {\n if (!this.nodes.hasOwnProperty(key)) return\n\n if (!this.multipleActive) {\n this.activeCache.forEach(active => {\n this.nodes[active].isActive = false\n this.updateVnodeState(active)\n this.activeCache.delete(active)\n })\n }\n\n const node = this.nodes[key]\n if (!node) return\n\n if (isActive) this.activeCache.add(key)\n else this.activeCache.delete(key)\n\n node.isActive = isActive\n\n this.updateVnodeState(key)\n },\n updateSelected (key: string | number, isSelected: boolean) {\n if (!this.nodes.hasOwnProperty(key)) return\n\n const changed = new Map()\n\n const descendants = [key, ...this.getDescendants(key)]\n descendants.forEach(descendant => {\n this.nodes[descendant].isSelected = isSelected\n this.nodes[descendant].isIndeterminate = false\n changed.set(descendant, isSelected)\n })\n\n const parents = this.getParents(key)\n parents.forEach(parent => {\n this.nodes[parent] = this.calculateState(this.nodes[parent], this.nodes)\n changed.set(parent, this.nodes[parent].isSelected)\n })\n\n const all = [key, ...descendants, ...parents]\n all.forEach(this.updateVnodeState)\n\n for (const [key, value] of changed.entries()) {\n value === true ? this.selectedCache.add(key) : this.selectedCache.delete(key)\n }\n },\n updateOpen (key: string | number, isOpen: boolean) {\n if (!this.nodes.hasOwnProperty(key)) return\n\n const node = this.nodes[key]\n const children = getObjectValueByPath(node.item, this.itemChildren)\n\n if (children && !children.length && node.vnode && !node.vnode.hasLoaded) {\n node.vnode.checkChildren().then(() => this.updateOpen(key, isOpen))\n } else if (children && children.length) {\n node.isOpen = isOpen\n\n node.isOpen ? this.openCache.add(key) : this.openCache.delete(key)\n\n this.updateVnodeState(key)\n }\n },\n updateVnodeState (key: string | number) {\n const node = this.nodes[key]\n\n if (node && node.vnode) {\n node.vnode.isSelected = node.isSelected\n node.vnode.isIndeterminate = node.isIndeterminate\n node.vnode.isActive = node.isActive\n node.vnode.isOpen = node.isOpen\n }\n },\n isExcluded (key: string | number) {\n return !!this.search && this.excludedItems.has(key)\n }\n },\n\n render (h): VNode {\n const children: VNodeChildrenArrayContents = this.items.length\n ? this.items.map(VTreeviewNode.options.methods.genChild.bind(this))\n /* istanbul ignore next */\n : this.$slots.default! // TODO: remove type annotation with TS 3.2\n\n return h('div', {\n staticClass: 'v-treeview',\n class: {\n 'v-treeview--hoverable': this.hoverable,\n ...this.themeClasses\n }\n }, children)\n }\n})\n"],"sourceRoot":""}
|