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aAAO,KAAK,cAAL,CAAoB,8BAApB,EAAuC,CAAC,KAAK,kBAAL,EAAD,CAAvC,CAAP;AACD;AA3JM,GAnEwC;AAiOjD,EAAA,MAjOiD,kBAiOzC,CAjOyC,EAiOxC;AACP,QAAM,QAAQ,GAAG,CAAC,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,C","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"} |