vue-devui 1.5.13 → 1.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/index.es.js +3 -0
- package/auto-complete/index.umd.js +1 -1
- package/breadcrumb/index.es.js +3 -0
- package/breadcrumb/index.umd.js +1 -1
- package/checkbox/index.es.js +3 -0
- package/checkbox/index.umd.js +1 -1
- package/code-review/index.es.js +3 -0
- package/code-review/index.umd.js +1 -1
- package/date-picker-pro/index.es.js +3 -0
- package/date-picker-pro/index.umd.js +8 -8
- package/dropdown/index.es.js +3 -0
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.es.js +3 -0
- package/editable-select/index.umd.js +7 -7
- package/editor-md/index.es.js +1423 -1213
- package/editor-md/index.umd.js +45 -45
- package/editor-md/style.css +1 -1
- package/form/index.es.js +3 -0
- package/form/index.umd.js +1 -1
- package/git-graph/index.es.js +3 -0
- package/git-graph/index.umd.js +12 -12
- package/input/index.es.js +3 -0
- package/input/index.umd.js +6 -6
- package/input-number/index.es.js +3 -0
- package/input-number/index.umd.js +1 -1
- package/mention/index.es.js +3 -0
- package/mention/index.umd.js +1 -1
- package/modal/index.es.js +3 -0
- package/modal/index.umd.js +1 -1
- package/nuxt/components/checkbox.js +3 -0
- package/overlay/index.es.js +3 -0
- package/overlay/index.umd.js +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +155 -292
- package/pagination/index.umd.js +18 -18
- package/pagination/style.css +1 -1
- package/popover/index.es.js +3 -0
- package/popover/index.umd.js +6 -6
- package/radio/index.es.js +3 -0
- package/radio/index.umd.js +1 -1
- package/search/index.es.js +3 -0
- package/search/index.umd.js +1 -1
- package/select/index.es.js +119 -265
- package/select/index.umd.js +17 -17
- package/select/style.css +1 -1
- package/splitter/index.es.js +3 -0
- package/splitter/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +3 -0
- package/switch/index.umd.js +1 -1
- package/table/index.es.js +3 -0
- package/table/index.umd.js +1 -1
- package/textarea/index.es.js +3 -0
- package/textarea/index.umd.js +1 -1
- package/time-picker/index.es.js +3 -0
- package/time-picker/index.umd.js +1 -1
- package/time-select/index.es.js +119 -265
- package/time-select/index.umd.js +18 -18
- package/time-select/style.css +1 -1
- package/tooltip/index.es.js +3 -0
- package/tooltip/index.umd.js +4 -4
- package/tree/index.es.js +3 -0
- package/tree/index.umd.js +1 -1
- package/types/editor-md/index.d.ts +1 -0
- package/types/editor-md/src/components/md-render.d.ts +1 -1
- package/types/editor-md/src/composables/use-editor-md.d.ts +3 -0
- package/types/editor-md/src/editor-md-types.d.ts +9 -1
- package/types/editor-md/src/editor-md.d.ts +6 -3
- package/types/editor-md/src/plugins/checkbox.d.ts +1 -0
- package/types/pagination/src/pagination-types.d.ts +4 -13
- package/types/pagination/src/pagination.d.ts +218 -0
- package/types/select/src/select-types.d.ts +4 -23
- package/types/select/src/select.d.ts +1 -19
- package/types/select/src/use-select.d.ts +1 -1
- package/types/tag/src/tag.d.ts +2 -2
- package/vue-devui.es.js +229 -242
- package/vue-devui.umd.js +46 -46
package/time-select/index.es.js
CHANGED
|
@@ -29,9 +29,9 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance
|
|
33
|
-
import "clipboard";
|
|
32
|
+
import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance } from "vue";
|
|
34
33
|
import { onClickOutside } from "@vueuse/core";
|
|
34
|
+
import "clipboard";
|
|
35
35
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
36
36
|
function deepAssign(...objects) {
|
|
37
37
|
const isObject2 = (obj) => obj && typeof obj === "object";
|
|
@@ -211,25 +211,6 @@ function className(classStr, classOpt) {
|
|
|
211
211
|
}
|
|
212
212
|
return classname;
|
|
213
213
|
}
|
|
214
|
-
function lockScroll() {
|
|
215
|
-
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
216
|
-
const scrollTop = document.documentElement.scrollTop;
|
|
217
|
-
const style = document.documentElement.getAttribute("style");
|
|
218
|
-
document.documentElement.style.position = "fixed";
|
|
219
|
-
document.documentElement.style.top = `-${scrollTop}px`;
|
|
220
|
-
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
221
|
-
document.documentElement.style.overflowY = "scroll";
|
|
222
|
-
return () => {
|
|
223
|
-
if (style) {
|
|
224
|
-
document.documentElement.setAttribute("style", style);
|
|
225
|
-
} else {
|
|
226
|
-
document.documentElement.removeAttribute("style");
|
|
227
|
-
}
|
|
228
|
-
document.documentElement.scrollTop = scrollTop;
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
214
|
function createBem$1(namespace, element, modifier) {
|
|
234
215
|
let cls = namespace;
|
|
235
216
|
if (element) {
|
|
@@ -5723,6 +5704,48 @@ const formProps = {
|
|
|
5723
5704
|
};
|
|
5724
5705
|
const FORM_TOKEN = Symbol("dForm");
|
|
5725
5706
|
const STYLE_TOKEN = Symbol("dForm");
|
|
5707
|
+
function lockScroll() {
|
|
5708
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
5709
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
5710
|
+
const style = document.documentElement.getAttribute("style");
|
|
5711
|
+
document.documentElement.style.position = "fixed";
|
|
5712
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
5713
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
5714
|
+
document.documentElement.style.overflowY = "scroll";
|
|
5715
|
+
return () => {
|
|
5716
|
+
if (style) {
|
|
5717
|
+
document.documentElement.setAttribute("style", style);
|
|
5718
|
+
} else {
|
|
5719
|
+
document.documentElement.removeAttribute("style");
|
|
5720
|
+
}
|
|
5721
|
+
document.documentElement.scrollTop = scrollTop;
|
|
5722
|
+
};
|
|
5723
|
+
}
|
|
5724
|
+
return;
|
|
5725
|
+
}
|
|
5726
|
+
function createBem(namespace, element, modifier) {
|
|
5727
|
+
let cls = namespace;
|
|
5728
|
+
if (element) {
|
|
5729
|
+
cls += `__${element}`;
|
|
5730
|
+
}
|
|
5731
|
+
if (modifier) {
|
|
5732
|
+
cls += `--${modifier}`;
|
|
5733
|
+
}
|
|
5734
|
+
return cls;
|
|
5735
|
+
}
|
|
5736
|
+
function useNamespace(block, needDot = false) {
|
|
5737
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
5738
|
+
const b = () => createBem(namespace);
|
|
5739
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
5740
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
5741
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
5742
|
+
return {
|
|
5743
|
+
b,
|
|
5744
|
+
e,
|
|
5745
|
+
m,
|
|
5746
|
+
em
|
|
5747
|
+
};
|
|
5748
|
+
}
|
|
5726
5749
|
function useFieldCollection() {
|
|
5727
5750
|
const itemContexts = [];
|
|
5728
5751
|
const addItemContext = (field) => {
|
|
@@ -5790,7 +5813,7 @@ defineComponent({
|
|
|
5790
5813
|
props: formProps,
|
|
5791
5814
|
emits: ["validate"],
|
|
5792
5815
|
setup(props, ctx) {
|
|
5793
|
-
const ns2 = useNamespace
|
|
5816
|
+
const ns2 = useNamespace("form");
|
|
5794
5817
|
const {
|
|
5795
5818
|
itemContexts,
|
|
5796
5819
|
addItemContext,
|
|
@@ -5908,29 +5931,6 @@ function useFixedOverlay(props, ctx) {
|
|
|
5908
5931
|
onUnmounted(removeBodyAdditions);
|
|
5909
5932
|
return { onClick };
|
|
5910
5933
|
}
|
|
5911
|
-
function createBem(namespace, element, modifier) {
|
|
5912
|
-
let cls = namespace;
|
|
5913
|
-
if (element) {
|
|
5914
|
-
cls += `__${element}`;
|
|
5915
|
-
}
|
|
5916
|
-
if (modifier) {
|
|
5917
|
-
cls += `--${modifier}`;
|
|
5918
|
-
}
|
|
5919
|
-
return cls;
|
|
5920
|
-
}
|
|
5921
|
-
function useNamespace(block, needDot = false) {
|
|
5922
|
-
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
5923
|
-
const b = () => createBem(namespace);
|
|
5924
|
-
const e = (element) => element ? createBem(namespace, element) : "";
|
|
5925
|
-
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
5926
|
-
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
5927
|
-
return {
|
|
5928
|
-
b,
|
|
5929
|
-
e,
|
|
5930
|
-
m,
|
|
5931
|
-
em
|
|
5932
|
-
};
|
|
5933
|
-
}
|
|
5934
5934
|
var fixedOverlay = "";
|
|
5935
5935
|
defineComponent({
|
|
5936
5936
|
name: "DFixedOverlay",
|
|
@@ -5941,7 +5941,7 @@ defineComponent({
|
|
|
5941
5941
|
const {
|
|
5942
5942
|
modelValue
|
|
5943
5943
|
} = toRefs(props);
|
|
5944
|
-
const ns2 = useNamespace("fixed-overlay");
|
|
5944
|
+
const ns2 = useNamespace$1("fixed-overlay");
|
|
5945
5945
|
const {
|
|
5946
5946
|
onClick
|
|
5947
5947
|
} = useFixedOverlay(props, ctx);
|
|
@@ -6058,6 +6058,9 @@ function useOverlay(props, emit) {
|
|
|
6058
6058
|
];
|
|
6059
6059
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
6060
6060
|
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
6061
|
+
if (!overlayEl) {
|
|
6062
|
+
return;
|
|
6063
|
+
}
|
|
6061
6064
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
6062
6065
|
strategy: "fixed",
|
|
6063
6066
|
middleware
|
|
@@ -6107,7 +6110,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
6107
6110
|
emit,
|
|
6108
6111
|
expose
|
|
6109
6112
|
}) {
|
|
6110
|
-
const ns2 = useNamespace("flexible-overlay");
|
|
6113
|
+
const ns2 = useNamespace$1("flexible-overlay");
|
|
6111
6114
|
const {
|
|
6112
6115
|
clickEventBubble
|
|
6113
6116
|
} = toRefs(props);
|
|
@@ -6136,7 +6139,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
6136
6139
|
});
|
|
6137
6140
|
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
6138
6141
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
6139
|
-
const ns$1 = useNamespace("popper-trigger");
|
|
6142
|
+
const ns$1 = useNamespace$1("popper-trigger");
|
|
6140
6143
|
function wrapContent(content) {
|
|
6141
6144
|
return h("span", { class: ns$1.b() }, content);
|
|
6142
6145
|
}
|
|
@@ -6323,7 +6326,7 @@ function usePopoverEvent(props, visible, origin) {
|
|
|
6323
6326
|
});
|
|
6324
6327
|
return { placement, handlePositionChange, onMouseenter, onMouseleave };
|
|
6325
6328
|
}
|
|
6326
|
-
const ns = useNamespace("popover");
|
|
6329
|
+
const ns = useNamespace$1("popover");
|
|
6327
6330
|
function SuccessIcon$1() {
|
|
6328
6331
|
return createVNode("svg", {
|
|
6329
6332
|
"class": [ns.e("icon"), ns.em("icon", "success")],
|
|
@@ -6425,7 +6428,7 @@ var PopoverIcon = defineComponent({
|
|
|
6425
6428
|
}
|
|
6426
6429
|
},
|
|
6427
6430
|
setup(props) {
|
|
6428
|
-
const ns2 = useNamespace("popover");
|
|
6431
|
+
const ns2 = useNamespace$1("popover");
|
|
6429
6432
|
return () => props.type && props.type !== "default" && createVNode("span", {
|
|
6430
6433
|
"class": ns2.e("icon-wrap")
|
|
6431
6434
|
}, [props.type === "success" && createVNode(SuccessIcon$1, null, null), props.type === "warning" && createVNode(WarningIcon, null, null), props.type === "info" && createVNode(InfoIcon, null, null), props.type === "error" && createVNode(ErrorIcon$1, null, null)]);
|
|
@@ -6462,7 +6465,7 @@ var Popover = defineComponent({
|
|
|
6462
6465
|
const {
|
|
6463
6466
|
overlayStyles
|
|
6464
6467
|
} = usePopover(props, visible, placement, origin, popoverRef);
|
|
6465
|
-
const ns2 = useNamespace("popover");
|
|
6468
|
+
const ns2 = useNamespace$1("popover");
|
|
6466
6469
|
provide(POPPER_TRIGGER_TOKEN, origin);
|
|
6467
6470
|
watch(visible, (newVal) => {
|
|
6468
6471
|
if (newVal) {
|
|
@@ -6595,7 +6598,7 @@ function useFormLabel() {
|
|
|
6595
6598
|
const formContext = inject(FORM_TOKEN);
|
|
6596
6599
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
6597
6600
|
const labelData = inject(LABEL_DATA);
|
|
6598
|
-
const ns2 = useNamespace
|
|
6601
|
+
const ns2 = useNamespace("form");
|
|
6599
6602
|
const defaultTipsPopover = {
|
|
6600
6603
|
content: "",
|
|
6601
6604
|
position: ["top"],
|
|
@@ -6626,7 +6629,7 @@ var formLabel = "";
|
|
|
6626
6629
|
var FormLabel = defineComponent({
|
|
6627
6630
|
name: "DFormLabel",
|
|
6628
6631
|
setup(_, ctx) {
|
|
6629
|
-
const ns2 = useNamespace
|
|
6632
|
+
const ns2 = useNamespace("form");
|
|
6630
6633
|
const {
|
|
6631
6634
|
labelClasses,
|
|
6632
6635
|
labelInnerClasses,
|
|
@@ -6659,7 +6662,7 @@ const formControlProps = {
|
|
|
6659
6662
|
};
|
|
6660
6663
|
function useFormControl(props) {
|
|
6661
6664
|
const labelData = inject(LABEL_DATA);
|
|
6662
|
-
const ns2 = useNamespace
|
|
6665
|
+
const ns2 = useNamespace("form");
|
|
6663
6666
|
const { feedbackStatus } = toRefs(props);
|
|
6664
6667
|
const controlClasses = computed(() => ({
|
|
6665
6668
|
[ns2.e("control")]: true,
|
|
@@ -6691,7 +6694,7 @@ var FormControl = defineComponent({
|
|
|
6691
6694
|
const formContext = inject(FORM_TOKEN);
|
|
6692
6695
|
const formControl2 = ref();
|
|
6693
6696
|
const popoverRef = ref();
|
|
6694
|
-
const ns2 = useNamespace
|
|
6697
|
+
const ns2 = useNamespace("form");
|
|
6695
6698
|
const showPopoverClick = ref(true);
|
|
6696
6699
|
const {
|
|
6697
6700
|
controlClasses,
|
|
@@ -7782,7 +7785,7 @@ function getFieldValue(obj, path) {
|
|
|
7782
7785
|
}
|
|
7783
7786
|
function useFormItem(messageType, _rules, validateState) {
|
|
7784
7787
|
const formContext = inject(FORM_TOKEN);
|
|
7785
|
-
const ns2 = useNamespace
|
|
7788
|
+
const ns2 = useNamespace("form");
|
|
7786
7789
|
const itemClasses = computed(() => ({
|
|
7787
7790
|
[`${ns2.em("item", "horizontal")}`]: formContext.layout === "horizontal",
|
|
7788
7791
|
[`${ns2.em("item", "vertical")}`]: formContext.layout === "vertical",
|
|
@@ -8021,6 +8024,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8021
8024
|
const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
|
|
8022
8025
|
const selectSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
|
|
8023
8026
|
const isObjectOption = ref(false);
|
|
8027
|
+
const originRef = ref();
|
|
8024
8028
|
const isOpen = ref(false);
|
|
8025
8029
|
const toggleChange = (bool) => {
|
|
8026
8030
|
if (selectDisabled.value) {
|
|
@@ -8030,14 +8034,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8030
8034
|
ctx.emit("toggle-change", bool);
|
|
8031
8035
|
};
|
|
8032
8036
|
onClickOutside(dropdownRef, () => {
|
|
8033
|
-
|
|
8034
|
-
if (props.multiple && isOpen.value) {
|
|
8035
|
-
(_a = selectRef.value) == null ? void 0 : _a.clearMultipleSearchKey();
|
|
8036
|
-
onBlur();
|
|
8037
|
-
}
|
|
8038
|
-
if (isOpen.value) {
|
|
8039
|
-
toggleChange(false);
|
|
8040
|
-
}
|
|
8037
|
+
toggleChange(false);
|
|
8041
8038
|
}, { ignore: [selectRef] });
|
|
8042
8039
|
const dropdownMenuMultipleNs = useNamespace$1("dropdown-menu-multiple");
|
|
8043
8040
|
const selectCls = computed(() => {
|
|
@@ -8150,11 +8147,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8150
8147
|
}
|
|
8151
8148
|
};
|
|
8152
8149
|
const valueChange = (item) => {
|
|
8153
|
-
var _a;
|
|
8154
8150
|
const { multiple } = props;
|
|
8155
8151
|
let { modelValue } = props;
|
|
8156
|
-
filterQuery.value = "";
|
|
8157
|
-
handlerQueryFunc("");
|
|
8158
8152
|
if (multiple) {
|
|
8159
8153
|
const checkedItems = Array.isArray(modelValue) ? modelValue.slice() : [];
|
|
8160
8154
|
const index2 = checkedItems.indexOf(item.value);
|
|
@@ -8181,7 +8175,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8181
8175
|
}
|
|
8182
8176
|
getMultipleSelected(checkedItems);
|
|
8183
8177
|
} else {
|
|
8184
|
-
(_a = selectRef.value) == null ? void 0 : _a.clearSingleSearchKey();
|
|
8185
8178
|
ctx.emit("update:modelValue", item.value);
|
|
8186
8179
|
getSingleSelected(item);
|
|
8187
8180
|
toggleChange(false);
|
|
@@ -8192,8 +8185,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8192
8185
|
ctx.emit("toggle-change", false);
|
|
8193
8186
|
};
|
|
8194
8187
|
const handleClear = () => {
|
|
8195
|
-
filterQuery.value = "";
|
|
8196
|
-
handlerQueryFunc("");
|
|
8197
8188
|
if (props.multiple) {
|
|
8198
8189
|
ctx.emit("update:modelValue", []);
|
|
8199
8190
|
ctx.emit("value-change", []);
|
|
@@ -8206,6 +8197,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8206
8197
|
handleClose();
|
|
8207
8198
|
blur();
|
|
8208
8199
|
}
|
|
8200
|
+
filterQuery.value = "";
|
|
8209
8201
|
};
|
|
8210
8202
|
const tagDelete = (data) => {
|
|
8211
8203
|
let { modelValue } = props;
|
|
@@ -8223,17 +8215,15 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8223
8215
|
ctx.emit("remove-tag", data.value);
|
|
8224
8216
|
getMultipleSelected(checkedItems);
|
|
8225
8217
|
};
|
|
8226
|
-
const onFocus = () => {
|
|
8218
|
+
const onFocus = (e) => {
|
|
8219
|
+
ctx.emit("focus", e);
|
|
8227
8220
|
if (!selectDisabled.value) {
|
|
8228
8221
|
isSelectFocus.value = true;
|
|
8229
8222
|
}
|
|
8230
8223
|
};
|
|
8231
|
-
const onBlur = () => {
|
|
8224
|
+
const onBlur = (e) => {
|
|
8225
|
+
ctx.emit("blur", e);
|
|
8232
8226
|
if (!selectDisabled.value) {
|
|
8233
|
-
setTimeout(() => {
|
|
8234
|
-
filterQuery.value = "";
|
|
8235
|
-
handlerQueryFunc("");
|
|
8236
|
-
}, 150);
|
|
8237
8227
|
isSelectFocus.value = false;
|
|
8238
8228
|
}
|
|
8239
8229
|
};
|
|
@@ -8266,7 +8256,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8266
8256
|
const emptyText = computed(() => {
|
|
8267
8257
|
const visibleOptionsCount = injectOptionsArray.value.filter((item) => {
|
|
8268
8258
|
const label = item.name || item.value;
|
|
8269
|
-
return label.toString().toLocaleLowerCase().includes(filterQuery.value.
|
|
8259
|
+
return label.toString().toLocaleLowerCase().includes(filterQuery.value.toLocaleLowerCase().trim());
|
|
8270
8260
|
}).length;
|
|
8271
8261
|
if (isLoading.value) {
|
|
8272
8262
|
return props.loadingText || t("loadingText");
|
|
@@ -8293,8 +8283,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8293
8283
|
}
|
|
8294
8284
|
};
|
|
8295
8285
|
watch(() => props.modelValue, () => {
|
|
8296
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch(() =>
|
|
8297
|
-
});
|
|
8286
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
8298
8287
|
updateInjectOptionsStatus();
|
|
8299
8288
|
}, { deep: true });
|
|
8300
8289
|
watch(injectOptions, () => {
|
|
@@ -8309,17 +8298,10 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8309
8298
|
(_a = dropdownRef.value) == null ? void 0 : _a.updatePosition();
|
|
8310
8299
|
}
|
|
8311
8300
|
}, { flush: "post" });
|
|
8312
|
-
watch(isSelectFocus, (val) => {
|
|
8313
|
-
if (val) {
|
|
8314
|
-
ctx.emit("focus");
|
|
8315
|
-
} else {
|
|
8316
|
-
ctx.emit("blur");
|
|
8317
|
-
}
|
|
8318
|
-
});
|
|
8319
|
-
onMounted(updateInjectOptionsStatus);
|
|
8320
8301
|
return {
|
|
8321
8302
|
selectDisabled,
|
|
8322
8303
|
selectSize,
|
|
8304
|
+
originRef,
|
|
8323
8305
|
dropdownRef,
|
|
8324
8306
|
isOpen,
|
|
8325
8307
|
selectCls,
|
|
@@ -8344,7 +8326,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8344
8326
|
}
|
|
8345
8327
|
const selectProps = {
|
|
8346
8328
|
modelValue: {
|
|
8347
|
-
type: [String, Number, Array
|
|
8329
|
+
type: [String, Number, Array],
|
|
8348
8330
|
default: ""
|
|
8349
8331
|
},
|
|
8350
8332
|
"onUpdate:modelValue": {
|
|
@@ -8359,10 +8341,6 @@ const selectProps = {
|
|
|
8359
8341
|
type: String,
|
|
8360
8342
|
default: ""
|
|
8361
8343
|
},
|
|
8362
|
-
position: {
|
|
8363
|
-
type: Array,
|
|
8364
|
-
default: () => ["bottom", "top"]
|
|
8365
|
-
},
|
|
8366
8344
|
overview: {
|
|
8367
8345
|
type: String,
|
|
8368
8346
|
default: "border"
|
|
@@ -8434,10 +8412,6 @@ const selectProps = {
|
|
|
8434
8412
|
multipleLimit: {
|
|
8435
8413
|
type: Number,
|
|
8436
8414
|
default: 0
|
|
8437
|
-
},
|
|
8438
|
-
showEmptyWhenUnmatched: {
|
|
8439
|
-
type: Boolean,
|
|
8440
|
-
default: true
|
|
8441
8415
|
}
|
|
8442
8416
|
};
|
|
8443
8417
|
const optionProps = {
|
|
@@ -8734,7 +8708,7 @@ var Checkbox = defineComponent({
|
|
|
8734
8708
|
props: checkboxProps,
|
|
8735
8709
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8736
8710
|
setup(props, ctx) {
|
|
8737
|
-
const ns2 = useNamespace
|
|
8711
|
+
const ns2 = useNamespace("checkbox");
|
|
8738
8712
|
const {
|
|
8739
8713
|
mergedChecked,
|
|
8740
8714
|
mergedDisabled,
|
|
@@ -8835,7 +8809,7 @@ defineComponent({
|
|
|
8835
8809
|
props: checkboxGroupProps,
|
|
8836
8810
|
emits: ["change", "update:modelValue"],
|
|
8837
8811
|
setup(props, ctx) {
|
|
8838
|
-
const ns2 = useNamespace
|
|
8812
|
+
const ns2 = useNamespace("checkbox");
|
|
8839
8813
|
const {
|
|
8840
8814
|
defaultOpt
|
|
8841
8815
|
} = useCheckboxGroup(props, ctx);
|
|
@@ -8881,7 +8855,7 @@ defineComponent({
|
|
|
8881
8855
|
props: checkboxProps,
|
|
8882
8856
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8883
8857
|
setup(props, ctx) {
|
|
8884
|
-
const ns2 = useNamespace
|
|
8858
|
+
const ns2 = useNamespace("checkbox-button");
|
|
8885
8859
|
const {
|
|
8886
8860
|
mergedChecked,
|
|
8887
8861
|
mergedDisabled,
|
|
@@ -8944,23 +8918,20 @@ function useOption(props) {
|
|
|
8944
8918
|
return select2.modelValue === props.value;
|
|
8945
8919
|
}
|
|
8946
8920
|
});
|
|
8947
|
-
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8948
8921
|
const optionItem = computed(() => {
|
|
8949
8922
|
return {
|
|
8950
8923
|
name: props.name || props.value + "" || "",
|
|
8951
8924
|
value: props.value,
|
|
8952
8925
|
create: props.create,
|
|
8953
|
-
_checked: false
|
|
8954
|
-
disabled: isDisabled.value
|
|
8926
|
+
_checked: false
|
|
8955
8927
|
};
|
|
8956
8928
|
});
|
|
8929
|
+
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8957
8930
|
const isObjectOption = ref(!!props.name);
|
|
8958
8931
|
const selectOptionCls = computed(() => {
|
|
8959
8932
|
return className(ns2.e("item"), {
|
|
8960
8933
|
active: isOptionSelected.value,
|
|
8961
|
-
disabled: isDisabled.value
|
|
8962
|
-
[ns2.em("item", "sm")]: (select2 == null ? void 0 : select2.selectSize) === "sm",
|
|
8963
|
-
[ns2.em("item", "lg")]: (select2 == null ? void 0 : select2.selectSize) === "lg"
|
|
8934
|
+
disabled: isDisabled.value
|
|
8964
8935
|
});
|
|
8965
8936
|
});
|
|
8966
8937
|
const optionSelect = () => {
|
|
@@ -9076,7 +9047,7 @@ const tagProps = {
|
|
|
9076
9047
|
}
|
|
9077
9048
|
};
|
|
9078
9049
|
function useClass(props) {
|
|
9079
|
-
const ns2 = useNamespace("tag");
|
|
9050
|
+
const ns2 = useNamespace$1("tag");
|
|
9080
9051
|
return computed(() => {
|
|
9081
9052
|
const { type: type4, color, deletable } = props;
|
|
9082
9053
|
return `${ns2.e("item")} ${ns2.m(type4 || (color ? "colorful" : "") || "default")} ${deletable ? ns2.m("deletable") : ""} ${ns2.m(props.size)}`;
|
|
@@ -9118,7 +9089,7 @@ var Tag = defineComponent({
|
|
|
9118
9089
|
slots,
|
|
9119
9090
|
emit
|
|
9120
9091
|
}) {
|
|
9121
|
-
const ns2 = useNamespace("tag");
|
|
9092
|
+
const ns2 = useNamespace$1("tag");
|
|
9122
9093
|
const {
|
|
9123
9094
|
type: type4,
|
|
9124
9095
|
color,
|
|
@@ -9176,13 +9147,9 @@ function useSelectContent() {
|
|
|
9176
9147
|
const ns2 = useNamespace$1("select");
|
|
9177
9148
|
const select2 = inject(SELECT_TOKEN);
|
|
9178
9149
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
9179
|
-
const styleType = inject(STYLE_TOKEN, void 0);
|
|
9180
9150
|
const app = getCurrentInstance();
|
|
9181
9151
|
const t = createI18nTranslate("DSelect", app);
|
|
9182
9152
|
const searchQuery = ref("");
|
|
9183
|
-
const singleSearchKey = ref("");
|
|
9184
|
-
const singleInputRef = ref();
|
|
9185
|
-
const singlePlaceholderWidth = computed(() => (select2 == null ? void 0 : select2.dropdownWidth) ? `${(select2 == null ? void 0 : select2.dropdownWidth) - 40}px` : "auto");
|
|
9186
9153
|
const selectedData = computed(() => {
|
|
9187
9154
|
return (select2 == null ? void 0 : select2.selectedOptions) || [];
|
|
9188
9155
|
});
|
|
@@ -9200,37 +9167,21 @@ function useSelectContent() {
|
|
|
9200
9167
|
const displayInputValue = computed(() => {
|
|
9201
9168
|
var _a;
|
|
9202
9169
|
if (select2 == null ? void 0 : select2.selectedOptions) {
|
|
9203
|
-
return select2.selectedOptions.length > 1 ? select2.selectedOptions.map((item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.value) || "").join(",") : ((_a = select2.selectedOptions[0]) == null ? void 0 : _a.name) ||
|
|
9170
|
+
return select2.selectedOptions.length > 1 ? select2.selectedOptions.map((item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.value) || "").join(",") : ((_a = select2.selectedOptions[0]) == null ? void 0 : _a.name) || "";
|
|
9204
9171
|
} else {
|
|
9205
9172
|
return "";
|
|
9206
9173
|
}
|
|
9207
9174
|
});
|
|
9208
|
-
const isPlaceholderDark = computed(() => {
|
|
9209
|
-
if (!singleSearchKey.value) {
|
|
9210
|
-
if (isSelectDisable.value) {
|
|
9211
|
-
return false;
|
|
9212
|
-
}
|
|
9213
|
-
if (!displayInputValue.value) {
|
|
9214
|
-
return true;
|
|
9215
|
-
} else {
|
|
9216
|
-
return select2 == null ? void 0 : select2.isSelectFocus;
|
|
9217
|
-
}
|
|
9218
|
-
} else {
|
|
9219
|
-
return false;
|
|
9220
|
-
}
|
|
9221
|
-
});
|
|
9222
9175
|
const mergeClearable = computed(() => {
|
|
9223
9176
|
return !isSelectDisable.value && !!(select2 == null ? void 0 : select2.allowClear) && (displayInputValue.value ? true : false);
|
|
9224
9177
|
});
|
|
9225
9178
|
const isDisabledTooltip = computed(() => {
|
|
9226
9179
|
return !isSupportTagsTooltip.value || !!(select2 == null ? void 0 : select2.isOpen);
|
|
9227
9180
|
});
|
|
9228
|
-
const isSupportFilter = computed(() => lodash.exports.isFunction(select2 == null ? void 0 : select2.filter) || typeof (select2 == null ? void 0 : select2.filter) === "boolean" && (select2 == null ? void 0 : select2.filter));
|
|
9229
9181
|
const selectionCls = computed(() => {
|
|
9230
9182
|
return className(ns2.e("selection"), {
|
|
9231
9183
|
[ns2.e("clearable")]: mergeClearable.value,
|
|
9232
|
-
[ns2.em("selection", "error")]: isValidateError.value
|
|
9233
|
-
[ns2.em("selection", "gray-style")]: styleType === "gray"
|
|
9184
|
+
[ns2.em("selection", "error")]: isValidateError.value
|
|
9234
9185
|
});
|
|
9235
9186
|
});
|
|
9236
9187
|
const inputCls = computed(() => {
|
|
@@ -9241,20 +9192,12 @@ function useSelectContent() {
|
|
|
9241
9192
|
});
|
|
9242
9193
|
const tagSize = computed(() => (select2 == null ? void 0 : select2.selectSize) || "sm");
|
|
9243
9194
|
const placeholder = computed(() => displayInputValue.value ? "" : (select2 == null ? void 0 : select2.placeholder) || t("placeholder"));
|
|
9244
|
-
const singlePlaceholder = computed(() => (select2 == null ? void 0 : select2.placeholder) || t("placeholder"));
|
|
9245
9195
|
const isMultiple = computed(() => !!(select2 == null ? void 0 : select2.multiple));
|
|
9246
9196
|
const handleClear = (e) => {
|
|
9247
9197
|
e.preventDefault();
|
|
9248
9198
|
e.stopPropagation();
|
|
9249
|
-
searchQuery.value = "";
|
|
9250
|
-
singleSearchKey.value = "";
|
|
9251
9199
|
select2 == null ? void 0 : select2.handleClear();
|
|
9252
9200
|
};
|
|
9253
|
-
const onSingleInputWrapClick = () => {
|
|
9254
|
-
if (!(select2 == null ? void 0 : select2.selectDisabled)) {
|
|
9255
|
-
singleInputRef.value.focus();
|
|
9256
|
-
}
|
|
9257
|
-
};
|
|
9258
9201
|
const tagDelete = (data) => {
|
|
9259
9202
|
if (data && (data.value || data.value === 0)) {
|
|
9260
9203
|
select2 == null ? void 0 : select2.tagDelete(data);
|
|
@@ -9264,67 +9207,39 @@ function useSelectContent() {
|
|
|
9264
9207
|
select2 == null ? void 0 : select2.onFocus(e);
|
|
9265
9208
|
};
|
|
9266
9209
|
const onBlur = (e) => {
|
|
9267
|
-
singleSearchKey.value = "";
|
|
9268
9210
|
select2 == null ? void 0 : select2.onBlur(e);
|
|
9269
9211
|
};
|
|
9270
|
-
const onMultipleClick = () => {
|
|
9271
|
-
if (select2 == null ? void 0 : select2.selectDisabled) {
|
|
9272
|
-
return;
|
|
9273
|
-
}
|
|
9274
|
-
if (select2 == null ? void 0 : select2.isOpen) {
|
|
9275
|
-
searchQuery.value = "";
|
|
9276
|
-
select2 == null ? void 0 : select2.onBlur();
|
|
9277
|
-
} else {
|
|
9278
|
-
select2 == null ? void 0 : select2.onFocus();
|
|
9279
|
-
}
|
|
9280
|
-
};
|
|
9281
|
-
const onArrowClick = () => {
|
|
9282
|
-
if (isMultiple.value) {
|
|
9283
|
-
onMultipleClick();
|
|
9284
|
-
}
|
|
9285
|
-
};
|
|
9286
9212
|
const queryFilter = (e) => {
|
|
9287
9213
|
e.preventDefault();
|
|
9288
9214
|
e.stopPropagation();
|
|
9289
9215
|
const query = e.target.value;
|
|
9290
|
-
singleSearchKey.value = query;
|
|
9291
|
-
searchQuery.value = query;
|
|
9292
9216
|
if (!isReadOnly.value && (select2 == null ? void 0 : select2.debounceQueryFilter)) {
|
|
9293
9217
|
select2 == null ? void 0 : select2.debounceQueryFilter(query);
|
|
9294
9218
|
}
|
|
9295
9219
|
};
|
|
9296
9220
|
return {
|
|
9297
|
-
singleInputRef,
|
|
9298
9221
|
searchQuery,
|
|
9299
|
-
singleSearchKey,
|
|
9300
9222
|
selectedData,
|
|
9301
9223
|
isSelectDisable,
|
|
9302
9224
|
isSupportCollapseTags,
|
|
9303
9225
|
isDisabledTooltip,
|
|
9304
|
-
isSupportFilter,
|
|
9305
9226
|
isReadOnly,
|
|
9306
9227
|
selectionCls,
|
|
9307
9228
|
inputCls,
|
|
9308
9229
|
tagSize,
|
|
9309
9230
|
placeholder,
|
|
9310
|
-
singlePlaceholder,
|
|
9311
|
-
singlePlaceholderWidth,
|
|
9312
9231
|
isMultiple,
|
|
9313
9232
|
displayInputValue,
|
|
9314
|
-
isPlaceholderDark,
|
|
9315
|
-
onSingleInputWrapClick,
|
|
9316
9233
|
handleClear,
|
|
9317
9234
|
tagDelete,
|
|
9318
9235
|
onFocus,
|
|
9319
9236
|
onBlur,
|
|
9320
|
-
onMultipleClick,
|
|
9321
|
-
onArrowClick,
|
|
9322
9237
|
queryFilter
|
|
9323
9238
|
};
|
|
9324
9239
|
}
|
|
9325
9240
|
var SelectContent = defineComponent({
|
|
9326
9241
|
name: "SelectContent",
|
|
9327
|
-
setup(
|
|
9242
|
+
setup() {
|
|
9328
9243
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
9329
9244
|
const ns2 = useNamespace$1("select");
|
|
9330
9245
|
const clearCls = computed(() => ({
|
|
@@ -9338,71 +9253,44 @@ var SelectContent = defineComponent({
|
|
|
9338
9253
|
const multipleCls = ns2.e("multiple");
|
|
9339
9254
|
const multipleInputCls = ns2.em("multiple", "input");
|
|
9340
9255
|
const {
|
|
9341
|
-
singleInputRef,
|
|
9342
9256
|
searchQuery,
|
|
9343
|
-
singleSearchKey,
|
|
9344
9257
|
selectedData,
|
|
9345
9258
|
isSelectDisable,
|
|
9346
9259
|
isSupportCollapseTags,
|
|
9347
9260
|
isDisabledTooltip,
|
|
9348
9261
|
isReadOnly,
|
|
9349
|
-
isSupportFilter,
|
|
9350
9262
|
selectionCls,
|
|
9351
9263
|
inputCls,
|
|
9352
9264
|
tagSize,
|
|
9353
9265
|
placeholder,
|
|
9354
|
-
singlePlaceholder,
|
|
9355
|
-
singlePlaceholderWidth,
|
|
9356
9266
|
isMultiple,
|
|
9357
|
-
isPlaceholderDark,
|
|
9358
9267
|
displayInputValue,
|
|
9359
|
-
onSingleInputWrapClick,
|
|
9360
|
-
onMultipleClick,
|
|
9361
|
-
onArrowClick,
|
|
9362
9268
|
handleClear,
|
|
9363
9269
|
tagDelete,
|
|
9364
9270
|
onFocus,
|
|
9365
9271
|
onBlur,
|
|
9366
9272
|
queryFilter
|
|
9367
9273
|
} = useSelectContent();
|
|
9368
|
-
const clearSingleSearchKey = () => {
|
|
9369
|
-
singleSearchKey.value = "";
|
|
9370
|
-
};
|
|
9371
|
-
const clearMultipleSearchKey = () => {
|
|
9372
|
-
searchQuery.value = "";
|
|
9373
|
-
};
|
|
9374
|
-
ctx.expose({
|
|
9375
|
-
clearSingleSearchKey,
|
|
9376
|
-
clearMultipleSearchKey
|
|
9377
|
-
});
|
|
9378
9274
|
return () => {
|
|
9379
9275
|
return createVNode("div", {
|
|
9380
9276
|
"class": selectionCls.value
|
|
9381
9277
|
}, [isMultiple.value ? createVNode("div", {
|
|
9382
|
-
"class": multipleCls
|
|
9383
|
-
"onClick": onMultipleClick
|
|
9278
|
+
"class": multipleCls
|
|
9384
9279
|
}, [!isSupportCollapseTags.value && selectedData.value.length >= 1 && selectedData.value.map((item) => createVNode(Tag, {
|
|
9385
|
-
"deletable":
|
|
9280
|
+
"deletable": true,
|
|
9386
9281
|
"onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
|
|
9387
9282
|
"key": item.value,
|
|
9388
|
-
"maxWidth": "78%",
|
|
9389
|
-
"class": ["multiple-tag", {
|
|
9390
|
-
disabled: isSelectDisable.value || item.disabled
|
|
9391
|
-
}],
|
|
9392
9283
|
"size": tagSize.value
|
|
9393
9284
|
}, {
|
|
9394
9285
|
default: () => [item.name]
|
|
9395
9286
|
})), isSupportCollapseTags.value && selectedData.value.length >= 1 && createVNode(Tag, {
|
|
9396
9287
|
"deletable": true,
|
|
9397
|
-
"maxWidth": "75%",
|
|
9398
|
-
"class": "multiple-tag",
|
|
9399
9288
|
"onTagDelete": withModifiers(() => tagDelete(selectedData.value[0]), ["prevent", "stop"]),
|
|
9400
9289
|
"size": tagSize.value
|
|
9401
9290
|
}, {
|
|
9402
9291
|
default: () => [selectedData.value[0].name]
|
|
9403
9292
|
}), isSupportCollapseTags.value && selectedData.value.length > 1 && createVNode(Popover, {
|
|
9404
9293
|
"trigger": "hover",
|
|
9405
|
-
"auto-update-position": true,
|
|
9406
9294
|
"disabled": isDisabledTooltip.value
|
|
9407
9295
|
}, {
|
|
9408
9296
|
default: () => createVNode(Tag, {
|
|
@@ -9414,49 +9302,39 @@ var SelectContent = defineComponent({
|
|
|
9414
9302
|
"deletable": true,
|
|
9415
9303
|
"onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
|
|
9416
9304
|
"key": item.value,
|
|
9417
|
-
"class": "popover-tag",
|
|
9418
9305
|
"size": tagSize.value
|
|
9419
9306
|
}, {
|
|
9420
9307
|
default: () => [item.name]
|
|
9421
9308
|
}))])
|
|
9422
9309
|
}), createVNode("div", {
|
|
9423
9310
|
"class": multipleInputCls
|
|
9424
|
-
}, [
|
|
9311
|
+
}, [createVNode("input", {
|
|
9425
9312
|
"ref": "input",
|
|
9426
9313
|
"value": searchQuery.value,
|
|
9427
9314
|
"type": "text",
|
|
9428
9315
|
"class": inputCls.value,
|
|
9429
9316
|
"placeholder": placeholder.value,
|
|
9430
|
-
"readonly": isReadOnly.value
|
|
9317
|
+
"readonly": isReadOnly.value,
|
|
9431
9318
|
"disabled": isSelectDisable.value,
|
|
9432
|
-
"onInput": queryFilter
|
|
9433
|
-
|
|
9434
|
-
"
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
"
|
|
9438
|
-
"placeholder-dark": isPlaceholderDark.value
|
|
9439
|
-
}],
|
|
9440
|
-
"style": {
|
|
9441
|
-
width: singlePlaceholderWidth.value
|
|
9442
|
-
},
|
|
9443
|
-
"title": displayInputValue.value || singlePlaceholder.value
|
|
9444
|
-
}, [displayInputValue.value || singlePlaceholder.value]), withDirectives(createVNode("input", {
|
|
9445
|
-
"ref": singleInputRef,
|
|
9319
|
+
"onInput": queryFilter,
|
|
9320
|
+
"onFocus": onFocus,
|
|
9321
|
+
"onBlur": onBlur
|
|
9322
|
+
}, null)])]) : createVNode("input", {
|
|
9323
|
+
"ref": "input",
|
|
9324
|
+
"value": displayInputValue.value,
|
|
9446
9325
|
"type": "text",
|
|
9447
|
-
"onUpdate:modelValue": ($event) => singleSearchKey.value = $event,
|
|
9448
9326
|
"class": inputCls.value,
|
|
9327
|
+
"placeholder": placeholder.value,
|
|
9449
9328
|
"readonly": isReadOnly.value,
|
|
9450
9329
|
"disabled": isSelectDisable.value,
|
|
9451
9330
|
"onFocus": onFocus,
|
|
9452
9331
|
"onBlur": onBlur,
|
|
9453
9332
|
"onInput": queryFilter
|
|
9454
|
-
}, null),
|
|
9333
|
+
}, null), createVNode("span", {
|
|
9455
9334
|
"onClick": handleClear,
|
|
9456
9335
|
"class": clearCls.value
|
|
9457
9336
|
}, [createVNode(AlertCloseIcon, null, null)]), createVNode("span", {
|
|
9458
|
-
"class": arrowCls.value
|
|
9459
|
-
"onClick": onArrowClick
|
|
9337
|
+
"class": arrowCls.value
|
|
9460
9338
|
}, [createVNode(SelectArrowIcon, null, null)])]);
|
|
9461
9339
|
};
|
|
9462
9340
|
}
|
|
@@ -9484,38 +9362,11 @@ function useSelectFunction(props, selectRef) {
|
|
|
9484
9362
|
};
|
|
9485
9363
|
return { isSelectFocus, focus, blur };
|
|
9486
9364
|
}
|
|
9487
|
-
function useSelectMenuSize(selectRef, dropdownRef, isOpen) {
|
|
9488
|
-
const originRef = ref();
|
|
9489
|
-
const dropdownWidth = ref(0);
|
|
9490
|
-
let observer;
|
|
9491
|
-
const updateDropdownWidth = () => {
|
|
9492
|
-
var _a;
|
|
9493
|
-
dropdownWidth.value = ((_a = originRef.value) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
9494
|
-
if (isOpen.value) {
|
|
9495
|
-
dropdownRef.value.updatePosition();
|
|
9496
|
-
}
|
|
9497
|
-
};
|
|
9498
|
-
const watchInputSize = () => {
|
|
9499
|
-
if (window) {
|
|
9500
|
-
observer = new window.ResizeObserver(updateDropdownWidth);
|
|
9501
|
-
observer.observe(originRef.value);
|
|
9502
|
-
}
|
|
9503
|
-
};
|
|
9504
|
-
onMounted(() => {
|
|
9505
|
-
originRef.value = selectRef.value.$el;
|
|
9506
|
-
watchInputSize();
|
|
9507
|
-
updateDropdownWidth();
|
|
9508
|
-
});
|
|
9509
|
-
onBeforeUnmount(() => {
|
|
9510
|
-
observer == null ? void 0 : observer.unobserve(originRef.value);
|
|
9511
|
-
});
|
|
9512
|
-
return { originRef, dropdownWidth };
|
|
9513
|
-
}
|
|
9514
9365
|
var select = "";
|
|
9515
9366
|
var Select = defineComponent({
|
|
9516
9367
|
name: "DSelect",
|
|
9517
9368
|
props: selectProps,
|
|
9518
|
-
emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear"
|
|
9369
|
+
emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear"],
|
|
9519
9370
|
setup(props, ctx) {
|
|
9520
9371
|
const app = getCurrentInstance();
|
|
9521
9372
|
const t = createI18nTranslate("DSelect", app);
|
|
@@ -9528,6 +9379,7 @@ var Select = defineComponent({
|
|
|
9528
9379
|
const {
|
|
9529
9380
|
selectDisabled,
|
|
9530
9381
|
selectSize,
|
|
9382
|
+
originRef,
|
|
9531
9383
|
dropdownRef,
|
|
9532
9384
|
isOpen,
|
|
9533
9385
|
selectCls,
|
|
@@ -9549,16 +9401,9 @@ var Select = defineComponent({
|
|
|
9549
9401
|
isShowCreateOption
|
|
9550
9402
|
} = useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t);
|
|
9551
9403
|
const dropdownContainer = ref();
|
|
9552
|
-
const {
|
|
9553
|
-
originRef,
|
|
9554
|
-
dropdownWidth
|
|
9555
|
-
} = useSelectMenuSize(selectRef, dropdownRef, isOpen);
|
|
9556
9404
|
const scrollbarNs = useNamespace$1("scrollbar");
|
|
9557
9405
|
const ns2 = useNamespace$1("select");
|
|
9558
|
-
const dropdownCls =
|
|
9559
|
-
[ns2.e("dropdown")]: true,
|
|
9560
|
-
[ns2.em("dropdown", "multiple")]: props.multiple
|
|
9561
|
-
};
|
|
9406
|
+
const dropdownCls = ns2.e("dropdown");
|
|
9562
9407
|
const listCls = {
|
|
9563
9408
|
[ns2.e("dropdown-list")]: true,
|
|
9564
9409
|
[scrollbarNs.b()]: true
|
|
@@ -9570,8 +9415,17 @@ var Select = defineComponent({
|
|
|
9570
9415
|
toggleChange
|
|
9571
9416
|
});
|
|
9572
9417
|
const isRender = ref(false);
|
|
9573
|
-
|
|
9574
|
-
|
|
9418
|
+
const position = ref(["bottom-start", "top-start"]);
|
|
9419
|
+
const dropdownWidth = ref("0");
|
|
9420
|
+
const updateDropdownWidth = () => {
|
|
9421
|
+
var _a;
|
|
9422
|
+
dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
|
|
9423
|
+
};
|
|
9424
|
+
watch(selectRef, (val) => {
|
|
9425
|
+
if (val) {
|
|
9426
|
+
originRef.value = val.$el;
|
|
9427
|
+
updateDropdownWidth();
|
|
9428
|
+
}
|
|
9575
9429
|
});
|
|
9576
9430
|
const scrollToBottom = () => {
|
|
9577
9431
|
const compareHeight = dropdownContainer.value.scrollHeight - dropdownContainer.value.clientHeight;
|
|
@@ -9581,18 +9435,22 @@ var Select = defineComponent({
|
|
|
9581
9435
|
}
|
|
9582
9436
|
};
|
|
9583
9437
|
onMounted(() => {
|
|
9438
|
+
isRender.value = true;
|
|
9439
|
+
updateDropdownWidth();
|
|
9440
|
+
window.addEventListener("resize", updateDropdownWidth);
|
|
9584
9441
|
nextTick(() => {
|
|
9585
9442
|
dropdownContainer.value.addEventListener("scroll", scrollToBottom);
|
|
9586
9443
|
});
|
|
9587
9444
|
});
|
|
9445
|
+
onUnmounted(() => {
|
|
9446
|
+
window.removeEventListener("resize", updateDropdownWidth);
|
|
9447
|
+
});
|
|
9588
9448
|
provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
|
|
9589
9449
|
selectDisabled,
|
|
9590
9450
|
selectSize,
|
|
9591
9451
|
isOpen,
|
|
9592
|
-
isSelectFocus,
|
|
9593
9452
|
selectedOptions,
|
|
9594
9453
|
filterQuery,
|
|
9595
|
-
dropdownWidth,
|
|
9596
9454
|
valueChange,
|
|
9597
9455
|
handleClear,
|
|
9598
9456
|
updateInjectOptions,
|
|
@@ -9606,7 +9464,7 @@ var Select = defineComponent({
|
|
|
9606
9464
|
"class": selectCls.value,
|
|
9607
9465
|
"onClick": withModifiers(() => {
|
|
9608
9466
|
toggleChange(!isOpen.value);
|
|
9609
|
-
}, [])
|
|
9467
|
+
}, ["stop"])
|
|
9610
9468
|
}, [createVNode(SelectContent, {
|
|
9611
9469
|
"ref": selectRef
|
|
9612
9470
|
}, null), createVNode(Teleport, {
|
|
@@ -9620,9 +9478,9 @@ var Select = defineComponent({
|
|
|
9620
9478
|
"onUpdate:modelValue": ($event) => isRender.value = $event,
|
|
9621
9479
|
"ref": dropdownRef,
|
|
9622
9480
|
"origin": originRef.value,
|
|
9481
|
+
"align": "start",
|
|
9623
9482
|
"offset": 4,
|
|
9624
|
-
"
|
|
9625
|
-
"position": props.position,
|
|
9483
|
+
"position": position.value,
|
|
9626
9484
|
"style": {
|
|
9627
9485
|
visibility: isOpen.value ? "visible" : "hidden",
|
|
9628
9486
|
"z-index": isOpen.value ? "var(--devui-z-index-dropdown, 1052)" : -1
|
|
@@ -9633,14 +9491,11 @@ var Select = defineComponent({
|
|
|
9633
9491
|
return [createVNode("div", {
|
|
9634
9492
|
"class": dropdownCls,
|
|
9635
9493
|
"style": {
|
|
9636
|
-
width: `${dropdownWidth.value}
|
|
9494
|
+
width: `${dropdownWidth.value}`,
|
|
9637
9495
|
visibility: isOpen.value ? "visible" : "hidden"
|
|
9638
9496
|
}
|
|
9639
9497
|
}, [withDirectives(createVNode("ul", {
|
|
9640
9498
|
"class": listCls,
|
|
9641
|
-
"style": {
|
|
9642
|
-
padding: isShowEmptyText.value ? "0" : "12px"
|
|
9643
|
-
},
|
|
9644
9499
|
"ref": dropdownContainer
|
|
9645
9500
|
}, [isShowCreateOption.value && createVNode(Option, {
|
|
9646
9501
|
"value": filterQuery.value,
|
|
@@ -9660,8 +9515,7 @@ var Select = defineComponent({
|
|
|
9660
9515
|
default: () => [props.multiple ? createVNode(Checkbox, {
|
|
9661
9516
|
"modelValue": item._checked,
|
|
9662
9517
|
"label": item.name,
|
|
9663
|
-
"disabled": isDisabled(item)
|
|
9664
|
-
"class": "select-checkbox"
|
|
9518
|
+
"disabled": isDisabled(item)
|
|
9665
9519
|
}, null) : item.name || item.value]
|
|
9666
9520
|
}))]), [[vShow, !isLoading.value]]), isShowEmptyText.value && createVNode("div", null, [((_c = ctx.slots) == null ? void 0 : _c.empty) && ctx.slots.empty(), !((_d = ctx.slots) == null ? void 0 : _d.empty) && createVNode("p", {
|
|
9667
9521
|
"class": dropdownEmptyCls
|