aiflowy-ui-admin/node_modules/.vite/deps/chunk-DXOVFSWI.js

503 lines
15 KiB
JavaScript

import {
defaultInitialZIndex,
emptyValuesContextKey,
useZIndex,
zIndexContextKey
} from "./chunk-22HKH5YS.js";
import {
localeContextKey,
useLocale
} from "./chunk-APPTXKCZ.js";
import {
iconPropType
} from "./chunk-R665FMDM.js";
import {
ElIcon,
keysOf
} from "./chunk-3DJYPQW6.js";
import {
useDeprecated
} from "./chunk-HYWPQNOB.js";
import {
useFormItem
} from "./chunk-DIGHH22S.js";
import {
SIZE_INJECTION_KEY,
useFormDisabled,
useFormSize,
useSizeProp
} from "./chunk-FYPMSKES.js";
import {
debugWarn
} from "./chunk-UFIWN4M6.js";
import {
_export_sfc
} from "./chunk-MUJDDH7P.js";
import {
buildProps,
defaultNamespace,
definePropType,
namespaceContextKey,
useNamespace,
withInstall,
withNoopInstall
} from "./chunk-R2OGZABH.js";
import {
TinyColor
} from "./chunk-VK2ZSTB7.js";
import {
loading_default
} from "./chunk-3C23FNYW.js";
import {
Fragment,
Text,
computed,
createBlock,
createCommentVNode,
createElementBlock,
defineComponent,
getCurrentInstance,
inject,
mergeProps,
openBlock,
provide,
reactive,
ref,
renderSlot,
resolveDynamicComponent,
toRef,
unref,
useSlots,
withCtx
} from "./chunk-AAHVYXXY.js";
import {
normalizeClass
} 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/components/button/src/constants.mjs
var buttonGroupContextKey = Symbol("buttonGroupContextKey");
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/config-provider/src/constants.mjs
var configProviderContextKey = Symbol();
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/config-provider/src/hooks/use-global-config.mjs
var globalConfig = ref();
function useGlobalConfig(key, defaultValue = void 0) {
const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
if (key) {
return computed(() => {
var _a, _b;
return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
});
} else {
return config;
}
}
function useGlobalComponentSettings(block, sizeFallback) {
const config = useGlobalConfig();
const ns = useNamespace(block, computed(() => {
var _a;
return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
}));
const locale = useLocale(computed(() => {
var _a;
return (_a = config.value) == null ? void 0 : _a.locale;
}));
const zIndex = useZIndex(computed(() => {
var _a;
return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
}));
const size = computed(() => {
var _a;
return unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
});
provideGlobalConfig(computed(() => unref(config) || {}));
return {
ns,
locale,
zIndex,
size
};
}
var provideGlobalConfig = (config, app, global = false) => {
var _a;
const inSetup = !!getCurrentInstance();
const oldConfig = inSetup ? useGlobalConfig() : void 0;
const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
if (!provideFn) {
debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
return;
}
const context = computed(() => {
const cfg = unref(config);
if (!(oldConfig == null ? void 0 : oldConfig.value))
return cfg;
return mergeConfig(oldConfig.value, cfg);
});
provideFn(configProviderContextKey, context);
provideFn(localeContextKey, computed(() => context.value.locale));
provideFn(namespaceContextKey, computed(() => context.value.namespace));
provideFn(zIndexContextKey, computed(() => context.value.zIndex));
provideFn(SIZE_INJECTION_KEY, {
size: computed(() => context.value.size || "")
});
provideFn(emptyValuesContextKey, computed(() => ({
emptyValues: context.value.emptyValues,
valueOnClear: context.value.valueOnClear
})));
if (global || !globalConfig.value) {
globalConfig.value = context.value;
}
return context;
};
var mergeConfig = (a, b) => {
const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
const obj = {};
for (const key of keys) {
obj[key] = b[key] !== void 0 ? b[key] : a[key];
}
return obj;
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/use-button.mjs
var useButton = (props, emit) => {
useDeprecated({
from: "type.text",
replacement: "link",
version: "3.0.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
}, computed(() => props.type === "text"));
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
const globalConfig2 = useGlobalConfig("button");
const { form } = useFormItem();
const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
const _disabled = useFormDisabled();
const _ref = ref();
const slots = useSlots();
const _type = computed(() => {
var _a;
return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a = globalConfig2.value) == null ? void 0 : _a.type) || "";
});
const autoInsertSpace = computed(() => {
var _a, _b, _c;
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig2.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
});
const _plain = computed(() => {
var _a, _b, _c;
return (_c = (_b = props.plain) != null ? _b : (_a = globalConfig2.value) == null ? void 0 : _a.plain) != null ? _c : false;
});
const _round = computed(() => {
var _a, _b, _c;
return (_c = (_b = props.round) != null ? _b : (_a = globalConfig2.value) == null ? void 0 : _a.round) != null ? _c : false;
});
const _text = computed(() => {
var _a, _b, _c;
return (_c = (_b = props.text) != null ? _b : (_a = globalConfig2.value) == null ? void 0 : _a.text) != null ? _c : false;
});
const _props = computed(() => {
if (props.tag === "button") {
return {
ariaDisabled: _disabled.value || props.loading,
disabled: _disabled.value || props.loading,
autofocus: props.autofocus,
type: props.nativeType
};
}
return {};
});
const shouldAddSpace = computed(() => {
var _a;
const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
const slot = defaultSlot[0];
if ((slot == null ? void 0 : slot.type) === Text) {
const text = slot.children;
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim());
}
}
return false;
});
const handleClick = (evt) => {
if (_disabled.value || props.loading) {
evt.stopPropagation();
return;
}
if (props.nativeType === "reset") {
form == null ? void 0 : form.resetFields();
}
emit("click", evt);
};
return {
_disabled,
_size,
_type,
_ref,
_props,
_plain,
_round,
_text,
shouldAddSpace,
handleClick
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/button.mjs
var buttonTypes = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
];
var buttonNativeTypes = ["button", "submit", "reset"];
var buttonProps = buildProps({
size: useSizeProp,
disabled: Boolean,
type: {
type: String,
values: buttonTypes,
default: ""
},
icon: {
type: iconPropType
},
nativeType: {
type: String,
values: buttonNativeTypes,
default: "button"
},
loading: Boolean,
loadingIcon: {
type: iconPropType,
default: () => loading_default
},
plain: {
type: Boolean,
default: void 0
},
text: {
type: Boolean,
default: void 0
},
link: Boolean,
bg: Boolean,
autofocus: Boolean,
round: {
type: Boolean,
default: void 0
},
circle: Boolean,
color: String,
dark: Boolean,
autoInsertSpace: {
type: Boolean,
default: void 0
},
tag: {
type: definePropType([String, Object]),
default: "button"
}
});
var buttonEmits = {
click: (evt) => evt instanceof MouseEvent
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/button-custom.mjs
function darken(color, amount = 20) {
return color.mix("#141414", amount).toString();
}
function useButtonCustomStyle(props) {
const _disabled = useFormDisabled();
const ns = useNamespace("button");
return computed(() => {
let styles = {};
let buttonColor = props.color;
if (buttonColor) {
const match = buttonColor.match(/var\((.*?)\)/);
if (match) {
buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
}
const color = new TinyColor(buttonColor);
const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
if (props.plain) {
styles = ns.cssVarBlock({
"bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
"text-color": buttonColor,
"border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
"hover-text-color": `var(${ns.cssVarName("color-white")})`,
"hover-bg-color": buttonColor,
"hover-border-color": buttonColor,
"active-bg-color": activeBgColor,
"active-text-color": `var(${ns.cssVarName("color-white")})`,
"active-border-color": activeBgColor
});
if (_disabled.value) {
styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
}
} else {
const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
styles = ns.cssVarBlock({
"bg-color": buttonColor,
"text-color": textColor,
"border-color": buttonColor,
"hover-bg-color": hoverBgColor,
"hover-text-color": textColor,
"hover-border-color": hoverBgColor,
"active-bg-color": activeBgColor,
"active-border-color": activeBgColor
});
if (_disabled.value) {
const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
}
}
}
return styles;
});
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/button2.mjs
var __default__ = defineComponent({
name: "ElButton"
});
var _sfc_main = defineComponent({
...__default__,
props: buttonProps,
emits: buttonEmits,
setup(__props, { expose, emit }) {
const props = __props;
const buttonStyle = useButtonCustomStyle(props);
const ns = useNamespace("button");
const {
_ref,
_size,
_type,
_disabled,
_props,
_plain,
_round,
_text,
shouldAddSpace,
handleClick
} = useButton(props, emit);
const buttonKls = computed(() => [
ns.b(),
ns.m(_type.value),
ns.m(_size.value),
ns.is("disabled", _disabled.value),
ns.is("loading", props.loading),
ns.is("plain", _plain.value),
ns.is("round", _round.value),
ns.is("circle", props.circle),
ns.is("text", _text.value),
ns.is("link", props.link),
ns.is("has-bg", props.bg)
]);
expose({
ref: _ref,
size: _size,
type: _type,
disabled: _disabled,
shouldAddSpace
});
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
ref_key: "_ref",
ref: _ref
}, unref(_props), {
class: unref(buttonKls),
style: unref(buttonStyle),
onClick: unref(handleClick)
}), {
default: withCtx(() => [
_ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass(unref(ns).is("loading"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
]),
_: 3
})) : createCommentVNode("v-if", true),
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
key: 2,
class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
}, [
renderSlot(_ctx.$slots, "default")
], 2)) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["class", "style", "onClick"]);
};
}
});
var Button = _export_sfc(_sfc_main, [["__file", "button.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/button-group.mjs
var buttonGroupProps = {
size: buttonProps.size,
type: buttonProps.type
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/src/button-group2.mjs
var __default__2 = defineComponent({
name: "ElButtonGroup"
});
var _sfc_main2 = defineComponent({
...__default__2,
props: buttonGroupProps,
setup(__props) {
const props = __props;
provide(buttonGroupContextKey, reactive({
size: toRef(props, "size"),
type: toRef(props, "type")
}));
const ns = useNamespace("button");
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(ns).b("group"))
}, [
renderSlot(_ctx.$slots, "default")
], 2);
};
}
});
var ButtonGroup = _export_sfc(_sfc_main2, [["__file", "button-group.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/button/index.mjs
var ElButton = withInstall(Button, {
ButtonGroup
});
var ElButtonGroup = withNoopInstall(ButtonGroup);
export {
configProviderContextKey,
useGlobalConfig,
useGlobalComponentSettings,
provideGlobalConfig,
buttonGroupContextKey,
buttonTypes,
buttonNativeTypes,
buttonProps,
buttonEmits,
ElButton,
ElButtonGroup
};
//# sourceMappingURL=chunk-DXOVFSWI.js.map