| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/apache/htdocs/app/node_modules/vuetify/src/mixins/stackable/ |
Upload File : |
import Vue from 'vue'
import { getZIndex } from '../../util/helpers'
interface options extends Vue {
$refs: {
content: Element
}
}
/* @vue/component */
export default Vue.extend<options>().extend({
name: 'stackable',
data () {
return {
stackElement: null as Element | null,
stackExclude: null as Element[] | null,
stackMinZIndex: 0,
isActive: false,
}
},
computed: {
activeZIndex (): number {
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: Element[] = []) {
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)
},
},
})