This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/mixins/dependent/index.js

70 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
import mixins from '../../util/mixins';
function searchChildren(children) {
const results = [];
for (let index = 0; index < children.length; index++) {
const child = children[index];
if (child.isActive && child.isDependent) {
results.push(child);
} else {
results.push(...searchChildren(child.$children));
}
}
return results;
}
/* @vue/component */
export default mixins().extend({
name: 'dependent',
data() {
return {
closeDependents: true,
isActive: false,
isDependent: true
};
},
watch: {
isActive(val) {
if (val) return;
const openDependents = this.getOpenDependents();
for (let index = 0; index < openDependents.length; index++) {
openDependents[index].isActive = false;
}
}
},
methods: {
getOpenDependents() {
if (this.closeDependents) return searchChildren(this.$children);
return [];
},
getOpenDependentElements() {
const result = [];
const openDependents = this.getOpenDependents();
for (let index = 0; index < openDependents.length; index++) {
result.push(...openDependents[index].getClickableDependentElements());
}
return result;
},
getClickableDependentElements() {
const result = [this.$el];
if (this.$refs.content) result.push(this.$refs.content);
if (this.overlay) result.push(this.overlay);
result.push(...this.getOpenDependentElements());
return result;
}
}
});
//# sourceMappingURL=index.js.map