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AAL,CAAY,OAHR,CAAP;AAID;AApH2E,CAA/D,CAAf","sourcesContent":["import '../../stylus/components/_expansion-panel.styl'\n\nimport { VExpansionPanelContent } from '.'\n\nimport Themeable from '../../mixins/themeable'\nimport { provide as RegistrableProvide } from '../../mixins/registrable'\n\nimport mixins from '../../util/mixins'\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\n\ntype VExpansionPanelContentInstance = InstanceType<typeof VExpansionPanelContent>\n\n/* @vue/component */\nexport default mixins(Themeable, RegistrableProvide('expansionPanel')).extend({\n name: 'v-expansion-panel',\n\n provide (): object {\n return {\n expansionPanel: this\n }\n },\n\n props: {\n disabled: Boolean,\n readonly: Boolean,\n expand: Boolean,\n focusable: Boolean,\n inset: Boolean,\n popout: Boolean,\n value: {\n type: [Number, Array],\n default: () => null\n } as any as PropValidator<number | number[]>\n },\n\n data: () => ({\n items: [] as VExpansionPanelContentInstance[],\n open: [] as boolean[]\n }),\n\n computed: {\n classes (): object {\n return {\n 'v-expansion-panel--focusable': this.focusable,\n 'v-expansion-panel--popout': this.popout,\n 'v-expansion-panel--inset': this.inset,\n ...this.themeClasses\n }\n }\n },\n\n watch: {\n expand (v: boolean) {\n let openIndex = -1\n if (!v) {\n // Close all panels unless only one is open\n const openCount = this.open.reduce((acc, val) => val ? acc + 1 : acc, 0)\n const open = Array(this.items.length).fill(false)\n\n if (openCount === 1) {\n openIndex = this.open.indexOf(true)\n }\n\n if (openIndex > -1) {\n open[openIndex] = true\n }\n\n this.open = open\n }\n\n this.$emit('input', v ? this.open : (openIndex > -1 ? openIndex : null))\n },\n value (v: number | number[]) {\n this.updateFromValue(v)\n }\n },\n\n mounted () {\n this.value !== null && this.updateFromValue(this.value)\n },\n\n methods: {\n updateFromValue (v: number | number[]) {\n if (Array.isArray(v) && !this.expand) return\n\n let open = Array(this.items.length).fill(false)\n if (typeof v === 'number') {\n open[v] = true\n } else if (v !== null) {\n open = v\n }\n\n this.updatePanels(open)\n },\n updatePanels (open: boolean[]) {\n this.open = open\n for (let i = 0; i < this.items.length; i++) {\n this.items[i].toggle(open && open[i])\n }\n },\n panelClick (uid: number) {\n const open = this.expand ? this.open.slice() : Array(this.items.length).fill(false)\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i]._uid === uid) {\n open[i] = !this.open[i]\n !this.expand && this.$emit('input', open[i] ? i : null)\n }\n }\n\n this.updatePanels(open)\n if (this.expand) this.$emit('input', open)\n },\n register (content: VExpansionPanelContentInstance) {\n const i = this.items.push(content) - 1\n this.value !== null && this.updateFromValue(this.value)\n content.toggle(!!this.open[i])\n },\n unregister (content: VExpansionPanelContentInstance) {\n const index = this.items.findIndex(i => i._uid === content._uid)\n this.items.splice(index, 1)\n this.open.splice(index, 1)\n }\n },\n\n render (h): VNode {\n return h('ul', {\n staticClass: 'v-expansion-panel',\n class: this.classes\n }, this.$slots.default)\n }\n})\n"],"sourceRoot":""}
|