feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import "../../utils/index.js";
import { _default } from "./src/select.vue.js";
import { OptionV2Props, SelectV2Instance, SelectV2Props } from "./src/defaults.js";
import { SelectV2Context, selectV2InjectionKey } from "./src/token.js";
//#region ../../packages/components/select-v2/index.d.ts
declare const ElSelectV2: SFCWithInstall<typeof _default>;
//#endregion
export { ElSelectV2, ElSelectV2 as default, OptionV2Props, SelectV2Context, SelectV2Instance, SelectV2Props, selectV2InjectionKey };
+10
View File
@@ -0,0 +1,10 @@
import { withInstall } from "../../utils/vue/install.mjs";
import { selectV2InjectionKey } from "./src/token.mjs";
import select_default from "./src/select.mjs";
//#region ../../packages/components/select-v2/index.ts
const ElSelectV2 = withInstall(select_default);
//#endregion
export { ElSelectV2, ElSelectV2 as default, selectV2InjectionKey };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["Select"],"sources":["../../../../../packages/components/select-v2/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Select from './src/select.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElSelectV2: SFCWithInstall<typeof Select> = withInstall(Select)\nexport default ElSelectV2\n\nexport * from './src/token'\n"],"mappings":";;;;;AAKA,MAAa,aAA4C,YAAYA,eAAO"}
@@ -0,0 +1,264 @@
import "../../../utils/vue/typescript.js";
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import { PopperEffect } from "../../popper/src/popper.js";
import { Option, OptionType } from "./select.types.js";
import { _default } from "./select.vue.js";
import { Props } from "./useProps.js";
import { Options, Placement } from "../../popper/index.js";
import * as vue from "vue";
import { CSSProperties, ExtractPropTypes, ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/select-v2/src/defaults.d.ts
/**
* @description Tag tooltip configuration interface
*/
interface TagTooltipProps {
appendTo?: string | HTMLElement;
placement?: Placement;
fallbackPlacements?: Placement[];
effect?: PopperEffect;
popperClass?: string;
popperStyle?: string | CSSProperties;
transition?: string;
teleported?: boolean;
popperOptions?: Partial<Options>;
showAfter?: number;
hideAfter?: number;
autoClose?: number;
offset?: number;
}
declare const selectV2Props: {
readonly ariaLabel: StringConstructor;
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown, undefined, boolean>;
readonly allowCreate: BooleanConstructor;
readonly autocomplete: EpPropFinalized<(new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list") | (((new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list")) | null)[], unknown, unknown, "none", boolean>;
readonly automaticDropdown: BooleanConstructor;
readonly clearable: BooleanConstructor;
readonly clearIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
readonly effect: EpPropFinalized<(new (...args: any[]) => string) | (() => PopperEffect) | (((new (...args: any[]) => string) | (() => PopperEffect)) | null)[], unknown, unknown, "light", boolean>;
readonly collapseTags: BooleanConstructor;
readonly collapseTagsTooltip: BooleanConstructor;
readonly tagTooltip: EpPropFinalized<(new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps) | (((new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps)) | null)[], unknown, unknown, () => {}, boolean>;
readonly maxCollapseTags: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly defaultFirstOption: BooleanConstructor;
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly estimatedOptionHeight: EpPropFinalized<NumberConstructor, unknown, unknown, undefined, boolean>;
readonly filterable: BooleanConstructor;
readonly filterMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly height: EpPropFinalized<NumberConstructor, unknown, unknown, 274, boolean>;
readonly itemHeight: EpPropFinalized<NumberConstructor, unknown, unknown, 34, boolean>;
readonly id: StringConstructor;
readonly loading: BooleanConstructor;
readonly loadingText: StringConstructor;
readonly modelValue: EpPropFinalized<(new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
} | (((new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
}) | null)[], unknown, unknown, undefined, boolean>;
readonly multiple: BooleanConstructor;
readonly multipleLimit: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly name: StringConstructor;
readonly noDataText: StringConstructor;
readonly noMatchText: StringConstructor;
readonly remoteMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly reserveKeyword: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly options: {
readonly type: vue.PropType<OptionType[]>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly placeholder: {
readonly type: vue.PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly teleported: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly popperClass: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (((new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[])) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperStyle: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | false | CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue) | (((new (...args: any[]) => string | false | CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperOptions: EpPropFinalized<(new (...args: any[]) => Partial<Options>) | (() => Partial<Options>) | (((new (...args: any[]) => Partial<Options>) | (() => Partial<Options>)) | null)[], unknown, unknown, () => Partial<Options>, boolean>;
readonly remote: BooleanConstructor;
readonly debounce: EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly size: {
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly props: EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | (((new (...args: any[]) => Props) | (() => Props)) | null)[], unknown, unknown, () => Required<Props>, boolean>;
readonly valueKey: EpPropFinalized<StringConstructor, unknown, unknown, "value", boolean>;
readonly scrollbarAlwaysOn: BooleanConstructor;
readonly validateEvent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 12, boolean>;
readonly remoteShowSuffix: BooleanConstructor;
readonly showArrow: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly placement: EpPropFinalized<(new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, "bottom-start", boolean>;
readonly fallbackPlacements: EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | (((new (...args: any[]) => Placement[]) | (() => Placement[])) | null)[], unknown, unknown, readonly ["bottom-start", "top-start", "right", "left"], boolean>;
readonly tagType: {
readonly default: "info";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tagEffect: {
readonly default: "light";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "light" | "dark" | "plain", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tabindex: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
readonly appendTo: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>) | (((new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly fitInputWidth: EpPropFinalized<readonly [BooleanConstructor, NumberConstructor], unknown, number | boolean, true, boolean>;
readonly suffixIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
};
declare const optionV2Props: {
readonly data: ArrayConstructor;
readonly disabled: BooleanConstructor;
readonly hovering: BooleanConstructor;
readonly item: {
readonly type: vue.PropType<Option>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly index: NumberConstructor;
readonly style: ObjectConstructor;
readonly selected: BooleanConstructor;
readonly created: BooleanConstructor;
};
type SelectV2Props = ExtractPropTypes<typeof selectV2Props>;
type OptionV2Props = ExtractPropTypes<typeof optionV2Props>;
type SelectV2Instance = InstanceType<typeof _default> & unknown;
//#endregion
export { OptionV2Props, SelectV2Instance, SelectV2Props, TagTooltipProps };
@@ -0,0 +1,200 @@
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
import { isBoolean, isNumber } from "../../../utils/types.mjs";
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
import { iconPropType } from "../../../utils/vue/icon.mjs";
import { useSizeProp } from "../../../hooks/use-size/index.mjs";
import { useEmptyValuesProps } from "../../../hooks/use-empty-values/index.mjs";
import { useAriaProps } from "../../../hooks/use-aria/index.mjs";
import { useTooltipContentProps } from "../../tooltip/src/content.mjs";
import { tagProps } from "../../tag/src/tag.mjs";
import { defaultProps } from "./useProps.mjs";
import { ArrowDown, CircleClose } from "@element-plus/icons-vue";
import { placements } from "@popperjs/core";
//#region ../../packages/components/select-v2/src/defaults.ts
const selectV2Props = buildProps({
allowCreate: Boolean,
autocomplete: {
type: definePropType(String),
default: "none"
},
automaticDropdown: Boolean,
clearable: Boolean,
clearIcon: {
type: iconPropType,
default: CircleClose
},
effect: {
type: definePropType(String),
default: "light"
},
collapseTags: Boolean,
collapseTagsTooltip: Boolean,
tagTooltip: {
type: definePropType(Object),
default: () => ({})
},
maxCollapseTags: {
type: Number,
default: 1
},
defaultFirstOption: Boolean,
disabled: {
type: Boolean,
default: void 0
},
estimatedOptionHeight: {
type: Number,
default: void 0
},
filterable: Boolean,
filterMethod: { type: definePropType(Function) },
height: {
type: Number,
default: 274
},
itemHeight: {
type: Number,
default: 34
},
id: String,
loading: Boolean,
loadingText: String,
modelValue: {
type: definePropType([
Array,
String,
Number,
Boolean,
Object
]),
default: void 0
},
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
name: String,
noDataText: String,
noMatchText: String,
remoteMethod: { type: definePropType(Function) },
reserveKeyword: {
type: Boolean,
default: true
},
options: {
type: definePropType(Array),
required: true
},
placeholder: { type: String },
teleported: useTooltipContentProps.teleported,
persistent: {
type: Boolean,
default: true
},
popperClass: useTooltipContentProps.popperClass,
popperStyle: useTooltipContentProps.popperStyle,
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
remote: Boolean,
debounce: {
type: Number,
default: 300
},
size: useSizeProp,
props: {
type: definePropType(Object),
default: () => defaultProps
},
valueKey: {
type: String,
default: "value"
},
scrollbarAlwaysOn: Boolean,
validateEvent: {
type: Boolean,
default: true
},
offset: {
type: Number,
default: 12
},
remoteShowSuffix: Boolean,
showArrow: {
type: Boolean,
default: true
},
placement: {
type: definePropType(String),
values: placements,
default: "bottom-start"
},
fallbackPlacements: {
type: definePropType(Array),
default: [
"bottom-start",
"top-start",
"right",
"left"
]
},
tagType: {
...tagProps.type,
default: "info"
},
tagEffect: {
...tagProps.effect,
default: "light"
},
tabindex: {
type: [String, Number],
default: 0
},
appendTo: useTooltipContentProps.appendTo,
fitInputWidth: {
type: [Boolean, Number],
default: true,
validator(val) {
return isBoolean(val) || isNumber(val);
}
},
suffixIcon: {
type: iconPropType,
default: ArrowDown
},
...useEmptyValuesProps,
...useAriaProps(["ariaLabel"])
});
const optionV2Props = buildProps({
data: Array,
disabled: Boolean,
hovering: Boolean,
item: {
type: definePropType(Object),
required: true
},
index: Number,
style: Object,
selected: Boolean,
created: Boolean
});
const selectV2Emits = {
[UPDATE_MODEL_EVENT]: (val) => true,
[CHANGE_EVENT]: (val) => true,
"remove-tag": (val) => true,
"visible-change": (visible) => true,
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true
};
const optionV2Emits = {
hover: (index) => isNumber(index),
select: (val, index) => true
};
//#endregion
export { optionV2Emits, optionV2Props, selectV2Emits, selectV2Props };
//# sourceMappingURL=defaults.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
import group_item_vue_vue_type_script_lang_default from "./group-item.vue_vue_type_script_lang.mjs";
import { createElementBlock, normalizeClass, normalizeStyle, openBlock, toDisplayString } from "vue";
//#region ../../packages/components/select-v2/src/group-item.vue
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass(_ctx.ns.be("group", "title")),
style: normalizeStyle({
..._ctx.style,
lineHeight: `${_ctx.height}px`
})
}, toDisplayString(_ctx.item.label), 7);
}
var group_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(group_item_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
//#endregion
export { group_item_default as default };
//# sourceMappingURL=group-item.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"group-item.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/group-item.vue"],"sourcesContent":["<template>\n <div\n :class=\"ns.be('group', 'title')\"\n :style=\"{ ...style, lineHeight: `${height}px` }\"\n >\n {{ item.label }}\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\n\nimport type { CSSProperties, PropType } from 'vue'\n\nexport default defineComponent({\n props: {\n item: {\n type: Object,\n required: true,\n },\n style: {\n type: Object as PropType<CSSProperties>,\n },\n height: Number,\n },\n setup() {\n const ns = useNamespace('select')\n return {\n ns,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;qBACE,mBAKM,OAAA;EAJH,OAAK,eAAE,KAAA,GAAG,GAAE,SAAA,QAAA,CAAA;EACZ,OAAK,eAAA;GAAA,GAAO,KAAA;GAAK,YAAA,GAAiB,KAAA,OAAM;GAAA,CAAA;EAAA,kBAEtC,KAAA,KAAK,MAAK,EAAA,EAAA"}
@@ -0,0 +1,21 @@
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { defineComponent } from "vue";
//#region ../../packages/components/select-v2/src/group-item.vue?vue&type=script&lang.ts
var group_item_vue_vue_type_script_lang_default = defineComponent({
props: {
item: {
type: Object,
required: true
},
style: { type: Object },
height: Number
},
setup() {
return { ns: useNamespace("select") };
}
});
//#endregion
export { group_item_vue_vue_type_script_lang_default as default };
//# sourceMappingURL=group-item.vue_vue_type_script_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"group-item.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/group-item.vue"],"sourcesContent":["<template>\n <div\n :class=\"ns.be('group', 'title')\"\n :style=\"{ ...style, lineHeight: `${height}px` }\"\n >\n {{ item.label }}\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\n\nimport type { CSSProperties, PropType } from 'vue'\n\nexport default defineComponent({\n props: {\n item: {\n type: Object,\n required: true,\n },\n style: {\n type: Object as PropType<CSSProperties>,\n },\n height: Number,\n },\n setup() {\n const ns = useNamespace('select')\n return {\n ns,\n }\n },\n})\n</script>\n"],"mappings":";;;;AAeA,kDAAe,gBAAgB;CAC7B,OAAO;EACL,MAAM;GACJ,MAAM;GACN,UAAU;GACX;EACD,OAAO,EACL,MAAM,QACP;EACD,QAAQ;EACT;CACD,QAAQ;AAEN,SAAO,EACL,IAFS,aAAa,SAAQ,EAGhC;;CAEH,CAAA"}
@@ -0,0 +1,38 @@
import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
import option_item_vue_vue_type_script_lang_default from "./option-item.vue_vue_type_script_lang.mjs";
import { createElementBlock, createElementVNode, normalizeClass, normalizeStyle, openBlock, renderSlot, toDisplayString, withModifiers } from "vue";
//#region ../../packages/components/select-v2/src/option-item.vue
const _hoisted_1 = [
"id",
"aria-selected",
"aria-disabled"
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("li", {
id: `${_ctx.contentId}-${_ctx.index}`,
role: "option",
"aria-selected": _ctx.selected,
"aria-disabled": _ctx.disabled || void 0,
style: normalizeStyle(_ctx.style),
class: normalizeClass([
_ctx.ns.be("dropdown", "item"),
_ctx.ns.is("selected", _ctx.selected),
_ctx.ns.is("disabled", _ctx.disabled),
_ctx.ns.is("created", _ctx.created),
_ctx.ns.is("hovering", _ctx.hovering)
]),
onMousemove: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
}, [renderSlot(_ctx.$slots, "default", {
item: _ctx.item,
index: _ctx.index,
disabled: _ctx.disabled
}, () => [createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)])], 46, _hoisted_1);
}
var option_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_item_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
//#endregion
export { option_item_default as default };
//# sourceMappingURL=option-item.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"option-item.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/option-item.vue"],"sourcesContent":["<template>\n <li\n :id=\"`${contentId}-${index}`\"\n role=\"option\"\n :aria-selected=\"selected\"\n :aria-disabled=\"disabled || undefined\"\n :style=\"style\"\n :class=\"[\n ns.be('dropdown', 'item'),\n ns.is('selected', selected),\n ns.is('disabled', disabled),\n ns.is('created', created),\n ns.is('hovering', hovering),\n ]\"\n @mousemove=\"hoverItem\"\n @mousedown=\"handleMousedown\"\n @click.stop=\"selectOptionClick\"\n >\n <slot :item=\"item\" :index=\"index\" :disabled=\"disabled\">\n <span>{{ getLabel(item) }}</span>\n </slot>\n </li>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, inject } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useOption } from './useOption'\nimport { useProps } from './useProps'\nimport { optionV2Emits, optionV2Props } from './defaults'\nimport { selectV2InjectionKey } from './token'\nimport { isFocusable } from '@element-plus/utils'\n\nexport default defineComponent({\n props: optionV2Props,\n emits: optionV2Emits,\n setup(props, { emit }) {\n const select = inject(selectV2InjectionKey)!\n const ns = useNamespace('select')\n const { hoverItem, selectOptionClick } = useOption(props, { emit })\n const { getLabel } = useProps(select.props)\n const contentId = select.contentId\n\n const handleMousedown = (event: MouseEvent) => {\n let target = event.target as HTMLElement | null\n const currentTarget = event.currentTarget as HTMLElement\n\n while (target && target !== currentTarget) {\n if (isFocusable(target)) {\n return\n }\n target = target.parentElement\n }\n\n event.preventDefault()\n }\n\n return {\n ns,\n contentId,\n hoverItem,\n handleMousedown,\n selectOptionClick,\n getLabel,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;qBACE,mBAoBK,MAAA;EAnBF,IAAE,GAAK,KAAA,UAAS,GAAI,KAAA;EACrB,MAAK;EACJ,iBAAe,KAAA;EACf,iBAAe,KAAA,YAAY,KAAA;EAC3B,OAAK,eAAE,KAAA,MAAK;EACZ,OAAK,eAAA;GAAU,KAAA,GAAG,GAAE,YAAA,OAAA;GAA4B,KAAA,GAAG,GAAE,YAAa,KAAA,SAAQ;GAAS,KAAA,GAAG,GAAE,YAAa,KAAA,SAAQ;GAAS,KAAA,GAAG,GAAE,WAAY,KAAA,QAAO;GAAS,KAAA,GAAG,GAAE,YAAa,KAAA,SAAQ;GAAA,CAAA;EAOjL,aAAS,OAAA,OAAA,OAAA,MAAA,GAAA,SAAE,KAAA,aAAA,KAAA,UAAA,GAAA,KAAA;EACX,aAAS,OAAA,OAAA,OAAA,MAAA,GAAA,SAAE,KAAA,mBAAA,KAAA,gBAAA,GAAA,KAAA;EACX,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,GAAA,SAAO,KAAA,qBAAA,KAAA,kBAAA,GAAA,KAAA,EAAiB,CAAA,OAAA,CAAA;EAAA,EAAA,CAE9B,WAEO,KAAA,QAAA,WAAA;EAFA,MAAM,KAAA;EAAO,OAAO,KAAA;EAAQ,UAAU,KAAA;EAAA,QAEtC,CADL,mBAAiC,QAAA,MAAA,gBAAxB,KAAA,SAAS,KAAA,KAAI,CAAA,EAAA,EAAA,CAAA,CAAA"}
@@ -0,0 +1,41 @@
import { isFocusable } from "../../../utils/dom/aria.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { useProps } from "./useProps.mjs";
import { useOption } from "./useOption.mjs";
import { optionV2Emits, optionV2Props } from "./defaults.mjs";
import { selectV2InjectionKey } from "./token.mjs";
import { defineComponent, inject } from "vue";
//#region ../../packages/components/select-v2/src/option-item.vue?vue&type=script&lang.ts
var option_item_vue_vue_type_script_lang_default = defineComponent({
props: optionV2Props,
emits: optionV2Emits,
setup(props, { emit }) {
const select = inject(selectV2InjectionKey);
const ns = useNamespace("select");
const { hoverItem, selectOptionClick } = useOption(props, { emit });
const { getLabel } = useProps(select.props);
const contentId = select.contentId;
const handleMousedown = (event) => {
let target = event.target;
const currentTarget = event.currentTarget;
while (target && target !== currentTarget) {
if (isFocusable(target)) return;
target = target.parentElement;
}
event.preventDefault();
};
return {
ns,
contentId,
hoverItem,
handleMousedown,
selectOptionClick,
getLabel
};
}
});
//#endregion
export { option_item_vue_vue_type_script_lang_default as default };
//# sourceMappingURL=option-item.vue_vue_type_script_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"option-item.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/option-item.vue"],"sourcesContent":["<template>\n <li\n :id=\"`${contentId}-${index}`\"\n role=\"option\"\n :aria-selected=\"selected\"\n :aria-disabled=\"disabled || undefined\"\n :style=\"style\"\n :class=\"[\n ns.be('dropdown', 'item'),\n ns.is('selected', selected),\n ns.is('disabled', disabled),\n ns.is('created', created),\n ns.is('hovering', hovering),\n ]\"\n @mousemove=\"hoverItem\"\n @mousedown=\"handleMousedown\"\n @click.stop=\"selectOptionClick\"\n >\n <slot :item=\"item\" :index=\"index\" :disabled=\"disabled\">\n <span>{{ getLabel(item) }}</span>\n </slot>\n </li>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, inject } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useOption } from './useOption'\nimport { useProps } from './useProps'\nimport { optionV2Emits, optionV2Props } from './defaults'\nimport { selectV2InjectionKey } from './token'\nimport { isFocusable } from '@element-plus/utils'\n\nexport default defineComponent({\n props: optionV2Props,\n emits: optionV2Emits,\n setup(props, { emit }) {\n const select = inject(selectV2InjectionKey)!\n const ns = useNamespace('select')\n const { hoverItem, selectOptionClick } = useOption(props, { emit })\n const { getLabel } = useProps(select.props)\n const contentId = select.contentId\n\n const handleMousedown = (event: MouseEvent) => {\n let target = event.target as HTMLElement | null\n const currentTarget = event.currentTarget as HTMLElement\n\n while (target && target !== currentTarget) {\n if (isFocusable(target)) {\n return\n }\n target = target.parentElement\n }\n\n event.preventDefault()\n }\n\n return {\n ns,\n contentId,\n hoverItem,\n handleMousedown,\n selectOptionClick,\n getLabel,\n }\n },\n})\n</script>\n"],"mappings":";;;;;;;;;AAiCA,mDAAe,gBAAgB;CAC7B,OAAO;CACP,OAAO;CACP,MAAM,OAAO,EAAE,QAAQ;EACrB,MAAM,SAAS,OAAO,qBAAqB;EAC3C,MAAM,KAAK,aAAa,SAAQ;EAChC,MAAM,EAAE,WAAW,sBAAsB,UAAU,OAAO,EAAE,MAAM,CAAA;EAClE,MAAM,EAAE,aAAa,SAAS,OAAO,MAAK;EAC1C,MAAM,YAAY,OAAO;EAEzB,MAAM,mBAAmB,UAAsB;GAC7C,IAAI,SAAS,MAAM;GACnB,MAAM,gBAAgB,MAAM;AAE5B,UAAO,UAAU,WAAW,eAAe;AACzC,QAAI,YAAY,OAAO,CACrB;AAEF,aAAS,OAAO;;AAGlB,SAAM,gBAAe;;AAGvB,SAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACF;;CAEH,CAAA"}
@@ -0,0 +1,31 @@
import { Option } from "./select.types.js";
import { FixedSizeListInstance } from "../../virtual-list/src/components/fixed-size-list.js";
import { DynamicSizeListInstance } from "../../virtual-list/src/components/dynamic-size-list.js";
import "../../virtual-list/index.js";
import { ComponentPublicInstance, ComputedRef, ExtractPropTypes, Ref } from "vue";
import "vue/jsx-runtime";
//#region ../../packages/components/select-v2/src/select-dropdown.d.ts
declare const props: {
loading: BooleanConstructor;
data: {
type: ArrayConstructor;
required: true;
};
hoveringIndex: NumberConstructor;
width: NumberConstructor;
id: StringConstructor;
ariaLabel: StringConstructor;
};
interface SelectDropdownExposed {
listRef: Ref<FixedSizeListInstance | DynamicSizeListInstance | undefined>;
isSized: ComputedRef<boolean>;
isItemDisabled: (modelValue: any[] | any, selected: boolean) => boolean;
isItemHovering: (target: number) => boolean;
isItemSelected: (modelValue: any[] | any, target: Option) => boolean;
scrollToItem: (index: number) => void;
resetScrollTop: () => void;
}
type SelectDropdownInstance = ComponentPublicInstance<ExtractPropTypes<typeof props>, SelectDropdownExposed>;
//#endregion
export { SelectDropdownInstance };
@@ -0,0 +1,187 @@
import { EVENT_CODE } from "../../../constants/aria.mjs";
import { isIOS } from "../../../utils/browser.mjs";
import { getEventCode } from "../../../utils/dom/event.mjs";
import { isObject, isUndefined as isUndefined$1 } from "../../../utils/types.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { useProps } from "./useProps.mjs";
import FixedSizeList from "../../virtual-list/src/components/fixed-size-list.mjs";
import DynamicSizeList from "../../virtual-list/src/components/dynamic-size-list.mjs";
import group_item_default from "./group-item.mjs";
import { selectV2InjectionKey } from "./token.mjs";
import option_item_default from "./option-item.mjs";
import { get } from "lodash-unified";
import { computed, createVNode, defineComponent, inject, mergeProps, ref, toRaw, unref, watch } from "vue";
//#region ../../packages/components/select-v2/src/select-dropdown.tsx
const props = {
loading: Boolean,
data: {
type: Array,
required: true
},
hoveringIndex: Number,
width: Number,
id: String,
ariaLabel: String
};
var select_dropdown_default = /* @__PURE__ */ defineComponent({
name: "ElSelectDropdown",
props,
setup(props, { slots, expose }) {
const select = inject(selectV2InjectionKey);
const ns = useNamespace("select");
const { getLabel, getValue, getDisabled } = useProps(select.props);
const cachedHeights = ref([]);
const listRef = ref();
const size = computed(() => props.data.length);
watch(() => size.value, () => {
select.tooltipRef.value?.updatePopper?.();
});
const isSized = computed(() => isUndefined$1(select.props.estimatedOptionHeight));
const listProps = computed(() => {
if (isSized.value) return { itemSize: select.props.itemHeight };
return {
estimatedSize: select.props.estimatedOptionHeight,
itemSize: (idx) => cachedHeights.value[idx]
};
});
const contains = (arr = [], target) => {
const { props: { valueKey } } = select;
if (!isObject(target)) return arr.includes(target);
return arr && arr.some((item) => {
return toRaw(get(item, valueKey)) === get(target, valueKey);
});
};
const isEqual = (selected, target) => {
if (!isObject(target)) return selected === target;
else {
const { valueKey } = select.props;
return get(selected, valueKey) === get(target, valueKey);
}
};
const isItemSelected = (modelValue, target) => {
if (select.props.multiple) return contains(modelValue, getValue(target));
return isEqual(modelValue, getValue(target));
};
const isItemDisabled = (modelValue, selected) => {
const { disabled, multiple, multipleLimit } = select.props;
return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
};
const isItemHovering = (target) => props.hoveringIndex === target;
const scrollToItem = (index) => {
const list = listRef.value;
if (list) list.scrollToItem(index);
};
const resetScrollTop = () => {
const list = listRef.value;
if (list) list.resetScrollTop();
};
expose({
listRef,
isSized,
isItemDisabled,
isItemHovering,
isItemSelected,
scrollToItem,
resetScrollTop
});
const Item = (itemProps) => {
const { index, data, style } = itemProps;
const sized = unref(isSized);
const { itemSize, estimatedSize } = unref(listProps);
const { modelValue } = select.props;
const { onSelect, onHover } = select;
const item = data[index];
if (item.type === "Group") return createVNode(group_item_default, {
"item": item,
"style": style,
"height": sized ? itemSize : estimatedSize
}, null);
const isSelected = isItemSelected(modelValue, item);
const isDisabled = isItemDisabled(modelValue, isSelected);
const isHovering = isItemHovering(index);
return createVNode(option_item_default, mergeProps(itemProps, {
"selected": isSelected,
"disabled": getDisabled(item) || isDisabled,
"created": !!item.created,
"hovering": isHovering,
"item": item,
"onSelect": onSelect,
"onHover": onHover
}), { default: (props) => slots.default?.(props) || createVNode("span", null, [getLabel(item)]) });
};
const { onKeyboardNavigate, onKeyboardSelect } = select;
const onForward = () => {
onKeyboardNavigate("forward");
};
const onBackward = () => {
onKeyboardNavigate("backward");
};
const onEscOrTab = () => {};
const onKeydown = (e) => {
const code = getEventCode(e);
const { tab, esc, down, up, enter, numpadEnter } = EVENT_CODE;
if ([
esc,
down,
up,
enter,
numpadEnter
].includes(code)) {
e.preventDefault();
e.stopPropagation();
}
switch (code) {
case tab:
case esc:
onEscOrTab();
break;
case down:
onForward();
break;
case up:
onBackward();
break;
case enter:
case numpadEnter:
onKeyboardSelect();
break;
}
};
return () => {
const { data, width } = props;
const { height, multiple, scrollbarAlwaysOn } = select.props;
const isScrollbarAlwaysOn = computed(() => {
return isIOS ? true : scrollbarAlwaysOn;
});
const List = unref(isSized) ? FixedSizeList : DynamicSizeList;
return createVNode("div", {
"class": [ns.b("dropdown"), ns.is("multiple", multiple)],
"style": { width: `${width}px` }
}, [
slots.header?.(),
slots.loading?.() || slots.empty?.() || createVNode(List, mergeProps({ "ref": listRef }, unref(listProps), {
"className": ns.be("dropdown", "list"),
"scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
"data": data,
"height": height,
"width": width,
"total": data.length,
"innerElement": "ul",
"innerProps": {
id: props.id,
role: "listbox",
"aria-label": props.ariaLabel,
"aria-orientation": "vertical"
},
"onKeydown": onKeydown
}), { default: (props) => createVNode(Item, props, null) }),
slots.footer?.()
]);
};
}
});
//#endregion
export { select_dropdown_default as default };
//# sourceMappingURL=select-dropdown.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,365 @@
import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
import select_vue_vue_type_script_lang_default from "./select.vue_vue_type_script_lang.mjs";
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, guardReactiveProps, normalizeClass, normalizeProps, normalizeStyle, openBlock, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, toDisplayString, vShow, withCtx, withDirectives, withKeys, withModifiers } from "vue";
//#region ../../packages/components/select-v2/src/select.vue
const _hoisted_1 = [
"id",
"value",
"autocomplete",
"tabindex",
"aria-expanded",
"aria-label",
"disabled",
"aria-controls",
"aria-activedescendant",
"readonly",
"name"
];
const _hoisted_2 = ["textContent"];
const _hoisted_3 = { key: 1 };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_tag = resolveComponent("el-tag");
const _component_el_tooltip = resolveComponent("el-tooltip");
const _component_el_icon = resolveComponent("el-icon");
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)]),
onMouseenter: _cache[15] || (_cache[15] = ($event) => _ctx.states.inputHovering = true),
onMouseleave: _cache[16] || (_cache[16] = ($event) => _ctx.states.inputHovering = false)
}, [createVNode(_component_el_tooltip, {
ref: "tooltipRef",
visible: _ctx.dropdownMenuVisible,
teleported: _ctx.teleported,
"popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
"popper-style": _ctx.popperStyle,
"gpu-acceleration": false,
"stop-popper-mouse-event": false,
"popper-options": _ctx.popperOptions,
"fallback-placements": _ctx.fallbackPlacements,
effect: _ctx.effect,
placement: _ctx.placement,
pure: "",
transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
trigger: "click",
persistent: _ctx.persistent,
"append-to": _ctx.appendTo,
"show-arrow": _ctx.showArrow,
offset: _ctx.offset,
onBeforeShow: _ctx.handleMenuEnter,
onHide: _cache[14] || (_cache[14] = ($event) => _ctx.states.isBeforeHide = false)
}, {
default: withCtx(() => [createElementVNode("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: _cache[11] || (_cache[11] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["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),
createElementVNode("div", {
ref: "selectionRef",
class: normalizeClass([_ctx.nsSelect.e("selection"), _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)])
}, [
_ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
key: 0,
data: _ctx.states.cachedOptions,
deleteTag: _ctx.deleteTag,
selectDisabled: _ctx.selectDisabled
}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
return openBlock(), createElementBlock("div", {
key: _ctx.getValueKey(_ctx.getValue(item)),
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
}, [createVNode(_component_el_tag, {
closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
size: _ctx.collapseTagSize,
type: _ctx.tagType,
effect: _ctx.tagEffect,
"disable-transitions": "",
style: normalizeStyle(_ctx.tagStyle),
onClose: ($event) => _ctx.deleteTag($event, item)
}, {
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
index: _ctx.getIndex(item),
label: _ctx.getLabel(item),
value: _ctx.getValue(item)
}, () => [createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)])], 2)]),
_: 2
}, 1032, [
"closable",
"size",
"type",
"effect",
"style",
"onClose"
])], 2);
}), 128)), _ctx.collapseTags && _ctx.states.cachedOptions.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
key: 0,
ref: "tagTooltipRef",
disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
"fallback-placements": _ctx.tagTooltip?.fallbackPlacements ?? [
"bottom",
"top",
"right",
"left"
],
effect: _ctx.tagTooltip?.effect ?? _ctx.effect,
placement: _ctx.tagTooltip?.placement ?? "bottom",
"popper-class": _ctx.tagTooltip?.popperClass ?? _ctx.popperClass,
"popper-style": _ctx.tagTooltip?.popperStyle ?? _ctx.popperStyle,
teleported: _ctx.tagTooltip?.teleported ?? _ctx.teleported,
"append-to": _ctx.tagTooltip?.appendTo ?? _ctx.appendTo,
"popper-options": _ctx.tagTooltip?.popperOptions ?? _ctx.popperOptions,
transition: _ctx.tagTooltip?.transition,
"show-after": _ctx.tagTooltip?.showAfter,
"hide-after": _ctx.tagTooltip?.hideAfter,
"auto-close": _ctx.tagTooltip?.autoClose,
offset: _ctx.tagTooltip?.offset
}, {
default: withCtx(() => [createElementVNode("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,
style: normalizeStyle(_ctx.collapseTagStyle),
"disable-transitions": ""
}, {
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, " + " + toDisplayString(_ctx.states.cachedOptions.length - _ctx.maxCollapseTags), 3)]),
_: 1
}, 8, [
"size",
"type",
"effect",
"style"
])], 2)]),
content: withCtx(() => [createElementVNode("div", {
ref: "tagMenuRef",
class: normalizeClass(_ctx.nsSelect.e("selection"))
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
return openBlock(), createElementBlock("div", {
key: _ctx.getValueKey(_ctx.getValue(selected)),
class: normalizeClass(_ctx.nsSelect.e("selected-item"))
}, [createVNode(_component_el_tag, {
class: "in-tooltip",
closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
size: _ctx.collapseTagSize,
type: _ctx.tagType,
effect: _ctx.tagEffect,
"disable-transitions": "",
onClose: ($event) => _ctx.deleteTag($event, selected)
}, {
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
index: _ctx.getIndex(selected),
label: _ctx.getLabel(selected),
value: _ctx.getValue(selected)
}, () => [createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)])], 2)]),
_: 2
}, 1032, [
"closable",
"size",
"type",
"effect",
"onClose"
])], 2);
}), 128))], 2)]),
_: 3
}, 8, [
"disabled",
"fallback-placements",
"effect",
"placement",
"popper-class",
"popper-style",
"teleported",
"append-to",
"popper-options",
"transition",
"show-after",
"hide-after",
"auto-close",
"offset"
])) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true),
createElementVNode("div", { class: normalizeClass([
_ctx.nsSelect.e("selected-item"),
_ctx.nsSelect.e("input-wrapper"),
_ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled || !_ctx.states.inputValue && !_ctx.isFocused)
]) }, [createElementVNode("input", {
id: _ctx.inputId,
ref: "inputRef",
value: _ctx.states.inputValue,
style: normalizeStyle(_ctx.inputStyle),
autocomplete: _ctx.autocomplete,
tabindex: _ctx.tabindex,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
autocapitalize: "off",
"aria-expanded": _ctx.expanded,
"aria-label": _ctx.ariaLabel,
class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
disabled: _ctx.selectDisabled,
role: "combobox",
"aria-controls": _ctx.contentId,
"aria-activedescendant": _ctx.states.hoveringIndex >= 0 ? `${_ctx.contentId}-${_ctx.states.hoveringIndex}` : "",
readonly: !_ctx.filterable,
spellcheck: "false",
type: "text",
name: _ctx.name,
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
onChange: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
onCompositionstart: _cache[2] || (_cache[2] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
onCompositionupdate: _cache[3] || (_cache[3] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
onCompositionend: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
onKeydown: [
_cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
_cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
_cache[7] || (_cache[7] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
_cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
_cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
],
onClick: _cache[10] || (_cache[10] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
}, null, 46, _hoisted_1), _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, _hoisted_2)) : 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.allOptionsValueMap.get(_ctx.modelValue)?.index ?? -1,
label: _ctx.currentPlaceholder,
value: _ctx.modelValue
}, () => [createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)]) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.currentPlaceholder), 1))], 2)) : createCommentVNode("v-if", true)
], 2),
createElementVNode("div", {
ref: "suffixRef",
class: normalizeClass(_ctx.nsSelect.e("suffix"))
}, [
_ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
key: 0,
class: normalizeClass([
_ctx.nsSelect.e("caret"),
_ctx.nsInput.e("icon"),
_ctx.iconReverse
])
}, {
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
_: 1
}, 8, ["class"])), [[vShow, !_ctx.showClearBtn]]) : createCommentVNode("v-if", true),
_ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
key: 1,
class: normalizeClass([
_ctx.nsSelect.e("caret"),
_ctx.nsInput.e("icon"),
_ctx.nsSelect.e("clear")
]),
onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
}, {
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)
], 2)]),
content: withCtx(() => [createVNode(_component_el_select_menu, {
id: _ctx.contentId,
ref: "menuRef",
data: _ctx.filteredOptions,
width: _ctx.popperSize - _ctx.BORDER_HORIZONTAL_WIDTH,
"hovering-index": _ctx.states.hoveringIndex,
"scrollbar-always-on": _ctx.scrollbarAlwaysOn,
"aria-label": _ctx.ariaLabel
}, createSlots({
default: withCtx((scope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))]),
_: 2
}, [
_ctx.$slots.header ? {
name: "header",
fn: withCtx(() => [createElementVNode("div", {
class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
onClick: _cache[12] || (_cache[12] = withModifiers(() => {}, ["stop"]))
}, [renderSlot(_ctx.$slots, "header")], 2)]),
key: "0"
} : void 0,
_ctx.$slots.loading && _ctx.loading ? {
name: "loading",
fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading")) }, [renderSlot(_ctx.$slots, "loading")], 2)]),
key: "1"
} : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
name: "empty",
fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)])], 2)]),
key: "2"
} : void 0,
_ctx.$slots.footer ? {
name: "footer",
fn: withCtx(() => [createElementVNode("div", {
class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
onClick: _cache[13] || (_cache[13] = withModifiers(() => {}, ["stop"]))
}, [renderSlot(_ctx.$slots, "footer")], 2)]),
key: "3"
} : void 0
]), 1032, [
"id",
"data",
"width",
"hovering-index",
"scrollbar-always-on",
"aria-label"
])]),
_: 3
}, 8, [
"visible",
"teleported",
"popper-class",
"popper-style",
"popper-options",
"fallback-placements",
"effect",
"placement",
"transition",
"persistent",
"append-to",
"show-arrow",
"offset",
"onBeforeShow"
])], 34)), [[
_directive_click_outside,
_ctx.handleClickOutside,
_ctx.popperRef
]]);
}
var select_default = /* @__PURE__ */ _plugin_vue_export_helper_default(select_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
//#endregion
export { select_default as default };
//# sourceMappingURL=select.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
//#region ../../packages/components/select-v2/src/select.types.d.ts
type OptionCommon = Record<string, any>;
type Option = OptionCommon & {
created?: boolean;
};
type OptionGroup = OptionCommon;
type OptionType = Option | OptionGroup;
type SelectStates = {
inputValue: string;
cachedOptions: Option[];
createdOptions: Option[];
hoveringIndex: number;
inputHovering: boolean;
selectionWidth: number;
collapseItemWidth: number;
previousQuery: string | null;
previousValue: unknown;
selectedLabel: string;
menuVisibleOnFocus: boolean;
isBeforeHide: boolean;
};
//#endregion
export { Option, OptionType, SelectStates };
@@ -0,0 +1,893 @@
import { SFCWithInstall } from "../../../utils/vue/typescript.js";
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import { Arrayable } from "../../../utils/typescript.js";
import "../../../utils/index.js";
import { PopperEffect, PopperInstance, roleTypes } from "../../popper/src/popper.js";
import { TagProps } from "../../tag/src/tag.js";
import "../../tag/index.js";
import { TooltipTriggerType } from "../../tooltip/src/trigger.js";
import { TooltipContentInstance } from "../../tooltip/src/content.js";
import { TooltipInstance, UseTooltipProps } from "../../tooltip/src/tooltip.js";
import "../../tooltip/index.js";
import { IconProps } from "../../icon/src/icon.js";
import "../../icon/index.js";
import { Option, OptionType, SelectStates } from "./select.types.js";
import { SelectDropdownInstance } from "./select-dropdown.js";
import { SelectV2Props, TagTooltipProps } from "./defaults.js";
import { Props } from "./useProps.js";
import "../../../index.js";
import { Options, Placement } from "../../popper/index.js";
import * as vue from "vue";
import * as _vueuse_core0 from "@vueuse/core";
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
//#region ../../packages/components/select-v2/src/select.vue.d.ts
declare const _default: typeof __VLS_export;
declare const __VLS_export: vue.DefineComponent<vue.ExtractPropTypes<{
readonly ariaLabel: StringConstructor;
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown, undefined, boolean>;
readonly allowCreate: BooleanConstructor;
readonly autocomplete: EpPropFinalized<(new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list") | (((new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list")) | null)[], unknown, unknown, "none", boolean>;
readonly automaticDropdown: BooleanConstructor;
readonly clearable: BooleanConstructor;
readonly clearIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
readonly effect: EpPropFinalized<(new (...args: any[]) => string) | (() => PopperEffect) | (((new (...args: any[]) => string) | (() => PopperEffect)) | null)[], unknown, unknown, "light", boolean>;
readonly collapseTags: BooleanConstructor;
readonly collapseTagsTooltip: BooleanConstructor;
readonly tagTooltip: EpPropFinalized<(new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps) | (((new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps)) | null)[], unknown, unknown, () => {}, boolean>;
readonly maxCollapseTags: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly defaultFirstOption: BooleanConstructor;
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly estimatedOptionHeight: EpPropFinalized<NumberConstructor, unknown, unknown, undefined, boolean>;
readonly filterable: BooleanConstructor;
readonly filterMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly height: EpPropFinalized<NumberConstructor, unknown, unknown, 274, boolean>;
readonly itemHeight: EpPropFinalized<NumberConstructor, unknown, unknown, 34, boolean>;
readonly id: StringConstructor;
readonly loading: BooleanConstructor;
readonly loadingText: StringConstructor;
readonly modelValue: EpPropFinalized<(new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
} | (((new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
}) | null)[], unknown, unknown, undefined, boolean>;
readonly multiple: BooleanConstructor;
readonly multipleLimit: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly name: StringConstructor;
readonly noDataText: StringConstructor;
readonly noMatchText: StringConstructor;
readonly remoteMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly reserveKeyword: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly options: {
readonly type: vue.PropType<OptionType[]>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly placeholder: {
readonly type: vue.PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly teleported: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly popperClass: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (((new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[])) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperStyle: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | false | vue.CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue) | (((new (...args: any[]) => string | false | vue.CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperOptions: EpPropFinalized<(new (...args: any[]) => Partial<Options>) | (() => Partial<Options>) | (((new (...args: any[]) => Partial<Options>) | (() => Partial<Options>)) | null)[], unknown, unknown, () => Partial<Options>, boolean>;
readonly remote: BooleanConstructor;
readonly debounce: EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly size: {
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly props: EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | (((new (...args: any[]) => Props) | (() => Props)) | null)[], unknown, unknown, () => Required<Props>, boolean>;
readonly valueKey: EpPropFinalized<StringConstructor, unknown, unknown, "value", boolean>;
readonly scrollbarAlwaysOn: BooleanConstructor;
readonly validateEvent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 12, boolean>;
readonly remoteShowSuffix: BooleanConstructor;
readonly showArrow: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly placement: EpPropFinalized<(new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, "bottom-start", boolean>;
readonly fallbackPlacements: EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | (((new (...args: any[]) => Placement[]) | (() => Placement[])) | null)[], unknown, unknown, readonly ["bottom-start", "top-start", "right", "left"], boolean>;
readonly tagType: {
readonly default: "info";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tagEffect: {
readonly default: "light";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "light" | "dark" | "plain", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tabindex: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
readonly appendTo: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>) | (((new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly fitInputWidth: EpPropFinalized<readonly [BooleanConstructor, NumberConstructor], unknown, number | boolean, true, boolean>;
readonly suffixIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
}>, {
modelValue: vue.ComputedRef<any>;
selectedLabel: vue.ComputedRef<string | string[]>;
calculatorRef: vue.ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
inputStyle: vue.ComputedRef<{
minWidth: string;
}>;
contentId: vue.Ref<string, string>;
BORDER_HORIZONTAL_WIDTH: number;
inputId: vue.Ref<string | undefined, string | undefined>;
collapseTagSize: vue.ComputedRef<"default" | "small">;
currentPlaceholder: vue.ComputedRef<string>;
expanded: vue.Ref<boolean, boolean>;
emptyText: vue.ComputedRef<string | null>;
popupHeight: vue.ComputedRef<number>;
debounce: vue.ComputedRef<number>;
allOptions: vue.ComputedRef<OptionType[]>;
allOptionsValueMap: vue.ComputedRef<Map<any, any>>;
filteredOptions: vue.Ref<({
[x: string]: any;
} | {
[x: string]: any;
created?: boolean | undefined;
})[], OptionType[] | ({
[x: string]: any;
} | {
[x: string]: any;
created?: boolean | undefined;
})[]>;
iconComponent: vue.ComputedRef<EpPropMergeType<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown>>;
iconReverse: vue.ComputedRef<string>;
tagStyle: vue.ComputedRef<{
maxWidth: string;
}>;
collapseTagStyle: vue.ComputedRef<{
maxWidth: string;
}>;
popperSize: vue.Ref<number, number>;
dropdownMenuVisible: vue.WritableComputedRef<boolean, boolean>;
hasModelValue: vue.ComputedRef<boolean>;
shouldShowPlaceholder: vue.ComputedRef<boolean>;
selectDisabled: vue.ComputedRef<boolean>;
selectSize: vue.ComputedRef<"" | "default" | "small" | "large">;
needStatusIcon: vue.ComputedRef<boolean>;
showClearBtn: vue.ComputedRef<boolean>;
states: SelectStates;
isFocused: vue.Ref<boolean, boolean>;
nsSelect: {
namespace: vue.ComputedRef<string>;
b: (blockSuffix?: string) => string;
e: (element?: string) => string;
m: (modifier?: string) => string;
be: (blockSuffix?: string, element?: string) => string;
em: (element?: string, modifier?: string) => string;
bm: (blockSuffix?: string, modifier?: string) => string;
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
is: {
(name: string, state: boolean | undefined): string;
(name: string): string;
};
cssVar: (object: Record<string, string>) => Record<string, string>;
cssVarName: (name: string) => string;
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
cssVarBlockName: (name: string) => string;
};
nsInput: {
namespace: vue.ComputedRef<string>;
b: (blockSuffix?: string) => string;
e: (element?: string) => string;
m: (modifier?: string) => string;
be: (blockSuffix?: string, element?: string) => string;
em: (element?: string, modifier?: string) => string;
bm: (blockSuffix?: string, modifier?: string) => string;
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
is: {
(name: string, state: boolean | undefined): string;
(name: string): string;
};
cssVar: (object: Record<string, string>) => Record<string, string>;
cssVarName: (name: string) => string;
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
cssVarBlockName: (name: string) => string;
};
inputRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
menuRef: vue.Ref<SelectDropdownInstance | undefined, SelectDropdownInstance | undefined>;
tagMenuRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
tooltipRef: vue.Ref<TooltipInstance | undefined, TooltipInstance | undefined>;
tagTooltipRef: vue.Ref<TooltipInstance | undefined, TooltipInstance | undefined>;
selectRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
wrapperRef: vue.ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
selectionRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
prefixRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
suffixRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
collapseItemRef: vue.Ref<HTMLElement | undefined, HTMLElement | undefined>;
popperRef: vue.ComputedRef<HTMLElement | undefined>;
validateState: vue.ComputedRef<"error" | "" | "success" | "validating">;
validateIcon: vue.ComputedRef<vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any> | undefined>;
showTagList: vue.ComputedRef<Option[]>;
collapseTagList: vue.ComputedRef<Option[]>;
debouncedOnInputChange: _vueuse_core0.PromisifyFn<() => void>;
deleteTag: (event: MouseEvent, option: Option) => void;
getLabel: (option: Option) => any;
getValue: (option: Option) => any;
getDisabled: (option: Option) => any;
getValueKey: (item: unknown) => any;
getIndex: (option: Option) => any;
handleClear: () => void;
handleClickOutside: (event: Event) => void;
handleDel: (e: KeyboardEvent) => void;
handleEsc: () => void;
focus: () => void;
blur: () => void;
handleMenuEnter: () => Promise<void>;
handleResize: () => void;
resetSelectionWidth: () => void;
updateTooltip: () => void;
updateTagTooltip: () => void;
updateOptions: () => void;
toggleMenu: (event?: Event) => void;
scrollTo: (index: number) => void;
onInput: (event: Event) => void;
onKeyboardNavigate: (direction: "forward" | "backward", hoveringIndex?: number | undefined) => void;
onKeyboardSelect: () => void;
onSelect: (option: Option) => void;
onHover: (idx?: number) => void;
handleCompositionStart: (event: CompositionEvent) => void;
handleCompositionEnd: (event: CompositionEvent) => void;
handleCompositionUpdate: (event: CompositionEvent) => void;
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
"update:modelValue": (val: SelectV2Props["modelValue"]) => boolean;
change: (val: SelectV2Props["modelValue"]) => boolean;
'remove-tag': (val: unknown) => boolean;
'visible-change': (visible: boolean) => boolean;
focus: (evt: FocusEvent) => boolean;
blur: (evt: FocusEvent) => boolean;
clear: () => boolean;
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
readonly ariaLabel: StringConstructor;
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown, undefined, boolean>;
readonly allowCreate: BooleanConstructor;
readonly autocomplete: EpPropFinalized<(new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list") | (((new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list")) | null)[], unknown, unknown, "none", boolean>;
readonly automaticDropdown: BooleanConstructor;
readonly clearable: BooleanConstructor;
readonly clearIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
readonly effect: EpPropFinalized<(new (...args: any[]) => string) | (() => PopperEffect) | (((new (...args: any[]) => string) | (() => PopperEffect)) | null)[], unknown, unknown, "light", boolean>;
readonly collapseTags: BooleanConstructor;
readonly collapseTagsTooltip: BooleanConstructor;
readonly tagTooltip: EpPropFinalized<(new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps) | (((new (...args: any[]) => TagTooltipProps) | (() => TagTooltipProps)) | null)[], unknown, unknown, () => {}, boolean>;
readonly maxCollapseTags: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
readonly defaultFirstOption: BooleanConstructor;
readonly disabled: EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly estimatedOptionHeight: EpPropFinalized<NumberConstructor, unknown, unknown, undefined, boolean>;
readonly filterable: BooleanConstructor;
readonly filterMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly height: EpPropFinalized<NumberConstructor, unknown, unknown, 274, boolean>;
readonly itemHeight: EpPropFinalized<NumberConstructor, unknown, unknown, 34, boolean>;
readonly id: StringConstructor;
readonly loading: BooleanConstructor;
readonly loadingText: StringConstructor;
readonly modelValue: EpPropFinalized<(new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
} | (((new (...args: any[]) => any) | (() => any) | {
(): any;
new (): any;
readonly prototype: any;
}) | null)[], unknown, unknown, undefined, boolean>;
readonly multiple: BooleanConstructor;
readonly multipleLimit: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly name: StringConstructor;
readonly noDataText: StringConstructor;
readonly noMatchText: StringConstructor;
readonly remoteMethod: {
readonly type: vue.PropType<(query: string) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly reserveKeyword: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly options: {
readonly type: vue.PropType<OptionType[]>;
readonly required: true;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly placeholder: {
readonly type: vue.PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly teleported: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly popperClass: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (((new (...args: any[]) => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | (string | {
[x: string]: boolean;
} | any)[])[])[])[])[])[])[])[])[])[])[])) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperStyle: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | false | vue.CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue) | (((new (...args: any[]) => string | false | vue.CSSProperties | vue.StyleValue[]) | (() => vue.StyleValue)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly popperOptions: EpPropFinalized<(new (...args: any[]) => Partial<Options>) | (() => Partial<Options>) | (((new (...args: any[]) => Partial<Options>) | (() => Partial<Options>)) | null)[], unknown, unknown, () => Partial<Options>, boolean>;
readonly remote: BooleanConstructor;
readonly debounce: EpPropFinalized<NumberConstructor, unknown, unknown, 300, boolean>;
readonly size: {
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly props: EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | (((new (...args: any[]) => Props) | (() => Props)) | null)[], unknown, unknown, () => Required<Props>, boolean>;
readonly valueKey: EpPropFinalized<StringConstructor, unknown, unknown, "value", boolean>;
readonly scrollbarAlwaysOn: BooleanConstructor;
readonly validateEvent: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 12, boolean>;
readonly remoteShowSuffix: BooleanConstructor;
readonly showArrow: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly placement: EpPropFinalized<(new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, "bottom-start", boolean>;
readonly fallbackPlacements: EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | (((new (...args: any[]) => Placement[]) | (() => Placement[])) | null)[], unknown, unknown, readonly ["bottom-start", "top-start", "right", "left"], boolean>;
readonly tagType: {
readonly default: "info";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tagEffect: {
readonly default: "light";
readonly type: vue.PropType<EpPropMergeType<StringConstructor, "light" | "dark" | "plain", unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly tabindex: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
readonly appendTo: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>) | (((new (...args: any[]) => string | HTMLElement) | (() => EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly fitInputWidth: EpPropFinalized<readonly [BooleanConstructor, NumberConstructor], unknown, number | boolean, true, boolean>;
readonly suffixIcon: EpPropFinalized<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown, vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>, boolean>;
}>> & Readonly<{
onBlur?: ((evt: FocusEvent) => any) | undefined;
onChange?: ((val: any) => any) | undefined;
onFocus?: ((evt: FocusEvent) => any) | undefined;
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
onClear?: (() => any) | undefined;
"onVisible-change"?: ((visible: boolean) => any) | undefined;
"onRemove-tag"?: ((val: unknown) => any) | undefined;
}>, {
readonly offset: number;
readonly teleported: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly props: Props;
readonly effect: EpPropMergeType<(new (...args: any[]) => string) | (() => PopperEffect) | (((new (...args: any[]) => string) | (() => PopperEffect)) | null)[], unknown, unknown>;
readonly disabled: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly modelValue: any;
readonly autocomplete: EpPropMergeType<(new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list") | (((new (...args: any[]) => "none" | "both" | "inline" | "list") | (() => "none" | "both" | "inline" | "list")) | null)[], unknown, unknown>;
readonly clearable: boolean;
readonly clearIcon: EpPropMergeType<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown>;
readonly suffixIcon: EpPropMergeType<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown>;
readonly tabindex: EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
readonly validateEvent: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly multiple: boolean;
readonly fallbackPlacements: Placement[];
readonly placement: EpPropMergeType<(new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "top" | "auto" | "bottom" | "left" | "right" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown>;
readonly popperOptions: Partial<Options>;
readonly showArrow: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly persistent: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly height: number;
readonly valueKey: string;
readonly debounce: number;
readonly fitInputWidth: EpPropMergeType<readonly [BooleanConstructor, NumberConstructor], unknown, number | boolean>;
readonly loading: boolean;
readonly valueOnClear: EpPropMergeType<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown>;
readonly filterable: boolean;
readonly collapseTags: boolean;
readonly maxCollapseTags: number;
readonly collapseTagsTooltip: boolean;
readonly tagType: EpPropMergeType<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown>;
readonly tagEffect: EpPropMergeType<StringConstructor, "light" | "dark" | "plain", unknown>;
readonly automaticDropdown: boolean;
readonly allowCreate: boolean;
readonly remote: boolean;
readonly multipleLimit: number;
readonly defaultFirstOption: boolean;
readonly reserveKeyword: EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly tagTooltip: TagTooltipProps;
readonly remoteShowSuffix: boolean;
readonly estimatedOptionHeight: number;
readonly itemHeight: number;
readonly scrollbarAlwaysOn: boolean;
}, {}, {
ElSelectMenu: vue.DefineComponent<vue.ExtractPropTypes<{
loading: BooleanConstructor;
data: {
type: ArrayConstructor;
required: true;
};
hoveringIndex: NumberConstructor;
width: NumberConstructor;
id: StringConstructor;
ariaLabel: StringConstructor;
}>, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
loading: BooleanConstructor;
data: {
type: ArrayConstructor;
required: true;
};
hoveringIndex: NumberConstructor;
width: NumberConstructor;
id: StringConstructor;
ariaLabel: StringConstructor;
}>> & Readonly<{}>, {
loading: boolean;
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
ElTag: SFCWithInstall<{
new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<TagProps> & Readonly<{
onClick?: ((evt: MouseEvent) => any) | undefined;
onClose?: ((evt: MouseEvent) => any) | undefined;
}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
click: (evt: MouseEvent) => void;
close: (evt: MouseEvent) => void;
}, vue.PublicProps, {
type: "primary" | "success" | "info" | "warning" | "danger";
effect: "dark" | "light" | "plain";
}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
P: {};
B: {};
D: {};
C: {};
M: {};
Defaults: {};
}, Readonly<TagProps> & Readonly<{
onClick?: ((evt: MouseEvent) => any) | undefined;
onClose?: ((evt: MouseEvent) => any) | undefined;
}>, {}, {}, {}, {}, {
type: "primary" | "success" | "info" | "warning" | "danger";
effect: "dark" | "light" | "plain";
}>;
__isFragment?: never;
__isTeleport?: never;
__isSuspense?: never;
} & vue.ComponentOptionsBase<Readonly<TagProps> & Readonly<{
onClick?: ((evt: MouseEvent) => any) | undefined;
onClose?: ((evt: MouseEvent) => any) | undefined;
}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
click: (evt: MouseEvent) => void;
close: (evt: MouseEvent) => void;
}, string, {
type: "primary" | "success" | "info" | "warning" | "danger";
effect: "dark" | "light" | "plain";
}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
$slots: {
default?: (props: {}) => any;
} & {
default?: (props: {}) => any;
};
})>;
ElTooltip: SFCWithInstall<{
new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<UseTooltipProps> & Readonly<{
onClose?: ((...args: any[]) => any) | undefined;
onHide?: ((...args: any[]) => any) | undefined;
onShow?: ((...args: any[]) => any) | undefined;
onOpen?: ((...args: any[]) => any) | undefined;
"onUpdate:visible"?: ((...args: any[]) => any) | undefined;
"onBefore-show"?: ((...args: any[]) => any) | undefined;
"onBefore-hide"?: ((...args: any[]) => any) | undefined;
}>, {
popperRef: vue.Ref<PopperInstance | undefined, PopperInstance | undefined>;
contentRef: vue.Ref<TooltipContentInstance | undefined, TooltipContentInstance | undefined>;
isFocusInsideContent: (event?: FocusEvent) => boolean | undefined;
updatePopper: () => void;
onOpen: (event?: Event, delay?: number) => void;
onClose: (event?: Event, delay?: number) => void;
hide: (event?: Event) => void;
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
close: (...args: any[]) => void;
hide: (...args: any[]) => void;
show: (...args: any[]) => void;
open: (...args: any[]) => void;
"update:visible": (...args: any[]) => void;
"before-show": (...args: any[]) => void;
"before-hide": (...args: any[]) => void;
}, vue.PublicProps, {
offset: number;
teleported: boolean;
effect: PopperEffect;
visible: boolean | null;
content: string;
style: string | false | vue.CSSProperties | vue.StyleValue[] | null;
enterable: boolean;
pure: boolean;
focusOnShow: boolean;
trapping: boolean;
popperStyle: string | false | vue.CSSProperties | vue.StyleValue[] | null;
stopPopperMouseEvent: boolean;
virtualTriggering: boolean;
loop: boolean;
boundariesPadding: number;
gpuAcceleration: boolean;
placement: Placement;
popperOptions: Partial<Options>;
strategy: "fixed" | "absolute";
arrowOffset: number;
showArrow: boolean;
role: typeof roleTypes[number];
showAfter: number;
hideAfter: number;
autoClose: number;
trigger: Arrayable<TooltipTriggerType>;
triggerKeys: string[];
}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
P: {};
B: {};
D: {};
C: {};
M: {};
Defaults: {};
}, Readonly<UseTooltipProps> & Readonly<{
onClose?: ((...args: any[]) => any) | undefined;
onHide?: ((...args: any[]) => any) | undefined;
onShow?: ((...args: any[]) => any) | undefined;
onOpen?: ((...args: any[]) => any) | undefined;
"onUpdate:visible"?: ((...args: any[]) => any) | undefined;
"onBefore-show"?: ((...args: any[]) => any) | undefined;
"onBefore-hide"?: ((...args: any[]) => any) | undefined;
}>, {
popperRef: vue.Ref<PopperInstance | undefined, PopperInstance | undefined>;
contentRef: vue.Ref<TooltipContentInstance | undefined, TooltipContentInstance | undefined>;
isFocusInsideContent: (event?: FocusEvent) => boolean | undefined;
updatePopper: () => void;
onOpen: (event?: Event, delay?: number) => void;
onClose: (event?: Event, delay?: number) => void;
hide: (event?: Event) => void;
}, {}, {}, {}, {
offset: number;
teleported: boolean;
effect: PopperEffect;
visible: boolean | null;
content: string;
style: string | false | vue.CSSProperties | vue.StyleValue[] | null;
enterable: boolean;
pure: boolean;
focusOnShow: boolean;
trapping: boolean;
popperStyle: string | false | vue.CSSProperties | vue.StyleValue[] | null;
stopPopperMouseEvent: boolean;
virtualTriggering: boolean;
loop: boolean;
boundariesPadding: number;
gpuAcceleration: boolean;
placement: Placement;
popperOptions: Partial<Options>;
strategy: "fixed" | "absolute";
arrowOffset: number;
showArrow: boolean;
role: typeof roleTypes[number];
showAfter: number;
hideAfter: number;
autoClose: number;
trigger: Arrayable<TooltipTriggerType>;
triggerKeys: string[];
}>;
__isFragment?: never;
__isTeleport?: never;
__isSuspense?: never;
} & vue.ComponentOptionsBase<Readonly<UseTooltipProps> & Readonly<{
onClose?: ((...args: any[]) => any) | undefined;
onHide?: ((...args: any[]) => any) | undefined;
onShow?: ((...args: any[]) => any) | undefined;
onOpen?: ((...args: any[]) => any) | undefined;
"onUpdate:visible"?: ((...args: any[]) => any) | undefined;
"onBefore-show"?: ((...args: any[]) => any) | undefined;
"onBefore-hide"?: ((...args: any[]) => any) | undefined;
}>, {
popperRef: vue.Ref<PopperInstance | undefined, PopperInstance | undefined>;
contentRef: vue.Ref<TooltipContentInstance | undefined, TooltipContentInstance | undefined>;
isFocusInsideContent: (event?: FocusEvent) => boolean | undefined;
updatePopper: () => void;
onOpen: (event?: Event, delay?: number) => void;
onClose: (event?: Event, delay?: number) => void;
hide: (event?: Event) => void;
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
close: (...args: any[]) => void;
hide: (...args: any[]) => void;
show: (...args: any[]) => void;
open: (...args: any[]) => void;
"update:visible": (...args: any[]) => void;
"before-show": (...args: any[]) => void;
"before-hide": (...args: any[]) => void;
}, string, {
offset: number;
teleported: boolean;
effect: PopperEffect;
visible: boolean | null;
content: string;
style: string | false | vue.CSSProperties | vue.StyleValue[] | null;
enterable: boolean;
pure: boolean;
focusOnShow: boolean;
trapping: boolean;
popperStyle: string | false | vue.CSSProperties | vue.StyleValue[] | null;
stopPopperMouseEvent: boolean;
virtualTriggering: boolean;
loop: boolean;
boundariesPadding: number;
gpuAcceleration: boolean;
placement: Placement;
popperOptions: Partial<Options>;
strategy: "fixed" | "absolute";
arrowOffset: number;
showArrow: boolean;
role: typeof roleTypes[number];
showAfter: number;
hideAfter: number;
autoClose: number;
trigger: Arrayable<TooltipTriggerType>;
triggerKeys: string[];
}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
$slots: {
default?: (props: {}) => any;
} & {
content?: (props: {}) => any;
};
})>;
ElIcon: SFCWithInstall<{
new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
P: {};
B: {};
D: {};
C: {};
M: {};
Defaults: {};
}, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, {}>;
__isFragment?: never;
__isTeleport?: never;
__isSuspense?: never;
} & vue.ComponentOptionsBase<Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
$slots: {
default?: (props: {}) => any;
};
})>;
}, {
ClickOutside: vue.ObjectDirective<HTMLElement, any, string, any>;
}, string, vue.ComponentProvideOptions, true, {}, any>;
//#endregion
export { _default };
@@ -0,0 +1,72 @@
import { BORDER_HORIZONTAL_WIDTH } from "../../../constants/form.mjs";
import { isArray } from "../../../utils/types.mjs";
import ClickOutside from "../../../directives/click-outside/index.mjs";
import { useCalcInputWidth } from "../../../hooks/use-calc-input-width/index.mjs";
import { useId } from "../../../hooks/use-id/index.mjs";
import { ElIcon } from "../../icon/index.mjs";
import { ElTooltip } from "../../tooltip/index.mjs";
import { ElTag } from "../../tag/index.mjs";
import { selectV2Emits, selectV2Props } from "./defaults.mjs";
import { selectV2InjectionKey } from "./token.mjs";
import select_dropdown_default from "./select-dropdown.mjs";
import useSelect from "./useSelect.mjs";
import { computed, defineComponent, provide, reactive, toRefs } from "vue";
//#region ../../packages/components/select-v2/src/select.vue?vue&type=script&lang.ts
var select_vue_vue_type_script_lang_default = defineComponent({
name: "ElSelectV2",
components: {
ElSelectMenu: select_dropdown_default,
ElTag,
ElTooltip,
ElIcon
},
directives: { ClickOutside },
props: selectV2Props,
emits: selectV2Emits,
setup(props, { emit }) {
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 API = useSelect(reactive({
...toRefs(props),
modelValue
}), emit);
const { calculatorRef, inputStyle } = useCalcInputWidth();
const contentId = useId();
provide(selectV2InjectionKey, {
props: reactive({
...toRefs(props),
height: API.popupHeight,
modelValue
}),
expanded: API.expanded,
tooltipRef: API.tooltipRef,
contentId,
onSelect: API.onSelect,
onHover: API.onHover,
onKeyboardNavigate: API.onKeyboardNavigate,
onKeyboardSelect: API.onKeyboardSelect
});
const selectedLabel = computed(() => {
if (!props.multiple) return API.states.selectedLabel;
return API.states.cachedOptions.map((i) => API.getLabel(i));
});
return {
...API,
modelValue,
selectedLabel,
calculatorRef,
inputStyle,
contentId,
BORDER_HORIZONTAL_WIDTH
};
}
});
//#endregion
export { select_vue_vue_type_script_lang_default as default };
//# sourceMappingURL=select.vue_vue_type_script_lang.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
import { TooltipInstance } from "../../tooltip/src/tooltip.js";
import "../../tooltip/index.js";
import { Option } from "./select.types.js";
import { OptionV2Props, SelectV2Instance, SelectV2Props } from "./defaults.js";
import { InjectionKey, Ref } from "vue";
//#region ../../packages/components/select-v2/src/token.d.ts
interface SelectV2Context {
props: SelectV2Props;
expanded: Ref<boolean>;
tooltipRef: Ref<TooltipInstance | undefined>;
contentId: Ref<string>;
onSelect: (option: Option) => void;
onHover: (idx?: number) => void;
onKeyboardNavigate: (direction: 'forward' | 'backward') => void;
onKeyboardSelect: () => void;
}
declare const selectV2InjectionKey: InjectionKey<SelectV2Context>;
//#endregion
export { SelectV2Context, selectV2InjectionKey };
@@ -0,0 +1,6 @@
//#region ../../packages/components/select-v2/src/token.ts
const selectV2InjectionKey = Symbol("ElSelectV2Injection");
//#endregion
export { selectV2InjectionKey };
//# sourceMappingURL=token.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"token.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/token.ts"],"sourcesContent":["import type { OptionV2Props, SelectV2Instance, SelectV2Props } from './defaults'\nimport type { InjectionKey, Ref } from 'vue'\nimport type { Option } from './select.types'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\n\nexport interface SelectV2Context {\n props: SelectV2Props\n expanded: Ref<boolean>\n tooltipRef: Ref<TooltipInstance | undefined>\n contentId: Ref<string>\n onSelect: (option: Option) => void\n onHover: (idx?: number) => void\n onKeyboardNavigate: (direction: 'forward' | 'backward') => void\n onKeyboardSelect: () => void\n}\n\nexport const selectV2InjectionKey: InjectionKey<SelectV2Context> = Symbol(\n 'ElSelectV2Injection'\n)\nexport type { SelectV2Instance, OptionV2Props, SelectV2Props }\n"],"mappings":";AAgBA,MAAa,uBAAsD,OACjE,sBACD"}
@@ -0,0 +1,70 @@
import { useProps } from "./useProps.mjs";
import { computed, ref, watch } from "vue";
//#region ../../packages/components/select-v2/src/useAllowCreate.ts
function useAllowCreate(props, states) {
const { aliasProps, getLabel, getValue } = useProps(props);
const createOptionCount = ref(0);
const cachedSelectedOption = ref();
const enableAllowCreateMode = computed(() => {
return props.allowCreate && props.filterable;
});
watch(() => props.options, (options) => {
const optionLabelsSet = new Set(options.map((option) => getLabel(option)));
states.createdOptions = states.createdOptions.filter((createdOption) => !optionLabelsSet.has(getLabel(createdOption)));
});
function hasExistingOption(query) {
const hasOption = (option) => getLabel(option) === query;
return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
}
function selectNewOption(option) {
if (!enableAllowCreateMode.value) return;
if (props.multiple && option.created) createOptionCount.value++;
else cachedSelectedOption.value = option;
}
function createNewOption(query) {
if (enableAllowCreateMode.value) if (query && query.length > 0) {
if (hasExistingOption(query)) {
states.createdOptions = states.createdOptions.filter((createdOption) => getLabel(createdOption) !== states.previousQuery);
return;
}
const newOption = {
[aliasProps.value.value]: query,
[aliasProps.value.label]: query,
created: true,
[aliasProps.value.disabled]: false
};
if (states.createdOptions.length >= createOptionCount.value) states.createdOptions[createOptionCount.value] = newOption;
else states.createdOptions.push(newOption);
} else if (props.multiple) states.createdOptions.length = createOptionCount.value;
else {
const selectedOption = cachedSelectedOption.value;
states.createdOptions.length = 0;
if (selectedOption && selectedOption.created) states.createdOptions.push(selectedOption);
}
}
function removeNewOption(option) {
if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) return;
const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
if (~idx) {
states.createdOptions.splice(idx, 1);
createOptionCount.value--;
}
}
function clearAllNewOption() {
if (enableAllowCreateMode.value) {
states.createdOptions.length = 0;
createOptionCount.value = 0;
}
}
return {
createNewOption,
removeNewOption,
selectNewOption,
clearAllNewOption
};
}
//#endregion
export { useAllowCreate };
//# sourceMappingURL=useAllowCreate.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"useAllowCreate.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/useAllowCreate.ts"],"sourcesContent":["import { computed, ref, watch } from 'vue'\nimport { useProps } from './useProps'\n\nimport type { SelectV2Props } from './token'\nimport type { Option, SelectStates } from './select.types'\n\nexport function useAllowCreate(props: SelectV2Props, states: SelectStates) {\n const { aliasProps, getLabel, getValue } = useProps(props)\n\n const createOptionCount = ref(0)\n const cachedSelectedOption = ref<Option>()\n\n const enableAllowCreateMode = computed(() => {\n return props.allowCreate && props.filterable\n })\n\n watch(\n () => props.options,\n (options) => {\n const optionLabelsSet = new Set(options.map((option) => getLabel(option)))\n states.createdOptions = states.createdOptions.filter(\n (createdOption) => !optionLabelsSet.has(getLabel(createdOption))\n )\n }\n )\n\n function hasExistingOption(query: string) {\n const hasOption = (option: Option) => getLabel(option) === query\n return (\n (props.options && props.options.some(hasOption)) ||\n states.createdOptions.some(hasOption)\n )\n }\n\n function selectNewOption(option: Option) {\n if (!enableAllowCreateMode.value) {\n return\n }\n if (props.multiple && option.created) {\n createOptionCount.value++\n } else {\n cachedSelectedOption.value = option\n }\n }\n\n function createNewOption(query: string) {\n if (enableAllowCreateMode.value) {\n if (query && query.length > 0) {\n if (hasExistingOption(query)) {\n states.createdOptions = states.createdOptions.filter(\n (createdOption) => getLabel(createdOption) !== states.previousQuery\n )\n return\n }\n const newOption = {\n [aliasProps.value.value]: query,\n [aliasProps.value.label]: query,\n created: true,\n [aliasProps.value.disabled]: false,\n }\n if (states.createdOptions.length >= createOptionCount.value) {\n states.createdOptions[createOptionCount.value] = newOption\n } else {\n states.createdOptions.push(newOption)\n }\n } else {\n if (props.multiple) {\n states.createdOptions.length = createOptionCount.value\n } else {\n const selectedOption = cachedSelectedOption.value\n states.createdOptions.length = 0\n if (selectedOption && selectedOption.created) {\n states.createdOptions.push(selectedOption)\n }\n }\n }\n }\n }\n\n function removeNewOption(option: Option) {\n if (\n !enableAllowCreateMode.value ||\n !option ||\n !option.created ||\n (option.created &&\n props.reserveKeyword &&\n states.inputValue === getLabel(option))\n ) {\n return\n }\n const idx = states.createdOptions.findIndex(\n (it) => getValue(it) === getValue(option)\n )\n if (~idx) {\n states.createdOptions.splice(idx, 1)\n createOptionCount.value--\n }\n }\n\n function clearAllNewOption() {\n if (enableAllowCreateMode.value) {\n states.createdOptions.length = 0\n createOptionCount.value = 0\n }\n }\n\n return {\n createNewOption,\n removeNewOption,\n selectNewOption,\n clearAllNewOption,\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,eAAe,OAAsB,QAAsB;CACzE,MAAM,EAAE,YAAY,UAAU,aAAa,SAAS,MAAM;CAE1D,MAAM,oBAAoB,IAAI,EAAE;CAChC,MAAM,uBAAuB,KAAa;CAE1C,MAAM,wBAAwB,eAAe;AAC3C,SAAO,MAAM,eAAe,MAAM;GAClC;AAEF,aACQ,MAAM,UACX,YAAY;EACX,MAAM,kBAAkB,IAAI,IAAI,QAAQ,KAAK,WAAW,SAAS,OAAO,CAAC,CAAC;AAC1E,SAAO,iBAAiB,OAAO,eAAe,QAC3C,kBAAkB,CAAC,gBAAgB,IAAI,SAAS,cAAc,CAAC,CACjE;GAEJ;CAED,SAAS,kBAAkB,OAAe;EACxC,MAAM,aAAa,WAAmB,SAAS,OAAO,KAAK;AAC3D,SACG,MAAM,WAAW,MAAM,QAAQ,KAAK,UAAU,IAC/C,OAAO,eAAe,KAAK,UAAU;;CAIzC,SAAS,gBAAgB,QAAgB;AACvC,MAAI,CAAC,sBAAsB,MACzB;AAEF,MAAI,MAAM,YAAY,OAAO,QAC3B,mBAAkB;MAElB,sBAAqB,QAAQ;;CAIjC,SAAS,gBAAgB,OAAe;AACtC,MAAI,sBAAsB,MACxB,KAAI,SAAS,MAAM,SAAS,GAAG;AAC7B,OAAI,kBAAkB,MAAM,EAAE;AAC5B,WAAO,iBAAiB,OAAO,eAAe,QAC3C,kBAAkB,SAAS,cAAc,KAAK,OAAO,cACvD;AACD;;GAEF,MAAM,YAAY;KACf,WAAW,MAAM,QAAQ;KACzB,WAAW,MAAM,QAAQ;IAC1B,SAAS;KACR,WAAW,MAAM,WAAW;IAC9B;AACD,OAAI,OAAO,eAAe,UAAU,kBAAkB,MACpD,QAAO,eAAe,kBAAkB,SAAS;OAEjD,QAAO,eAAe,KAAK,UAAU;aAGnC,MAAM,SACR,QAAO,eAAe,SAAS,kBAAkB;OAC5C;GACL,MAAM,iBAAiB,qBAAqB;AAC5C,UAAO,eAAe,SAAS;AAC/B,OAAI,kBAAkB,eAAe,QACnC,QAAO,eAAe,KAAK,eAAe;;;CAOpD,SAAS,gBAAgB,QAAgB;AACvC,MACE,CAAC,sBAAsB,SACvB,CAAC,UACD,CAAC,OAAO,WACP,OAAO,WACN,MAAM,kBACN,OAAO,eAAe,SAAS,OAAO,CAExC;EAEF,MAAM,MAAM,OAAO,eAAe,WAC/B,OAAO,SAAS,GAAG,KAAK,SAAS,OAAO,CAC1C;AACD,MAAI,CAAC,KAAK;AACR,UAAO,eAAe,OAAO,KAAK,EAAE;AACpC,qBAAkB;;;CAItB,SAAS,oBAAoB;AAC3B,MAAI,sBAAsB,OAAO;AAC/B,UAAO,eAAe,SAAS;AAC/B,qBAAkB,QAAQ;;;AAI9B,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,15 @@
//#region ../../packages/components/select-v2/src/useOption.ts
function useOption(props, { emit }) {
return {
hoverItem: () => {
if (!props.disabled) emit("hover", props.index);
},
selectOptionClick: () => {
if (!props.disabled) emit("select", props.item, props.index);
}
};
}
//#endregion
export { useOption };
//# sourceMappingURL=useOption.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"useOption.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/useOption.ts"],"sourcesContent":["import type { OptionV2EmitFn, OptionV2Props } from './defaults'\n\nexport function useOption(\n props: OptionV2Props,\n { emit }: { emit: OptionV2EmitFn }\n) {\n return {\n hoverItem: () => {\n if (!props.disabled) {\n emit('hover', props.index)\n }\n },\n selectOptionClick: () => {\n if (!props.disabled) {\n emit('select', props.item, props.index)\n }\n },\n }\n}\n"],"mappings":";AAEA,SAAgB,UACd,OACA,EAAE,QACF;AACA,QAAO;EACL,iBAAiB;AACf,OAAI,CAAC,MAAM,SACT,MAAK,SAAS,MAAM,MAAM;;EAG9B,yBAAyB;AACvB,OAAI,CAAC,MAAM,SACT,MAAK,UAAU,MAAM,MAAM,MAAM,MAAM;;EAG5C"}
@@ -0,0 +1,12 @@
import "./token.js";
import "vue";
//#region ../../packages/components/select-v2/src/useProps.d.ts
interface Props {
label?: string;
value?: string;
disabled?: string;
options?: string;
}
//#endregion
export { Props };
@@ -0,0 +1,41 @@
import { get, isEqual } from "lodash-unified";
import { ref, watch } from "vue";
//#region ../../packages/components/select-v2/src/useProps.ts
const defaultProps = {
label: "label",
value: "value",
disabled: "disabled",
options: "options"
};
function useProps(props) {
const aliasProps = ref({
...defaultProps,
...props.props
});
let cache = { ...props.props };
watch(() => props.props, (val) => {
if (!isEqual(val, cache)) {
aliasProps.value = {
...defaultProps,
...val
};
cache = { ...val };
}
}, { deep: true });
const getLabel = (option) => get(option, aliasProps.value.label);
const getValue = (option) => get(option, aliasProps.value.value);
const getDisabled = (option) => get(option, aliasProps.value.disabled);
const getOptions = (option) => get(option, aliasProps.value.options);
return {
aliasProps,
getLabel,
getValue,
getDisabled,
getOptions
};
}
//#endregion
export { defaultProps, useProps };
//# sourceMappingURL=useProps.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"useProps.mjs","names":[],"sources":["../../../../../../packages/components/select-v2/src/useProps.ts"],"sourcesContent":["import { ref, watch } from 'vue'\nimport { get, isEqual } from 'lodash-unified'\n\nimport type { SelectV2Props } from './token'\nimport type { Option } from './select.types'\n\nexport interface Props {\n label?: string\n value?: string\n disabled?: string\n options?: string\n}\n\nexport const defaultProps: Required<Props> = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n options: 'options',\n}\n\nexport function useProps(props: Pick<SelectV2Props, 'props'>) {\n const aliasProps = ref({ ...defaultProps, ...props.props })\n let cache = { ...props.props }\n\n watch(\n () => props.props,\n (val) => {\n // The props is an object, and its properties may be modified without changing the reference. In this case, the watch values before and after are equal. Here, we compare using the cached previous value.\n if (!isEqual(val, cache)) {\n aliasProps.value = { ...defaultProps, ...val }\n cache = { ...val }\n }\n },\n { deep: true }\n )\n\n const getLabel = (option: Option) => get(option, aliasProps.value.label)\n const getValue = (option: Option) => get(option, aliasProps.value.value)\n const getDisabled = (option: Option) => get(option, aliasProps.value.disabled)\n const getOptions = (option: Option) => get(option, aliasProps.value.options)\n\n return {\n aliasProps,\n getLabel,\n getValue,\n getDisabled,\n getOptions,\n }\n}\n"],"mappings":";;;;AAaA,MAAa,eAAgC;CAC3C,OAAO;CACP,OAAO;CACP,UAAU;CACV,SAAS;CACV;AAED,SAAgB,SAAS,OAAqC;CAC5D,MAAM,aAAa,IAAI;EAAE,GAAG;EAAc,GAAG,MAAM;EAAO,CAAC;CAC3D,IAAI,QAAQ,EAAE,GAAG,MAAM,OAAO;AAE9B,aACQ,MAAM,QACX,QAAQ;AAEP,MAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;AACxB,cAAW,QAAQ;IAAE,GAAG;IAAc,GAAG;IAAK;AAC9C,WAAQ,EAAE,GAAG,KAAK;;IAGtB,EAAE,MAAM,MAAM,CACf;CAED,MAAM,YAAY,WAAmB,IAAI,QAAQ,WAAW,MAAM,MAAM;CACxE,MAAM,YAAY,WAAmB,IAAI,QAAQ,WAAW,MAAM,MAAM;CACxE,MAAM,eAAe,WAAmB,IAAI,QAAQ,WAAW,MAAM,SAAS;CAC9E,MAAM,cAAc,WAAmB,IAAI,QAAQ,WAAW,MAAM,QAAQ;AAE5E,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,647 @@
import { EVENT_CODE } from "../../../constants/aria.mjs";
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
import { MINIMUM_INPUT_WIDTH } from "../../../constants/form.mjs";
import { getEventCode } from "../../../utils/dom/event.mjs";
import { isArray, isEmpty, isFunction, isNumber, isObject, isUndefined as isUndefined$1 } from "../../../utils/types.mjs";
import { escapeStringRegexp } from "../../../utils/strings.mjs";
import { debugWarn } from "../../../utils/error.mjs";
import { ValidateComponentsMap } from "../../../utils/vue/icon.mjs";
import { useLocale } from "../../../hooks/use-locale/index.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { useFocusController } from "../../../hooks/use-focus-controller/index.mjs";
import { useComposition } from "../../../hooks/use-composition/index.mjs";
import { useEmptyValues } from "../../../hooks/use-empty-values/index.mjs";
import { useFormDisabled, useFormSize } from "../../form/src/hooks/use-form-common-props.mjs";
import { useFormItem, useFormItemInputId } from "../../form/src/hooks/use-form-item.mjs";
import { useProps } from "./useProps.mjs";
import { useAllowCreate } from "./useAllowCreate.mjs";
import { useDebounceFn, useResizeObserver } from "@vueuse/core";
import { findLastIndex, get, isEqual } from "lodash-unified";
import { computed, nextTick, onMounted, reactive, ref, useSlots, watch, watchEffect } from "vue";
//#region ../../packages/components/select-v2/src/useSelect.ts
const useSelect = (props, emit) => {
const { t } = useLocale();
const slots = useSlots();
const nsSelect = useNamespace("select");
const nsInput = useNamespace("input");
const { form: elForm, formItem: elFormItem } = useFormItem();
const { inputId } = useFormItemInputId(props, { formItemContext: elFormItem });
const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
const { valueOnClear, isEmptyValue } = useEmptyValues(props);
const states = reactive({
inputValue: "",
cachedOptions: [],
createdOptions: [],
hoveringIndex: -1,
inputHovering: false,
selectionWidth: 0,
collapseItemWidth: 0,
previousQuery: null,
previousValue: void 0,
selectedLabel: "",
menuVisibleOnFocus: false,
isBeforeHide: false
});
const popperSize = ref(-1);
const debouncing = ref(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 { isComposing, handleCompositionStart, handleCompositionEnd, handleCompositionUpdate } = useComposition({ afterComposition: (e) => onInput(e) });
const selectDisabled = useFormDisabled();
const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
disabled: selectDisabled,
afterFocus() {
if (props.automaticDropdown && !expanded.value) {
expanded.value = true;
states.menuVisibleOnFocus = true;
}
},
beforeBlur(event) {
return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
},
afterBlur() {
expanded.value = false;
states.menuVisibleOnFocus = false;
if (props.validateEvent) elFormItem?.validate?.("blur").catch((err) => debugWarn(err));
}
});
const allOptions = computed(() => filterOptions(""));
const hasOptions = computed(() => {
if (props.loading) return false;
return props.options.length > 0 || states.createdOptions.length > 0;
});
const filteredOptions = ref([]);
const expanded = ref(false);
const needStatusIcon = computed(() => elForm?.statusIcon ?? false);
const popupHeight = computed(() => {
const totalHeight = filteredOptions.value.length * props.itemHeight;
return totalHeight > props.height ? props.height : totalHeight;
});
const hasModelValue = computed(() => {
return props.multiple ? isArray(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
});
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(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
const validateState = computed(() => elFormItem?.validateState || "");
const validateIcon = computed(() => {
if (!validateState.value) return;
return ValidateComponentsMap[validateState.value];
});
const debounce = computed(() => props.remote ? props.debounce : 0);
const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && !hasOptions.value);
const emptyText = computed(() => {
if (props.loading) return props.loadingText || t("el.select.loading");
else {
if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) return props.noMatchText || t("el.select.noMatch");
if (!hasOptions.value) return props.noDataText || t("el.select.noData");
}
return null;
});
const isFilterMethodValid = computed(() => props.filterable && isFunction(props.filterMethod));
const isRemoteMethodValid = computed(() => props.filterable && props.remote && isFunction(props.remoteMethod));
const filterOptions = (query) => {
const regexp = new RegExp(escapeStringRegexp(query), "i");
const isValidOption = (o) => {
if (isFilterMethodValid.value || isRemoteMethodValid.value) return true;
return query ? regexp.test(getLabel(o) || "") : true;
};
if (props.loading) return [];
return [...states.createdOptions, ...props.options].reduce((all, item) => {
const options = getOptions(item);
if (isArray(options)) {
const filtered = options.filter(isValidOption);
if (filtered.length > 0) all.push({
label: getLabel(item),
type: "Group"
}, ...filtered);
} else if (props.remote || isValidOption(item)) all.push(item);
return all;
}, []);
};
const updateOptions = () => {
filteredOptions.value = filterOptions(states.inputValue);
};
const allOptionsValueMap = computed(() => {
const valueMap = /* @__PURE__ */ new Map();
allOptions.value.forEach((option, index) => {
valueMap.set(getValueKey(getValue(option)), {
option,
index
});
});
return valueMap;
});
const filteredOptionsValueMap = computed(() => {
const valueMap = /* @__PURE__ */ new Map();
filteredOptions.value.forEach((option, index) => {
valueMap.set(getValueKey(getValue(option)), {
option,
index
});
});
return valueMap;
});
const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
const selectSize = useFormSize();
const collapseTagSize = computed(() => "small" === selectSize.value ? "small" : "default");
const calculatePopperSize = () => {
if (isNumber(props.fitInputWidth)) {
popperSize.value = props.fitInputWidth;
return;
}
const width = selectRef.value?.offsetWidth || 200;
if (!props.fitInputWidth && hasOptions.value) nextTick(() => {
popperSize.value = Math.max(width, calculateLabelMaxWidth());
});
else popperSize.value = width;
};
const calculateLabelMaxWidth = () => {
const ctx = document.createElement("canvas").getContext("2d");
const selector = nsSelect.be("dropdown", "item");
const dropdownItemEl = (menuRef.value?.listRef?.innerRef || document).querySelector(`.${selector}`);
if (dropdownItemEl === null || ctx === null) return 0;
const style = getComputedStyle(dropdownItemEl);
const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
ctx.font = `bold ${style.font.replace(new RegExp(`\\b${style.fontWeight}\\b`), "")}`;
return filteredOptions.value.reduce((max, option) => {
const metrics = ctx.measureText(getLabel(option));
return Math.max(metrics.width, max);
}, 0) + padding;
};
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;
return { maxWidth: `${collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth}px` };
});
const collapseTagStyle = computed(() => {
return { maxWidth: `${states.selectionWidth}px` };
});
const shouldShowPlaceholder = computed(() => {
if (isArray(props.modelValue)) return props.modelValue.length === 0 && !states.inputValue;
return props.filterable ? !states.inputValue : true;
});
const currentPlaceholder = computed(() => {
const _placeholder = props.placeholder ?? t("el.select.placeholder");
return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
});
const popperRef = computed(() => tooltipRef.value?.popperRef?.contentRef);
const indexRef = computed(() => {
if (props.multiple) {
const len = props.modelValue.length;
if (len > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
return index;
}
} else if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
const { index } = filteredOptionsValueMap.value.get(props.modelValue);
return index;
}
return -1;
});
const dropdownMenuVisible = computed({
get() {
return expanded.value && (props.loading || !isRemoteSearchEmpty.value || props.remote && !!slots.empty) && (!debouncing.value || !isEmpty(states.previousQuery) || hasOptions.value);
},
set(val) {
expanded.value = val;
}
});
const showTagList = computed(() => {
if (!props.multiple) return [];
return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
});
const collapseTagList = computed(() => {
if (!props.multiple) return [];
return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
});
const { createNewOption, removeNewOption, selectNewOption, clearAllNewOption } = useAllowCreate(props, states);
const toggleMenu = (event) => {
if (selectDisabled.value || props.filterable && expanded.value && event && !suffixRef.value?.contains(event.target)) return;
if (states.menuVisibleOnFocus) states.menuVisibleOnFocus = false;
else expanded.value = !expanded.value;
};
const onInputChange = () => {
if (states.inputValue.length > 0 && !expanded.value) expanded.value = true;
createNewOption(states.inputValue);
nextTick(() => {
handleQueryChange(states.inputValue);
});
};
const debouncedOnInputChange = useDebounceFn(() => {
onInputChange();
debouncing.value = false;
}, debounce);
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) && filteredOptions.value.length) nextTick(checkDefaultFirstOption);
else nextTick(updateHoveringIndex);
};
/**
* find and highlight first option as default selected
* @remark
* - if the first option in dropdown list is user-created,
* it would be at the end of the optionsArray
* so find it and set hover.
* (NOTE: there must be only one user-created option in dropdown list with query)
* - if there's no user-created option in list, just find the first one as usual
* (NOTE: exclude options that are disabled or in disabled-group)
*/
const checkDefaultFirstOption = () => {
const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
const userCreatedOption = optionsInDropdown.find((n) => n.created);
const firstOriginOption = optionsInDropdown[0];
states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
};
const emitChange = (val) => {
if (!isEqual(props.modelValue, val)) emit(CHANGE_EVENT, val);
};
const update = (val) => {
emit(UPDATE_MODEL_EVENT, val);
emitChange(val);
states.previousValue = props.multiple ? String(val) : val;
nextTick(() => {
if (props.multiple && isArray(props.modelValue)) {
const cachedOptions = states.cachedOptions.slice();
const selectedOptions = props.modelValue.map((value) => getOption(value, cachedOptions));
if (!isEqual(states.cachedOptions, selectedOptions)) states.cachedOptions = selectedOptions;
} else initStates(true);
});
};
const getValueIndex = (arr = [], value) => {
if (!isObject(value)) return arr.indexOf(value);
const valueKey = props.valueKey;
let index = -1;
arr.some((item, i) => {
if (get(item, valueKey) === get(value, valueKey)) {
index = i;
return true;
}
return false;
});
return index;
};
const getValueKey = (item) => {
return isObject(item) ? get(item, props.valueKey) : item;
};
const handleResize = () => {
calculatePopperSize();
};
const resetSelectionWidth = () => {
states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
};
const resetCollapseItemWidth = () => {
states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
};
const updateTooltip = () => {
tooltipRef.value?.updatePopper?.();
};
const updateTagTooltip = () => {
tagTooltipRef.value?.updatePopper?.();
};
const onSelect = (option) => {
const optionValue = getValue(option);
if (props.multiple) {
let selectedOptions = props.modelValue.slice();
const index = getValueIndex(selectedOptions, optionValue);
if (index > -1) {
selectedOptions = [...selectedOptions.slice(0, index), ...selectedOptions.slice(index + 1)];
states.cachedOptions.splice(index, 1);
removeNewOption(option);
} else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
selectedOptions = [...selectedOptions, optionValue];
states.cachedOptions.push(option);
selectNewOption(option);
}
update(selectedOptions);
if (option.created) handleQueryChange("");
if (props.filterable && (option.created || !props.reserveKeyword)) states.inputValue = "";
} else {
states.selectedLabel = getLabel(option);
!isEqual(props.modelValue, optionValue) && update(optionValue);
expanded.value = false;
selectNewOption(option);
if (!option.created) clearAllNewOption();
}
focus();
};
const deleteTag = (event, option) => {
let selectedOptions = props.modelValue.slice();
const index = getValueIndex(selectedOptions, getValue(option));
if (index > -1 && !selectDisabled.value) {
selectedOptions = [...props.modelValue.slice(0, index), ...props.modelValue.slice(index + 1)];
states.cachedOptions.splice(index, 1);
update(selectedOptions);
emit("remove-tag", getValue(option));
removeNewOption(option);
}
event.stopPropagation();
focus();
};
const focus = () => {
inputRef.value?.focus();
};
const blur = () => {
if (expanded.value) {
expanded.value = false;
nextTick(() => inputRef.value?.blur());
return;
}
inputRef.value?.blur();
};
const handleEsc = () => {
if (states.inputValue.length > 0) states.inputValue = "";
else expanded.value = false;
};
const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
const handleDel = (e) => {
const code = getEventCode(e);
if (!props.multiple) return;
if (code === EVENT_CODE.delete) return;
if (states.inputValue.length === 0) {
e.preventDefault();
const selected = props.modelValue.slice();
const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
if (lastNotDisabledIndex < 0) return;
const removeTagValue = selected[lastNotDisabledIndex];
selected.splice(lastNotDisabledIndex, 1);
const option = states.cachedOptions[lastNotDisabledIndex];
states.cachedOptions.splice(lastNotDisabledIndex, 1);
removeNewOption(option);
update(selected);
emit("remove-tag", removeTagValue);
}
};
const handleClear = () => {
let emptyValue;
if (isArray(props.modelValue)) emptyValue = [];
else emptyValue = valueOnClear.value;
states.selectedLabel = "";
expanded.value = false;
update(emptyValue);
emit("clear");
clearAllNewOption();
focus();
};
const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
const options = filteredOptions.value;
if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) return;
if (!expanded.value) return toggleMenu();
if (isUndefined$1(hoveringIndex)) hoveringIndex = states.hoveringIndex;
let newIndex = -1;
if (direction === "forward") {
newIndex = hoveringIndex + 1;
if (newIndex >= options.length) newIndex = 0;
} else if (direction === "backward") {
newIndex = hoveringIndex - 1;
if (newIndex < 0 || newIndex >= options.length) newIndex = options.length - 1;
}
const option = options[newIndex];
if (getDisabled(option) || option.type === "Group") return onKeyboardNavigate(direction, newIndex);
else {
states.hoveringIndex = newIndex;
scrollToItem(newIndex);
}
};
const onKeyboardSelect = () => {
if (!expanded.value) return toggleMenu();
else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) onSelect(filteredOptions.value[states.hoveringIndex]);
};
const onHoverOption = (idx) => {
states.hoveringIndex = idx ?? -1;
};
const updateHoveringIndex = () => {
if (!props.multiple) states.hoveringIndex = filteredOptions.value.findIndex((item) => {
return getValueKey(getValue(item)) === getValueKey(props.modelValue);
});
else {
const length = props.modelValue.length;
if (length > 0) {
const lastValue = props.modelValue[length - 1];
states.hoveringIndex = filteredOptions.value.findIndex((item) => getValueKey(lastValue) === getValueKey(getValue(item)));
} else states.hoveringIndex = -1;
}
};
const onInput = (event) => {
states.inputValue = event.target.value;
if (props.remote) {
debouncing.value = true;
debouncedOnInputChange();
} else return onInputChange();
};
const handleClickOutside = (event) => {
expanded.value = false;
if (isFocused.value) handleBlur(new FocusEvent("blur", event));
};
const handleMenuEnter = () => {
states.isBeforeHide = false;
return nextTick(() => {
if (~indexRef.value) scrollToItem(indexRef.value);
});
};
const scrollToItem = (index) => {
menuRef.value.scrollToItem(index);
};
const getOption = (value, cachedOptions) => {
const selectValue = getValueKey(value);
if (allOptionsValueMap.value.has(selectValue)) {
const { option } = allOptionsValueMap.value.get(selectValue);
return option;
}
if (cachedOptions && cachedOptions.length) {
const option = cachedOptions.find((option) => getValueKey(getValue(option)) === selectValue);
if (option) return option;
}
return {
[aliasProps.value.value]: value,
[aliasProps.value.label]: value
};
};
const getIndex = (option) => allOptionsValueMap.value.get(getValue(option))?.index ?? -1;
const initStates = (needUpdateSelectedLabel = false) => {
if (props.multiple) if (props.modelValue.length > 0) {
const cachedOptions = states.cachedOptions.slice();
states.cachedOptions.length = 0;
states.previousValue = props.modelValue.toString();
for (const value of props.modelValue) {
const option = getOption(value, cachedOptions);
states.cachedOptions.push(option);
}
} else {
states.cachedOptions = [];
states.previousValue = void 0;
}
else if (hasModelValue.value) {
states.previousValue = props.modelValue;
const options = filteredOptions.value;
const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
if (~selectedItemIndex) states.selectedLabel = getLabel(options[selectedItemIndex]);
else if (!states.selectedLabel || needUpdateSelectedLabel) states.selectedLabel = getValueKey(props.modelValue);
} else {
states.selectedLabel = "";
states.previousValue = void 0;
}
clearAllNewOption();
calculatePopperSize();
};
watch(() => props.fitInputWidth, () => {
calculatePopperSize();
});
watch(expanded, (val) => {
if (val) {
if (!props.persistent) calculatePopperSize();
handleQueryChange("");
} else {
states.inputValue = "";
states.previousQuery = null;
states.isBeforeHide = true;
states.menuVisibleOnFocus = false;
createNewOption("");
}
});
watch(() => props.modelValue, (val, oldVal) => {
if (!val || isArray(val) && val.length === 0 || props.multiple && !isEqual(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) initStates(true);
if (!isEqual(val, oldVal) && props.validateEvent) elFormItem?.validate?.("change").catch((err) => debugWarn(err));
}, { deep: true });
watch(() => props.options, () => {
const input = inputRef.value;
if (!input || input && document.activeElement !== input) initStates();
}, {
deep: true,
flush: "post"
});
watch(() => filteredOptions.value, () => {
calculatePopperSize();
return menuRef.value && nextTick(menuRef.value.resetScrollTop);
});
watchEffect(() => {
if (states.isBeforeHide) return;
updateOptions();
});
watchEffect(() => {
const { valueKey, options } = props;
const duplicateValue = /* @__PURE__ */ new Map();
for (const item of options) {
const optionValue = getValue(item);
let v = optionValue;
if (isObject(v)) v = get(optionValue, valueKey);
if (duplicateValue.get(v)) {
debugWarn("ElSelectV2", `The option values you provided seem to be duplicated, which may cause some problems, please check.`);
break;
} else duplicateValue.set(v, true);
}
});
onMounted(() => {
initStates();
});
useResizeObserver(selectRef, handleResize);
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?.();
stop = void 0;
}
emit("visible-change", newVal);
});
return {
inputId,
collapseTagSize,
currentPlaceholder,
expanded,
emptyText,
popupHeight,
debounce,
allOptions,
allOptionsValueMap,
filteredOptions,
iconComponent,
iconReverse,
tagStyle,
collapseTagStyle,
popperSize,
dropdownMenuVisible,
hasModelValue,
shouldShowPlaceholder,
selectDisabled,
selectSize,
needStatusIcon,
showClearBtn,
states,
isFocused,
nsSelect,
nsInput,
inputRef,
menuRef,
tagMenuRef,
tooltipRef,
tagTooltipRef,
selectRef,
wrapperRef,
selectionRef,
prefixRef,
suffixRef,
collapseItemRef,
popperRef,
validateState,
validateIcon,
showTagList,
collapseTagList,
debouncedOnInputChange,
deleteTag,
getLabel,
getValue,
getDisabled,
getValueKey,
getIndex,
handleClear,
handleClickOutside,
handleDel,
handleEsc,
focus,
blur,
handleMenuEnter,
handleResize,
resetSelectionWidth,
updateTooltip,
updateTagTooltip,
updateOptions,
toggleMenu,
scrollTo: scrollToItem,
onInput,
onKeyboardNavigate,
onKeyboardSelect,
onSelect,
onHover: onHoverOption,
handleCompositionStart,
handleCompositionEnd,
handleCompositionUpdate
};
};
//#endregion
export { useSelect as default };
//# sourceMappingURL=useSelect.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
import "../../base/style/css.mjs";
import "../../input/style/css.mjs";
import "../../scrollbar/style/css.mjs";
import "../../popper/style/css.mjs";
import "../../tag/style/css.mjs";
import "../../virtual-list/style/css.mjs";
import "element-plus/theme-chalk/el-select-v2.css";
@@ -0,0 +1,7 @@
import "../../base/style/index.mjs";
import "../../input/style/index.mjs";
import "../../scrollbar/style/index.mjs";
import "../../popper/style/index.mjs";
import "../../tag/style/index.mjs";
import "../../virtual-list/style/index.mjs";
import "element-plus/theme-chalk/src/select-v2.scss";