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/stackable/index.js

52 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
import Vue from 'vue';
import { getZIndex } from '../../util/helpers';
/* @vue/component */
export default Vue.extend().extend({
name: 'stackable',
data() {
return {
stackElement: null,
stackExclude: null,
stackMinZIndex: 0,
isActive: false
};
},
computed: {
activeZIndex() {
if (typeof window === 'undefined') return 0;
const content = this.stackElement || this.$refs.content; // Return current zindex if not active
const index = !this.isActive ? getZIndex(content) : this.getMaxZIndex(this.stackExclude || [content]) + 2;
if (index == null) return index; // Return max current z-index (excluding self) + 2
// (2 to leave room for an overlay below, if needed)
return parseInt(index);
}
},
methods: {
getMaxZIndex(exclude = []) {
const base = this.$el; // Start with lowest allowed z-index or z-index of
// base component's element, whichever is greater
const zis = [this.stackMinZIndex, getZIndex(base)]; // Convert the NodeList to an array to
// prevent an Edge bug with Symbol.iterator
// https://github.com/vuetifyjs/vuetify/issues/2146
const activeElements = [...document.getElementsByClassName('v-menu__content--active'), ...document.getElementsByClassName('v-dialog__content--active')]; // Get z-index for all active dialogs
for (let index = 0; index < activeElements.length; index++) {
if (!exclude.includes(activeElements[index])) {
zis.push(getZIndex(activeElements[index]));
}
}
return Math.max(...zis);
}
}
});
//# sourceMappingURL=index.js.map