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AAC,KAAK,OAAL,EAAD,CAAjB;AAEA,QAAI,KAAK,UAAT,EAAqB,QAAQ,CAAC,IAAT,CAAc,KAAK,aAAL,EAAd,EAArB,KACK,QAAQ,CAAC,IAAT,CAAc,KAAK,kBAAL,EAAd;AAEL,WAAO,CAAC,CAAC,KAAD,EAAQ;AACd,MAAA,WAAW,EAAE,iBADC;AAEd,MAAA,KAAK,EAAE;AACL,iCAAyB,CAAC,KAAK,WAD1B;AAEL,kCAA0B,KAAK,WAF1B;AAGL,qCAA6B,KAAK,QAH7B;AAIL,oCAA4B,KAAK,OAJ5B;AAKL,mCAA2B,KAAK,MAL3B;AAML,qCAA6B,KAAK,UAN7B;AAOL,qCAA6B,KAAK,QAAL,CAAc,UAAd,CAAyB,KAAK,GAA9B;AAPxB,OAFO;AAWd,MAAA,KAAK,EAAE;AACL,yBAAiB,MAAM,CAAC,KAAK,MAAN;AADlB;AAXO,KAAR,EAcL,QAdK,CAAR;AAeD;;AAtPgD,CAApC,CAAf","sourcesContent":["// Components\nimport { VExpandTransition } from '../transitions'\nimport { VIcon } from '../VIcon'\nimport VTreeview from './VTreeview'\nimport VTreeviewNode from './VTreeviewNode'\n\n// Mixins\nimport { inject as RegistrableInject } from '../../mixins/registrable'\nimport Colorable from '../../mixins/colorable'\n\n// Utils\nimport mixins, { ExtractVue } from '../../util/mixins'\nimport { getObjectValueByPath } from '../../util/helpers'\nimport { PropValidator } from 'vue/types/options'\n\n// Types\nimport { VNode } from 'vue'\n\ntype VTreeViewInstance = InstanceType<typeof VTreeview>\n\nconst baseMixins = mixins(\n Colorable,\n RegistrableInject('treeview')\n)\n\ninterface options extends ExtractVue<typeof baseMixins> {\n treeview: VTreeViewInstance\n}\n\nexport const VTreeviewNodeProps = {\n activatable: Boolean,\n activeClass: {\n type: String,\n default: 'v-treeview-node--active',\n },\n color: {\n type: String,\n default: 'primary',\n },\n expandIcon: {\n type: String,\n default: '$vuetify.icons.subgroup',\n },\n indeterminateIcon: {\n type: String,\n default: '$vuetify.icons.checkboxIndeterminate',\n },\n itemChildren: {\n type: String,\n default: 'children',\n },\n itemDisabled: {\n type: String,\n default: 'disabled',\n },\n itemKey: {\n type: String,\n default: 'id',\n },\n itemText: {\n type: String,\n default: 'name',\n },\n loadChildren: Function as PropValidator<(item: any) => Promise<void>>,\n loadingIcon: {\n type: String,\n default: '$vuetify.icons.loading',\n },\n offIcon: {\n type: String,\n default: '$vuetify.icons.checkboxOff',\n },\n onIcon: {\n type: String,\n default: '$vuetify.icons.checkboxOn',\n },\n openOnClick: Boolean,\n rounded: Boolean,\n selectable: Boolean,\n selectedColor: {\n type: String,\n default: 'accent',\n },\n shaped: Boolean,\n transition: Boolean,\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'v-treeview-node',\n\n inject: {\n treeview: {\n default: null,\n },\n },\n\n props: {\n item: {\n type: Object,\n default: () => null,\n },\n ...VTreeviewNodeProps,\n },\n\n data: () => ({\n hasLoaded: false,\n isActive: false, // Node is selected (row)\n isIndeterminate: false, // Node has at least one selected child\n isLoading: false,\n isOpen: false, // Node is open/expanded\n isSelected: false, // Node is selected (checkbox)\n }),\n\n computed: {\n disabled (): string {\n return getObjectValueByPath(this.item, this.itemDisabled)\n },\n key (): string {\n return getObjectValueByPath(this.item, this.itemKey)\n },\n children (): any[] | null {\n return getObjectValueByPath(this.item, this.itemChildren)\n },\n text (): string {\n return getObjectValueByPath(this.item, this.itemText)\n },\n scopedProps (): object {\n return {\n item: this.item,\n leaf: !this.children,\n selected: this.isSelected,\n indeterminate: this.isIndeterminate,\n active: this.isActive,\n open: this.isOpen,\n }\n },\n computedIcon (): string {\n if (this.isIndeterminate) return this.indeterminateIcon\n else if (this.isSelected) return this.onIcon\n else return this.offIcon\n },\n hasChildren (): boolean {\n return !!this.children && (!!this.children.length || !!this.loadChildren)\n },\n },\n\n created () {\n this.treeview.register(this)\n },\n\n beforeDestroy () {\n this.treeview.unregister(this)\n },\n\n methods: {\n checkChildren (): Promise<void> {\n return new Promise<void>(resolve => {\n // TODO: Potential issue with always trying\n // to load children if response is empty?\n if (!this.children || this.children.length || !this.loadChildren || this.hasLoaded) return resolve()\n\n this.isLoading = true\n resolve(this.loadChildren(this.item))\n }).then(() => {\n this.isLoading = false\n this.hasLoaded = true\n })\n },\n open () {\n this.isOpen = !this.isOpen\n this.treeview.updateOpen(this.key, this.isOpen)\n this.treeview.emitOpen()\n },\n genLabel () {\n const children = []\n\n if (this.$scopedSlots.label) children.push(this.$scopedSlots.label(this.scopedProps))\n else children.push(this.text)\n\n return this.$createElement('div', {\n slot: 'label',\n staticClass: 'v-treeview-node__label',\n }, children)\n },\n genContent () {\n const children = [\n this.$scopedSlots.prepend && this.$scopedSlots.prepend(this.scopedProps),\n this.genLabel(),\n this.$scopedSlots.append && this.$scopedSlots.append(this.scopedProps),\n ]\n\n return this.$createElement('div', {\n staticClass: 'v-treeview-node__content',\n }, children)\n },\n genToggle () {\n return this.$createElement(VIcon, {\n staticClass: 'v-treeview-node__toggle',\n class: {\n 'v-treeview-node__toggle--open': this.isOpen,\n 'v-treeview-node__toggle--loading': this.isLoading,\n },\n slot: 'prepend',\n on: {\n click: (e: MouseEvent) => {\n if (this.disabled) return\n\n e.stopPropagation()\n\n if (this.isLoading) return\n\n this.checkChildren().then(() => this.open())\n },\n },\n }, [this.isLoading ? this.loadingIcon : this.expandIcon])\n },\n genCheckbox () {\n return this.$createElement(VIcon, {\n staticClass: 'v-treeview-node__checkbox',\n props: {\n color: this.isSelected ? this.selectedColor : undefined,\n },\n on: {\n click: (e: MouseEvent) => {\n if (this.disabled) return\n\n e.stopPropagation()\n\n if (this.isLoading) return\n\n this.checkChildren().then(() => {\n // We nextTick here so that items watch in VTreeview has a chance to run first\n this.$nextTick(() => {\n this.isSelected = !this.isSelected\n this.isIndeterminate = false\n\n this.treeview.updateSelected(this.key, this.isSelected)\n this.treeview.emitSelected()\n })\n })\n },\n },\n }, [this.computedIcon])\n },\n genNode (): VNode {\n const children = [this.genContent()]\n\n if (this.selectable) children.unshift(this.genCheckbox())\n if (this.hasChildren) children.unshift(this.genToggle())\n\n return this.$createElement('div', this.setTextColor(this.isActive && this.color, {\n staticClass: 'v-treeview-node__root',\n class: {\n [this.activeClass]: this.isActive,\n },\n on: {\n click: () => {\n if (this.disabled) return\n\n if (this.openOnClick && this.children) {\n this.open()\n } else if (this.activatable) {\n this.isActive = !this.isActive\n this.treeview.updateActive(this.key, this.isActive)\n this.treeview.emitActive()\n }\n },\n },\n }), children)\n },\n genChild (item: any): VNode {\n return this.$createElement(VTreeviewNode, {\n key: getObjectValueByPath(item, this.itemKey),\n props: {\n activatable: this.activatable,\n activeClass: this.activeClass,\n item,\n selectable: this.selectable,\n selectedColor: this.selectedColor,\n color: this.color,\n expandIcon: this.expandIcon,\n indeterminateIcon: this.indeterminateIcon,\n offIcon: this.offIcon,\n onIcon: this.onIcon,\n loadingIcon: this.loadingIcon,\n itemKey: this.itemKey,\n itemText: this.itemText,\n itemDisabled: this.itemDisabled,\n itemChildren: this.itemChildren,\n loadChildren: this.loadChildren,\n transition: this.transition,\n openOnClick: this.openOnClick,\n rounded: this.rounded,\n shaped: this.shaped,\n },\n scopedSlots: this.$scopedSlots,\n })\n },\n genChildrenWrapper (): any {\n if (!this.isOpen || !this.children) return null\n\n const children = [this.children.map(this.genChild)]\n\n return this.$createElement('div', {\n staticClass: 'v-treeview-node__children',\n }, children)\n },\n genTransition () {\n return this.$createElement(VExpandTransition, [this.genChildrenWrapper()])\n },\n },\n\n render (h): VNode {\n const children = [this.genNode()]\n\n if (this.transition) children.push(this.genTransition())\n else children.push(this.genChildrenWrapper())\n\n return h('div', {\n staticClass: 'v-treeview-node',\n class: {\n 'v-treeview-node--leaf': !this.hasChildren,\n 'v-treeview-node--click': this.openOnClick,\n 'v-treeview-node--disabled': this.disabled,\n 'v-treeview-node--rounded': this.rounded,\n 'v-treeview-node--shaped': this.shaped,\n 'v-treeview-node--selected': this.isSelected,\n 'v-treeview-node--excluded': this.treeview.isExcluded(this.key),\n },\n attrs: {\n 'aria-expanded': String(this.isOpen),\n },\n }, children)\n },\n})\n"],"sourceRoot":"","file":"VTreeviewNode.js"} |