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f;AACD;AAED,mBAAO,MAAP;AACD,SAfM;AAgBP,qCAhBO,2CAgBsB;AAC3B,gBAAM,SAAS,CAAC,KAAK,GAAN,CAAf;AACA,gBAAI,KAAK,KAAL,CAAW,OAAf,EAAwB,OAAO,IAAP,CAAY,KAAK,KAAL,CAAW,OAAvB;AACxB,gBAAI,KAAK,OAAT,EAAkB,OAAO,IAAP,CAAY,KAAK,OAAjB;AAClB,mBAAO,IAAP,kCAAe,KAAK,wBAAL,EAAf;AAEA,mBAAO,MAAP;AACD;AAvBM;AAtB6B,CAAzB,CAAf","sourcesContent":["import Vue from 'vue'\n\nimport mixins from '../util/mixins'\n\ninterface options extends Vue {\n $el: HTMLElement\n $refs: {\n content: HTMLElement\n }\n overlay?: HTMLElement\n}\n\ninterface DependentInstance extends Vue {\n isActive?: boolean\n isDependent?: boolean\n}\n\nfunction searchChildren (children: Vue[]): DependentInstance[] {\n const results = []\n for (let index = 0; index < children.length; index++) {\n const child = children[index] as DependentInstance\n if (child.isActive && child.isDependent) {\n results.push(child)\n } else {\n results.push(...searchChildren(child.$children))\n }\n }\n\n return results\n}\n\n/* @vue/component */\nexport default mixins<options>().extend({\n name: 'dependent',\n\n data () {\n return {\n closeDependents: true,\n isActive: false,\n isDependent: true\n }\n },\n\n watch: {\n isActive (val) {\n if (val) return\n\n const openDependents = this.getOpenDependents()\n for (let index = 0; index < openDependents.length; index++) {\n openDependents[index].isActive = false\n }\n }\n },\n\n methods: {\n getOpenDependents (): any[] {\n if (this.closeDependents) return searchChildren(this.$children)\n\n return []\n },\n getOpenDependentElements (): HTMLElement[] {\n const result = []\n const openDependents = this.getOpenDependents()\n\n for (let index = 0; index < openDependents.length; index++) {\n result.push(...openDependents[index].getClickableDependentElements())\n }\n\n return result\n },\n getClickableDependentElements (): HTMLElement[] {\n const result = [this.$el]\n if (this.$refs.content) result.push(this.$refs.content)\n if (this.overlay) result.push(this.overlay)\n result.push(...this.getOpenDependentElements())\n\n return result\n }\n }\n})\n"],"sourceRoot":""}
|