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

4341 lines
141 KiB
JavaScript

import {
BORDER_HORIZONTAL_WIDTH,
ElTag,
MINIMUM_INPUT_WIDTH,
cAF,
defaultProps,
escapeStringRegexp,
rAF,
tagProps,
useCalcInputWidth,
useProps
} from "./chunk-LZ2AJP2V.js";
import {
flattedChildren
} from "./chunk-57H52JND.js";
import {
ElCheckbox
} from "./chunk-IOI5IEYC.js";
import {
ElScrollbar,
scrollbarEmits
} from "./chunk-SY5SN5AU.js";
import {
ClickOutside
} from "./chunk-SSCO4CCM.js";
import {
Ee,
ElTooltip,
useTooltipContentProps
} from "./chunk-7F6Y7TML.js";
import {
EVENT_CODE,
getEventCode
} from "./chunk-BUVJOKYK.js";
import {
useComposition,
useFocusController
} from "./chunk-6KKRONM6.js";
import {
useEmptyValues,
useEmptyValuesProps
} from "./chunk-22HKH5YS.js";
import {
useLocale
} from "./chunk-APPTXKCZ.js";
import {
ValidateComponentsMap,
iconPropType
} from "./chunk-R665FMDM.js";
import {
ElIcon,
addClass,
getStyle,
removeClass
} from "./chunk-3DJYPQW6.js";
import {
CHANGE_EVENT,
UPDATE_MODEL_EVENT,
useAriaProps
} from "./chunk-6VHTGKN7.js";
import {
useFormItem,
useFormItemInputId,
useId
} from "./chunk-DIGHH22S.js";
import {
formItemContextKey,
isClient,
isIOS,
useDebounceFn,
useEventListener,
useFormSize,
useMutationObserver,
useResizeObserver,
useSizeProp
} from "./chunk-FYPMSKES.js";
import {
componentSizes,
debugWarn,
isBoolean,
isEmpty,
isNumber,
isPropAbsent,
isUndefined,
isWindow,
throwError
} from "./chunk-UFIWN4M6.js";
import {
_export_sfc
} from "./chunk-MUJDDH7P.js";
import {
buildProps,
castArray_default,
clamp_default,
definePropType,
findLastIndex_default,
get_default,
isEqual_default,
isNil_default,
pick_default,
useNamespace,
withInstall,
withNoopInstall
} from "./chunk-R2OGZABH.js";
import {
arrow_down_default,
caret_right_default,
circle_close_default,
loading_default
} from "./chunk-3C23FNYW.js";
import {
Fragment,
Transition,
computed,
createBaseVNode,
createBlock,
createCommentVNode,
createElementBlock,
createTextVNode,
createVNode,
defineComponent,
getCurrentInstance,
h,
inject,
isVNode,
mergeProps,
nextTick,
onBeforeUnmount,
onMounted,
onUpdated,
openBlock,
provide,
reactive,
ref,
renderList,
renderSlot,
resolveComponent,
resolveDirective,
resolveDynamicComponent,
toHandlers,
toRaw,
toRefs,
unref,
useAttrs,
vModelText,
vShow,
watch,
watchEffect,
withCtx,
withDirectives,
withModifiers
} from "./chunk-AAHVYXXY.js";
import {
NOOP,
hasOwn,
init_shared_esm_bundler,
isArray,
isFunction,
isObject,
isPlainObject,
isString,
normalizeClass,
normalizeProps,
normalizeStyle,
toDisplayString,
toHandlerKey
} 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/select/src/token.mjs
var selectGroupKey = Symbol("ElSelectGroup");
var selectKey = Symbol("ElSelect");
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/option.mjs
var COMPONENT_NAME = "ElOption";
var optionProps = buildProps({
value: {
type: [String, Number, Boolean, Object],
required: true
},
label: {
type: [String, Number]
},
created: Boolean,
disabled: Boolean
});
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/useOption.mjs
init_shared_esm_bundler();
function useOption(props, states) {
const select = inject(selectKey);
if (!select) {
throwError(COMPONENT_NAME, "usage: <el-select><el-option /></el-select/>");
}
const selectGroup = inject(selectGroupKey, { disabled: false });
const itemSelected = computed(() => {
return contains(castArray_default(select.props.modelValue), props.value);
});
const limitReached = computed(() => {
var _a;
if (select.props.multiple) {
const modelValue = castArray_default((_a = select.props.modelValue) != null ? _a : []);
return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
} else {
return false;
}
});
const currentLabel = computed(() => {
var _a;
return (_a = props.label) != null ? _a : isObject(props.value) ? "" : props.value;
});
const currentValue = computed(() => {
return props.value || props.label || "";
});
const isDisabled = computed(() => {
return props.disabled || states.groupDisabled || limitReached.value;
});
const instance = getCurrentInstance();
const contains = (arr = [], target) => {
if (!isObject(props.value)) {
return arr && arr.includes(target);
} else {
const valueKey = select.props.valueKey;
return arr && arr.some((item) => {
return toRaw(get_default(item, valueKey)) === get_default(target, valueKey);
});
}
};
const hoverItem = () => {
if (!props.disabled && !selectGroup.disabled) {
select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
}
};
const updateOption = (query) => {
const regexp = new RegExp(escapeStringRegexp(query), "i");
states.visible = regexp.test(String(currentLabel.value)) || props.created;
};
watch(() => currentLabel.value, () => {
if (!props.created && !select.props.remote)
select.setSelected();
});
watch(() => props.value, (val, oldVal) => {
const { remote, valueKey } = select.props;
const shouldUpdate = remote ? val !== oldVal : !isEqual_default(val, oldVal);
if (shouldUpdate) {
select.onOptionDestroy(oldVal, instance.proxy);
select.onOptionCreate(instance.proxy);
}
if (!props.created && !remote) {
if (valueKey && isObject(val) && isObject(oldVal) && val[valueKey] === oldVal[valueKey]) {
return;
}
select.setSelected();
}
});
watch(() => selectGroup.disabled, () => {
states.groupDisabled = selectGroup.disabled;
}, { immediate: true });
return {
select,
currentLabel,
currentValue,
itemSelected,
isDisabled,
hoverItem,
updateOption
};
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/option2.mjs
var _sfc_main = defineComponent({
name: COMPONENT_NAME,
componentName: COMPONENT_NAME,
props: optionProps,
setup(props) {
const ns = useNamespace("select");
const id = useId();
const containerKls = computed(() => [
ns.be("dropdown", "item"),
ns.is("disabled", unref(isDisabled)),
ns.is("selected", unref(itemSelected)),
ns.is("hovering", unref(hover))
]);
const states = reactive({
index: -1,
groupDisabled: false,
visible: true,
hover: false
});
const {
currentLabel,
itemSelected,
isDisabled,
select,
hoverItem,
updateOption
} = useOption(props, states);
const { visible, hover } = toRefs(states);
const vm = getCurrentInstance().proxy;
select.onOptionCreate(vm);
onBeforeUnmount(() => {
const key = vm.value;
nextTick(() => {
const { selected: selectedOptions } = select.states;
const doesSelected = selectedOptions.some((item) => {
return item.value === vm.value;
});
if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
select.states.cachedOptions.delete(key);
}
});
select.onOptionDestroy(key, vm);
});
function selectOptionClick() {
if (!isDisabled.value) {
select.handleOptionSelect(vm);
}
}
return {
ns,
id,
containerKls,
currentLabel,
itemSelected,
isDisabled,
select,
visible,
hover,
states,
hoverItem,
updateOption,
selectOptionClick
};
}
});
function _sfc_render(_ctx, _cache) {
return withDirectives((openBlock(), createElementBlock("li", {
id: _ctx.id,
class: normalizeClass(_ctx.containerKls),
role: "option",
"aria-disabled": _ctx.isDisabled || void 0,
"aria-selected": _ctx.itemSelected,
onMousemove: _ctx.hoverItem,
onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createBaseVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
])
], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
[vShow, _ctx.visible]
]);
}
var Option = _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "option.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/select-dropdown.mjs
var _sfc_main2 = defineComponent({
name: "ElSelectDropdown",
componentName: "ElSelectDropdown",
setup() {
const select = inject(selectKey);
const ns = useNamespace("select");
const popperClass = computed(() => select.props.popperClass);
const isMultiple = computed(() => select.props.multiple);
const isFitInputWidth = computed(() => select.props.fitInputWidth);
const minWidth = ref("");
function updateMinWidth() {
var _a;
const offsetWidth = (_a = select.selectRef) == null ? void 0 : _a.offsetWidth;
if (offsetWidth) {
minWidth.value = `${offsetWidth - BORDER_HORIZONTAL_WIDTH}px`;
} else {
minWidth.value = "";
}
}
onMounted(() => {
updateMinWidth();
useResizeObserver(select.selectRef, updateMinWidth);
});
return {
ns,
minWidth,
popperClass,
isMultiple,
isFitInputWidth
};
}
});
function _sfc_render2(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
}, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(_ctx.ns.be("dropdown", "header"))
}, [
renderSlot(_ctx.$slots, "header")
], 2)) : createCommentVNode("v-if", true),
renderSlot(_ctx.$slots, "default"),
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
}, [
renderSlot(_ctx.$slots, "footer")
], 2)) : createCommentVNode("v-if", true)
], 6);
}
var ElSelectMenu = _export_sfc(_sfc_main2, [["render", _sfc_render2], ["__file", "select-dropdown.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/useSelect.mjs
init_shared_esm_bundler();
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/utils/easings.mjs
function easeInOutCubic(t, b, c, d) {
const cc = c - b;
t /= d / 2;
if (t < 1) {
return cc / 2 * t * t * t + b;
}
return cc / 2 * ((t -= 2) * t * t + 2) + b;
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/utils/dom/scroll.mjs
init_shared_esm_bundler();
var isScroll = (el, isVertical) => {
if (!isClient)
return false;
const key = {
undefined: "overflow",
true: "overflow-y",
false: "overflow-x"
}[String(isVertical)];
const overflow = getStyle(el, key);
return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
};
var getScrollContainer = (el, isVertical) => {
if (!isClient)
return;
let parent = el;
while (parent) {
if ([window, document, document.documentElement].includes(parent))
return window;
if (isScroll(parent, isVertical))
return parent;
parent = parent.parentNode;
}
return parent;
};
var scrollBarWidth;
var getScrollBarWidth = (namespace) => {
var _a;
if (!isClient)
return 0;
if (scrollBarWidth !== void 0)
return scrollBarWidth;
const outer = document.createElement("div");
outer.className = `${namespace}-scrollbar__wrap`;
outer.style.visibility = "hidden";
outer.style.width = "100px";
outer.style.position = "absolute";
outer.style.top = "-9999px";
document.body.appendChild(outer);
const widthNoScroll = outer.offsetWidth;
outer.style.overflow = "scroll";
const inner = document.createElement("div");
inner.style.width = "100%";
outer.appendChild(inner);
const widthWithScroll = inner.offsetWidth;
(_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
scrollBarWidth = widthNoScroll - widthWithScroll;
return scrollBarWidth;
};
function scrollIntoView(container, selected) {
if (!isClient)
return;
if (!selected) {
container.scrollTop = 0;
return;
}
const offsetParents = [];
let pointer = selected.offsetParent;
while (pointer !== null && container !== pointer && container.contains(pointer)) {
offsetParents.push(pointer);
pointer = pointer.offsetParent;
}
const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
const bottom = top + selected.offsetHeight;
const viewRectTop = container.scrollTop;
const viewRectBottom = viewRectTop + container.clientHeight;
if (top < viewRectTop) {
container.scrollTop = top;
} else if (bottom > viewRectBottom) {
container.scrollTop = bottom - container.clientHeight;
}
}
function animateScrollTo(container, from, to, duration, callback) {
const startTime = Date.now();
let handle;
const scroll = () => {
const timestamp = Date.now();
const time = timestamp - startTime;
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
if (isWindow(container)) {
container.scrollTo(window.pageXOffset, nextScrollTop);
} else {
container.scrollTop = nextScrollTop;
}
if (time < duration) {
handle = rAF(scroll);
} else if (isFunction(callback)) {
callback();
}
};
scroll();
return () => {
handle && cAF(handle);
};
}
var getScrollElement = (target, container) => {
if (isWindow(container)) {
return target.ownerDocument.documentElement;
}
return container;
};
var getScrollTop = (container) => {
if (isWindow(container)) {
return window.scrollY;
}
return container.scrollTop;
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/useSelect.mjs
var useSelect = (props, emit) => {
const { t } = useLocale();
const contentId = useId();
const nsSelect = useNamespace("select");
const nsInput = useNamespace("input");
const states = reactive({
inputValue: "",
options: /* @__PURE__ */ new Map(),
cachedOptions: /* @__PURE__ */ new Map(),
optionValues: [],
selected: [],
selectionWidth: 0,
collapseItemWidth: 0,
selectedLabel: "",
hoveringIndex: -1,
previousQuery: null,
inputHovering: false,
menuVisibleOnFocus: false,
isBeforeHide: false
});
const selectRef = ref();
const selectionRef = ref();
const tooltipRef = ref();
const tagTooltipRef = ref();
const inputRef = ref();
const prefixRef = ref();
const suffixRef = ref();
const menuRef = ref();
const tagMenuRef = ref();
const collapseItemRef = ref();
const scrollbarRef = ref();
const expanded = ref(false);
const hoverOption = ref();
const debouncing = ref(false);
const { form, formItem } = useFormItem();
const { inputId } = useFormItemInputId(props, {
formItemContext: formItem
});
const { valueOnClear, isEmptyValue } = useEmptyValues(props);
const {
isComposing,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd
} = useComposition({
afterComposition: (e) => onInput(e)
});
const selectDisabled = computed(() => props.disabled || !!(form == null ? void 0 : form.disabled));
const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
disabled: selectDisabled,
afterFocus() {
if (props.automaticDropdown && !expanded.value) {
expanded.value = true;
states.menuVisibleOnFocus = true;
}
},
beforeBlur(event) {
var _a, _b;
return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
},
afterBlur() {
var _a;
expanded.value = false;
states.menuVisibleOnFocus = false;
if (props.validateEvent) {
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
}
}
});
const hasModelValue = computed(() => {
return isArray(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
});
const needStatusIcon = computed(() => {
var _a;
return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
});
const showClearBtn = computed(() => {
return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
});
const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
const debounce = computed(() => props.remote ? props.debounce : 0);
const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
const emptyText = computed(() => {
if (props.loading) {
return props.loadingText || t("el.select.loading");
} else {
if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
return props.noMatchText || t("el.select.noMatch");
}
if (states.options.size === 0) {
return props.noDataText || t("el.select.noData");
}
}
return null;
});
const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
const optionsArray = computed(() => {
const list = Array.from(states.options.values());
const newList = [];
states.optionValues.forEach((item) => {
const index = list.findIndex((i) => i.value === item);
if (index > -1) {
newList.push(list[index]);
}
});
return newList.length >= list.length ? newList : list;
});
const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
const showNewOption = computed(() => {
const hasExistingOption = optionsArray.value.filter((option) => {
return !option.created;
}).some((option) => {
return option.currentLabel === states.inputValue;
});
return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
});
const updateOptions = () => {
if (props.filterable && isFunction(props.filterMethod))
return;
if (props.filterable && props.remote && isFunction(props.remoteMethod))
return;
optionsArray.value.forEach((option) => {
var _a;
(_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
});
};
const selectSize = useFormSize();
const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
const dropdownMenuVisible = computed({
get() {
return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
},
set(val) {
expanded.value = val;
}
});
const shouldShowPlaceholder = computed(() => {
if (props.multiple && !isUndefined(props.modelValue)) {
return castArray_default(props.modelValue).length === 0 && !states.inputValue;
}
const value = isArray(props.modelValue) ? props.modelValue[0] : props.modelValue;
return props.filterable || isUndefined(value) ? !states.inputValue : true;
});
const currentPlaceholder = computed(() => {
var _a;
const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
});
const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
watch(() => props.modelValue, (val, oldVal) => {
if (props.multiple) {
if (props.filterable && !props.reserveKeyword) {
states.inputValue = "";
handleQueryChange("");
}
}
setSelected();
if (!isEqual_default(val, oldVal) && props.validateEvent) {
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
}
}, {
flush: "post",
deep: true
});
watch(() => expanded.value, (val) => {
if (val) {
handleQueryChange(states.inputValue);
} else {
states.inputValue = "";
states.previousQuery = null;
states.isBeforeHide = true;
}
emit("visible-change", val);
});
watch(() => states.options.entries(), () => {
if (!isClient)
return;
setSelected();
if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
checkDefaultFirstOption();
}
}, {
flush: "post"
});
watch([() => states.hoveringIndex, optionsArray], ([val]) => {
if (isNumber(val) && val > -1) {
hoverOption.value = optionsArray.value[val] || {};
} else {
hoverOption.value = {};
}
optionsArray.value.forEach((option) => {
option.hover = hoverOption.value === option;
});
});
watchEffect(() => {
if (states.isBeforeHide)
return;
updateOptions();
});
const handleQueryChange = (val) => {
if (states.previousQuery === val || isComposing.value) {
return;
}
states.previousQuery = val;
if (props.filterable && isFunction(props.filterMethod)) {
props.filterMethod(val);
} else if (props.filterable && props.remote && isFunction(props.remoteMethod)) {
props.remoteMethod(val);
}
if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
nextTick(checkDefaultFirstOption);
} else {
nextTick(updateHoveringIndex);
}
};
const checkDefaultFirstOption = () => {
const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
const userCreatedOption = optionsInDropdown.find((n) => n.created);
const firstOriginOption = optionsInDropdown[0];
const valueList = optionsArray.value.map((item) => item.value);
states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
};
const setSelected = () => {
if (!props.multiple) {
const value = isArray(props.modelValue) ? props.modelValue[0] : props.modelValue;
const option = getOption(value);
states.selectedLabel = option.currentLabel;
states.selected = [option];
return;
} else {
states.selectedLabel = "";
}
const result = [];
if (!isUndefined(props.modelValue)) {
castArray_default(props.modelValue).forEach((value) => {
result.push(getOption(value));
});
}
states.selected = result;
};
const getOption = (value) => {
let option;
const isObjectValue = isPlainObject(value);
for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
const cachedOption = cachedOptionsArray.value[i];
const isEqualValue = isObjectValue ? get_default(cachedOption.value, props.valueKey) === get_default(value, props.valueKey) : cachedOption.value === value;
if (isEqualValue) {
option = {
index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
value,
currentLabel: cachedOption.currentLabel,
get isDisabled() {
return cachedOption.isDisabled;
}
};
break;
}
}
if (option)
return option;
const label = isObjectValue ? value.label : value != null ? value : "";
const newOption = {
index: -1,
value,
currentLabel: label
};
return newOption;
};
const updateHoveringIndex = () => {
states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
};
const resetSelectionWidth = () => {
states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
};
const resetCollapseItemWidth = () => {
states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
};
const updateTooltip = () => {
var _a, _b;
(_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
};
const updateTagTooltip = () => {
var _a, _b;
(_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
};
const onInputChange = () => {
if (states.inputValue.length > 0 && !expanded.value) {
expanded.value = true;
}
handleQueryChange(states.inputValue);
};
const onInput = (event) => {
states.inputValue = event.target.value;
if (props.remote) {
debouncing.value = true;
debouncedOnInputChange();
} else {
return onInputChange();
}
};
const debouncedOnInputChange = useDebounceFn(() => {
onInputChange();
debouncing.value = false;
}, debounce);
const emitChange = (val) => {
if (!isEqual_default(props.modelValue, val)) {
emit(CHANGE_EVENT, val);
}
};
const getLastNotDisabledIndex = (value) => findLastIndex_default(value, (it) => {
const option = states.cachedOptions.get(it);
return option && !option.disabled && !option.states.groupDisabled;
});
const deletePrevTag = (e) => {
const code = getEventCode(e);
if (!props.multiple)
return;
if (code === EVENT_CODE.delete)
return;
if (e.target.value.length <= 0) {
const value = castArray_default(props.modelValue).slice();
const lastNotDisabledIndex = getLastNotDisabledIndex(value);
if (lastNotDisabledIndex < 0)
return;
const removeTagValue = value[lastNotDisabledIndex];
value.splice(lastNotDisabledIndex, 1);
emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
emit("remove-tag", removeTagValue);
}
};
const deleteTag = (event, tag) => {
const index = states.selected.indexOf(tag);
if (index > -1 && !selectDisabled.value) {
const value = castArray_default(props.modelValue).slice();
value.splice(index, 1);
emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
emit("remove-tag", tag.value);
}
event.stopPropagation();
focus();
};
const deleteSelected = (event) => {
event.stopPropagation();
const value = props.multiple ? [] : valueOnClear.value;
if (props.multiple) {
for (const item of states.selected) {
if (item.isDisabled)
value.push(item.value);
}
}
emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
states.hoveringIndex = -1;
expanded.value = false;
emit("clear");
focus();
};
const handleOptionSelect = (option) => {
var _a;
if (props.multiple) {
const value = castArray_default((_a = props.modelValue) != null ? _a : []).slice();
const optionIndex = getValueIndex(value, option);
if (optionIndex > -1) {
value.splice(optionIndex, 1);
} else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
value.push(option.value);
}
emit(UPDATE_MODEL_EVENT, value);
emitChange(value);
if (option.created) {
handleQueryChange("");
}
if (props.filterable && !props.reserveKeyword) {
states.inputValue = "";
}
} else {
!isEqual_default(props.modelValue, option.value) && emit(UPDATE_MODEL_EVENT, option.value);
emitChange(option.value);
expanded.value = false;
}
focus();
if (expanded.value)
return;
nextTick(() => {
scrollToOption(option);
});
};
const getValueIndex = (arr, option) => {
if (isUndefined(option))
return -1;
if (!isObject(option.value))
return arr.indexOf(option.value);
return arr.findIndex((item) => {
return isEqual_default(get_default(item, props.valueKey), getValueKey(option));
});
};
const scrollToOption = (option) => {
var _a, _b, _c, _d, _e;
const targetOption = isArray(option) ? option[0] : option;
let target = null;
if (!isNil_default(targetOption == null ? void 0 : targetOption.value)) {
const options = optionsArray.value.filter((item) => item.value === targetOption.value);
if (options.length > 0) {
target = options[0].$el;
}
}
if (tooltipRef.value && target) {
const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
if (menu) {
scrollIntoView(menu, target);
}
}
(_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
};
const onOptionCreate = (vm) => {
states.options.set(vm.value, vm);
states.cachedOptions.set(vm.value, vm);
};
const onOptionDestroy = (key, vm) => {
if (states.options.get(key) === vm) {
states.options.delete(key);
}
};
const popperRef = computed(() => {
var _a, _b;
return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
});
const handleMenuEnter = () => {
states.isBeforeHide = false;
nextTick(() => {
var _a;
(_a = scrollbarRef.value) == null ? void 0 : _a.update();
scrollToOption(states.selected);
});
};
const focus = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.focus();
};
const blur = () => {
var _a;
if (expanded.value) {
expanded.value = false;
nextTick(() => {
var _a2;
return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
});
return;
}
(_a = inputRef.value) == null ? void 0 : _a.blur();
};
const handleClearClick = (event) => {
deleteSelected(event);
};
const handleClickOutside = (event) => {
expanded.value = false;
if (isFocused.value) {
const _event = new FocusEvent("blur", event);
nextTick(() => handleBlur(_event));
}
};
const handleEsc = () => {
if (states.inputValue.length > 0) {
states.inputValue = "";
} else {
expanded.value = false;
}
};
const toggleMenu = () => {
if (selectDisabled.value)
return;
if (isIOS)
states.inputHovering = true;
if (states.menuVisibleOnFocus) {
states.menuVisibleOnFocus = false;
} else {
expanded.value = !expanded.value;
}
};
const selectOption = () => {
if (!expanded.value) {
toggleMenu();
} else {
const option = optionsArray.value[states.hoveringIndex];
if (option && !option.isDisabled) {
handleOptionSelect(option);
}
}
};
const getValueKey = (item) => {
return isObject(item.value) ? get_default(item.value, props.valueKey) : item.value;
};
const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
const showTagList = computed(() => {
if (!props.multiple) {
return [];
}
return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
});
const collapseTagList = computed(() => {
if (!props.multiple) {
return [];
}
return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
});
const navigateOptions = (direction) => {
if (!expanded.value) {
expanded.value = true;
return;
}
if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
return;
if (!optionsAllDisabled.value) {
if (direction === "next") {
states.hoveringIndex++;
if (states.hoveringIndex === states.options.size) {
states.hoveringIndex = 0;
}
} else if (direction === "prev") {
states.hoveringIndex--;
if (states.hoveringIndex < 0) {
states.hoveringIndex = states.options.size - 1;
}
}
const option = optionsArray.value[states.hoveringIndex];
if (option.isDisabled || !option.visible) {
navigateOptions(direction);
}
nextTick(() => scrollToOption(hoverOption.value));
}
};
const findFocusableIndex = (arr, start, step, len) => {
for (let i = start; i >= 0 && i < len; i += step) {
const obj = arr[i];
if (!(obj == null ? void 0 : obj.isDisabled) && (obj == null ? void 0 : obj.visible)) {
return i;
}
}
return null;
};
const focusOption = (targetIndex, mode) => {
var _a;
const len = states.options.size;
if (len === 0)
return;
const start = clamp_default(targetIndex, 0, len - 1);
const options = optionsArray.value;
const direction = mode === "up" ? -1 : 1;
const newIndex = (_a = findFocusableIndex(options, start, direction, len)) != null ? _a : findFocusableIndex(options, start - direction, -direction, len);
if (newIndex != null) {
states.hoveringIndex = newIndex;
nextTick(() => scrollToOption(hoverOption.value));
}
};
const handleKeydown = (e) => {
const code = getEventCode(e);
let isPreventDefault = true;
switch (code) {
case EVENT_CODE.up:
navigateOptions("prev");
break;
case EVENT_CODE.down:
navigateOptions("next");
break;
case EVENT_CODE.enter:
selectOption();
break;
case EVENT_CODE.esc:
handleEsc();
break;
case EVENT_CODE.backspace:
isPreventDefault = false;
deletePrevTag(e);
return;
case EVENT_CODE.home:
if (!expanded.value)
return;
focusOption(0, "down");
break;
case EVENT_CODE.end:
if (!expanded.value)
return;
focusOption(states.options.size - 1, "up");
break;
case EVENT_CODE.pageUp:
if (!expanded.value)
return;
focusOption(states.hoveringIndex - 10, "up");
break;
case EVENT_CODE.pageDown:
if (!expanded.value)
return;
focusOption(states.hoveringIndex + 10, "down");
break;
default:
isPreventDefault = false;
break;
}
if (isPreventDefault) {
e.preventDefault();
e.stopPropagation();
}
};
const getGapWidth = () => {
if (!selectionRef.value)
return 0;
const style = window.getComputedStyle(selectionRef.value);
return Number.parseFloat(style.gap || "6px");
};
const tagStyle = computed(() => {
const gapWidth = getGapWidth();
const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
return { maxWidth: `${maxWidth}px` };
});
const collapseTagStyle = computed(() => {
return { maxWidth: `${states.selectionWidth}px` };
});
const popupScroll = (data) => {
emit("popup-scroll", data);
};
useResizeObserver(selectionRef, resetSelectionWidth);
useResizeObserver(wrapperRef, updateTooltip);
useResizeObserver(tagMenuRef, updateTagTooltip);
useResizeObserver(collapseItemRef, resetCollapseItemWidth);
let stop;
watch(() => dropdownMenuVisible.value, (newVal) => {
if (newVal) {
stop = useResizeObserver(menuRef, updateTooltip).stop;
} else {
stop == null ? void 0 : stop();
stop = void 0;
}
});
onMounted(() => {
setSelected();
});
return {
inputId,
contentId,
nsSelect,
nsInput,
states,
isFocused,
expanded,
optionsArray,
hoverOption,
selectSize,
filteredOptionsCount,
updateTooltip,
updateTagTooltip,
debouncedOnInputChange,
onInput,
deletePrevTag,
deleteTag,
deleteSelected,
handleOptionSelect,
scrollToOption,
hasModelValue,
shouldShowPlaceholder,
currentPlaceholder,
mouseEnterEventName,
needStatusIcon,
showClearBtn,
iconComponent,
iconReverse,
validateState,
validateIcon,
showNewOption,
updateOptions,
collapseTagSize,
setSelected,
selectDisabled,
emptyText,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd,
handleKeydown,
onOptionCreate,
onOptionDestroy,
handleMenuEnter,
focus,
blur,
handleClearClick,
handleClickOutside,
handleEsc,
toggleMenu,
selectOption,
getValueKey,
navigateOptions,
dropdownMenuVisible,
showTagList,
collapseTagList,
popupScroll,
getOption,
tagStyle,
collapseTagStyle,
popperRef,
inputRef,
tooltipRef,
tagTooltipRef,
prefixRef,
suffixRef,
selectRef,
wrapperRef,
selectionRef,
scrollbarRef,
menuRef,
tagMenuRef,
collapseItemRef
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/options.mjs
init_shared_esm_bundler();
var ElOptions = defineComponent({
name: "ElOptions",
setup(_, { slots }) {
const select = inject(selectKey);
let cachedValueList = [];
return () => {
var _a, _b;
const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
const valueList = [];
function filterOptions(children2) {
if (!isArray(children2))
return;
children2.forEach((item) => {
var _a2, _b2, _c, _d;
const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
if (name === "ElOptionGroup") {
filterOptions(!isString(item.children) && !isArray(item.children) && isFunction((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
} else if (name === "ElOption") {
valueList.push((_d = item.props) == null ? void 0 : _d.value);
} else if (isArray(item.children)) {
filterOptions(item.children);
}
});
}
if (children.length) {
filterOptions((_b = children[0]) == null ? void 0 : _b.children);
}
if (!isEqual_default(valueList, cachedValueList)) {
cachedValueList = valueList;
if (select) {
select.states.optionValues = valueList;
}
}
return children;
};
}
});
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/select.mjs
var selectProps = buildProps({
name: String,
id: String,
modelValue: {
type: definePropType([
Array,
String,
Number,
Boolean,
Object
]),
default: void 0
},
autocomplete: {
type: String,
default: "off"
},
automaticDropdown: Boolean,
size: useSizeProp,
effect: {
type: definePropType(String),
default: "light"
},
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperStyle: {
type: definePropType([String, Object])
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
remote: Boolean,
debounce: {
type: Number,
default: 300
},
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: {
type: definePropType(Function)
},
filterMethod: {
type: definePropType(Function)
},
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String
},
defaultFirstOption: Boolean,
reserveKeyword: {
type: Boolean,
default: true
},
valueKey: {
type: String,
default: "value"
},
collapseTags: Boolean,
collapseTagsTooltip: Boolean,
maxCollapseTags: {
type: Number,
default: 1
},
teleported: useTooltipContentProps.teleported,
persistent: {
type: Boolean,
default: true
},
clearIcon: {
type: iconPropType,
default: circle_close_default
},
fitInputWidth: Boolean,
suffixIcon: {
type: iconPropType,
default: arrow_down_default
},
tagType: { ...tagProps.type, default: "info" },
tagEffect: { ...tagProps.effect, default: "light" },
validateEvent: {
type: Boolean,
default: true
},
remoteShowSuffix: Boolean,
showArrow: {
type: Boolean,
default: true
},
offset: {
type: Number,
default: 12
},
placement: {
type: definePropType(String),
values: Ee,
default: "bottom-start"
},
fallbackPlacements: {
type: definePropType(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
tabindex: {
type: [String, Number],
default: 0
},
appendTo: useTooltipContentProps.appendTo,
options: {
type: definePropType(Array)
},
props: {
type: definePropType(Object),
default: () => defaultProps
},
...useEmptyValuesProps,
...useAriaProps(["ariaLabel"])
});
var selectEmits = {
[UPDATE_MODEL_EVENT]: (val) => true,
[CHANGE_EVENT]: (val) => true,
"popup-scroll": scrollbarEmits.scroll,
"remove-tag": (val) => true,
"visible-change": (visible) => true,
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/option-group.mjs
init_shared_esm_bundler();
var _sfc_main3 = defineComponent({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: Boolean
},
setup(props) {
const ns = useNamespace("select");
const groupRef = ref();
const instance = getCurrentInstance();
const children = ref([]);
provide(selectGroupKey, reactive({
...toRefs(props)
}));
const visible = computed(() => children.value.some((option) => option.visible === true));
const isOption = (node) => {
var _a;
return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
};
const flattedChildren2 = (node) => {
const nodes = castArray_default(node);
const children2 = [];
nodes.forEach((child) => {
var _a;
if (!isVNode(child))
return;
if (isOption(child)) {
children2.push(child.component.proxy);
} else if (isArray(child.children) && child.children.length) {
children2.push(...flattedChildren2(child.children));
} else if ((_a = child.component) == null ? void 0 : _a.subTree) {
children2.push(...flattedChildren2(child.component.subTree));
}
});
return children2;
};
const updateChildren = () => {
children.value = flattedChildren2(instance.subTree);
};
onMounted(() => {
updateChildren();
});
useMutationObserver(groupRef, updateChildren, {
attributes: true,
subtree: true,
childList: true
});
return {
groupRef,
visible,
ns
};
}
});
function _sfc_render3(_ctx, _cache, $props, $setup, $data, $options) {
return withDirectives((openBlock(), createElementBlock("ul", {
ref: "groupRef",
class: normalizeClass(_ctx.ns.be("group", "wrap"))
}, [
createBaseVNode("li", {
class: normalizeClass(_ctx.ns.be("group", "title"))
}, toDisplayString(_ctx.label), 3),
createBaseVNode("li", null, [
createBaseVNode("ul", {
class: normalizeClass(_ctx.ns.b("group"))
}, [
renderSlot(_ctx.$slots, "default")
], 2)
])
], 2)), [
[vShow, _ctx.visible]
]);
}
var OptionGroup = _export_sfc(_sfc_main3, [["render", _sfc_render3], ["__file", "option-group.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/src/select2.mjs
init_shared_esm_bundler();
var COMPONENT_NAME2 = "ElSelect";
var _sfc_main4 = defineComponent({
name: COMPONENT_NAME2,
componentName: COMPONENT_NAME2,
components: {
ElSelectMenu,
ElOption: Option,
ElOptions,
ElOptionGroup: OptionGroup,
ElTag,
ElScrollbar,
ElTooltip,
ElIcon
},
directives: { ClickOutside },
props: selectProps,
emits: [
UPDATE_MODEL_EVENT,
CHANGE_EVENT,
"remove-tag",
"clear",
"visible-change",
"focus",
"blur",
"popup-scroll"
],
setup(props, { emit, slots }) {
const instance = getCurrentInstance();
const originalWarnHandler = instance.appContext.config.warnHandler;
instance.appContext.config.warnHandler = (...args) => {
if (!args[0] || args[0].includes('Slot "default" invoked outside of the render function')) {
return;
}
console.warn(...args);
};
const modelValue = computed(() => {
const { modelValue: rawModelValue, multiple } = props;
const fallback = multiple ? [] : void 0;
if (isArray(rawModelValue)) {
return multiple ? rawModelValue : fallback;
}
return multiple ? fallback : rawModelValue;
});
const _props = reactive({
...toRefs(props),
modelValue
});
const API = useSelect(_props, emit);
const { calculatorRef, inputStyle } = useCalcInputWidth();
const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
const getOptionProps = (option) => ({
label: getLabel(option),
value: getValue(option),
disabled: getDisabled(option)
});
const flatTreeSelectData = (data) => {
return data.reduce((acc, item) => {
acc.push(item);
if (item.children && item.children.length > 0) {
acc.push(...flatTreeSelectData(item.children));
}
return acc;
}, []);
};
const manuallyRenderSlots = (vnodes) => {
const children = flattedChildren(vnodes || []);
children.forEach((item) => {
var _a;
if (isObject(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
const _name = item.type.name;
if (_name === "ElTree") {
const treeData = ((_a = item.props) == null ? void 0 : _a.data) || [];
const flatData = flatTreeSelectData(treeData);
flatData.forEach((treeItem) => {
treeItem.currentLabel = treeItem.label || (isObject(treeItem.value) ? "" : treeItem.value);
API.onOptionCreate(treeItem);
});
} else if (_name === "ElOption") {
const obj = { ...item.props };
obj.currentLabel = obj.label || (isObject(obj.value) ? "" : obj.value);
API.onOptionCreate(obj);
}
}
});
};
watch(() => {
var _a;
return [(_a = slots.default) == null ? void 0 : _a.call(slots), modelValue.value];
}, () => {
var _a;
if (props.persistent || API.states.options.size > 0) {
return;
}
manuallyRenderSlots((_a = slots.default) == null ? void 0 : _a.call(slots));
}, {
immediate: true
});
provide(selectKey, reactive({
props: _props,
states: API.states,
selectRef: API.selectRef,
optionsArray: API.optionsArray,
setSelected: API.setSelected,
handleOptionSelect: API.handleOptionSelect,
onOptionCreate: API.onOptionCreate,
onOptionDestroy: API.onOptionDestroy
}));
const selectedLabel = computed(() => {
if (!props.multiple) {
return API.states.selectedLabel;
}
return API.states.selected.map((i) => i.currentLabel);
});
onBeforeUnmount(() => {
instance.appContext.config.warnHandler = originalWarnHandler;
});
return {
...API,
modelValue,
selectedLabel,
calculatorRef,
inputStyle,
getLabel,
getValue,
getOptions,
getDisabled,
getOptionProps
};
}
});
function _sfc_render4(_ctx, _cache) {
const _component_el_tag = resolveComponent("el-tag");
const _component_el_tooltip = resolveComponent("el-tooltip");
const _component_el_icon = resolveComponent("el-icon");
const _component_el_option = resolveComponent("el-option");
const _component_el_option_group = resolveComponent("el-option-group");
const _component_el_options = resolveComponent("el-options");
const _component_el_scrollbar = resolveComponent("el-scrollbar");
const _component_el_select_menu = resolveComponent("el-select-menu");
const _directive_click_outside = resolveDirective("click-outside");
return withDirectives((openBlock(), createElementBlock("div", {
ref: "selectRef",
class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
[toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
onMouseleave: ($event) => _ctx.states.inputHovering = false
}, [
createVNode(_component_el_tooltip, {
ref: "tooltipRef",
visible: _ctx.dropdownMenuVisible,
placement: _ctx.placement,
teleported: _ctx.teleported,
"popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
"popper-style": _ctx.popperStyle,
"popper-options": _ctx.popperOptions,
"fallback-placements": _ctx.fallbackPlacements,
effect: _ctx.effect,
pure: "",
trigger: "click",
transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
"stop-popper-mouse-event": false,
"gpu-acceleration": false,
persistent: _ctx.persistent,
"append-to": _ctx.appendTo,
"show-arrow": _ctx.showArrow,
offset: _ctx.offset,
onBeforeShow: _ctx.handleMenuEnter,
onHide: ($event) => _ctx.states.isBeforeHide = false
}, {
default: withCtx(() => {
var _a;
return [
createBaseVNode("div", {
ref: "wrapperRef",
class: normalizeClass([
_ctx.nsSelect.e("wrapper"),
_ctx.nsSelect.is("focused", _ctx.isFocused),
_ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
_ctx.nsSelect.is("filterable", _ctx.filterable),
_ctx.nsSelect.is("disabled", _ctx.selectDisabled)
]),
onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
}, [
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
key: 0,
ref: "prefixRef",
class: normalizeClass(_ctx.nsSelect.e("prefix"))
}, [
renderSlot(_ctx.$slots, "prefix")
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("div", {
ref: "selectionRef",
class: normalizeClass([
_ctx.nsSelect.e("selection"),
_ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
])
}, [
_ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
key: 0,
data: _ctx.states.selected,
deleteTag: _ctx.deleteTag,
selectDisabled: _ctx.selectDisabled
}, () => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
return openBlock(), createElementBlock("div", {
key: _ctx.getValueKey(item),
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
}, [
createVNode(_component_el_tag, {
closable: !_ctx.selectDisabled && !item.isDisabled,
size: _ctx.collapseTagSize,
type: _ctx.tagType,
effect: _ctx.tagEffect,
"disable-transitions": "",
style: normalizeStyle(_ctx.tagStyle),
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
}, [
renderSlot(_ctx.$slots, "label", {
index: item.index,
label: item.currentLabel,
value: item.value
}, () => [
createTextVNode(toDisplayString(item.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
], 2);
}), 128)),
_ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
key: 0,
ref: "tagTooltipRef",
disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
"fallback-placements": ["bottom", "top", "right", "left"],
effect: _ctx.effect,
placement: "bottom",
"popper-class": _ctx.popperClass,
"popper-style": _ctx.popperStyle,
teleported: _ctx.teleported
}, {
default: withCtx(() => [
createBaseVNode("div", {
ref: "collapseItemRef",
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
}, [
createVNode(_component_el_tag, {
closable: false,
size: _ctx.collapseTagSize,
type: _ctx.tagType,
effect: _ctx.tagEffect,
"disable-transitions": "",
style: normalizeStyle(_ctx.collapseTagStyle)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
}, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
]),
_: 1
}, 8, ["size", "type", "effect", "style"])
], 2)
]),
content: withCtx(() => [
createBaseVNode("div", {
ref: "tagMenuRef",
class: normalizeClass(_ctx.nsSelect.e("selection"))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
return openBlock(), createElementBlock("div", {
key: _ctx.getValueKey(item),
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
}, [
createVNode(_component_el_tag, {
class: "in-tooltip",
closable: !_ctx.selectDisabled && !item.isDisabled,
size: _ctx.collapseTagSize,
type: _ctx.tagType,
effect: _ctx.tagEffect,
"disable-transitions": "",
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(_ctx.nsSelect.e("tags-text"))
}, [
renderSlot(_ctx.$slots, "label", {
index: item.index,
label: item.currentLabel,
value: item.value
}, () => [
createTextVNode(toDisplayString(item.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "onClose"])
], 2);
}), 128))
], 2)
]),
_: 3
}, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : createCommentVNode("v-if", true)
]) : createCommentVNode("v-if", true),
createBaseVNode("div", {
class: normalizeClass([
_ctx.nsSelect.e("selected-item"),
_ctx.nsSelect.e("input-wrapper"),
_ctx.nsSelect.is("hidden", !_ctx.filterable)
])
}, [
withDirectives(createBaseVNode("input", {
id: _ctx.inputId,
ref: "inputRef",
"onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
type: "text",
name: _ctx.name,
class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
disabled: _ctx.selectDisabled,
autocomplete: _ctx.autocomplete,
style: normalizeStyle(_ctx.inputStyle),
tabindex: _ctx.tabindex,
role: "combobox",
readonly: !_ctx.filterable,
spellcheck: "false",
"aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
"aria-controls": _ctx.contentId,
"aria-expanded": _ctx.dropdownMenuVisible,
"aria-label": _ctx.ariaLabel,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
onKeydown: _ctx.handleKeydown,
onCompositionstart: _ctx.handleCompositionStart,
onCompositionupdate: _ctx.handleCompositionUpdate,
onCompositionend: _ctx.handleCompositionEnd,
onInput: _ctx.onInput,
onClick: withModifiers(_ctx.toggleMenu, ["stop"])
}, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
[vModelText, _ctx.states.inputValue]
]),
_ctx.filterable ? (openBlock(), createElementBlock("span", {
key: 0,
ref: "calculatorRef",
"aria-hidden": "true",
class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
textContent: toDisplayString(_ctx.states.inputValue)
}, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
], 2),
_ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([
_ctx.nsSelect.e("selected-item"),
_ctx.nsSelect.e("placeholder"),
_ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
])
}, [
_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
key: 0,
index: _ctx.getOption(_ctx.modelValue).index,
label: _ctx.currentPlaceholder,
value: _ctx.modelValue
}, () => [
createBaseVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
], 2)) : createCommentVNode("v-if", true)
], 2),
createBaseVNode("div", {
ref: "suffixRef",
class: normalizeClass(_ctx.nsSelect.e("suffix"))
}, [
_ctx.iconComponent && !_ctx.showClearBtn ? (openBlock(), createBlock(_component_el_icon, {
key: 0,
class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
_ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
key: 1,
class: normalizeClass([
_ctx.nsSelect.e("caret"),
_ctx.nsSelect.e("icon"),
_ctx.nsSelect.e("clear")
]),
onClick: _ctx.handleClearClick
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
_ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
key: 2,
class: normalizeClass([
_ctx.nsInput.e("icon"),
_ctx.nsInput.e("validateIcon"),
_ctx.nsInput.is("loading", _ctx.validateState === "validating")
])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 10, ["onClick"])
];
}),
content: withCtx(() => [
createVNode(_component_el_select_menu, { ref: "menuRef" }, {
default: withCtx(() => [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(_ctx.$slots, "header")
], 10, ["onClick"])) : createCommentVNode("v-if", true),
withDirectives(createVNode(_component_el_scrollbar, {
id: _ctx.contentId,
ref: "scrollbarRef",
tag: "ul",
"wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
"view-class": _ctx.nsSelect.be("dropdown", "list"),
class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
role: "listbox",
"aria-label": _ctx.ariaLabel,
"aria-orientation": "vertical",
onScroll: _ctx.popupScroll
}, {
default: withCtx(() => [
_ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
key: 0,
value: _ctx.states.inputValue,
created: true
}, null, 8, ["value"])) : createCommentVNode("v-if", true),
createVNode(_component_el_options, null, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
var _a;
return openBlock(), createElementBlock(Fragment, { key: index }, [
((_a = _ctx.getOptions(option)) == null ? void 0 : _a.length) ? (openBlock(), createBlock(_component_el_option_group, {
key: 0,
label: _ctx.getLabel(option),
disabled: _ctx.getDisabled(option)
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getOptions(option), (item) => {
return openBlock(), createBlock(_component_el_option, mergeProps({
key: _ctx.getValue(item)
}, _ctx.getOptionProps(item)), null, 16);
}), 128))
]),
_: 2
}, 1032, ["label", "disabled"])) : (openBlock(), createBlock(_component_el_option, normalizeProps(mergeProps({ key: 1 }, _ctx.getOptionProps(option))), null, 16))
], 64);
}), 128))
])
]),
_: 3
})
]),
_: 3
}, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
[vShow, _ctx.states.options.size > 0 && !_ctx.loading]
]),
_ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
}, [
renderSlot(_ctx.$slots, "loading")
], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
}, [
renderSlot(_ctx.$slots, "empty", {}, () => [
createBaseVNode("span", null, toDisplayString(_ctx.emptyText), 1)
])
], 2)) : createCommentVNode("v-if", true),
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 3,
class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(_ctx.$slots, "footer")
], 10, ["onClick"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 512)
]),
_: 3
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
], 16, ["onMouseleave"])), [
[_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
]);
}
var Select = _export_sfc(_sfc_main4, [["render", _sfc_render4], ["__file", "select.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/select/index.mjs
var ElSelect = withInstall(Select, {
Option,
OptionGroup
});
var ElOption = withNoopInstall(Option);
var ElOptionGroup = withNoopInstall(OptionGroup);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/util.mjs
var NODE_KEY = "$treeNodeId";
var markNodeData = function(node, data) {
if (!data || data[NODE_KEY])
return;
Object.defineProperty(data, NODE_KEY, {
value: node.id,
enumerable: false,
configurable: false,
writable: false
});
};
var getNodeKey = (key, data) => data == null ? void 0 : data[key || NODE_KEY];
var handleCurrentChange = (store, emit, setCurrent) => {
const preCurrentNode = store.value.currentNode;
setCurrent();
const currentNode = store.value.currentNode;
if (preCurrentNode === currentNode)
return;
emit("current-change", currentNode ? currentNode.data : null, currentNode);
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/node.mjs
init_shared_esm_bundler();
var getChildState = (node) => {
let all = true;
let none = true;
let allWithoutDisable = true;
for (let i = 0, j = node.length; i < j; i++) {
const n = node[i];
if (n.checked !== true || n.indeterminate) {
all = false;
if (!n.disabled) {
allWithoutDisable = false;
}
}
if (n.checked !== false || n.indeterminate) {
none = false;
}
}
return { all, none, allWithoutDisable, half: !all && !none };
};
var reInitChecked = function(node) {
if (node.childNodes.length === 0 || node.loading)
return;
const { all, none, half } = getChildState(node.childNodes);
if (all) {
node.checked = true;
node.indeterminate = false;
} else if (half) {
node.checked = false;
node.indeterminate = true;
} else if (none) {
node.checked = false;
node.indeterminate = false;
}
const parent = node.parent;
if (!parent || parent.level === 0)
return;
if (!node.store.checkStrictly) {
reInitChecked(parent);
}
};
var getPropertyFromData = function(node, prop) {
const props = node.store.props;
const data = node.data || {};
const config = props[prop];
if (isFunction(config)) {
return config(data, node);
} else if (isString(config)) {
return data[config];
} else if (isUndefined(config)) {
const dataProp = data[prop];
return isUndefined(dataProp) ? "" : dataProp;
}
};
var setCanFocus = function(childNodes, focus) {
childNodes.forEach((item) => {
item.canFocus = focus;
setCanFocus(item.childNodes, focus);
});
};
var nodeIdSeed = 0;
var Node = class _Node {
constructor(options) {
this.isLeafByUser = void 0;
this.isLeaf = void 0;
this.id = nodeIdSeed++;
this.text = null;
this.checked = false;
this.indeterminate = false;
this.data = null;
this.expanded = false;
this.parent = null;
this.visible = true;
this.isCurrent = false;
this.canFocus = false;
for (const name in options) {
if (hasOwn(options, name)) {
this[name] = options[name];
}
}
this.level = 0;
this.loaded = false;
this.childNodes = [];
this.loading = false;
if (this.parent) {
this.level = this.parent.level + 1;
}
}
initialize() {
var _a;
const store = this.store;
if (!store) {
throw new Error("[Node]store is required!");
}
store.registerNode(this);
const props = store.props;
if (props && typeof props.isLeaf !== "undefined") {
const isLeaf = getPropertyFromData(this, "isLeaf");
if (isBoolean(isLeaf)) {
this.isLeafByUser = isLeaf;
}
}
if (store.lazy !== true && this.data) {
this.setData(this.data);
if (store.defaultExpandAll) {
this.expanded = true;
this.canFocus = true;
}
} else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
this.expand();
}
if (!isArray(this.data)) {
markNodeData(this, this.data);
}
if (!this.data)
return;
const defaultExpandedKeys = store.defaultExpandedKeys;
const key = store.key;
if (key && !isNil_default(this.key) && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
this.expand(null, store.autoExpandParent);
}
if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
store.currentNode = this;
store.currentNode.isCurrent = true;
}
if (store.lazy) {
store._initDefaultCheckedNode(this);
}
this.updateLeafState();
if (this.level === 1 || ((_a = this.parent) == null ? void 0 : _a.expanded) === true)
this.canFocus = true;
}
setData(data) {
if (!isArray(data)) {
markNodeData(this, data);
}
this.data = data;
this.childNodes = [];
let children;
if (this.level === 0 && isArray(this.data)) {
children = this.data;
} else {
children = getPropertyFromData(this, "children") || [];
}
for (let i = 0, j = children.length; i < j; i++) {
this.insertChild({ data: children[i] });
}
}
get label() {
return getPropertyFromData(this, "label");
}
get key() {
const nodeKey = this.store.key;
if (this.data)
return this.data[nodeKey];
return null;
}
get disabled() {
return getPropertyFromData(this, "disabled");
}
get nextSibling() {
const parent = this.parent;
if (parent) {
const index = parent.childNodes.indexOf(this);
if (index > -1) {
return parent.childNodes[index + 1];
}
}
return null;
}
get previousSibling() {
const parent = this.parent;
if (parent) {
const index = parent.childNodes.indexOf(this);
if (index > -1) {
return index > 0 ? parent.childNodes[index - 1] : null;
}
}
return null;
}
contains(target, deep = true) {
return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
}
remove() {
const parent = this.parent;
if (parent) {
parent.removeChild(this);
}
}
insertChild(child, index, batch) {
if (!child)
throw new Error("InsertChild error: child is required.");
if (!(child instanceof _Node)) {
if (!batch) {
const children = this.getChildren(true);
if (!(children == null ? void 0 : children.includes(child.data))) {
if (isUndefined(index) || index < 0) {
children == null ? void 0 : children.push(child.data);
} else {
children == null ? void 0 : children.splice(index, 0, child.data);
}
}
}
Object.assign(child, {
parent: this,
store: this.store
});
child = reactive(new _Node(child));
if (child instanceof _Node) {
child.initialize();
}
}
child.level = this.level + 1;
if (isUndefined(index) || index < 0) {
this.childNodes.push(child);
} else {
this.childNodes.splice(index, 0, child);
}
this.updateLeafState();
}
insertBefore(child, ref2) {
let index;
if (ref2) {
index = this.childNodes.indexOf(ref2);
}
this.insertChild(child, index);
}
insertAfter(child, ref2) {
let index;
if (ref2) {
index = this.childNodes.indexOf(ref2);
if (index !== -1)
index += 1;
}
this.insertChild(child, index);
}
removeChild(child) {
const children = this.getChildren() || [];
const dataIndex = children.indexOf(child.data);
if (dataIndex > -1) {
children.splice(dataIndex, 1);
}
const index = this.childNodes.indexOf(child);
if (index > -1) {
this.store && this.store.deregisterNode(child);
child.parent = null;
this.childNodes.splice(index, 1);
}
this.updateLeafState();
}
removeChildByData(data) {
let targetNode = null;
for (let i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i].data === data) {
targetNode = this.childNodes[i];
break;
}
}
if (targetNode) {
this.removeChild(targetNode);
}
}
expand(callback, expandParent) {
const done = () => {
if (expandParent) {
let parent = this.parent;
while (parent && parent.level > 0) {
parent.expanded = true;
parent = parent.parent;
}
}
this.expanded = true;
if (callback)
callback();
setCanFocus(this.childNodes, true);
};
if (this.shouldLoadData()) {
this.loadData((data) => {
if (isArray(data)) {
if (this.checked) {
this.setChecked(true, true);
} else if (!this.store.checkStrictly) {
reInitChecked(this);
}
done();
}
});
} else {
done();
}
}
doCreateChildren(array, defaultProps2 = {}) {
array.forEach((item) => {
this.insertChild(Object.assign({ data: item }, defaultProps2), void 0, true);
});
}
collapse() {
this.expanded = false;
setCanFocus(this.childNodes, false);
}
shouldLoadData() {
return Boolean(this.store.lazy === true && this.store.load && !this.loaded);
}
updateLeafState() {
if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
this.isLeaf = this.isLeafByUser;
return;
}
const childNodes = this.childNodes;
if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
this.isLeaf = !childNodes || childNodes.length === 0;
return;
}
this.isLeaf = false;
}
setChecked(value, deep, recursion, passValue) {
this.indeterminate = value === "half";
this.checked = value === true;
if (this.store.checkStrictly)
return;
if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
const { all, allWithoutDisable } = getChildState(this.childNodes);
if (!this.isLeaf && !all && allWithoutDisable) {
this.checked = false;
value = false;
}
const handleDescendants = () => {
if (deep) {
const childNodes = this.childNodes;
for (let i = 0, j = childNodes.length; i < j; i++) {
const child = childNodes[i];
passValue = passValue || value !== false;
const isCheck = child.disabled ? child.checked : passValue;
child.setChecked(isCheck, deep, true, passValue);
}
const { half, all: all2 } = getChildState(childNodes);
if (!all2) {
this.checked = all2;
this.indeterminate = half;
}
}
};
if (this.shouldLoadData()) {
this.loadData(() => {
handleDescendants();
reInitChecked(this);
}, {
checked: value !== false
});
return;
} else {
handleDescendants();
}
}
const parent = this.parent;
if (!parent || parent.level === 0)
return;
if (!recursion) {
reInitChecked(parent);
}
}
getChildren(forceInit = false) {
if (this.level === 0)
return this.data;
const data = this.data;
if (!data)
return null;
const props = this.store.props;
let children = "children";
if (props) {
children = props.children || "children";
}
if (isUndefined(data[children])) {
data[children] = null;
}
if (forceInit && !data[children]) {
data[children] = [];
}
return data[children];
}
updateChildren() {
const newData = this.getChildren() || [];
const oldData = this.childNodes.map((node) => node.data);
const newDataMap = {};
const newNodes = [];
newData.forEach((item, index) => {
const key = item[NODE_KEY];
const isNodeExists = !!key && oldData.some((data) => (data == null ? void 0 : data[NODE_KEY]) === key);
if (isNodeExists) {
newDataMap[key] = { index, data: item };
} else {
newNodes.push({ index, data: item });
}
});
if (!this.store.lazy) {
oldData.forEach((item) => {
if (!newDataMap[item == null ? void 0 : item[NODE_KEY]])
this.removeChildByData(item);
});
}
newNodes.forEach(({ index, data }) => {
this.insertChild({ data }, index);
});
this.updateLeafState();
}
loadData(callback, defaultProps2 = {}) {
if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps2).length)) {
this.loading = true;
const resolve = (children) => {
this.childNodes = [];
this.doCreateChildren(children, defaultProps2);
this.loaded = true;
this.loading = false;
this.updateLeafState();
if (callback) {
callback.call(this, children);
}
};
const reject = () => {
this.loading = false;
};
this.store.load(this, resolve, reject);
} else {
if (callback) {
callback.call(this);
}
}
}
eachNode(callback) {
const arr = [this];
while (arr.length) {
const node = arr.shift();
arr.unshift(...node.childNodes);
callback(node);
}
}
reInitChecked() {
if (this.store.checkStrictly)
return;
reInitChecked(this);
}
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/tree-store.mjs
init_shared_esm_bundler();
var TreeStore = class {
constructor(options) {
this.lazy = false;
this.checkStrictly = false;
this.autoExpandParent = false;
this.defaultExpandAll = false;
this.checkDescendants = false;
this.currentNode = null;
this.currentNodeKey = null;
for (const option in options) {
if (hasOwn(options, option)) {
this[option] = options[option];
}
}
this.nodesMap = {};
}
initialize() {
this.root = new Node({
data: this.data,
store: this
});
this.root.initialize();
if (this.lazy && this.load) {
const loadFn = this.load;
loadFn(this.root, (data) => {
this.root.doCreateChildren(data);
this._initDefaultCheckedNodes();
}, NOOP);
} else {
this._initDefaultCheckedNodes();
}
}
filter(value) {
const filterNodeMethod = this.filterNodeMethod;
const lazy = this.lazy;
const traverse = async function(node) {
const childNodes = node.root ? node.root.childNodes : node.childNodes;
for (const [index, child] of childNodes.entries()) {
child.visible = !!(filterNodeMethod == null ? void 0 : filterNodeMethod.call(child, value, child.data, child));
if (index % 80 === 0 && index > 0) {
await nextTick();
}
await traverse(child);
}
if (!node.visible && childNodes.length) {
let allHidden = true;
allHidden = !childNodes.some((child) => child.visible);
if (node.root) {
node.root.visible = allHidden === false;
} else {
node.visible = allHidden === false;
}
}
if (!value)
return;
if (node.visible && !node.isLeaf) {
if (!lazy || node.loaded) {
node.expand();
}
}
};
traverse(this);
}
setData(newVal) {
const instanceChanged = newVal !== this.root.data;
if (instanceChanged) {
this.nodesMap = {};
this.root.setData(newVal);
this._initDefaultCheckedNodes();
this.setCurrentNodeKey(this.currentNodeKey);
} else {
this.root.updateChildren();
}
}
getNode(data) {
if (data instanceof Node)
return data;
const key = isObject(data) ? getNodeKey(this.key, data) : data;
return this.nodesMap[key] || null;
}
insertBefore(data, refData) {
var _a;
const refNode = this.getNode(refData);
(_a = refNode.parent) == null ? void 0 : _a.insertBefore({ data }, refNode);
}
insertAfter(data, refData) {
var _a;
const refNode = this.getNode(refData);
(_a = refNode.parent) == null ? void 0 : _a.insertAfter({ data }, refNode);
}
remove(data) {
const node = this.getNode(data);
if (node && node.parent) {
if (node === this.currentNode) {
this.currentNode = null;
}
node.parent.removeChild(node);
}
}
append(data, parentData) {
const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
if (parentNode) {
parentNode.insertChild({ data });
}
}
_initDefaultCheckedNodes() {
const defaultCheckedKeys = this.defaultCheckedKeys || [];
const nodesMap = this.nodesMap;
defaultCheckedKeys.forEach((checkedKey) => {
const node = nodesMap[checkedKey];
if (node) {
node.setChecked(true, !this.checkStrictly);
}
});
}
_initDefaultCheckedNode(node) {
const defaultCheckedKeys = this.defaultCheckedKeys || [];
if (!isNil_default(node.key) && defaultCheckedKeys.includes(node.key)) {
node.setChecked(true, !this.checkStrictly);
}
}
setDefaultCheckedKey(newVal) {
if (newVal !== this.defaultCheckedKeys) {
this.defaultCheckedKeys = newVal;
this._initDefaultCheckedNodes();
}
}
registerNode(node) {
const key = this.key;
if (!node || !node.data)
return;
if (!key) {
this.nodesMap[node.id] = node;
} else {
const nodeKey = node.key;
if (!isNil_default(nodeKey))
this.nodesMap[nodeKey] = node;
}
}
deregisterNode(node) {
const key = this.key;
if (!key || !node || !node.data)
return;
node.childNodes.forEach((child) => {
this.deregisterNode(child);
});
delete this.nodesMap[node.key];
}
getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
const checkedNodes = [];
const traverse = function(node) {
const childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach((child) => {
if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
checkedNodes.push(child.data);
}
traverse(child);
});
};
traverse(this);
return checkedNodes;
}
getCheckedKeys(leafOnly = false) {
return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
}
getHalfCheckedNodes() {
const nodes = [];
const traverse = function(node) {
const childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach((child) => {
if (child.indeterminate) {
nodes.push(child.data);
}
traverse(child);
});
};
traverse(this);
return nodes;
}
getHalfCheckedKeys() {
return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
}
_getAllNodes() {
const allNodes = [];
const nodesMap = this.nodesMap;
for (const nodeKey in nodesMap) {
if (hasOwn(nodesMap, nodeKey)) {
allNodes.push(nodesMap[nodeKey]);
}
}
return allNodes;
}
updateChildren(key, data) {
const node = this.nodesMap[key];
if (!node)
return;
const childNodes = node.childNodes;
for (let i = childNodes.length - 1; i >= 0; i--) {
const child = childNodes[i];
this.remove(child.data);
}
for (let i = 0, j = data.length; i < j; i++) {
const child = data[i];
this.append(child, node.data);
}
}
_setCheckedKeys(key, leafOnly = false, checkedKeys) {
const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
const cache = /* @__PURE__ */ Object.create(null);
const keys = Object.keys(checkedKeys);
allNodes.forEach((node) => node.setChecked(false, false));
const cacheCheckedChild = (node) => {
node.childNodes.forEach((child) => {
var _a;
cache[child.data[key]] = true;
if ((_a = child.childNodes) == null ? void 0 : _a.length) {
cacheCheckedChild(child);
}
});
};
for (let i = 0, j = allNodes.length; i < j; i++) {
const node = allNodes[i];
const nodeKey = node.data[key].toString();
const checked = keys.includes(nodeKey);
if (!checked) {
if (node.checked && !cache[nodeKey]) {
node.setChecked(false, false);
}
continue;
}
if (node.childNodes.length) {
cacheCheckedChild(node);
}
if (node.isLeaf || this.checkStrictly) {
node.setChecked(true, false);
continue;
}
node.setChecked(true, true);
if (leafOnly) {
node.setChecked(false, false);
const traverse = function(node2) {
const childNodes = node2.childNodes;
childNodes.forEach((child) => {
if (!child.isLeaf) {
child.setChecked(false, false);
}
traverse(child);
});
};
traverse(node);
}
}
}
setCheckedNodes(array, leafOnly = false) {
const key = this.key;
const checkedKeys = {};
array.forEach((item) => {
checkedKeys[(item || {})[key]] = true;
});
this._setCheckedKeys(key, leafOnly, checkedKeys);
}
setCheckedKeys(keys, leafOnly = false) {
this.defaultCheckedKeys = keys;
const key = this.key;
const checkedKeys = {};
keys.forEach((key2) => {
checkedKeys[key2] = true;
});
this._setCheckedKeys(key, leafOnly, checkedKeys);
}
setDefaultExpandedKeys(keys) {
keys = keys || [];
this.defaultExpandedKeys = keys;
keys.forEach((key) => {
const node = this.getNode(key);
if (node)
node.expand(null, this.autoExpandParent);
});
}
setChecked(data, checked, deep) {
const node = this.getNode(data);
if (node) {
node.setChecked(!!checked, deep);
}
}
getCurrentNode() {
return this.currentNode;
}
setCurrentNode(currentNode) {
const prevCurrentNode = this.currentNode;
if (prevCurrentNode) {
prevCurrentNode.isCurrent = false;
}
this.currentNode = currentNode;
this.currentNode.isCurrent = true;
}
setUserCurrentNode(node, shouldAutoExpandParent = true) {
var _a;
const key = node[this.key];
const currNode = this.nodesMap[key];
this.setCurrentNode(currNode);
if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
(_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
}
}
setCurrentNodeKey(key, shouldAutoExpandParent = true) {
var _a;
this.currentNodeKey = key;
if (isPropAbsent(key)) {
this.currentNode && (this.currentNode.isCurrent = false);
this.currentNode = null;
return;
}
const node = this.getNode(key);
if (node) {
this.setCurrentNode(node);
if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
(_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
}
}
}
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/collapse-transition/src/collapse-transition.mjs
var __default__ = defineComponent({
name: "ElCollapseTransition"
});
var _sfc_main5 = defineComponent({
...__default__,
setup(__props) {
const ns = useNamespace("collapse-transition");
const reset = (el) => {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
};
const on = {
beforeEnter(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
if (el.style.height)
el.dataset.elExistsHeight = el.style.height;
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
},
enter(el) {
requestAnimationFrame(() => {
el.dataset.oldOverflow = el.style.overflow;
if (el.dataset.elExistsHeight) {
el.style.maxHeight = el.dataset.elExistsHeight;
} else if (el.scrollHeight !== 0) {
el.style.maxHeight = `${el.scrollHeight}px`;
} else {
el.style.maxHeight = 0;
}
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
el.style.overflow = "hidden";
});
},
afterEnter(el) {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
},
enterCancelled(el) {
reset(el);
},
beforeLeave(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldOverflow = el.style.overflow;
el.style.maxHeight = `${el.scrollHeight}px`;
el.style.overflow = "hidden";
},
leave(el) {
if (el.scrollHeight !== 0) {
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
}
},
afterLeave(el) {
reset(el);
},
leaveCancelled(el) {
reset(el);
}
};
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, mergeProps({
name: unref(ns).b()
}, toHandlers(on)), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["name"]);
};
}
});
var CollapseTransition = _export_sfc(_sfc_main5, [["__file", "collapse-transition.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/collapse-transition/index.mjs
var ElCollapseTransition = withInstall(CollapseTransition);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/text/src/text.mjs
var textProps = buildProps({
type: {
type: String,
values: ["primary", "success", "info", "warning", "danger", ""],
default: ""
},
size: {
type: String,
values: componentSizes,
default: ""
},
truncated: Boolean,
lineClamp: {
type: [String, Number]
},
tag: {
type: String,
default: "span"
}
});
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/text/src/text2.mjs
var __default__2 = defineComponent({
name: "ElText"
});
var _sfc_main6 = defineComponent({
...__default__2,
props: textProps,
setup(__props) {
const props = __props;
const textRef = ref();
const textSize = useFormSize();
const ns = useNamespace("text");
const textKls = computed(() => [
ns.b(),
ns.m(props.type),
ns.m(textSize.value),
ns.is("truncated", props.truncated),
ns.is("line-clamp", !isUndefined(props.lineClamp))
]);
const bindTitle = () => {
var _a, _b, _c, _d, _e, _f, _g;
const inheritTitle = useAttrs().title;
if (inheritTitle)
return;
let shouldAddTitle = false;
const text = ((_a = textRef.value) == null ? void 0 : _a.textContent) || "";
if (props.truncated) {
const width = (_b = textRef.value) == null ? void 0 : _b.offsetWidth;
const scrollWidth = (_c = textRef.value) == null ? void 0 : _c.scrollWidth;
if (width && scrollWidth && scrollWidth > width) {
shouldAddTitle = true;
}
} else if (!isUndefined(props.lineClamp)) {
const height = (_d = textRef.value) == null ? void 0 : _d.offsetHeight;
const scrollHeight = (_e = textRef.value) == null ? void 0 : _e.scrollHeight;
if (height && scrollHeight && scrollHeight > height) {
shouldAddTitle = true;
}
}
if (shouldAddTitle) {
(_f = textRef.value) == null ? void 0 : _f.setAttribute("title", text);
} else {
(_g = textRef.value) == null ? void 0 : _g.removeAttribute("title");
}
};
onMounted(bindTitle);
onUpdated(bindTitle);
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
ref_key: "textRef",
ref: textRef,
class: normalizeClass(unref(textKls)),
style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]);
};
}
});
var Text = _export_sfc(_sfc_main6, [["__file", "text.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/text/index.mjs
var ElText = withInstall(Text);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/tokens.mjs
var ROOT_TREE_INJECTION_KEY = "RootTree";
var NODE_INSTANCE_INJECTION_KEY = "NodeInstance";
var TREE_NODE_MAP_INJECTION_KEY = "TreeNodeMap";
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/tree-node-content.mjs
var _sfc_main7 = defineComponent({
name: "ElTreeNodeContent",
props: {
node: {
type: Object,
required: true
},
renderContent: Function
},
setup(props) {
const ns = useNamespace("tree");
const nodeInstance = inject(NODE_INSTANCE_INJECTION_KEY);
const tree = inject(ROOT_TREE_INJECTION_KEY);
return () => {
const node = props.node;
const { data, store } = node;
return props.renderContent ? props.renderContent(h, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
h(ElText, { tag: "span", truncated: true, class: ns.be("node", "label") }, () => [node.label])
]);
};
}
});
var NodeContent = _export_sfc(_sfc_main7, [["__file", "tree-node-content.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/useNodeExpandEventBroadcast.mjs
function useNodeExpandEventBroadcast(props) {
const parentNodeMap = inject(TREE_NODE_MAP_INJECTION_KEY, null);
const currentNodeMap = {
treeNodeExpand: (node) => {
var _a;
if (props.node !== node) {
(_a = props.node) == null ? void 0 : _a.collapse();
}
},
children: []
};
if (parentNodeMap) {
parentNodeMap.children.push(currentNodeMap);
}
provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
return {
broadcastExpanded: (node) => {
if (!props.accordion)
return;
for (const childNode of currentNodeMap.children) {
childNode.treeNodeExpand(node);
}
}
};
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/useDragNode.mjs
init_shared_esm_bundler();
var dragEventsKey = Symbol("dragEvents");
function useDragNodeHandler({
props,
ctx,
el$,
dropIndicator$,
store
}) {
const ns = useNamespace("tree");
const dragState = ref({
showDropIndicator: false,
draggingNode: null,
dropNode: null,
allowDrop: true,
dropType: null
});
const treeNodeDragStart = ({ event, treeNode }) => {
if (!event.dataTransfer)
return;
if (isFunction(props.allowDrag) && !props.allowDrag(treeNode.node)) {
event.preventDefault();
return false;
}
event.dataTransfer.effectAllowed = "move";
try {
event.dataTransfer.setData("text/plain", "");
} catch (e) {
}
dragState.value.draggingNode = treeNode;
ctx.emit("node-drag-start", treeNode.node, event);
};
const treeNodeDragOver = ({ event, treeNode }) => {
if (!event.dataTransfer)
return;
const dropNode = treeNode;
const oldDropNode = dragState.value.dropNode;
if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
removeClass(oldDropNode.$el, ns.is("drop-inner"));
}
const draggingNode = dragState.value.draggingNode;
if (!draggingNode || !dropNode)
return;
let dropPrev = true;
let dropInner = true;
let dropNext = true;
let userAllowDropInner = true;
if (isFunction(props.allowDrop)) {
dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
}
event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
if (oldDropNode) {
ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
}
ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
}
if (dropPrev || dropInner || dropNext) {
dragState.value.dropNode = dropNode;
} else {
dragState.value.dropNode = null;
}
if (dropNode.node.nextSibling === draggingNode.node) {
dropNext = false;
}
if (dropNode.node.previousSibling === draggingNode.node) {
dropPrev = false;
}
if (dropNode.node.contains(draggingNode.node, false)) {
dropInner = false;
}
if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
dropPrev = false;
dropInner = false;
dropNext = false;
}
const dropEl = dropNode.$el;
const targetPosition = dropEl.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
const treePosition = el$.value.getBoundingClientRect();
const treeScrollTop = el$.value.scrollTop;
let dropType;
const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : Number.NEGATIVE_INFINITY;
const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : Number.POSITIVE_INFINITY;
let indicatorTop = -9999;
const distance = event.clientY - targetPosition.top;
if (distance < targetPosition.height * prevPercent) {
dropType = "before";
} else if (distance > targetPosition.height * nextPercent) {
dropType = "after";
} else if (dropInner) {
dropType = "inner";
} else {
dropType = "none";
}
const iconPosition = dropEl.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
const dropIndicator = dropIndicator$.value;
if (dropType === "before") {
indicatorTop = iconPosition.top - treePosition.top + treeScrollTop;
} else if (dropType === "after") {
indicatorTop = iconPosition.bottom - treePosition.top + treeScrollTop;
}
dropIndicator.style.top = `${indicatorTop}px`;
dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
if (dropType === "inner") {
addClass(dropEl, ns.is("drop-inner"));
} else {
removeClass(dropEl, ns.is("drop-inner"));
}
dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
dragState.value.dropType = dropType;
ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
};
const treeNodeDragEnd = (event) => {
var _a, _b;
const { draggingNode, dropType, dropNode } = dragState.value;
event.preventDefault();
if (event.dataTransfer) {
event.dataTransfer.dropEffect = "move";
}
if ((draggingNode == null ? void 0 : draggingNode.node.data) && dropNode) {
const draggingNodeCopy = { data: draggingNode.node.data };
if (dropType !== "none") {
draggingNode.node.remove();
}
if (dropType === "before") {
(_a = dropNode.node.parent) == null ? void 0 : _a.insertBefore(draggingNodeCopy, dropNode.node);
} else if (dropType === "after") {
(_b = dropNode.node.parent) == null ? void 0 : _b.insertAfter(draggingNodeCopy, dropNode.node);
} else if (dropType === "inner") {
dropNode.node.insertChild(draggingNodeCopy);
}
if (dropType !== "none") {
store.value.registerNode(draggingNodeCopy);
if (store.value.key) {
draggingNode.node.eachNode((node) => {
var _a2;
(_a2 = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a2.setChecked(node.checked, !store.value.checkStrictly);
});
}
}
removeClass(dropNode.$el, ns.is("drop-inner"));
ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
if (dropType !== "none") {
ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
}
}
if (draggingNode && !dropNode) {
ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
}
dragState.value.showDropIndicator = false;
dragState.value.draggingNode = null;
dragState.value.dropNode = null;
dragState.value.allowDrop = true;
};
provide(dragEventsKey, {
treeNodeDragStart,
treeNodeDragOver,
treeNodeDragEnd
});
return {
dragState
};
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/tree-node.mjs
init_shared_esm_bundler();
var _sfc_main8 = defineComponent({
name: "ElTreeNode",
components: {
ElCollapseTransition,
ElCheckbox,
NodeContent,
ElIcon,
Loading: loading_default
},
props: {
node: {
type: Node,
default: () => ({})
},
props: {
type: Object,
default: () => ({})
},
accordion: Boolean,
renderContent: Function,
renderAfterExpand: Boolean,
showCheckbox: Boolean
},
emits: ["node-expand"],
setup(props, ctx) {
const ns = useNamespace("tree");
const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
const tree = inject(ROOT_TREE_INJECTION_KEY);
const expanded = ref(false);
const childNodeRendered = ref(false);
const oldChecked = ref();
const oldIndeterminate = ref();
const node$ = ref();
const dragEvents = inject(dragEventsKey);
const instance = getCurrentInstance();
provide(NODE_INSTANCE_INJECTION_KEY, instance);
if (!tree) {
debugWarn("Tree", "Can not find node's tree.");
}
if (props.node.expanded) {
expanded.value = true;
childNodeRendered.value = true;
}
const childrenKey = tree.props.props["children"] || "children";
watch(() => {
var _a;
const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
return children && [...children];
}, () => {
props.node.updateChildren();
});
watch(() => props.node.indeterminate, (val) => {
handleSelectChange(props.node.checked, val);
});
watch(() => props.node.checked, (val) => {
handleSelectChange(val, props.node.indeterminate);
});
watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
watch(() => props.node.expanded, (val) => {
nextTick(() => expanded.value = val);
if (val) {
childNodeRendered.value = true;
}
});
const getNodeKey$1 = (node) => {
return getNodeKey(tree.props.nodeKey, node.data);
};
const getNodeClass = (node) => {
const nodeClassFunc = props.props.class;
if (!nodeClassFunc) {
return {};
}
let className;
if (isFunction(nodeClassFunc)) {
const { data } = node;
className = nodeClassFunc(data, node);
} else {
className = nodeClassFunc;
}
if (isString(className)) {
return { [className]: true };
} else {
return className;
}
};
const handleSelectChange = (checked, indeterminate) => {
if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
}
oldChecked.value = checked;
oldIndeterminate.value = indeterminate;
};
const handleClick = (e) => {
handleCurrentChange(tree.store, tree.ctx.emit, () => {
var _a;
const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
if (nodeKeyProp) {
const curNodeKey = getNodeKey$1(props.node);
tree.store.value.setCurrentNodeKey(curNodeKey);
} else {
tree.store.value.setCurrentNode(props.node);
}
});
tree.currentNode.value = props.node;
if (tree.props.expandOnClickNode) {
handleExpandIconClick();
}
if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) {
handleCheckChange(!props.node.checked);
}
tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
};
const handleContextMenu = (event) => {
var _a;
if ((_a = tree.instance.vnode.props) == null ? void 0 : _a["onNodeContextmenu"]) {
event.stopPropagation();
event.preventDefault();
}
tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
};
const handleExpandIconClick = () => {
if (props.node.isLeaf)
return;
if (expanded.value) {
tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
props.node.collapse();
} else {
props.node.expand(() => {
ctx.emit("node-expand", props.node.data, props.node, instance);
});
}
};
const handleCheckChange = (value) => {
props.node.setChecked(value, !(tree == null ? void 0 : tree.props.checkStrictly));
nextTick(() => {
const store = tree.store.value;
tree.ctx.emit("check", props.node.data, {
checkedNodes: store.getCheckedNodes(),
checkedKeys: store.getCheckedKeys(),
halfCheckedNodes: store.getHalfCheckedNodes(),
halfCheckedKeys: store.getHalfCheckedKeys()
});
});
};
const handleChildNodeExpand = (nodeData, node, instance2) => {
broadcastExpanded(node);
tree.ctx.emit("node-expand", nodeData, node, instance2);
};
const handleDragStart = (event) => {
if (!tree.props.draggable)
return;
dragEvents.treeNodeDragStart({ event, treeNode: props });
};
const handleDragOver = (event) => {
event.preventDefault();
if (!tree.props.draggable)
return;
dragEvents.treeNodeDragOver({
event,
treeNode: { $el: node$.value, node: props.node }
});
};
const handleDrop = (event) => {
event.preventDefault();
};
const handleDragEnd = (event) => {
if (!tree.props.draggable)
return;
dragEvents.treeNodeDragEnd(event);
};
return {
ns,
node$,
tree,
expanded,
childNodeRendered,
oldChecked,
oldIndeterminate,
getNodeKey: getNodeKey$1,
getNodeClass,
handleSelectChange,
handleClick,
handleContextMenu,
handleExpandIconClick,
handleCheckChange,
handleChildNodeExpand,
handleDragStart,
handleDragOver,
handleDrop,
handleDragEnd,
CaretRight: caret_right_default
};
}
});
function _sfc_render5(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_icon = resolveComponent("el-icon");
const _component_el_checkbox = resolveComponent("el-checkbox");
const _component_loading = resolveComponent("loading");
const _component_node_content = resolveComponent("node-content");
const _component_el_tree_node = resolveComponent("el-tree-node");
const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
return withDirectives((openBlock(), createElementBlock("div", {
ref: "node$",
class: normalizeClass([
_ctx.ns.b("node"),
_ctx.ns.is("expanded", _ctx.expanded),
_ctx.ns.is("current", _ctx.node.isCurrent),
_ctx.ns.is("hidden", !_ctx.node.visible),
_ctx.ns.is("focusable", !_ctx.node.disabled),
_ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
_ctx.getNodeClass(_ctx.node)
]),
role: "treeitem",
tabindex: "-1",
"aria-expanded": _ctx.expanded,
"aria-disabled": _ctx.node.disabled,
"aria-checked": _ctx.node.checked,
draggable: _ctx.tree.props.draggable,
"data-key": _ctx.getNodeKey(_ctx.node),
onClick: withModifiers(_ctx.handleClick, ["stop"]),
onContextmenu: _ctx.handleContextMenu,
onDragstart: withModifiers(_ctx.handleDragStart, ["stop"]),
onDragover: withModifiers(_ctx.handleDragOver, ["stop"]),
onDragend: withModifiers(_ctx.handleDragEnd, ["stop"]),
onDrop: withModifiers(_ctx.handleDrop, ["stop"])
}, [
createBaseVNode("div", {
class: normalizeClass(_ctx.ns.be("node", "content")),
style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
}, [
_ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
key: 0,
class: normalizeClass([
_ctx.ns.be("node", "expand-icon"),
_ctx.ns.is("leaf", _ctx.node.isLeaf),
{
expanded: !_ctx.node.isLeaf && _ctx.expanded
}
]),
onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
_ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
key: 1,
"model-value": _ctx.node.checked,
indeterminate: _ctx.node.indeterminate,
disabled: !!_ctx.node.disabled,
onClick: withModifiers(() => {
}, ["stop"]),
onChange: _ctx.handleCheckChange
}, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : createCommentVNode("v-if", true),
_ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
key: 2,
class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
}, {
default: withCtx(() => [
createVNode(_component_loading)
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
createVNode(_component_node_content, {
node: _ctx.node,
"render-content": _ctx.renderContent
}, null, 8, ["node", "render-content"])
], 6),
createVNode(_component_el_collapse_transition, null, {
default: withCtx(() => [
!_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(_ctx.ns.be("node", "children")),
role: "group",
"aria-expanded": _ctx.expanded,
onClick: withModifiers(() => {
}, ["stop"])
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
return openBlock(), createBlock(_component_el_tree_node, {
key: _ctx.getNodeKey(child),
"render-content": _ctx.renderContent,
"render-after-expand": _ctx.renderAfterExpand,
"show-checkbox": _ctx.showCheckbox,
node: child,
accordion: _ctx.accordion,
props: _ctx.props,
onNodeExpand: _ctx.handleChildNodeExpand
}, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
}), 128))
], 10, ["aria-expanded", "onClick"])), [
[vShow, _ctx.expanded]
]) : createCommentVNode("v-if", true)
]),
_: 1
})
], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
[vShow, _ctx.node.visible]
]);
}
var ElTreeNode = _export_sfc(_sfc_main8, [["render", _sfc_render5], ["__file", "tree-node.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/model/useKeydown.mjs
function useKeydown({ el$ }, store) {
const ns = useNamespace("tree");
onMounted(() => {
initTabIndex();
});
onUpdated(() => {
const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
checkboxItems.forEach((checkbox) => {
checkbox.setAttribute("tabindex", "-1");
});
});
function canNodeFocus(treeItems, nextIndex) {
var _a, _b;
const currentNode = store.value.getNode(treeItems[nextIndex].dataset.key);
return currentNode.canFocus && currentNode.visible && (((_a = currentNode.parent) == null ? void 0 : _a.expanded) || ((_b = currentNode.parent) == null ? void 0 : _b.level) === 0);
}
const handleKeydown = (ev) => {
const currentItem = ev.target;
if (!currentItem.className.includes(ns.b("node")))
return;
const code = getEventCode(ev);
const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
const currentIndex = treeItems.indexOf(currentItem);
let nextIndex;
if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
ev.preventDefault();
if (code === EVENT_CODE.up) {
nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.length - 1;
const startIndex = nextIndex;
while (true) {
if (canNodeFocus(treeItems, nextIndex)) {
break;
}
nextIndex--;
if (nextIndex === startIndex) {
nextIndex = -1;
break;
}
if (nextIndex < 0) {
nextIndex = treeItems.length - 1;
}
}
} else {
nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.length - 1 ? currentIndex + 1 : 0;
const startIndex = nextIndex;
while (true) {
if (canNodeFocus(treeItems, nextIndex)) {
break;
}
nextIndex++;
if (nextIndex === startIndex) {
nextIndex = -1;
break;
}
if (nextIndex >= treeItems.length) {
nextIndex = 0;
}
}
}
nextIndex !== -1 && treeItems[nextIndex].focus();
}
if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
ev.preventDefault();
currentItem.click();
}
const hasInput = currentItem.querySelector('[type="checkbox"]');
if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
ev.preventDefault();
hasInput.click();
}
};
useEventListener(el$, "keydown", handleKeydown);
const initTabIndex = () => {
var _a;
if (!el$.value)
return;
const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
checkboxItems.forEach((checkbox) => {
checkbox.setAttribute("tabindex", "-1");
});
const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
if (checkedItem.length) {
checkedItem[0].setAttribute("tabindex", "0");
return;
}
(_a = treeItems[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
};
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/tree.mjs
var treeEmits = {
"check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
"current-change": (data, node) => true,
"node-click": (data, node, nodeInstance, evt) => data && node && evt instanceof Event,
"node-contextmenu": (evt, data, node, nodeInstance) => evt instanceof Event && data && node,
"node-collapse": (data, node, nodeInstance) => data && node,
"node-expand": (data, node, nodeInstance) => data && node,
check: (data, checkedInfo) => data && checkedInfo,
"node-drag-start": (node, evt) => node && evt,
"node-drag-end": (draggingNode, dropNode, dropType, evt) => draggingNode && evt,
"node-drop": (draggingNode, dropNode, dropType, evt) => draggingNode && dropNode && evt,
"node-drag-leave": (draggingNode, oldDropNode, evt) => draggingNode && oldDropNode && evt,
"node-drag-enter": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt,
"node-drag-over": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/src/tree2.mjs
var _sfc_main9 = defineComponent({
name: "ElTree",
components: { ElTreeNode },
props: {
data: {
type: definePropType(Array),
default: () => []
},
emptyText: {
type: String
},
renderAfterExpand: {
type: Boolean,
default: true
},
nodeKey: String,
checkStrictly: Boolean,
defaultExpandAll: Boolean,
expandOnClickNode: {
type: Boolean,
default: true
},
checkOnClickNode: Boolean,
checkOnClickLeaf: {
type: Boolean,
default: true
},
checkDescendants: Boolean,
autoExpandParent: {
type: Boolean,
default: true
},
defaultCheckedKeys: Array,
defaultExpandedKeys: Array,
currentNodeKey: [String, Number],
renderContent: {
type: definePropType(Function)
},
showCheckbox: Boolean,
draggable: Boolean,
allowDrag: {
type: definePropType(Function)
},
allowDrop: {
type: definePropType(Function)
},
props: {
type: Object,
default: () => ({
children: "children",
label: "label",
disabled: "disabled"
})
},
lazy: Boolean,
highlightCurrent: Boolean,
load: Function,
filterNodeMethod: Function,
accordion: Boolean,
indent: {
type: Number,
default: 18
},
icon: {
type: iconPropType
}
},
emits: treeEmits,
setup(props, ctx) {
const { t } = useLocale();
const ns = useNamespace("tree");
const store = ref(new TreeStore({
key: props.nodeKey,
data: props.data,
lazy: props.lazy,
props: props.props,
load: props.load,
currentNodeKey: props.currentNodeKey,
checkStrictly: props.checkStrictly,
checkDescendants: props.checkDescendants,
defaultCheckedKeys: props.defaultCheckedKeys,
defaultExpandedKeys: props.defaultExpandedKeys,
autoExpandParent: props.autoExpandParent,
defaultExpandAll: props.defaultExpandAll,
filterNodeMethod: props.filterNodeMethod
}));
store.value.initialize();
const root = ref(store.value.root);
const currentNode = ref(null);
const el$ = ref(null);
const dropIndicator$ = ref(null);
const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
const { dragState } = useDragNodeHandler({
props,
ctx,
el$,
dropIndicator$,
store
});
useKeydown({ el$ }, store);
const instance = getCurrentInstance();
const isSelectTree = computed(() => {
let parent = instance == null ? void 0 : instance.parent;
while (parent) {
if (parent.type.name === "ElTreeSelect") {
return true;
}
parent = parent.parent;
}
return false;
});
const isEmpty2 = computed(() => {
const { childNodes } = root.value;
return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
});
watch(() => props.currentNodeKey, (newVal) => {
store.value.setCurrentNodeKey(newVal != null ? newVal : null);
});
watch(() => props.defaultCheckedKeys, (newVal, oldVal) => {
if (isEqual_default(newVal, oldVal))
return;
store.value.setDefaultCheckedKey(newVal != null ? newVal : []);
});
watch(() => props.defaultExpandedKeys, (newVal) => {
store.value.setDefaultExpandedKeys(newVal != null ? newVal : []);
});
watch(() => props.data, (newVal) => {
store.value.setData(newVal);
}, { deep: true });
watch(() => props.checkStrictly, (newVal) => {
store.value.checkStrictly = newVal;
});
const filter = (value) => {
if (!props.filterNodeMethod)
throw new Error("[Tree] filterNodeMethod is required when filter");
store.value.filter(value);
};
const getNodeKey$1 = (node) => {
return getNodeKey(props.nodeKey, node.data);
};
const getNodePath = (data) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in getNodePath");
const node = store.value.getNode(data);
if (!node)
return [];
const path = [node.data];
let parent = node.parent;
while (parent && parent !== root.value) {
path.push(parent.data);
parent = parent.parent;
}
return path.reverse();
};
const getCheckedNodes = (leafOnly, includeHalfChecked) => {
return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
};
const getCheckedKeys = (leafOnly) => {
return store.value.getCheckedKeys(leafOnly);
};
const getCurrentNode = () => {
const currentNode2 = store.value.getCurrentNode();
return currentNode2 ? currentNode2.data : null;
};
const getCurrentKey = () => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in getCurrentKey");
const currentNode2 = getCurrentNode();
return currentNode2 ? currentNode2[props.nodeKey] : null;
};
const setCheckedNodes = (nodes, leafOnly) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in setCheckedNodes");
store.value.setCheckedNodes(nodes, leafOnly);
};
const setCheckedKeys = (keys, leafOnly) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in setCheckedKeys");
store.value.setCheckedKeys(keys, leafOnly);
};
const setChecked = (data, checked, deep) => {
store.value.setChecked(data, checked, deep);
};
const getHalfCheckedNodes = () => {
return store.value.getHalfCheckedNodes();
};
const getHalfCheckedKeys = () => {
return store.value.getHalfCheckedKeys();
};
const setCurrentNode = (node, shouldAutoExpandParent = true) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in setCurrentNode");
handleCurrentChange(store, ctx.emit, () => {
broadcastExpanded(node);
store.value.setUserCurrentNode(node, shouldAutoExpandParent);
});
};
const setCurrentKey = (key = null, shouldAutoExpandParent = true) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in setCurrentKey");
handleCurrentChange(store, ctx.emit, () => {
broadcastExpanded();
store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
});
};
const getNode = (data) => {
return store.value.getNode(data);
};
const remove = (data) => {
store.value.remove(data);
};
const append = (data, parentNode) => {
store.value.append(data, parentNode);
};
const insertBefore = (data, refNode) => {
store.value.insertBefore(data, refNode);
};
const insertAfter = (data, refNode) => {
store.value.insertAfter(data, refNode);
};
const handleNodeExpand = (nodeData, node, instance2) => {
broadcastExpanded(node);
ctx.emit("node-expand", nodeData, node, instance2);
};
const updateKeyChildren = (key, data) => {
if (!props.nodeKey)
throw new Error("[Tree] nodeKey is required in updateKeyChild");
store.value.updateChildren(key, data);
};
provide(ROOT_TREE_INJECTION_KEY, {
ctx,
props,
store,
root,
currentNode,
instance
});
provide(formItemContextKey, void 0);
return {
ns,
store,
root,
currentNode,
dragState,
el$,
dropIndicator$,
isEmpty: isEmpty2,
filter,
getNodeKey: getNodeKey$1,
getNodePath,
getCheckedNodes,
getCheckedKeys,
getCurrentNode,
getCurrentKey,
setCheckedNodes,
setCheckedKeys,
setChecked,
getHalfCheckedNodes,
getHalfCheckedKeys,
setCurrentNode,
setCurrentKey,
t,
getNode,
remove,
append,
insertBefore,
insertAfter,
handleNodeExpand,
updateKeyChildren
};
}
});
function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_tree_node = resolveComponent("el-tree-node");
return openBlock(), createElementBlock("div", {
ref: "el$",
class: normalizeClass([
_ctx.ns.b(),
_ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
_ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
_ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
{ [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
]),
role: "tree"
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
return openBlock(), createBlock(_component_el_tree_node, {
key: _ctx.getNodeKey(child),
node: child,
props: _ctx.props,
accordion: _ctx.accordion,
"render-after-expand": _ctx.renderAfterExpand,
"show-checkbox": _ctx.showCheckbox,
"render-content": _ctx.renderContent,
onNodeExpand: _ctx.handleNodeExpand
}, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
}), 128)),
_ctx.isEmpty ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(_ctx.ns.e("empty-block"))
}, [
renderSlot(_ctx.$slots, "empty", {}, () => {
var _a;
return [
createBaseVNode("span", {
class: normalizeClass(_ctx.ns.e("empty-text"))
}, toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
];
})
], 2)) : createCommentVNode("v-if", true),
withDirectives(createBaseVNode("div", {
ref: "dropIndicator$",
class: normalizeClass(_ctx.ns.e("drop-indicator"))
}, null, 2), [
[vShow, _ctx.dragState.showDropIndicator]
])
], 2);
}
var Tree = _export_sfc(_sfc_main9, [["render", _sfc_render6], ["__file", "tree.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree/index.mjs
var ElTree = withInstall(Tree);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/select.mjs
var useSelect2 = (props, { attrs, emit }, {
select,
tree,
key
}) => {
const ns = useNamespace("tree-select");
watch(() => props.data, () => {
if (props.filterable) {
nextTick(() => {
var _a, _b;
(_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
});
}
}, { flush: "post" });
const result = {
...pick_default(toRefs(props), Object.keys(ElSelect.props)),
...attrs,
class: computed(() => attrs.class),
style: computed(() => attrs.style),
"onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
valueKey: key,
popperClass: computed(() => {
const classes = [ns.e("popper")];
if (props.popperClass)
classes.push(props.popperClass);
return classes.join(" ");
}),
filterMethod: (keyword = "") => {
var _a;
if (props.filterMethod) {
props.filterMethod(keyword);
} else if (props.remoteMethod) {
props.remoteMethod(keyword);
} else {
(_a = tree.value) == null ? void 0 : _a.filter(keyword);
}
}
};
return result;
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/tree-select-option.mjs
var component = defineComponent({
extends: ElOption,
setup(props, ctx) {
const result = ElOption.setup(props, ctx);
delete result.selectOptionClick;
const vm = getCurrentInstance().proxy;
nextTick(() => {
if (!result.select.states.cachedOptions.get(vm.value)) {
result.select.onOptionCreate(vm);
}
});
watch(() => ctx.attrs.visible, (val) => {
nextTick(() => {
result.states.visible = val;
});
}, {
immediate: true
});
return result;
},
methods: {
selectOptionClick() {
this.$el.parentElement.click();
}
}
});
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/utils.mjs
init_shared_esm_bundler();
function isValidValue(val) {
return val || val === 0;
}
function isValidArray(val) {
return isArray(val) && val.length;
}
function toValidArray(val) {
return isArray(val) ? val : isValidValue(val) ? [val] : [];
}
function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
for (let i = 0; i < treeData.length; i++) {
const data = treeData[i];
if (findCallback(data, i, treeData, parent)) {
return resultCallback ? resultCallback(data, i, treeData, parent) : data;
} else {
const children = getChildren(data);
if (isValidArray(children)) {
const find = treeFind(children, findCallback, getChildren, resultCallback, data);
if (find)
return find;
}
}
}
}
function treeEach(treeData, callback, getChildren, parent) {
for (let i = 0; i < treeData.length; i++) {
const data = treeData[i];
callback(data, i, treeData, parent);
const children = getChildren(data);
if (isValidArray(children)) {
treeEach(children, callback, getChildren, data);
}
}
}
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/tree.mjs
init_shared_esm_bundler();
var useTree = (props, { attrs, slots, emit }, {
select,
tree,
key
}) => {
watch([() => props.modelValue, tree], () => {
if (props.showCheckbox) {
nextTick(() => {
const treeInstance = tree.value;
if (treeInstance && !isEqual_default(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
treeInstance.setCheckedKeys(toValidArray(props.modelValue));
}
});
}
}, {
immediate: true,
deep: true
});
const propsMap = computed(() => ({
value: key.value,
label: "label",
children: "children",
disabled: "disabled",
isLeaf: "isLeaf",
...props.props
}));
const getNodeValByProp = (prop, data) => {
var _a;
const propVal = propsMap.value[prop];
if (isFunction(propVal)) {
return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
} else {
return data[propVal];
}
};
const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
}).filter((item) => isValidValue(item));
const cacheOptions = computed(() => {
if (!props.renderAfterExpand && !props.lazy)
return [];
const options = [];
treeEach(props.data.concat(props.cacheData), (node) => {
const value = getNodeValByProp("value", node);
options.push({
value,
currentLabel: getNodeValByProp("label", node),
isDisabled: getNodeValByProp("disabled", node)
});
}, (data) => getNodeValByProp("children", data));
return options;
});
const getChildCheckedKeys = () => {
var _a;
return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
var _a2;
const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
return !isNil_default(node) && isEmpty(node.childNodes);
});
};
return {
...pick_default(toRefs(props), Object.keys(ElTree.props)),
...attrs,
nodeKey: key,
expandOnClickNode: computed(() => {
return !props.checkStrictly && props.expandOnClickNode;
}),
defaultExpandedKeys: computed(() => {
return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
}),
renderContent: (h2, { node, data, store }) => {
return h2(component, {
value: getNodeValByProp("value", data),
label: getNodeValByProp("label", data),
disabled: getNodeValByProp("disabled", data),
visible: node.visible
}, props.renderContent ? () => props.renderContent(h2, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
},
filterNodeMethod: (value, data, node) => {
if (props.filterNodeMethod)
return props.filterNodeMethod(value, data, node);
if (!value)
return true;
const regexp = new RegExp(escapeStringRegexp(value), "i");
return regexp.test(getNodeValByProp("label", data) || "");
},
onNodeClick: (data, node, e) => {
var _a, _b, _c, _d;
(_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
if (props.showCheckbox && props.checkOnClickNode)
return;
if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
if (!getNodeValByProp("disabled", data)) {
const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
(_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
}
} else if (props.expandOnClickNode) {
e.proxy.handleExpandIconClick();
}
(_d = select.value) == null ? void 0 : _d.focus();
},
onCheck: (data, params) => {
var _a;
if (!props.showCheckbox)
return;
const dataValue = getNodeValByProp("value", data);
const dataMap = {};
treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
const uncachedCheckedKeys = params.checkedKeys;
const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
if (props.checkStrictly) {
emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
} else {
if (props.multiple) {
const childKeys = getChildCheckedKeys();
emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
} else {
const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
}
}
nextTick(() => {
var _a2;
const checkedKeys2 = toValidArray(props.modelValue);
tree.value.setCheckedKeys(checkedKeys2);
(_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
checkedKeys: tree.value.getCheckedKeys(),
checkedNodes: tree.value.getCheckedNodes(),
halfCheckedKeys: tree.value.getHalfCheckedKeys(),
halfCheckedNodes: tree.value.getHalfCheckedNodes()
});
});
(_a = select.value) == null ? void 0 : _a.focus();
},
onNodeExpand: (data, node, e) => {
var _a;
(_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
nextTick(() => {
if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
const dataMap = {};
const uncachedCheckedKeys = tree.value.getCheckedKeys();
treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
const childKeys = getChildCheckedKeys();
emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
}
});
},
cacheOptions
};
};
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/cache-options.mjs
var CacheOptions = defineComponent({
props: {
data: {
type: Array,
default: () => []
}
},
setup(props) {
const select = inject(selectKey);
watch(() => props.data, () => {
var _a;
props.data.forEach((item) => {
if (!select.states.cachedOptions.has(item.value)) {
select.states.cachedOptions.set(item.value, item);
}
});
const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
if (isClient && !Array.from(inputs).includes(document.activeElement)) {
select.setSelected();
}
}, { flush: "post", immediate: true });
return () => void 0;
}
});
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/src/tree-select.mjs
var _sfc_main10 = defineComponent({
name: "ElTreeSelect",
inheritAttrs: false,
props: {
...ElSelect.props,
...ElTree.props,
cacheData: {
type: Array,
default: () => []
}
},
setup(props, context) {
const { slots, expose } = context;
const select = ref();
const tree = ref();
const key = computed(() => props.nodeKey || props.valueKey || "value");
const selectProps2 = useSelect2(props, context, { select, tree, key });
const { cacheOptions, ...treeProps } = useTree(props, context, {
select,
tree,
key
});
const methods = reactive({});
expose(methods);
onMounted(() => {
Object.assign(methods, {
...pick_default(tree.value, [
"filter",
"updateKeyChildren",
"getCheckedNodes",
"setCheckedNodes",
"getCheckedKeys",
"setCheckedKeys",
"setChecked",
"getHalfCheckedNodes",
"getHalfCheckedKeys",
"getCurrentKey",
"getCurrentNode",
"setCurrentKey",
"setCurrentNode",
"getNode",
"remove",
"append",
"insertBefore",
"insertAfter"
]),
...pick_default(select.value, ["focus", "blur", "selectedLabel"]),
treeRef: tree.value,
selectRef: select.value
});
});
return () => h(ElSelect, reactive({
...selectProps2,
ref: (ref2) => select.value = ref2
}), {
...slots,
default: () => [
h(CacheOptions, { data: cacheOptions.value }),
h(ElTree, reactive({
...treeProps,
ref: (ref2) => tree.value = ref2
}))
]
});
}
});
var TreeSelect = _export_sfc(_sfc_main10, [["__file", "tree-select.vue"]]);
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/tree-select/index.mjs
var ElTreeSelect = withInstall(TreeSelect);
export {
getScrollContainer,
getScrollBarWidth,
scrollIntoView,
animateScrollTo,
getScrollElement,
getScrollTop,
ElCollapseTransition,
selectGroupKey,
selectKey,
selectProps,
selectEmits,
ElSelect,
ElOption,
ElOptionGroup,
textProps,
ElText,
ROOT_TREE_INJECTION_KEY,
NODE_INSTANCE_INJECTION_KEY,
TREE_NODE_MAP_INJECTION_KEY,
treeEmits,
ElTree,
ElTreeSelect
};
//# sourceMappingURL=chunk-TZNJWHO5.js.map