2
This commit is contained in:
34
normal-admin/node_modules/element-plus/es/hooks/use-z-index/index.mjs
generated
vendored
Normal file
34
normal-admin/node_modules/element-plus/es/hooks/use-z-index/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ref, getCurrentInstance, inject, computed, unref } from 'vue';
|
||||
import { isNumber } from '../../utils/types.mjs';
|
||||
import { isClient } from '@vueuse/core';
|
||||
|
||||
const initial = {
|
||||
current: 0
|
||||
};
|
||||
const zIndex = ref(0);
|
||||
const defaultInitialZIndex = 2e3;
|
||||
const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
|
||||
const zIndexContextKey = Symbol("zIndexContextKey");
|
||||
const useZIndex = (zIndexOverrides) => {
|
||||
const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
|
||||
const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
|
||||
const initialZIndex = computed(() => {
|
||||
const zIndexFromInjection = unref(zIndexInjection);
|
||||
return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
|
||||
});
|
||||
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
||||
const nextZIndex = () => {
|
||||
increasingInjection.current++;
|
||||
zIndex.value = increasingInjection.current;
|
||||
return currentZIndex.value;
|
||||
};
|
||||
if (!isClient && !inject(ZINDEX_INJECTION_KEY)) ;
|
||||
return {
|
||||
initialZIndex,
|
||||
currentZIndex,
|
||||
nextZIndex
|
||||
};
|
||||
};
|
||||
|
||||
export { ZINDEX_INJECTION_KEY, defaultInitialZIndex, useZIndex, zIndexContextKey };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
Reference in New Issue
Block a user