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/select/index.es.js
CHANGED
|
@@ -29,9 +29,9 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, 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 { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, 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 className(classStr, classOpt) {
|
|
37
37
|
let classname = classStr;
|
|
@@ -42,25 +42,6 @@ function className(classStr, classOpt) {
|
|
|
42
42
|
}
|
|
43
43
|
return classname;
|
|
44
44
|
}
|
|
45
|
-
function lockScroll() {
|
|
46
|
-
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
47
|
-
const scrollTop = document.documentElement.scrollTop;
|
|
48
|
-
const style = document.documentElement.getAttribute("style");
|
|
49
|
-
document.documentElement.style.position = "fixed";
|
|
50
|
-
document.documentElement.style.top = `-${scrollTop}px`;
|
|
51
|
-
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
52
|
-
document.documentElement.style.overflowY = "scroll";
|
|
53
|
-
return () => {
|
|
54
|
-
if (style) {
|
|
55
|
-
document.documentElement.setAttribute("style", style);
|
|
56
|
-
} else {
|
|
57
|
-
document.documentElement.removeAttribute("style");
|
|
58
|
-
}
|
|
59
|
-
document.documentElement.scrollTop = scrollTop;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
45
|
function createBem$1(namespace, element, modifier) {
|
|
65
46
|
let cls = namespace;
|
|
66
47
|
if (element) {
|
|
@@ -5554,6 +5535,48 @@ const formProps = {
|
|
|
5554
5535
|
};
|
|
5555
5536
|
const FORM_TOKEN = Symbol("dForm");
|
|
5556
5537
|
const STYLE_TOKEN = Symbol("dForm");
|
|
5538
|
+
function lockScroll() {
|
|
5539
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
5540
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
5541
|
+
const style = document.documentElement.getAttribute("style");
|
|
5542
|
+
document.documentElement.style.position = "fixed";
|
|
5543
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
5544
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
5545
|
+
document.documentElement.style.overflowY = "scroll";
|
|
5546
|
+
return () => {
|
|
5547
|
+
if (style) {
|
|
5548
|
+
document.documentElement.setAttribute("style", style);
|
|
5549
|
+
} else {
|
|
5550
|
+
document.documentElement.removeAttribute("style");
|
|
5551
|
+
}
|
|
5552
|
+
document.documentElement.scrollTop = scrollTop;
|
|
5553
|
+
};
|
|
5554
|
+
}
|
|
5555
|
+
return;
|
|
5556
|
+
}
|
|
5557
|
+
function createBem(namespace, element, modifier) {
|
|
5558
|
+
let cls = namespace;
|
|
5559
|
+
if (element) {
|
|
5560
|
+
cls += `__${element}`;
|
|
5561
|
+
}
|
|
5562
|
+
if (modifier) {
|
|
5563
|
+
cls += `--${modifier}`;
|
|
5564
|
+
}
|
|
5565
|
+
return cls;
|
|
5566
|
+
}
|
|
5567
|
+
function useNamespace(block, needDot = false) {
|
|
5568
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
5569
|
+
const b = () => createBem(namespace);
|
|
5570
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
5571
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
5572
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
5573
|
+
return {
|
|
5574
|
+
b,
|
|
5575
|
+
e,
|
|
5576
|
+
m,
|
|
5577
|
+
em
|
|
5578
|
+
};
|
|
5579
|
+
}
|
|
5557
5580
|
function useFieldCollection() {
|
|
5558
5581
|
const itemContexts = [];
|
|
5559
5582
|
const addItemContext = (field) => {
|
|
@@ -5621,7 +5644,7 @@ defineComponent({
|
|
|
5621
5644
|
props: formProps,
|
|
5622
5645
|
emits: ["validate"],
|
|
5623
5646
|
setup(props, ctx) {
|
|
5624
|
-
const ns2 = useNamespace
|
|
5647
|
+
const ns2 = useNamespace("form");
|
|
5625
5648
|
const {
|
|
5626
5649
|
itemContexts,
|
|
5627
5650
|
addItemContext,
|
|
@@ -5739,29 +5762,6 @@ function useFixedOverlay(props, ctx) {
|
|
|
5739
5762
|
onUnmounted(removeBodyAdditions);
|
|
5740
5763
|
return { onClick };
|
|
5741
5764
|
}
|
|
5742
|
-
function createBem(namespace, element, modifier) {
|
|
5743
|
-
let cls = namespace;
|
|
5744
|
-
if (element) {
|
|
5745
|
-
cls += `__${element}`;
|
|
5746
|
-
}
|
|
5747
|
-
if (modifier) {
|
|
5748
|
-
cls += `--${modifier}`;
|
|
5749
|
-
}
|
|
5750
|
-
return cls;
|
|
5751
|
-
}
|
|
5752
|
-
function useNamespace(block, needDot = false) {
|
|
5753
|
-
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
5754
|
-
const b = () => createBem(namespace);
|
|
5755
|
-
const e = (element) => element ? createBem(namespace, element) : "";
|
|
5756
|
-
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
5757
|
-
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
5758
|
-
return {
|
|
5759
|
-
b,
|
|
5760
|
-
e,
|
|
5761
|
-
m,
|
|
5762
|
-
em
|
|
5763
|
-
};
|
|
5764
|
-
}
|
|
5765
5765
|
var fixedOverlay = "";
|
|
5766
5766
|
defineComponent({
|
|
5767
5767
|
name: "DFixedOverlay",
|
|
@@ -5772,7 +5772,7 @@ defineComponent({
|
|
|
5772
5772
|
const {
|
|
5773
5773
|
modelValue
|
|
5774
5774
|
} = toRefs(props);
|
|
5775
|
-
const ns2 = useNamespace("fixed-overlay");
|
|
5775
|
+
const ns2 = useNamespace$1("fixed-overlay");
|
|
5776
5776
|
const {
|
|
5777
5777
|
onClick
|
|
5778
5778
|
} = useFixedOverlay(props, ctx);
|
|
@@ -5889,6 +5889,9 @@ function useOverlay(props, emit) {
|
|
|
5889
5889
|
];
|
|
5890
5890
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
5891
5891
|
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
5892
|
+
if (!overlayEl) {
|
|
5893
|
+
return;
|
|
5894
|
+
}
|
|
5892
5895
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
5893
5896
|
strategy: "fixed",
|
|
5894
5897
|
middleware
|
|
@@ -5938,7 +5941,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
5938
5941
|
emit,
|
|
5939
5942
|
expose
|
|
5940
5943
|
}) {
|
|
5941
|
-
const ns2 = useNamespace("flexible-overlay");
|
|
5944
|
+
const ns2 = useNamespace$1("flexible-overlay");
|
|
5942
5945
|
const {
|
|
5943
5946
|
clickEventBubble
|
|
5944
5947
|
} = toRefs(props);
|
|
@@ -5967,7 +5970,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
5967
5970
|
});
|
|
5968
5971
|
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
5969
5972
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
5970
|
-
const ns$1 = useNamespace("popper-trigger");
|
|
5973
|
+
const ns$1 = useNamespace$1("popper-trigger");
|
|
5971
5974
|
function wrapContent(content) {
|
|
5972
5975
|
return h("span", { class: ns$1.b() }, content);
|
|
5973
5976
|
}
|
|
@@ -6154,7 +6157,7 @@ function usePopoverEvent(props, visible, origin) {
|
|
|
6154
6157
|
});
|
|
6155
6158
|
return { placement, handlePositionChange, onMouseenter, onMouseleave };
|
|
6156
6159
|
}
|
|
6157
|
-
const ns = useNamespace("popover");
|
|
6160
|
+
const ns = useNamespace$1("popover");
|
|
6158
6161
|
function SuccessIcon$1() {
|
|
6159
6162
|
return createVNode("svg", {
|
|
6160
6163
|
"class": [ns.e("icon"), ns.em("icon", "success")],
|
|
@@ -6256,7 +6259,7 @@ var PopoverIcon = defineComponent({
|
|
|
6256
6259
|
}
|
|
6257
6260
|
},
|
|
6258
6261
|
setup(props) {
|
|
6259
|
-
const ns2 = useNamespace("popover");
|
|
6262
|
+
const ns2 = useNamespace$1("popover");
|
|
6260
6263
|
return () => props.type && props.type !== "default" && createVNode("span", {
|
|
6261
6264
|
"class": ns2.e("icon-wrap")
|
|
6262
6265
|
}, [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)]);
|
|
@@ -6293,7 +6296,7 @@ var Popover = defineComponent({
|
|
|
6293
6296
|
const {
|
|
6294
6297
|
overlayStyles
|
|
6295
6298
|
} = usePopover(props, visible, placement, origin, popoverRef);
|
|
6296
|
-
const ns2 = useNamespace("popover");
|
|
6299
|
+
const ns2 = useNamespace$1("popover");
|
|
6297
6300
|
provide(POPPER_TRIGGER_TOKEN, origin);
|
|
6298
6301
|
watch(visible, (newVal) => {
|
|
6299
6302
|
if (newVal) {
|
|
@@ -6426,7 +6429,7 @@ function useFormLabel() {
|
|
|
6426
6429
|
const formContext = inject(FORM_TOKEN);
|
|
6427
6430
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
6428
6431
|
const labelData = inject(LABEL_DATA);
|
|
6429
|
-
const ns2 = useNamespace
|
|
6432
|
+
const ns2 = useNamespace("form");
|
|
6430
6433
|
const defaultTipsPopover = {
|
|
6431
6434
|
content: "",
|
|
6432
6435
|
position: ["top"],
|
|
@@ -6457,7 +6460,7 @@ var formLabel = "";
|
|
|
6457
6460
|
var FormLabel = defineComponent({
|
|
6458
6461
|
name: "DFormLabel",
|
|
6459
6462
|
setup(_, ctx) {
|
|
6460
|
-
const ns2 = useNamespace
|
|
6463
|
+
const ns2 = useNamespace("form");
|
|
6461
6464
|
const {
|
|
6462
6465
|
labelClasses,
|
|
6463
6466
|
labelInnerClasses,
|
|
@@ -6490,7 +6493,7 @@ const formControlProps = {
|
|
|
6490
6493
|
};
|
|
6491
6494
|
function useFormControl(props) {
|
|
6492
6495
|
const labelData = inject(LABEL_DATA);
|
|
6493
|
-
const ns2 = useNamespace
|
|
6496
|
+
const ns2 = useNamespace("form");
|
|
6494
6497
|
const { feedbackStatus } = toRefs(props);
|
|
6495
6498
|
const controlClasses = computed(() => ({
|
|
6496
6499
|
[ns2.e("control")]: true,
|
|
@@ -6522,7 +6525,7 @@ var FormControl = defineComponent({
|
|
|
6522
6525
|
const formContext = inject(FORM_TOKEN);
|
|
6523
6526
|
const formControl2 = ref();
|
|
6524
6527
|
const popoverRef = ref();
|
|
6525
|
-
const ns2 = useNamespace
|
|
6528
|
+
const ns2 = useNamespace("form");
|
|
6526
6529
|
const showPopoverClick = ref(true);
|
|
6527
6530
|
const {
|
|
6528
6531
|
controlClasses,
|
|
@@ -7613,7 +7616,7 @@ function getFieldValue(obj, path) {
|
|
|
7613
7616
|
}
|
|
7614
7617
|
function useFormItem(messageType, _rules, validateState) {
|
|
7615
7618
|
const formContext = inject(FORM_TOKEN);
|
|
7616
|
-
const ns2 = useNamespace
|
|
7619
|
+
const ns2 = useNamespace("form");
|
|
7617
7620
|
const itemClasses = computed(() => ({
|
|
7618
7621
|
[`${ns2.em("item", "horizontal")}`]: formContext.layout === "horizontal",
|
|
7619
7622
|
[`${ns2.em("item", "vertical")}`]: formContext.layout === "vertical",
|
|
@@ -7852,6 +7855,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7852
7855
|
const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
|
|
7853
7856
|
const selectSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
|
|
7854
7857
|
const isObjectOption = ref(false);
|
|
7858
|
+
const originRef = ref();
|
|
7855
7859
|
const isOpen = ref(false);
|
|
7856
7860
|
const toggleChange = (bool) => {
|
|
7857
7861
|
if (selectDisabled.value) {
|
|
@@ -7861,14 +7865,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7861
7865
|
ctx.emit("toggle-change", bool);
|
|
7862
7866
|
};
|
|
7863
7867
|
onClickOutside(dropdownRef, () => {
|
|
7864
|
-
|
|
7865
|
-
if (props.multiple && isOpen.value) {
|
|
7866
|
-
(_a = selectRef.value) == null ? void 0 : _a.clearMultipleSearchKey();
|
|
7867
|
-
onBlur();
|
|
7868
|
-
}
|
|
7869
|
-
if (isOpen.value) {
|
|
7870
|
-
toggleChange(false);
|
|
7871
|
-
}
|
|
7868
|
+
toggleChange(false);
|
|
7872
7869
|
}, { ignore: [selectRef] });
|
|
7873
7870
|
const dropdownMenuMultipleNs = useNamespace$1("dropdown-menu-multiple");
|
|
7874
7871
|
const selectCls = computed(() => {
|
|
@@ -7981,11 +7978,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7981
7978
|
}
|
|
7982
7979
|
};
|
|
7983
7980
|
const valueChange = (item) => {
|
|
7984
|
-
var _a;
|
|
7985
7981
|
const { multiple } = props;
|
|
7986
7982
|
let { modelValue } = props;
|
|
7987
|
-
filterQuery.value = "";
|
|
7988
|
-
handlerQueryFunc("");
|
|
7989
7983
|
if (multiple) {
|
|
7990
7984
|
const checkedItems = Array.isArray(modelValue) ? modelValue.slice() : [];
|
|
7991
7985
|
const index2 = checkedItems.indexOf(item.value);
|
|
@@ -8012,7 +8006,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8012
8006
|
}
|
|
8013
8007
|
getMultipleSelected(checkedItems);
|
|
8014
8008
|
} else {
|
|
8015
|
-
(_a = selectRef.value) == null ? void 0 : _a.clearSingleSearchKey();
|
|
8016
8009
|
ctx.emit("update:modelValue", item.value);
|
|
8017
8010
|
getSingleSelected(item);
|
|
8018
8011
|
toggleChange(false);
|
|
@@ -8023,8 +8016,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8023
8016
|
ctx.emit("toggle-change", false);
|
|
8024
8017
|
};
|
|
8025
8018
|
const handleClear = () => {
|
|
8026
|
-
filterQuery.value = "";
|
|
8027
|
-
handlerQueryFunc("");
|
|
8028
8019
|
if (props.multiple) {
|
|
8029
8020
|
ctx.emit("update:modelValue", []);
|
|
8030
8021
|
ctx.emit("value-change", []);
|
|
@@ -8037,6 +8028,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8037
8028
|
handleClose();
|
|
8038
8029
|
blur();
|
|
8039
8030
|
}
|
|
8031
|
+
filterQuery.value = "";
|
|
8040
8032
|
};
|
|
8041
8033
|
const tagDelete = (data) => {
|
|
8042
8034
|
let { modelValue } = props;
|
|
@@ -8054,17 +8046,15 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8054
8046
|
ctx.emit("remove-tag", data.value);
|
|
8055
8047
|
getMultipleSelected(checkedItems);
|
|
8056
8048
|
};
|
|
8057
|
-
const onFocus = () => {
|
|
8049
|
+
const onFocus = (e) => {
|
|
8050
|
+
ctx.emit("focus", e);
|
|
8058
8051
|
if (!selectDisabled.value) {
|
|
8059
8052
|
isSelectFocus.value = true;
|
|
8060
8053
|
}
|
|
8061
8054
|
};
|
|
8062
|
-
const onBlur = () => {
|
|
8055
|
+
const onBlur = (e) => {
|
|
8056
|
+
ctx.emit("blur", e);
|
|
8063
8057
|
if (!selectDisabled.value) {
|
|
8064
|
-
setTimeout(() => {
|
|
8065
|
-
filterQuery.value = "";
|
|
8066
|
-
handlerQueryFunc("");
|
|
8067
|
-
}, 150);
|
|
8068
8058
|
isSelectFocus.value = false;
|
|
8069
8059
|
}
|
|
8070
8060
|
};
|
|
@@ -8097,7 +8087,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8097
8087
|
const emptyText = computed(() => {
|
|
8098
8088
|
const visibleOptionsCount = injectOptionsArray.value.filter((item) => {
|
|
8099
8089
|
const label = item.name || item.value;
|
|
8100
|
-
return label.toString().toLocaleLowerCase().includes(filterQuery.value.
|
|
8090
|
+
return label.toString().toLocaleLowerCase().includes(filterQuery.value.toLocaleLowerCase().trim());
|
|
8101
8091
|
}).length;
|
|
8102
8092
|
if (isLoading.value) {
|
|
8103
8093
|
return props.loadingText || t("loadingText");
|
|
@@ -8124,8 +8114,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8124
8114
|
}
|
|
8125
8115
|
};
|
|
8126
8116
|
watch(() => props.modelValue, () => {
|
|
8127
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch(() =>
|
|
8128
|
-
});
|
|
8117
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
8129
8118
|
updateInjectOptionsStatus();
|
|
8130
8119
|
}, { deep: true });
|
|
8131
8120
|
watch(injectOptions, () => {
|
|
@@ -8140,17 +8129,10 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8140
8129
|
(_a = dropdownRef.value) == null ? void 0 : _a.updatePosition();
|
|
8141
8130
|
}
|
|
8142
8131
|
}, { flush: "post" });
|
|
8143
|
-
watch(isSelectFocus, (val) => {
|
|
8144
|
-
if (val) {
|
|
8145
|
-
ctx.emit("focus");
|
|
8146
|
-
} else {
|
|
8147
|
-
ctx.emit("blur");
|
|
8148
|
-
}
|
|
8149
|
-
});
|
|
8150
|
-
onMounted(updateInjectOptionsStatus);
|
|
8151
8132
|
return {
|
|
8152
8133
|
selectDisabled,
|
|
8153
8134
|
selectSize,
|
|
8135
|
+
originRef,
|
|
8154
8136
|
dropdownRef,
|
|
8155
8137
|
isOpen,
|
|
8156
8138
|
selectCls,
|
|
@@ -8175,7 +8157,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8175
8157
|
}
|
|
8176
8158
|
const selectProps = {
|
|
8177
8159
|
modelValue: {
|
|
8178
|
-
type: [String, Number, Array
|
|
8160
|
+
type: [String, Number, Array],
|
|
8179
8161
|
default: ""
|
|
8180
8162
|
},
|
|
8181
8163
|
"onUpdate:modelValue": {
|
|
@@ -8190,10 +8172,6 @@ const selectProps = {
|
|
|
8190
8172
|
type: String,
|
|
8191
8173
|
default: ""
|
|
8192
8174
|
},
|
|
8193
|
-
position: {
|
|
8194
|
-
type: Array,
|
|
8195
|
-
default: () => ["bottom", "top"]
|
|
8196
|
-
},
|
|
8197
8175
|
overview: {
|
|
8198
8176
|
type: String,
|
|
8199
8177
|
default: "border"
|
|
@@ -8265,10 +8243,6 @@ const selectProps = {
|
|
|
8265
8243
|
multipleLimit: {
|
|
8266
8244
|
type: Number,
|
|
8267
8245
|
default: 0
|
|
8268
|
-
},
|
|
8269
|
-
showEmptyWhenUnmatched: {
|
|
8270
|
-
type: Boolean,
|
|
8271
|
-
default: true
|
|
8272
8246
|
}
|
|
8273
8247
|
};
|
|
8274
8248
|
const optionProps = {
|
|
@@ -8565,7 +8539,7 @@ var Checkbox = defineComponent({
|
|
|
8565
8539
|
props: checkboxProps,
|
|
8566
8540
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8567
8541
|
setup(props, ctx) {
|
|
8568
|
-
const ns2 = useNamespace
|
|
8542
|
+
const ns2 = useNamespace("checkbox");
|
|
8569
8543
|
const {
|
|
8570
8544
|
mergedChecked,
|
|
8571
8545
|
mergedDisabled,
|
|
@@ -8666,7 +8640,7 @@ defineComponent({
|
|
|
8666
8640
|
props: checkboxGroupProps,
|
|
8667
8641
|
emits: ["change", "update:modelValue"],
|
|
8668
8642
|
setup(props, ctx) {
|
|
8669
|
-
const ns2 = useNamespace
|
|
8643
|
+
const ns2 = useNamespace("checkbox");
|
|
8670
8644
|
const {
|
|
8671
8645
|
defaultOpt
|
|
8672
8646
|
} = useCheckboxGroup(props, ctx);
|
|
@@ -8712,7 +8686,7 @@ defineComponent({
|
|
|
8712
8686
|
props: checkboxProps,
|
|
8713
8687
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8714
8688
|
setup(props, ctx) {
|
|
8715
|
-
const ns2 = useNamespace
|
|
8689
|
+
const ns2 = useNamespace("checkbox-button");
|
|
8716
8690
|
const {
|
|
8717
8691
|
mergedChecked,
|
|
8718
8692
|
mergedDisabled,
|
|
@@ -8775,23 +8749,20 @@ function useOption(props) {
|
|
|
8775
8749
|
return select2.modelValue === props.value;
|
|
8776
8750
|
}
|
|
8777
8751
|
});
|
|
8778
|
-
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8779
8752
|
const optionItem = computed(() => {
|
|
8780
8753
|
return {
|
|
8781
8754
|
name: props.name || props.value + "" || "",
|
|
8782
8755
|
value: props.value,
|
|
8783
8756
|
create: props.create,
|
|
8784
|
-
_checked: false
|
|
8785
|
-
disabled: isDisabled.value
|
|
8757
|
+
_checked: false
|
|
8786
8758
|
};
|
|
8787
8759
|
});
|
|
8760
|
+
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8788
8761
|
const isObjectOption = ref(!!props.name);
|
|
8789
8762
|
const selectOptionCls = computed(() => {
|
|
8790
8763
|
return className(ns2.e("item"), {
|
|
8791
8764
|
active: isOptionSelected.value,
|
|
8792
|
-
disabled: isDisabled.value
|
|
8793
|
-
[ns2.em("item", "sm")]: (select2 == null ? void 0 : select2.selectSize) === "sm",
|
|
8794
|
-
[ns2.em("item", "lg")]: (select2 == null ? void 0 : select2.selectSize) === "lg"
|
|
8765
|
+
disabled: isDisabled.value
|
|
8795
8766
|
});
|
|
8796
8767
|
});
|
|
8797
8768
|
const optionSelect = () => {
|
|
@@ -8907,7 +8878,7 @@ const tagProps = {
|
|
|
8907
8878
|
}
|
|
8908
8879
|
};
|
|
8909
8880
|
function useClass(props) {
|
|
8910
|
-
const ns2 = useNamespace("tag");
|
|
8881
|
+
const ns2 = useNamespace$1("tag");
|
|
8911
8882
|
return computed(() => {
|
|
8912
8883
|
const { type: type4, color, deletable } = props;
|
|
8913
8884
|
return `${ns2.e("item")} ${ns2.m(type4 || (color ? "colorful" : "") || "default")} ${deletable ? ns2.m("deletable") : ""} ${ns2.m(props.size)}`;
|
|
@@ -8949,7 +8920,7 @@ var Tag = defineComponent({
|
|
|
8949
8920
|
slots,
|
|
8950
8921
|
emit
|
|
8951
8922
|
}) {
|
|
8952
|
-
const ns2 = useNamespace("tag");
|
|
8923
|
+
const ns2 = useNamespace$1("tag");
|
|
8953
8924
|
const {
|
|
8954
8925
|
type: type4,
|
|
8955
8926
|
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
|