12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
- import Vue from 'vue';
- import { getZIndex } from '../util/helpers';
- /* @vue/component */
- export default Vue.extend().extend({
- name: 'stackable',
- data: function data() {
- return {
- stackClass: 'unpecified',
- stackElement: null,
- stackExclude: null,
- stackMinZIndex: 0,
- isActive: false
- };
- },
-
- computed: {
- activeZIndex: function activeZIndex() {
- if (typeof window === 'undefined') return 0;
- var content = this.stackElement || this.$refs.content;
- // Return current zindex if not active
- var 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: function getMaxZIndex() {
- var exclude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
-
- var base = this.$el;
- // Start with lowest allowed z-index or z-index of
- // base component's element, whichever is greater
- var 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
- var activeElements = [].concat(_toConsumableArray(document.getElementsByClassName(this.stackClass)));
- // Get z-index for all active dialogs
- for (var index = 0; index < activeElements.length; index++) {
- if (!exclude.includes(activeElements[index])) {
- zis.push(getZIndex(activeElements[index]));
- }
- }
- return Math.max.apply(Math, zis);
- }
- }
- });
- //# sourceMappingURL=stackable.js.map
|