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

701 lines
22 KiB
JavaScript

import {
CHANGE_EVENT,
UPDATE_MODEL_EVENT,
useAriaProps
} from "./chunk-6VHTGKN7.js";
import {
useDeprecated
} from "./chunk-HYWPQNOB.js";
import {
useFormItem,
useFormItemInputId
} from "./chunk-DIGHH22S.js";
import {
useFormDisabled,
useFormSize,
useSizeProp
} from "./chunk-FYPMSKES.js";
import {
debugWarn,
isBoolean,
isNumber,
isPropAbsent,
isUndefined
} from "./chunk-UFIWN4M6.js";
import {
_export_sfc
} from "./chunk-MUJDDH7P.js";
import {
buildProps,
definePropType,
isEqual_default,
omit_default,
pick_default,
useNamespace,
withInstall,
withNoopInstall
} from "./chunk-R2OGZABH.js";
import {
Fragment,
computed,
createBaseVNode,
createBlock,
createCommentVNode,
createElementBlock,
createTextVNode,
defineComponent,
getCurrentInstance,
inject,
isRef,
mergeProps,
nextTick,
openBlock,
provide,
ref,
renderList,
renderSlot,
resolveDynamicComponent,
toRaw,
toRefs,
unref,
useSlots,
vModelCheckbox,
watch,
withCtx,
withDirectives,
withModifiers
} from "./chunk-AAHVYXXY.js";
import {
init_shared_esm_bundler,
isArray,
isObject,
isString,
normalizeClass,
normalizeStyle,
toDisplayString
} 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/checkbox/src/checkbox.mjs
init_shared_esm_bundler();
var checkboxProps = {
modelValue: {
type: [Number, String, Boolean],
default: void 0
},
label: {
type: [String, Boolean, Number, Object],
default: void 0
},
value: {
type: [String, Boolean, Number, Object],
default: void 0
},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: {
type: String,
default: void 0
},
trueValue: {
type: [String, Number],
default: void 0
},
falseValue: {
type: [String, Number],
default: void 0
},
trueLabel: {
type: [String, Number],
default: void 0
},
falseLabel: {
type: [String, Number],
default: void 0
},
id: {
type: String,
default: void 0
},
border: Boolean,
size: useSizeProp,
tabindex: [String, Number],
validateEvent: {
type: Boolean,
default: true
},
...useAriaProps(["ariaControls"])
};
var checkboxEmits = {
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
change: (val) => isString(val) || isNumber(val) || isBoolean(val)
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/constants.mjs
var checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/composables/use-checkbox-disabled.mjs
var useCheckboxDisabled = ({
model,
isChecked
}) => {
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
const isLimitDisabled = computed(() => {
var _a, _b;
const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
});
const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
return {
isDisabled,
isLimitDisabled
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/composables/use-checkbox-event.mjs
var useCheckboxEvent = (props, {
model,
isLimitExceeded,
hasOwnLabel,
isDisabled,
isLabeledByFormItem
}) => {
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
const { formItem } = useFormItem();
const { emit } = getCurrentInstance();
function getLabeledValue(value) {
var _a, _b, _c, _d;
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
}
function emitChangeEvent(checked, e) {
emit(CHANGE_EVENT, getLabeledValue(checked), e);
}
function handleChange(e) {
if (isLimitExceeded.value)
return;
const target = e.target;
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
}
async function onClickRoot(e) {
if (isLimitExceeded.value)
return;
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
const eventTargets = e.composedPath();
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
if (!hasLabel) {
model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
await nextTick();
emitChangeEvent(model.value, e);
}
}
}
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
watch(() => props.modelValue, () => {
if (validateEvent.value) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
}
});
return {
handleChange,
onClickRoot
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/composables/use-checkbox-model.mjs
init_shared_esm_bundler();
var useCheckboxModel = (props) => {
const selfModel = ref(false);
const { emit } = getCurrentInstance();
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
const isLimitExceeded = ref(false);
const model = computed({
get() {
var _a, _b;
return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
},
set(val) {
var _a, _b;
if (isGroup.value && isArray(val)) {
isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
} else {
emit(UPDATE_MODEL_EVENT, val);
selfModel.value = val;
}
}
});
return {
model,
isGroup,
isLimitExceeded
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/composables/use-checkbox-status.mjs
init_shared_esm_bundler();
var useCheckboxStatus = (props, slots, { model }) => {
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
const isFocused = ref(false);
const actualValue = computed(() => {
if (!isPropAbsent(props.value)) {
return props.value;
}
return props.label;
});
const isChecked = computed(() => {
const value = model.value;
if (isBoolean(value)) {
return value;
} else if (isArray(value)) {
if (isObject(actualValue.value)) {
return value.map(toRaw).some((o) => isEqual_default(o, actualValue.value));
} else {
return value.map(toRaw).includes(actualValue.value);
}
} else if (value !== null && value !== void 0) {
return value === props.trueValue || value === props.trueLabel;
} else {
return !!value;
}
});
const checkboxButtonSize = useFormSize(computed(() => {
var _a;
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
}), {
prop: true
});
const checkboxSize = useFormSize(computed(() => {
var _a;
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
}));
const hasOwnLabel = computed(() => {
return !!slots.default || !isPropAbsent(actualValue.value);
});
return {
checkboxButtonSize,
isChecked,
isFocused,
checkboxSize,
hasOwnLabel,
actualValue
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/composables/use-checkbox.mjs
init_shared_esm_bundler();
var useCheckbox = (props, slots) => {
const { formItem: elFormItem } = useFormItem();
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
const {
isFocused,
isChecked,
checkboxButtonSize,
checkboxSize,
hasOwnLabel,
actualValue
} = useCheckboxStatus(props, slots, { model });
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
formItemContext: elFormItem,
disableIdGeneration: hasOwnLabel,
disableIdManagement: isGroup
});
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
model,
isLimitExceeded,
hasOwnLabel,
isDisabled,
isLabeledByFormItem
});
const setStoreValue = () => {
function addToStore() {
var _a, _b;
if (isArray(model.value) && !model.value.includes(actualValue.value)) {
model.value.push(actualValue.value);
} else {
model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
}
}
props.checked && addToStore();
};
setStoreValue();
useDeprecated({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => isGroup.value && isPropAbsent(props.value)));
useDeprecated({
from: "true-label",
replacement: "true-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => !!props.trueLabel));
useDeprecated({
from: "false-label",
replacement: "false-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => !!props.falseLabel));
return {
inputId,
isLabeledByFormItem,
isChecked,
isDisabled,
isFocused,
checkboxButtonSize,
checkboxSize,
hasOwnLabel,
model,
actualValue,
handleChange,
onClickRoot
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/checkbox2.mjs
var __default__ = defineComponent({
name: "ElCheckbox"
});
var _sfc_main = defineComponent({
...__default__,
props: checkboxProps,
emits: checkboxEmits,
setup(__props) {
const props = __props;
const slots = useSlots();
const {
inputId,
isLabeledByFormItem,
isChecked,
isDisabled,
isFocused,
checkboxSize,
hasOwnLabel,
model,
actualValue,
handleChange,
onClickRoot
} = useCheckbox(props, slots);
const inputBindings = computed(() => {
var _a, _b, _c, _d;
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
return {
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
};
}
return {
value: actualValue.value
};
});
const ns = useNamespace("checkbox");
const compKls = computed(() => {
return [
ns.b(),
ns.m(checkboxSize.value),
ns.is("disabled", isDisabled.value),
ns.is("bordered", props.border),
ns.is("checked", isChecked.value)
];
});
const spanKls = computed(() => {
return [
ns.e("input"),
ns.is("disabled", isDisabled.value),
ns.is("checked", isChecked.value),
ns.is("indeterminate", props.indeterminate),
ns.is("focus", isFocused.value)
];
});
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
class: normalizeClass(unref(compKls)),
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
onClick: unref(onClickRoot)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(unref(spanKls))
}, [
withDirectives(createBaseVNode("input", mergeProps({
id: unref(inputId),
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
class: unref(ns).e("original"),
type: "checkbox",
indeterminate: _ctx.indeterminate,
name: _ctx.name,
tabindex: _ctx.tabindex,
disabled: unref(isDisabled)
}, unref(inputBindings), {
onChange: unref(handleChange),
onFocus: ($event) => isFocused.value = true,
onBlur: ($event) => isFocused.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}), null, 16, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
[vModelCheckbox, unref(model)]
]),
createBaseVNode("span", {
class: normalizeClass(unref(ns).e("inner"))
}, null, 2)
], 2),
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(ns).e("label"))
}, [
renderSlot(_ctx.$slots, "default"),
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createTextVNode(toDisplayString(_ctx.label), 1)
], 64)) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["class", "aria-controls", "onClick"]);
};
}
});
var Checkbox = _export_sfc(_sfc_main, [["__file", "checkbox.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/checkbox-button.mjs
var __default__2 = defineComponent({
name: "ElCheckboxButton"
});
var _sfc_main2 = defineComponent({
...__default__2,
props: checkboxProps,
emits: checkboxEmits,
setup(__props) {
const props = __props;
const slots = useSlots();
const {
isFocused,
isChecked,
isDisabled,
checkboxButtonSize,
model,
actualValue,
handleChange
} = useCheckbox(props, slots);
const inputBindings = computed(() => {
var _a, _b, _c, _d;
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
return {
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
};
}
return {
value: actualValue.value
};
});
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
const ns = useNamespace("checkbox");
const activeStyle = computed(() => {
var _a, _b, _c, _d;
const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
return {
backgroundColor: fillValue,
borderColor: fillValue,
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
};
});
const labelKls = computed(() => {
return [
ns.b("button"),
ns.bm("button", checkboxButtonSize.value),
ns.is("disabled", isDisabled.value),
ns.is("checked", isChecked.value),
ns.is("focus", isFocused.value)
];
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("label", {
class: normalizeClass(unref(labelKls))
}, [
withDirectives(createBaseVNode("input", mergeProps({
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
class: unref(ns).be("button", "original"),
type: "checkbox",
name: _ctx.name,
tabindex: _ctx.tabindex,
disabled: unref(isDisabled)
}, unref(inputBindings), {
onChange: unref(handleChange),
onFocus: ($event) => isFocused.value = true,
onBlur: ($event) => isFocused.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}), null, 16, ["onUpdate:modelValue", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
[vModelCheckbox, unref(model)]
]),
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(ns).be("button", "inner")),
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.label), 1)
])
], 6)) : createCommentVNode("v-if", true)
], 2);
};
}
});
var CheckboxButton = _export_sfc(_sfc_main2, [["__file", "checkbox-button.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/checkbox-group.mjs
init_shared_esm_bundler();
var checkboxGroupProps = buildProps({
modelValue: {
type: definePropType(Array),
default: () => []
},
disabled: Boolean,
min: Number,
max: Number,
size: useSizeProp,
fill: String,
textColor: String,
tag: {
type: String,
default: "div"
},
validateEvent: {
type: Boolean,
default: true
},
options: {
type: definePropType(Array)
},
props: {
type: definePropType(Object),
default: () => checkboxDefaultProps
},
type: {
type: String,
values: ["checkbox", "button"],
default: "checkbox"
},
...useAriaProps(["ariaLabel"])
});
var checkboxGroupEmits = {
[UPDATE_MODEL_EVENT]: (val) => isArray(val),
change: (val) => isArray(val)
};
var checkboxDefaultProps = {
label: "label",
value: "value",
disabled: "disabled"
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/src/checkbox-group2.mjs
var __default__3 = defineComponent({
name: "ElCheckboxGroup"
});
var _sfc_main3 = defineComponent({
...__default__3,
props: checkboxGroupProps,
emits: checkboxGroupEmits,
setup(__props, { emit }) {
const props = __props;
const ns = useNamespace("checkbox");
const { formItem } = useFormItem();
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
formItemContext: formItem
});
const changeEvent = async (value) => {
emit(UPDATE_MODEL_EVENT, value);
await nextTick();
emit(CHANGE_EVENT, value);
};
const modelValue = computed({
get() {
return props.modelValue;
},
set(val) {
changeEvent(val);
}
});
const aliasProps = computed(() => ({
...checkboxDefaultProps,
...props.props
}));
const getOptionProps = (option) => {
const { label, value, disabled } = aliasProps.value;
const base = {
label: option[label],
value: option[value],
disabled: option[disabled]
};
return { ...omit_default(option, [label, value, disabled]), ...base };
};
const optionComponent = computed(() => props.type === "button" ? CheckboxButton : Checkbox);
provide(checkboxGroupContextKey, {
...pick_default(toRefs(props), [
"size",
"min",
"max",
"disabled",
"validateEvent",
"fill",
"textColor"
]),
modelValue,
changeEvent
});
watch(() => props.modelValue, (newVal, oldValue) => {
if (props.validateEvent && !isEqual_default(newVal, oldValue)) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
}
});
return (_ctx, _cache) => {
var _a;
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
id: unref(groupId),
class: normalizeClass(unref(ns).b("group")),
role: "group",
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)), mergeProps({ key: index }, getOptionProps(item)), null, 16);
}), 128))
])
]),
_: 3
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
};
}
});
var CheckboxGroup = _export_sfc(_sfc_main3, [["__file", "checkbox-group.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/checkbox/index.mjs
var ElCheckbox = withInstall(Checkbox, {
CheckboxButton,
CheckboxGroup
});
var ElCheckboxButton = withNoopInstall(CheckboxButton);
var ElCheckboxGroup = withNoopInstall(CheckboxGroup);
export {
checkboxProps,
checkboxEmits,
checkboxGroupContextKey,
checkboxGroupProps,
checkboxGroupEmits,
checkboxDefaultProps,
ElCheckbox,
ElCheckboxButton,
ElCheckboxGroup
};
//# sourceMappingURL=chunk-IOI5IEYC.js.map