132 lines
3.8 KiB
JavaScript
132 lines
3.8 KiB
JavaScript
import {
|
|
isClient
|
|
} from "./chunk-FYPMSKES.js";
|
|
import {
|
|
debugWarn,
|
|
isNumber
|
|
} from "./chunk-UFIWN4M6.js";
|
|
import {
|
|
buildProps,
|
|
definePropType,
|
|
isEqual_default
|
|
} from "./chunk-R2OGZABH.js";
|
|
import {
|
|
computed,
|
|
getCurrentInstance,
|
|
inject,
|
|
ref,
|
|
unref
|
|
} from "./chunk-AAHVYXXY.js";
|
|
import {
|
|
init_shared_esm_bundler,
|
|
isArray,
|
|
isFunction
|
|
} from "./chunk-OWZYVOTZ.js";
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/hooks/use-z-index/index.mjs
|
|
var initial = {
|
|
current: 0
|
|
};
|
|
var zIndex = ref(0);
|
|
var defaultInitialZIndex = 2e3;
|
|
var ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
|
|
var zIndexContextKey = Symbol("zIndexContextKey");
|
|
var 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)) {
|
|
debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
|
|
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
|
|
}
|
|
return {
|
|
initialZIndex,
|
|
currentZIndex,
|
|
nextZIndex
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/hooks/use-empty-values/index.mjs
|
|
init_shared_esm_bundler();
|
|
var emptyValuesContextKey = Symbol("emptyValuesContextKey");
|
|
var SCOPE = "use-empty-values";
|
|
var DEFAULT_EMPTY_VALUES = ["", void 0, null];
|
|
var DEFAULT_VALUE_ON_CLEAR = void 0;
|
|
var useEmptyValuesProps = buildProps({
|
|
emptyValues: Array,
|
|
valueOnClear: {
|
|
type: definePropType([
|
|
String,
|
|
Number,
|
|
Boolean,
|
|
Function
|
|
]),
|
|
default: void 0,
|
|
validator: (val) => {
|
|
val = isFunction(val) ? val() : val;
|
|
if (isArray(val)) {
|
|
return val.every((item) => !item);
|
|
}
|
|
return !val;
|
|
}
|
|
}
|
|
});
|
|
var useEmptyValues = (props, defaultValue) => {
|
|
const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
|
|
const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
|
|
const valueOnClear = computed(() => {
|
|
if (isFunction(props.valueOnClear)) {
|
|
return props.valueOnClear();
|
|
} else if (props.valueOnClear !== void 0) {
|
|
return props.valueOnClear;
|
|
} else if (isFunction(config.value.valueOnClear)) {
|
|
return config.value.valueOnClear();
|
|
} else if (config.value.valueOnClear !== void 0) {
|
|
return config.value.valueOnClear;
|
|
}
|
|
return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
|
|
});
|
|
const isEmptyValue = (value) => {
|
|
let result = true;
|
|
if (isArray(value)) {
|
|
result = emptyValues.value.some((emptyValue) => {
|
|
return isEqual_default(value, emptyValue);
|
|
});
|
|
} else {
|
|
result = emptyValues.value.includes(value);
|
|
}
|
|
return result;
|
|
};
|
|
if (!isEmptyValue(valueOnClear.value)) {
|
|
debugWarn(SCOPE, "value-on-clear should be a value of empty-values");
|
|
}
|
|
return {
|
|
emptyValues,
|
|
valueOnClear,
|
|
isEmptyValue
|
|
};
|
|
};
|
|
|
|
export {
|
|
defaultInitialZIndex,
|
|
ZINDEX_INJECTION_KEY,
|
|
zIndexContextKey,
|
|
useZIndex,
|
|
emptyValuesContextKey,
|
|
SCOPE,
|
|
DEFAULT_EMPTY_VALUES,
|
|
DEFAULT_VALUE_ON_CLEAR,
|
|
useEmptyValuesProps,
|
|
useEmptyValues
|
|
};
|
|
//# sourceMappingURL=chunk-22HKH5YS.js.map
|