vue-devui 1.5.12-hotfix.1 → 1.5.13
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 +139 -61
- package/auto-complete/index.umd.js +16 -16
- package/auto-complete/style.css +1 -1
- package/checkbox/index.es.js +115 -61
- package/checkbox/index.umd.js +15 -15
- package/checkbox/style.css +1 -1
- package/code-editor/index.es.js +5 -2
- package/code-editor/index.umd.js +6 -6
- package/code-review/index.es.js +12 -1
- package/code-review/index.umd.js +18 -18
- package/code-review/style.css +1 -1
- package/date-picker-pro/index.es.js +213 -109
- package/date-picker-pro/index.umd.js +19 -19
- package/date-picker-pro/style.css +1 -1
- package/editor-md/index.es.js +1 -1
- package/editor-md/index.umd.js +1 -1
- package/form/index.es.js +142 -64
- package/form/index.umd.js +14 -14
- package/form/style.css +1 -1
- package/image-preview/index.es.js +2 -6
- package/image-preview/index.umd.js +2 -2
- package/image-preview/style.css +1 -1
- package/input/index.es.js +207 -79
- package/input/index.umd.js +18 -18
- package/input/style.css +1 -1
- package/input-number/index.es.js +123 -46
- package/input-number/index.umd.js +20 -20
- package/input-number/style.css +1 -1
- package/mention/index.es.js +138 -60
- package/mention/index.umd.js +16 -16
- package/mention/style.css +1 -1
- package/nuxt/components/STYLE_TOKEN.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/package.json +1 -1
- package/pagination/index.es.js +376 -161
- package/pagination/index.umd.js +19 -19
- package/pagination/style.css +1 -1
- package/progress/index.es.js +6 -6
- package/progress/index.umd.js +1 -1
- package/radio/index.es.js +115 -61
- package/radio/index.umd.js +16 -16
- package/radio/style.css +1 -1
- package/search/index.es.js +211 -83
- package/search/index.umd.js +19 -19
- package/search/style.css +1 -1
- package/select/index.es.js +358 -143
- package/select/index.umd.js +17 -17
- package/select/style.css +1 -1
- package/skeleton/index.es.js +1 -0
- package/skeleton/index.umd.js +2 -2
- package/steps/index.es.js +35 -11
- package/steps/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +115 -61
- package/switch/index.umd.js +14 -14
- package/switch/style.css +1 -1
- package/table/index.es.js +88 -34
- package/table/index.umd.js +15 -15
- package/table/style.css +1 -1
- package/textarea/index.es.js +141 -63
- package/textarea/index.umd.js +17 -17
- package/textarea/style.css +1 -1
- package/time-picker/index.es.js +159 -55
- package/time-picker/index.umd.js +11 -11
- package/time-picker/style.css +1 -1
- package/time-select/index.es.js +358 -143
- package/time-select/index.umd.js +22 -22
- package/time-select/style.css +1 -1
- package/tree/index.es.js +86 -32
- package/tree/index.umd.js +11 -11
- package/tree/style.css +1 -1
- package/types/auto-focus/index.d.ts +9 -0
- package/types/auto-focus/src/auto-focus-directive.d.ts +4 -0
- package/types/code-review/src/code-review-types.d.ts +6 -0
- package/types/code-review/src/code-review.d.ts +9 -0
- package/types/form/index.d.ts +1 -0
- package/types/form/src/components/form-control/use-form-control.d.ts +11 -2
- package/types/form/src/components/form-item/form-item-types.d.ts +10 -2
- package/types/form/src/components/form-item/form-item.d.ts +3 -3
- package/types/form/src/components/form-label/form-label.d.ts +1 -13
- package/types/form/src/components/form-label/use-form-label.d.ts +14 -2
- package/types/form/src/form-types.d.ts +11 -0
- package/types/form/src/form.d.ts +18 -0
- package/types/input/src/composables/use-input-event.d.ts +12 -2
- package/types/input/src/input-types.d.ts +8 -0
- package/types/input/src/input.d.ts +18 -0
- package/types/input-icon/src/input-icon.d.ts +18 -0
- package/types/list/index.d.ts +0 -1
- package/types/select/src/composables/use-select-menu-size.d.ts +5 -0
- package/types/select/src/select-types.d.ts +23 -4
- package/types/select/src/select.d.ts +19 -1
- package/types/select/src/use-select.d.ts +1 -1
- package/types/vue-devui.d.ts +2 -1
- package/vue-devui.es.js +415 -134
- package/vue-devui.umd.js +76 -76
package/time-select/index.es.js
CHANGED
|
@@ -29,10 +29,10 @@ 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 } from "vue";
|
|
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, vModelText } from "vue";
|
|
33
|
+
import "clipboard";
|
|
33
34
|
import { onClickOutside } from "@vueuse/core";
|
|
34
35
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
35
|
-
import "clipboard";
|
|
36
36
|
function deepAssign(...objects) {
|
|
37
37
|
const isObject2 = (obj) => obj && typeof obj === "object";
|
|
38
38
|
return objects.reduce((prev, from) => {
|
|
@@ -211,6 +211,25 @@ 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
|
+
}
|
|
214
233
|
function createBem$1(namespace, element, modifier) {
|
|
215
234
|
let cls = namespace;
|
|
216
235
|
if (element) {
|
|
@@ -1414,7 +1433,7 @@ var lodash = { exports: {} };
|
|
|
1414
1433
|
if (typeof func != "function") {
|
|
1415
1434
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
1416
1435
|
}
|
|
1417
|
-
return
|
|
1436
|
+
return setTimeout2(function() {
|
|
1418
1437
|
func.apply(undefined$1, args);
|
|
1419
1438
|
}, wait);
|
|
1420
1439
|
}
|
|
@@ -3223,7 +3242,7 @@ var lodash = { exports: {} };
|
|
|
3223
3242
|
return object4[key];
|
|
3224
3243
|
}
|
|
3225
3244
|
var setData = shortOut(baseSetData);
|
|
3226
|
-
var
|
|
3245
|
+
var setTimeout2 = ctxSetTimeout || function(func, wait) {
|
|
3227
3246
|
return root.setTimeout(func, wait);
|
|
3228
3247
|
};
|
|
3229
3248
|
var setToString = shortOut(baseSetToString);
|
|
@@ -4015,7 +4034,7 @@ var lodash = { exports: {} };
|
|
|
4015
4034
|
}
|
|
4016
4035
|
function leadingEdge(time) {
|
|
4017
4036
|
lastInvokeTime = time;
|
|
4018
|
-
timerId =
|
|
4037
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
4019
4038
|
return leading ? invokeFunc(time) : result2;
|
|
4020
4039
|
}
|
|
4021
4040
|
function remainingWait(time) {
|
|
@@ -4031,7 +4050,7 @@ var lodash = { exports: {} };
|
|
|
4031
4050
|
if (shouldInvoke(time)) {
|
|
4032
4051
|
return trailingEdge(time);
|
|
4033
4052
|
}
|
|
4034
|
-
timerId =
|
|
4053
|
+
timerId = setTimeout2(timerExpired, remainingWait(time));
|
|
4035
4054
|
}
|
|
4036
4055
|
function trailingEdge(time) {
|
|
4037
4056
|
timerId = undefined$1;
|
|
@@ -4062,12 +4081,12 @@ var lodash = { exports: {} };
|
|
|
4062
4081
|
}
|
|
4063
4082
|
if (maxing) {
|
|
4064
4083
|
clearTimeout(timerId);
|
|
4065
|
-
timerId =
|
|
4084
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
4066
4085
|
return invokeFunc(lastCallTime);
|
|
4067
4086
|
}
|
|
4068
4087
|
}
|
|
4069
4088
|
if (timerId === undefined$1) {
|
|
4070
|
-
timerId =
|
|
4089
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
4071
4090
|
}
|
|
4072
4091
|
return result2;
|
|
4073
4092
|
}
|
|
@@ -5692,9 +5711,18 @@ const formProps = {
|
|
|
5692
5711
|
hideRequiredMark: {
|
|
5693
5712
|
type: Boolean,
|
|
5694
5713
|
default: false
|
|
5714
|
+
},
|
|
5715
|
+
styleType: {
|
|
5716
|
+
type: String,
|
|
5717
|
+
default: "default"
|
|
5718
|
+
},
|
|
5719
|
+
appendToBodyScrollStrategy: {
|
|
5720
|
+
type: String,
|
|
5721
|
+
default: "reposition"
|
|
5695
5722
|
}
|
|
5696
5723
|
};
|
|
5697
5724
|
const FORM_TOKEN = Symbol("dForm");
|
|
5725
|
+
const STYLE_TOKEN = Symbol("dForm");
|
|
5698
5726
|
function useFieldCollection() {
|
|
5699
5727
|
const itemContexts = [];
|
|
5700
5728
|
const addItemContext = (field) => {
|
|
@@ -5789,6 +5817,7 @@ defineComponent({
|
|
|
5789
5817
|
addItemContext,
|
|
5790
5818
|
removeItemContext
|
|
5791
5819
|
})));
|
|
5820
|
+
provide(STYLE_TOKEN, props.styleType);
|
|
5792
5821
|
ctx.expose({
|
|
5793
5822
|
validate,
|
|
5794
5823
|
validateFields,
|
|
@@ -5830,7 +5859,7 @@ const formItemProps = {
|
|
|
5830
5859
|
default: void 0
|
|
5831
5860
|
},
|
|
5832
5861
|
helpTips: {
|
|
5833
|
-
type: String,
|
|
5862
|
+
type: [String, Object],
|
|
5834
5863
|
default: ""
|
|
5835
5864
|
},
|
|
5836
5865
|
feedbackStatus: {
|
|
@@ -5843,12 +5872,6 @@ const formItemProps = {
|
|
|
5843
5872
|
};
|
|
5844
5873
|
const FORM_ITEM_TOKEN = Symbol("dFormItem");
|
|
5845
5874
|
const LABEL_DATA = Symbol("labelData");
|
|
5846
|
-
const formLabelProps = {
|
|
5847
|
-
helpTips: {
|
|
5848
|
-
type: String,
|
|
5849
|
-
default: ""
|
|
5850
|
-
}
|
|
5851
|
-
};
|
|
5852
5875
|
const fixedOverlayProps = {
|
|
5853
5876
|
modelValue: {
|
|
5854
5877
|
type: Boolean,
|
|
@@ -5863,25 +5886,6 @@ const fixedOverlayProps = {
|
|
|
5863
5886
|
default: true
|
|
5864
5887
|
}
|
|
5865
5888
|
};
|
|
5866
|
-
function lockScroll() {
|
|
5867
|
-
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
5868
|
-
const scrollTop = document.documentElement.scrollTop;
|
|
5869
|
-
const style = document.documentElement.getAttribute("style");
|
|
5870
|
-
document.documentElement.style.position = "fixed";
|
|
5871
|
-
document.documentElement.style.top = `-${scrollTop}px`;
|
|
5872
|
-
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
5873
|
-
document.documentElement.style.overflowY = "scroll";
|
|
5874
|
-
return () => {
|
|
5875
|
-
if (style) {
|
|
5876
|
-
document.documentElement.setAttribute("style", style);
|
|
5877
|
-
} else {
|
|
5878
|
-
document.documentElement.removeAttribute("style");
|
|
5879
|
-
}
|
|
5880
|
-
document.documentElement.scrollTop = scrollTop;
|
|
5881
|
-
};
|
|
5882
|
-
}
|
|
5883
|
-
return;
|
|
5884
|
-
}
|
|
5885
5889
|
function useFixedOverlay(props, ctx) {
|
|
5886
5890
|
let lockScrollCb;
|
|
5887
5891
|
const onClick = (event) => {
|
|
@@ -5904,6 +5908,29 @@ function useFixedOverlay(props, ctx) {
|
|
|
5904
5908
|
onUnmounted(removeBodyAdditions);
|
|
5905
5909
|
return { onClick };
|
|
5906
5910
|
}
|
|
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
|
+
}
|
|
5907
5934
|
var fixedOverlay = "";
|
|
5908
5935
|
defineComponent({
|
|
5909
5936
|
name: "DFixedOverlay",
|
|
@@ -5914,7 +5941,7 @@ defineComponent({
|
|
|
5914
5941
|
const {
|
|
5915
5942
|
modelValue
|
|
5916
5943
|
} = toRefs(props);
|
|
5917
|
-
const ns2 = useNamespace
|
|
5944
|
+
const ns2 = useNamespace("fixed-overlay");
|
|
5918
5945
|
const {
|
|
5919
5946
|
onClick
|
|
5920
5947
|
} = useFixedOverlay(props, ctx);
|
|
@@ -6080,7 +6107,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
6080
6107
|
emit,
|
|
6081
6108
|
expose
|
|
6082
6109
|
}) {
|
|
6083
|
-
const ns2 = useNamespace
|
|
6110
|
+
const ns2 = useNamespace("flexible-overlay");
|
|
6084
6111
|
const {
|
|
6085
6112
|
clickEventBubble
|
|
6086
6113
|
} = toRefs(props);
|
|
@@ -6109,7 +6136,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
6109
6136
|
});
|
|
6110
6137
|
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
6111
6138
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
6112
|
-
const ns$1 = useNamespace
|
|
6139
|
+
const ns$1 = useNamespace("popper-trigger");
|
|
6113
6140
|
function wrapContent(content) {
|
|
6114
6141
|
return h("span", { class: ns$1.b() }, content);
|
|
6115
6142
|
}
|
|
@@ -6296,7 +6323,7 @@ function usePopoverEvent(props, visible, origin) {
|
|
|
6296
6323
|
});
|
|
6297
6324
|
return { placement, handlePositionChange, onMouseenter, onMouseleave };
|
|
6298
6325
|
}
|
|
6299
|
-
const ns = useNamespace
|
|
6326
|
+
const ns = useNamespace("popover");
|
|
6300
6327
|
function SuccessIcon$1() {
|
|
6301
6328
|
return createVNode("svg", {
|
|
6302
6329
|
"class": [ns.e("icon"), ns.em("icon", "success")],
|
|
@@ -6398,7 +6425,7 @@ var PopoverIcon = defineComponent({
|
|
|
6398
6425
|
}
|
|
6399
6426
|
},
|
|
6400
6427
|
setup(props) {
|
|
6401
|
-
const ns2 = useNamespace
|
|
6428
|
+
const ns2 = useNamespace("popover");
|
|
6402
6429
|
return () => props.type && props.type !== "default" && createVNode("span", {
|
|
6403
6430
|
"class": ns2.e("icon-wrap")
|
|
6404
6431
|
}, [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)]);
|
|
@@ -6435,7 +6462,7 @@ var Popover = defineComponent({
|
|
|
6435
6462
|
const {
|
|
6436
6463
|
overlayStyles
|
|
6437
6464
|
} = usePopover(props, visible, placement, origin, popoverRef);
|
|
6438
|
-
const ns2 = useNamespace
|
|
6465
|
+
const ns2 = useNamespace("popover");
|
|
6439
6466
|
provide(POPPER_TRIGGER_TOKEN, origin);
|
|
6440
6467
|
watch(visible, (newVal) => {
|
|
6441
6468
|
if (newVal) {
|
|
@@ -6569,6 +6596,12 @@ function useFormLabel() {
|
|
|
6569
6596
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
6570
6597
|
const labelData = inject(LABEL_DATA);
|
|
6571
6598
|
const ns2 = useNamespace$1("form");
|
|
6599
|
+
const defaultTipsPopover = {
|
|
6600
|
+
content: "",
|
|
6601
|
+
position: ["top"],
|
|
6602
|
+
trigger: "hover",
|
|
6603
|
+
popType: "info"
|
|
6604
|
+
};
|
|
6572
6605
|
const labelClasses = computed(() => ({
|
|
6573
6606
|
[`${ns2.e("label")}`]: true,
|
|
6574
6607
|
[`${ns2.em("label", "vertical")}`]: labelData.value.layout === "vertical",
|
|
@@ -6580,17 +6613,24 @@ function useFormLabel() {
|
|
|
6580
6613
|
[`${ns2.em("label", "required")}`]: formItemContext.isRequired,
|
|
6581
6614
|
[`${ns2.em("label", "required-hide")}`]: formItemContext.isRequired && formContext.hideRequiredMark
|
|
6582
6615
|
}));
|
|
6583
|
-
|
|
6616
|
+
const tipsPopover = computed(() => {
|
|
6617
|
+
if (typeof labelData.value.helpTips === "string") {
|
|
6618
|
+
return __spreadProps(__spreadValues({}, defaultTipsPopover), { content: labelData.value.helpTips });
|
|
6619
|
+
} else {
|
|
6620
|
+
return __spreadValues(__spreadValues({}, defaultTipsPopover), labelData.value.helpTips);
|
|
6621
|
+
}
|
|
6622
|
+
});
|
|
6623
|
+
return { labelClasses, labelInnerClasses, tipsPopover };
|
|
6584
6624
|
}
|
|
6585
6625
|
var formLabel = "";
|
|
6586
6626
|
var FormLabel = defineComponent({
|
|
6587
6627
|
name: "DFormLabel",
|
|
6588
|
-
|
|
6589
|
-
setup(props, ctx) {
|
|
6628
|
+
setup(_, ctx) {
|
|
6590
6629
|
const ns2 = useNamespace$1("form");
|
|
6591
6630
|
const {
|
|
6592
6631
|
labelClasses,
|
|
6593
|
-
labelInnerClasses
|
|
6632
|
+
labelInnerClasses,
|
|
6633
|
+
tipsPopover
|
|
6594
6634
|
} = useFormLabel();
|
|
6595
6635
|
return () => {
|
|
6596
6636
|
var _a, _b;
|
|
@@ -6598,12 +6638,9 @@ var FormLabel = defineComponent({
|
|
|
6598
6638
|
"class": labelClasses.value
|
|
6599
6639
|
}, [createVNode("span", {
|
|
6600
6640
|
"class": labelInnerClasses.value
|
|
6601
|
-
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]),
|
|
6602
|
-
"
|
|
6603
|
-
|
|
6604
|
-
"trigger": "hover",
|
|
6605
|
-
"pop-type": "info"
|
|
6606
|
-
}, {
|
|
6641
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), tipsPopover.value.content && createVNode(Popover, mergeProps({
|
|
6642
|
+
"class": ns2.e("label-tips-popover")
|
|
6643
|
+
}, tipsPopover.value), {
|
|
6607
6644
|
default: () => [createVNode(HelpTipsIcon, {
|
|
6608
6645
|
"class": ns2.e("label-help")
|
|
6609
6646
|
}, null), createTextVNode(",")]
|
|
@@ -6634,7 +6671,7 @@ function useFormControl(props) {
|
|
|
6634
6671
|
[ns2.em("control-container", "has-feedback")]: Boolean(feedbackStatus == null ? void 0 : feedbackStatus.value),
|
|
6635
6672
|
[ns2.em("control-container", "feedback-error")]: Boolean((feedbackStatus == null ? void 0 : feedbackStatus.value) === "error")
|
|
6636
6673
|
}));
|
|
6637
|
-
return { controlClasses, controlContainerClasses };
|
|
6674
|
+
return { controlClasses, controlContainerClasses, labelData };
|
|
6638
6675
|
}
|
|
6639
6676
|
function useFormControlValidate() {
|
|
6640
6677
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
@@ -6651,11 +6688,15 @@ var FormControl = defineComponent({
|
|
|
6651
6688
|
name: "DFormControl",
|
|
6652
6689
|
props: formControlProps,
|
|
6653
6690
|
setup(props, ctx) {
|
|
6691
|
+
const formContext = inject(FORM_TOKEN);
|
|
6654
6692
|
const formControl2 = ref();
|
|
6693
|
+
const popoverRef = ref();
|
|
6655
6694
|
const ns2 = useNamespace$1("form");
|
|
6695
|
+
const showPopoverClick = ref(true);
|
|
6656
6696
|
const {
|
|
6657
6697
|
controlClasses,
|
|
6658
|
-
controlContainerClasses
|
|
6698
|
+
controlContainerClasses,
|
|
6699
|
+
labelData
|
|
6659
6700
|
} = useFormControl(props);
|
|
6660
6701
|
const {
|
|
6661
6702
|
feedbackStatus,
|
|
@@ -6665,17 +6706,52 @@ var FormControl = defineComponent({
|
|
|
6665
6706
|
errorMessage,
|
|
6666
6707
|
popPosition
|
|
6667
6708
|
} = useFormControlValidate();
|
|
6709
|
+
const align = computed(() => {
|
|
6710
|
+
var _a, _b;
|
|
6711
|
+
if ((_a = popPosition.value) == null ? void 0 : _a.some((item) => item.includes("start"))) {
|
|
6712
|
+
return "start";
|
|
6713
|
+
}
|
|
6714
|
+
if ((_b = popPosition.value) == null ? void 0 : _b.some((item) => item.includes("end"))) {
|
|
6715
|
+
return "end";
|
|
6716
|
+
}
|
|
6717
|
+
return void 0;
|
|
6718
|
+
});
|
|
6719
|
+
const onDocumentClick = (e) => {
|
|
6720
|
+
const composedPath = e.composedPath();
|
|
6721
|
+
if (composedPath.includes(popoverRef.value.triggerEl)) {
|
|
6722
|
+
showPopoverClick.value = true;
|
|
6723
|
+
} else {
|
|
6724
|
+
showPopoverClick.value = false;
|
|
6725
|
+
}
|
|
6726
|
+
};
|
|
6727
|
+
watch(showPopover, (val) => {
|
|
6728
|
+
if (val) {
|
|
6729
|
+
setTimeout(() => {
|
|
6730
|
+
document.addEventListener("click", onDocumentClick);
|
|
6731
|
+
});
|
|
6732
|
+
} else {
|
|
6733
|
+
showPopoverClick.value = true;
|
|
6734
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6735
|
+
}
|
|
6736
|
+
});
|
|
6737
|
+
onUnmounted(() => {
|
|
6738
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6739
|
+
});
|
|
6668
6740
|
return () => createVNode("div", {
|
|
6669
6741
|
"class": controlClasses.value,
|
|
6670
6742
|
"ref": formControl2
|
|
6671
6743
|
}, [createVNode("div", {
|
|
6672
6744
|
"class": controlContainerClasses.value
|
|
6673
6745
|
}, [createVNode(Popover, {
|
|
6674
|
-
"
|
|
6746
|
+
"ref": popoverRef,
|
|
6747
|
+
"is-open": showPopover.value && showPopoverClick.value,
|
|
6675
6748
|
"trigger": "manually",
|
|
6676
6749
|
"content": errorMessage.value,
|
|
6677
6750
|
"pop-type": "error",
|
|
6678
|
-
"position": popPosition.value
|
|
6751
|
+
"position": popPosition.value,
|
|
6752
|
+
"align": align.value,
|
|
6753
|
+
"scroll-element": "auto",
|
|
6754
|
+
"append-to-body-scroll-strategy": formContext.appendToBodyScrollStrategy
|
|
6679
6755
|
}, {
|
|
6680
6756
|
default: () => {
|
|
6681
6757
|
var _a, _b;
|
|
@@ -6687,7 +6763,7 @@ var FormControl = defineComponent({
|
|
|
6687
6763
|
"class": ns2.e("control-info")
|
|
6688
6764
|
}, [showMessage.value && createVNode("div", {
|
|
6689
6765
|
"class": "error-message"
|
|
6690
|
-
}, [errorMessage.value]), props.extraInfo && createVNode("div", {
|
|
6766
|
+
}, [errorMessage.value]), labelData.value.formItemCtx.slots.extraInfo ? labelData.value.formItemCtx.slots.extraInfo() : props.extraInfo && createVNode("div", {
|
|
6691
6767
|
"class": ns2.e("control-extra")
|
|
6692
6768
|
}, [props.extraInfo])])]);
|
|
6693
6769
|
}
|
|
@@ -7870,7 +7946,9 @@ defineComponent({
|
|
|
7870
7946
|
const labelData = computed(() => ({
|
|
7871
7947
|
layout: formContext.layout,
|
|
7872
7948
|
labelSize: formContext.labelSize,
|
|
7873
|
-
labelAlign: formContext.labelAlign
|
|
7949
|
+
labelAlign: formContext.labelAlign,
|
|
7950
|
+
helpTips: helpTips.value,
|
|
7951
|
+
formItemCtx: ctx
|
|
7874
7952
|
}));
|
|
7875
7953
|
provide(LABEL_DATA, labelData);
|
|
7876
7954
|
const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
|
|
@@ -7886,6 +7964,7 @@ defineComponent({
|
|
|
7886
7964
|
}));
|
|
7887
7965
|
provide(FORM_ITEM_TOKEN, context);
|
|
7888
7966
|
ctx.expose({
|
|
7967
|
+
validate,
|
|
7889
7968
|
resetField,
|
|
7890
7969
|
clearValidate
|
|
7891
7970
|
});
|
|
@@ -7899,9 +7978,7 @@ defineComponent({
|
|
|
7899
7978
|
});
|
|
7900
7979
|
return () => createVNode("div", {
|
|
7901
7980
|
"class": itemClasses.value
|
|
7902
|
-
}, [createVNode(FormLabel, {
|
|
7903
|
-
"help-tips": helpTips.value
|
|
7904
|
-
}, {
|
|
7981
|
+
}, [createVNode(FormLabel, null, {
|
|
7905
7982
|
default: () => [ctx.slots.label ? ctx.slots.label() : label == null ? void 0 : label.value]
|
|
7906
7983
|
}), createVNode(FormControl, {
|
|
7907
7984
|
"feedback-status": feedbackStatus == null ? void 0 : feedbackStatus.value,
|
|
@@ -7944,7 +8021,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7944
8021
|
const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
|
|
7945
8022
|
const selectSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
|
|
7946
8023
|
const isObjectOption = ref(false);
|
|
7947
|
-
const originRef = ref();
|
|
7948
8024
|
const isOpen = ref(false);
|
|
7949
8025
|
const toggleChange = (bool) => {
|
|
7950
8026
|
if (selectDisabled.value) {
|
|
@@ -7954,7 +8030,14 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7954
8030
|
ctx.emit("toggle-change", bool);
|
|
7955
8031
|
};
|
|
7956
8032
|
onClickOutside(dropdownRef, () => {
|
|
7957
|
-
|
|
8033
|
+
var _a;
|
|
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
|
+
}
|
|
7958
8041
|
}, { ignore: [selectRef] });
|
|
7959
8042
|
const dropdownMenuMultipleNs = useNamespace$1("dropdown-menu-multiple");
|
|
7960
8043
|
const selectCls = computed(() => {
|
|
@@ -8067,8 +8150,11 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8067
8150
|
}
|
|
8068
8151
|
};
|
|
8069
8152
|
const valueChange = (item) => {
|
|
8153
|
+
var _a;
|
|
8070
8154
|
const { multiple } = props;
|
|
8071
8155
|
let { modelValue } = props;
|
|
8156
|
+
filterQuery.value = "";
|
|
8157
|
+
handlerQueryFunc("");
|
|
8072
8158
|
if (multiple) {
|
|
8073
8159
|
const checkedItems = Array.isArray(modelValue) ? modelValue.slice() : [];
|
|
8074
8160
|
const index2 = checkedItems.indexOf(item.value);
|
|
@@ -8095,6 +8181,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8095
8181
|
}
|
|
8096
8182
|
getMultipleSelected(checkedItems);
|
|
8097
8183
|
} else {
|
|
8184
|
+
(_a = selectRef.value) == null ? void 0 : _a.clearSingleSearchKey();
|
|
8098
8185
|
ctx.emit("update:modelValue", item.value);
|
|
8099
8186
|
getSingleSelected(item);
|
|
8100
8187
|
toggleChange(false);
|
|
@@ -8105,6 +8192,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8105
8192
|
ctx.emit("toggle-change", false);
|
|
8106
8193
|
};
|
|
8107
8194
|
const handleClear = () => {
|
|
8195
|
+
filterQuery.value = "";
|
|
8196
|
+
handlerQueryFunc("");
|
|
8108
8197
|
if (props.multiple) {
|
|
8109
8198
|
ctx.emit("update:modelValue", []);
|
|
8110
8199
|
ctx.emit("value-change", []);
|
|
@@ -8117,7 +8206,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8117
8206
|
handleClose();
|
|
8118
8207
|
blur();
|
|
8119
8208
|
}
|
|
8120
|
-
filterQuery.value = "";
|
|
8121
8209
|
};
|
|
8122
8210
|
const tagDelete = (data) => {
|
|
8123
8211
|
let { modelValue } = props;
|
|
@@ -8135,15 +8223,17 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8135
8223
|
ctx.emit("remove-tag", data.value);
|
|
8136
8224
|
getMultipleSelected(checkedItems);
|
|
8137
8225
|
};
|
|
8138
|
-
const onFocus = (
|
|
8139
|
-
ctx.emit("focus", e);
|
|
8226
|
+
const onFocus = () => {
|
|
8140
8227
|
if (!selectDisabled.value) {
|
|
8141
8228
|
isSelectFocus.value = true;
|
|
8142
8229
|
}
|
|
8143
8230
|
};
|
|
8144
|
-
const onBlur = (
|
|
8145
|
-
ctx.emit("blur", e);
|
|
8231
|
+
const onBlur = () => {
|
|
8146
8232
|
if (!selectDisabled.value) {
|
|
8233
|
+
setTimeout(() => {
|
|
8234
|
+
filterQuery.value = "";
|
|
8235
|
+
handlerQueryFunc("");
|
|
8236
|
+
}, 150);
|
|
8147
8237
|
isSelectFocus.value = false;
|
|
8148
8238
|
}
|
|
8149
8239
|
};
|
|
@@ -8176,7 +8266,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8176
8266
|
const emptyText = computed(() => {
|
|
8177
8267
|
const visibleOptionsCount = injectOptionsArray.value.filter((item) => {
|
|
8178
8268
|
const label = item.name || item.value;
|
|
8179
|
-
return label.toString().toLocaleLowerCase().includes(filterQuery.value.
|
|
8269
|
+
return label.toString().toLocaleLowerCase().includes(filterQuery.value.trim().toLocaleLowerCase());
|
|
8180
8270
|
}).length;
|
|
8181
8271
|
if (isLoading.value) {
|
|
8182
8272
|
return props.loadingText || t("loadingText");
|
|
@@ -8203,7 +8293,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8203
8293
|
}
|
|
8204
8294
|
};
|
|
8205
8295
|
watch(() => props.modelValue, () => {
|
|
8206
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch((
|
|
8296
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch(() => {
|
|
8297
|
+
});
|
|
8207
8298
|
updateInjectOptionsStatus();
|
|
8208
8299
|
}, { deep: true });
|
|
8209
8300
|
watch(injectOptions, () => {
|
|
@@ -8218,10 +8309,17 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8218
8309
|
(_a = dropdownRef.value) == null ? void 0 : _a.updatePosition();
|
|
8219
8310
|
}
|
|
8220
8311
|
}, { flush: "post" });
|
|
8312
|
+
watch(isSelectFocus, (val) => {
|
|
8313
|
+
if (val) {
|
|
8314
|
+
ctx.emit("focus");
|
|
8315
|
+
} else {
|
|
8316
|
+
ctx.emit("blur");
|
|
8317
|
+
}
|
|
8318
|
+
});
|
|
8319
|
+
onMounted(updateInjectOptionsStatus);
|
|
8221
8320
|
return {
|
|
8222
8321
|
selectDisabled,
|
|
8223
8322
|
selectSize,
|
|
8224
|
-
originRef,
|
|
8225
8323
|
dropdownRef,
|
|
8226
8324
|
isOpen,
|
|
8227
8325
|
selectCls,
|
|
@@ -8246,7 +8344,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8246
8344
|
}
|
|
8247
8345
|
const selectProps = {
|
|
8248
8346
|
modelValue: {
|
|
8249
|
-
type: [String, Number, Array],
|
|
8347
|
+
type: [String, Number, Array, Boolean],
|
|
8250
8348
|
default: ""
|
|
8251
8349
|
},
|
|
8252
8350
|
"onUpdate:modelValue": {
|
|
@@ -8261,6 +8359,10 @@ const selectProps = {
|
|
|
8261
8359
|
type: String,
|
|
8262
8360
|
default: ""
|
|
8263
8361
|
},
|
|
8362
|
+
position: {
|
|
8363
|
+
type: Array,
|
|
8364
|
+
default: () => ["bottom", "top"]
|
|
8365
|
+
},
|
|
8264
8366
|
overview: {
|
|
8265
8367
|
type: String,
|
|
8266
8368
|
default: "border"
|
|
@@ -8332,6 +8434,10 @@ const selectProps = {
|
|
|
8332
8434
|
multipleLimit: {
|
|
8333
8435
|
type: Number,
|
|
8334
8436
|
default: 0
|
|
8437
|
+
},
|
|
8438
|
+
showEmptyWhenUnmatched: {
|
|
8439
|
+
type: Boolean,
|
|
8440
|
+
default: true
|
|
8335
8441
|
}
|
|
8336
8442
|
};
|
|
8337
8443
|
const optionProps = {
|
|
@@ -8470,29 +8576,6 @@ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
8470
8576
|
}
|
|
8471
8577
|
});
|
|
8472
8578
|
const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
|
|
8473
|
-
function createBem(namespace, element, modifier) {
|
|
8474
|
-
let cls = namespace;
|
|
8475
|
-
if (element) {
|
|
8476
|
-
cls += `__${element}`;
|
|
8477
|
-
}
|
|
8478
|
-
if (modifier) {
|
|
8479
|
-
cls += `--${modifier}`;
|
|
8480
|
-
}
|
|
8481
|
-
return cls;
|
|
8482
|
-
}
|
|
8483
|
-
function useNamespace(block, needDot = false) {
|
|
8484
|
-
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
8485
|
-
const b = () => createBem(namespace);
|
|
8486
|
-
const e = (element) => element ? createBem(namespace, element) : "";
|
|
8487
|
-
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
8488
|
-
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
8489
|
-
return {
|
|
8490
|
-
b,
|
|
8491
|
-
e,
|
|
8492
|
-
m,
|
|
8493
|
-
em
|
|
8494
|
-
};
|
|
8495
|
-
}
|
|
8496
8579
|
function useCheckbox(props, ctx) {
|
|
8497
8580
|
const formContext = inject(FORM_TOKEN, void 0);
|
|
8498
8581
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
@@ -8651,7 +8734,7 @@ var Checkbox = defineComponent({
|
|
|
8651
8734
|
props: checkboxProps,
|
|
8652
8735
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8653
8736
|
setup(props, ctx) {
|
|
8654
|
-
const ns2 = useNamespace("checkbox");
|
|
8737
|
+
const ns2 = useNamespace$1("checkbox");
|
|
8655
8738
|
const {
|
|
8656
8739
|
mergedChecked,
|
|
8657
8740
|
mergedDisabled,
|
|
@@ -8752,7 +8835,7 @@ defineComponent({
|
|
|
8752
8835
|
props: checkboxGroupProps,
|
|
8753
8836
|
emits: ["change", "update:modelValue"],
|
|
8754
8837
|
setup(props, ctx) {
|
|
8755
|
-
const ns2 = useNamespace("checkbox");
|
|
8838
|
+
const ns2 = useNamespace$1("checkbox");
|
|
8756
8839
|
const {
|
|
8757
8840
|
defaultOpt
|
|
8758
8841
|
} = useCheckboxGroup(props, ctx);
|
|
@@ -8798,7 +8881,7 @@ defineComponent({
|
|
|
8798
8881
|
props: checkboxProps,
|
|
8799
8882
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8800
8883
|
setup(props, ctx) {
|
|
8801
|
-
const ns2 = useNamespace("checkbox-button");
|
|
8884
|
+
const ns2 = useNamespace$1("checkbox-button");
|
|
8802
8885
|
const {
|
|
8803
8886
|
mergedChecked,
|
|
8804
8887
|
mergedDisabled,
|
|
@@ -8861,20 +8944,23 @@ function useOption(props) {
|
|
|
8861
8944
|
return select2.modelValue === props.value;
|
|
8862
8945
|
}
|
|
8863
8946
|
});
|
|
8947
|
+
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8864
8948
|
const optionItem = computed(() => {
|
|
8865
8949
|
return {
|
|
8866
8950
|
name: props.name || props.value + "" || "",
|
|
8867
8951
|
value: props.value,
|
|
8868
8952
|
create: props.create,
|
|
8869
|
-
_checked: false
|
|
8953
|
+
_checked: false,
|
|
8954
|
+
disabled: isDisabled.value
|
|
8870
8955
|
};
|
|
8871
8956
|
});
|
|
8872
|
-
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8873
8957
|
const isObjectOption = ref(!!props.name);
|
|
8874
8958
|
const selectOptionCls = computed(() => {
|
|
8875
8959
|
return className(ns2.e("item"), {
|
|
8876
8960
|
active: isOptionSelected.value,
|
|
8877
|
-
disabled: isDisabled.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"
|
|
8878
8964
|
});
|
|
8879
8965
|
});
|
|
8880
8966
|
const optionSelect = () => {
|
|
@@ -8990,7 +9076,7 @@ const tagProps = {
|
|
|
8990
9076
|
}
|
|
8991
9077
|
};
|
|
8992
9078
|
function useClass(props) {
|
|
8993
|
-
const ns2 = useNamespace
|
|
9079
|
+
const ns2 = useNamespace("tag");
|
|
8994
9080
|
return computed(() => {
|
|
8995
9081
|
const { type: type4, color, deletable } = props;
|
|
8996
9082
|
return `${ns2.e("item")} ${ns2.m(type4 || (color ? "colorful" : "") || "default")} ${deletable ? ns2.m("deletable") : ""} ${ns2.m(props.size)}`;
|
|
@@ -9032,7 +9118,7 @@ var Tag = defineComponent({
|
|
|
9032
9118
|
slots,
|
|
9033
9119
|
emit
|
|
9034
9120
|
}) {
|
|
9035
|
-
const ns2 = useNamespace
|
|
9121
|
+
const ns2 = useNamespace("tag");
|
|
9036
9122
|
const {
|
|
9037
9123
|
type: type4,
|
|
9038
9124
|
color,
|
|
@@ -9090,9 +9176,13 @@ function useSelectContent() {
|
|
|
9090
9176
|
const ns2 = useNamespace$1("select");
|
|
9091
9177
|
const select2 = inject(SELECT_TOKEN);
|
|
9092
9178
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
9179
|
+
const styleType = inject(STYLE_TOKEN, void 0);
|
|
9093
9180
|
const app = getCurrentInstance();
|
|
9094
9181
|
const t = createI18nTranslate("DSelect", app);
|
|
9095
9182
|
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");
|
|
9096
9186
|
const selectedData = computed(() => {
|
|
9097
9187
|
return (select2 == null ? void 0 : select2.selectedOptions) || [];
|
|
9098
9188
|
});
|
|
@@ -9110,21 +9200,37 @@ function useSelectContent() {
|
|
|
9110
9200
|
const displayInputValue = computed(() => {
|
|
9111
9201
|
var _a;
|
|
9112
9202
|
if (select2 == null ? void 0 : select2.selectedOptions) {
|
|
9113
|
-
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) || "";
|
|
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) || (select2.showEmptyWhenUnmatched ? "" : select2.modelValue);
|
|
9114
9204
|
} else {
|
|
9115
9205
|
return "";
|
|
9116
9206
|
}
|
|
9117
9207
|
});
|
|
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
|
+
});
|
|
9118
9222
|
const mergeClearable = computed(() => {
|
|
9119
9223
|
return !isSelectDisable.value && !!(select2 == null ? void 0 : select2.allowClear) && (displayInputValue.value ? true : false);
|
|
9120
9224
|
});
|
|
9121
9225
|
const isDisabledTooltip = computed(() => {
|
|
9122
9226
|
return !isSupportTagsTooltip.value || !!(select2 == null ? void 0 : select2.isOpen);
|
|
9123
9227
|
});
|
|
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));
|
|
9124
9229
|
const selectionCls = computed(() => {
|
|
9125
9230
|
return className(ns2.e("selection"), {
|
|
9126
9231
|
[ns2.e("clearable")]: mergeClearable.value,
|
|
9127
|
-
[ns2.em("selection", "error")]: isValidateError.value
|
|
9232
|
+
[ns2.em("selection", "error")]: isValidateError.value,
|
|
9233
|
+
[ns2.em("selection", "gray-style")]: styleType === "gray"
|
|
9128
9234
|
});
|
|
9129
9235
|
});
|
|
9130
9236
|
const inputCls = computed(() => {
|
|
@@ -9135,12 +9241,20 @@ function useSelectContent() {
|
|
|
9135
9241
|
});
|
|
9136
9242
|
const tagSize = computed(() => (select2 == null ? void 0 : select2.selectSize) || "sm");
|
|
9137
9243
|
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"));
|
|
9138
9245
|
const isMultiple = computed(() => !!(select2 == null ? void 0 : select2.multiple));
|
|
9139
9246
|
const handleClear = (e) => {
|
|
9140
9247
|
e.preventDefault();
|
|
9141
9248
|
e.stopPropagation();
|
|
9249
|
+
searchQuery.value = "";
|
|
9250
|
+
singleSearchKey.value = "";
|
|
9142
9251
|
select2 == null ? void 0 : select2.handleClear();
|
|
9143
9252
|
};
|
|
9253
|
+
const onSingleInputWrapClick = () => {
|
|
9254
|
+
if (!(select2 == null ? void 0 : select2.selectDisabled)) {
|
|
9255
|
+
singleInputRef.value.focus();
|
|
9256
|
+
}
|
|
9257
|
+
};
|
|
9144
9258
|
const tagDelete = (data) => {
|
|
9145
9259
|
if (data && (data.value || data.value === 0)) {
|
|
9146
9260
|
select2 == null ? void 0 : select2.tagDelete(data);
|
|
@@ -9150,39 +9264,67 @@ function useSelectContent() {
|
|
|
9150
9264
|
select2 == null ? void 0 : select2.onFocus(e);
|
|
9151
9265
|
};
|
|
9152
9266
|
const onBlur = (e) => {
|
|
9267
|
+
singleSearchKey.value = "";
|
|
9153
9268
|
select2 == null ? void 0 : select2.onBlur(e);
|
|
9154
9269
|
};
|
|
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
|
+
};
|
|
9155
9286
|
const queryFilter = (e) => {
|
|
9156
9287
|
e.preventDefault();
|
|
9157
9288
|
e.stopPropagation();
|
|
9158
9289
|
const query = e.target.value;
|
|
9290
|
+
singleSearchKey.value = query;
|
|
9291
|
+
searchQuery.value = query;
|
|
9159
9292
|
if (!isReadOnly.value && (select2 == null ? void 0 : select2.debounceQueryFilter)) {
|
|
9160
9293
|
select2 == null ? void 0 : select2.debounceQueryFilter(query);
|
|
9161
9294
|
}
|
|
9162
9295
|
};
|
|
9163
9296
|
return {
|
|
9297
|
+
singleInputRef,
|
|
9164
9298
|
searchQuery,
|
|
9299
|
+
singleSearchKey,
|
|
9165
9300
|
selectedData,
|
|
9166
9301
|
isSelectDisable,
|
|
9167
9302
|
isSupportCollapseTags,
|
|
9168
9303
|
isDisabledTooltip,
|
|
9304
|
+
isSupportFilter,
|
|
9169
9305
|
isReadOnly,
|
|
9170
9306
|
selectionCls,
|
|
9171
9307
|
inputCls,
|
|
9172
9308
|
tagSize,
|
|
9173
9309
|
placeholder,
|
|
9310
|
+
singlePlaceholder,
|
|
9311
|
+
singlePlaceholderWidth,
|
|
9174
9312
|
isMultiple,
|
|
9175
9313
|
displayInputValue,
|
|
9314
|
+
isPlaceholderDark,
|
|
9315
|
+
onSingleInputWrapClick,
|
|
9176
9316
|
handleClear,
|
|
9177
9317
|
tagDelete,
|
|
9178
9318
|
onFocus,
|
|
9179
9319
|
onBlur,
|
|
9320
|
+
onMultipleClick,
|
|
9321
|
+
onArrowClick,
|
|
9180
9322
|
queryFilter
|
|
9181
9323
|
};
|
|
9182
9324
|
}
|
|
9183
9325
|
var SelectContent = defineComponent({
|
|
9184
9326
|
name: "SelectContent",
|
|
9185
|
-
setup() {
|
|
9327
|
+
setup(_, ctx) {
|
|
9186
9328
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
9187
9329
|
const ns2 = useNamespace$1("select");
|
|
9188
9330
|
const clearCls = computed(() => ({
|
|
@@ -9196,44 +9338,71 @@ var SelectContent = defineComponent({
|
|
|
9196
9338
|
const multipleCls = ns2.e("multiple");
|
|
9197
9339
|
const multipleInputCls = ns2.em("multiple", "input");
|
|
9198
9340
|
const {
|
|
9341
|
+
singleInputRef,
|
|
9199
9342
|
searchQuery,
|
|
9343
|
+
singleSearchKey,
|
|
9200
9344
|
selectedData,
|
|
9201
9345
|
isSelectDisable,
|
|
9202
9346
|
isSupportCollapseTags,
|
|
9203
9347
|
isDisabledTooltip,
|
|
9204
9348
|
isReadOnly,
|
|
9349
|
+
isSupportFilter,
|
|
9205
9350
|
selectionCls,
|
|
9206
9351
|
inputCls,
|
|
9207
9352
|
tagSize,
|
|
9208
9353
|
placeholder,
|
|
9354
|
+
singlePlaceholder,
|
|
9355
|
+
singlePlaceholderWidth,
|
|
9209
9356
|
isMultiple,
|
|
9357
|
+
isPlaceholderDark,
|
|
9210
9358
|
displayInputValue,
|
|
9359
|
+
onSingleInputWrapClick,
|
|
9360
|
+
onMultipleClick,
|
|
9361
|
+
onArrowClick,
|
|
9211
9362
|
handleClear,
|
|
9212
9363
|
tagDelete,
|
|
9213
9364
|
onFocus,
|
|
9214
9365
|
onBlur,
|
|
9215
9366
|
queryFilter
|
|
9216
9367
|
} = useSelectContent();
|
|
9368
|
+
const clearSingleSearchKey = () => {
|
|
9369
|
+
singleSearchKey.value = "";
|
|
9370
|
+
};
|
|
9371
|
+
const clearMultipleSearchKey = () => {
|
|
9372
|
+
searchQuery.value = "";
|
|
9373
|
+
};
|
|
9374
|
+
ctx.expose({
|
|
9375
|
+
clearSingleSearchKey,
|
|
9376
|
+
clearMultipleSearchKey
|
|
9377
|
+
});
|
|
9217
9378
|
return () => {
|
|
9218
9379
|
return createVNode("div", {
|
|
9219
9380
|
"class": selectionCls.value
|
|
9220
9381
|
}, [isMultiple.value ? createVNode("div", {
|
|
9221
|
-
"class": multipleCls
|
|
9382
|
+
"class": multipleCls,
|
|
9383
|
+
"onClick": onMultipleClick
|
|
9222
9384
|
}, [!isSupportCollapseTags.value && selectedData.value.length >= 1 && selectedData.value.map((item) => createVNode(Tag, {
|
|
9223
|
-
"deletable":
|
|
9385
|
+
"deletable": !(isSelectDisable.value || item.disabled),
|
|
9224
9386
|
"onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
|
|
9225
9387
|
"key": item.value,
|
|
9388
|
+
"maxWidth": "78%",
|
|
9389
|
+
"class": ["multiple-tag", {
|
|
9390
|
+
disabled: isSelectDisable.value || item.disabled
|
|
9391
|
+
}],
|
|
9226
9392
|
"size": tagSize.value
|
|
9227
9393
|
}, {
|
|
9228
9394
|
default: () => [item.name]
|
|
9229
9395
|
})), isSupportCollapseTags.value && selectedData.value.length >= 1 && createVNode(Tag, {
|
|
9230
9396
|
"deletable": true,
|
|
9397
|
+
"maxWidth": "75%",
|
|
9398
|
+
"class": "multiple-tag",
|
|
9231
9399
|
"onTagDelete": withModifiers(() => tagDelete(selectedData.value[0]), ["prevent", "stop"]),
|
|
9232
9400
|
"size": tagSize.value
|
|
9233
9401
|
}, {
|
|
9234
9402
|
default: () => [selectedData.value[0].name]
|
|
9235
9403
|
}), isSupportCollapseTags.value && selectedData.value.length > 1 && createVNode(Popover, {
|
|
9236
9404
|
"trigger": "hover",
|
|
9405
|
+
"auto-update-position": true,
|
|
9237
9406
|
"disabled": isDisabledTooltip.value
|
|
9238
9407
|
}, {
|
|
9239
9408
|
default: () => createVNode(Tag, {
|
|
@@ -9245,39 +9414,49 @@ var SelectContent = defineComponent({
|
|
|
9245
9414
|
"deletable": true,
|
|
9246
9415
|
"onTagDelete": withModifiers(() => tagDelete(item), ["prevent", "stop"]),
|
|
9247
9416
|
"key": item.value,
|
|
9417
|
+
"class": "popover-tag",
|
|
9248
9418
|
"size": tagSize.value
|
|
9249
9419
|
}, {
|
|
9250
9420
|
default: () => [item.name]
|
|
9251
9421
|
}))])
|
|
9252
9422
|
}), createVNode("div", {
|
|
9253
9423
|
"class": multipleInputCls
|
|
9254
|
-
}, [createVNode("input", {
|
|
9424
|
+
}, [withDirectives(createVNode("input", {
|
|
9255
9425
|
"ref": "input",
|
|
9256
9426
|
"value": searchQuery.value,
|
|
9257
9427
|
"type": "text",
|
|
9258
9428
|
"class": inputCls.value,
|
|
9259
9429
|
"placeholder": placeholder.value,
|
|
9260
|
-
"readonly": isReadOnly.value,
|
|
9430
|
+
"readonly": isReadOnly.value || !isSupportFilter.value,
|
|
9261
9431
|
"disabled": isSelectDisable.value,
|
|
9262
|
-
"onInput": queryFilter
|
|
9263
|
-
|
|
9264
|
-
"
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
"
|
|
9432
|
+
"onInput": queryFilter
|
|
9433
|
+
}, null), [[vShow, !selectedData.value.length || isSupportFilter.value]])])]) : createVNode("div", {
|
|
9434
|
+
"class": "single-inner-input",
|
|
9435
|
+
"onClick": onSingleInputWrapClick
|
|
9436
|
+
}, [!singleSearchKey.value && createVNode("span", {
|
|
9437
|
+
"class": ["input-placeholder", {
|
|
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,
|
|
9268
9446
|
"type": "text",
|
|
9447
|
+
"onUpdate:modelValue": ($event) => singleSearchKey.value = $event,
|
|
9269
9448
|
"class": inputCls.value,
|
|
9270
|
-
"placeholder": placeholder.value,
|
|
9271
9449
|
"readonly": isReadOnly.value,
|
|
9272
9450
|
"disabled": isSelectDisable.value,
|
|
9273
9451
|
"onFocus": onFocus,
|
|
9274
9452
|
"onBlur": onBlur,
|
|
9275
9453
|
"onInput": queryFilter
|
|
9276
|
-
}, null), createVNode("span", {
|
|
9454
|
+
}, null), [[vModelText, singleSearchKey.value]])]), createVNode("span", {
|
|
9277
9455
|
"onClick": handleClear,
|
|
9278
9456
|
"class": clearCls.value
|
|
9279
9457
|
}, [createVNode(AlertCloseIcon, null, null)]), createVNode("span", {
|
|
9280
|
-
"class": arrowCls.value
|
|
9458
|
+
"class": arrowCls.value,
|
|
9459
|
+
"onClick": onArrowClick
|
|
9281
9460
|
}, [createVNode(SelectArrowIcon, null, null)])]);
|
|
9282
9461
|
};
|
|
9283
9462
|
}
|
|
@@ -9305,11 +9484,38 @@ function useSelectFunction(props, selectRef) {
|
|
|
9305
9484
|
};
|
|
9306
9485
|
return { isSelectFocus, focus, blur };
|
|
9307
9486
|
}
|
|
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
|
+
}
|
|
9308
9514
|
var select = "";
|
|
9309
9515
|
var Select = defineComponent({
|
|
9310
9516
|
name: "DSelect",
|
|
9311
9517
|
props: selectProps,
|
|
9312
|
-
emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear"],
|
|
9518
|
+
emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear", "load-more"],
|
|
9313
9519
|
setup(props, ctx) {
|
|
9314
9520
|
const app = getCurrentInstance();
|
|
9315
9521
|
const t = createI18nTranslate("DSelect", app);
|
|
@@ -9322,7 +9528,6 @@ var Select = defineComponent({
|
|
|
9322
9528
|
const {
|
|
9323
9529
|
selectDisabled,
|
|
9324
9530
|
selectSize,
|
|
9325
|
-
originRef,
|
|
9326
9531
|
dropdownRef,
|
|
9327
9532
|
isOpen,
|
|
9328
9533
|
selectCls,
|
|
@@ -9343,9 +9548,17 @@ var Select = defineComponent({
|
|
|
9343
9548
|
toggleChange,
|
|
9344
9549
|
isShowCreateOption
|
|
9345
9550
|
} = useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t);
|
|
9551
|
+
const dropdownContainer = ref();
|
|
9552
|
+
const {
|
|
9553
|
+
originRef,
|
|
9554
|
+
dropdownWidth
|
|
9555
|
+
} = useSelectMenuSize(selectRef, dropdownRef, isOpen);
|
|
9346
9556
|
const scrollbarNs = useNamespace$1("scrollbar");
|
|
9347
9557
|
const ns2 = useNamespace$1("select");
|
|
9348
|
-
const dropdownCls =
|
|
9558
|
+
const dropdownCls = {
|
|
9559
|
+
[ns2.e("dropdown")]: true,
|
|
9560
|
+
[ns2.em("dropdown", "multiple")]: props.multiple
|
|
9561
|
+
};
|
|
9349
9562
|
const listCls = {
|
|
9350
9563
|
[ns2.e("dropdown-list")]: true,
|
|
9351
9564
|
[scrollbarNs.b()]: true
|
|
@@ -9357,32 +9570,29 @@ var Select = defineComponent({
|
|
|
9357
9570
|
toggleChange
|
|
9358
9571
|
});
|
|
9359
9572
|
const isRender = ref(false);
|
|
9360
|
-
|
|
9361
|
-
const dropdownWidth = ref("0");
|
|
9362
|
-
const updateDropdownWidth = () => {
|
|
9363
|
-
var _a;
|
|
9364
|
-
dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
|
|
9365
|
-
};
|
|
9366
|
-
watch(selectRef, (val) => {
|
|
9367
|
-
if (val) {
|
|
9368
|
-
originRef.value = val.$el;
|
|
9369
|
-
updateDropdownWidth();
|
|
9370
|
-
}
|
|
9371
|
-
});
|
|
9372
|
-
onMounted(() => {
|
|
9573
|
+
onBeforeMount(() => {
|
|
9373
9574
|
isRender.value = true;
|
|
9374
|
-
updateDropdownWidth();
|
|
9375
|
-
window.addEventListener("resize", updateDropdownWidth);
|
|
9376
9575
|
});
|
|
9377
|
-
|
|
9378
|
-
|
|
9576
|
+
const scrollToBottom = () => {
|
|
9577
|
+
const compareHeight = dropdownContainer.value.scrollHeight - dropdownContainer.value.clientHeight;
|
|
9578
|
+
const scrollTop = dropdownContainer.value.scrollTop;
|
|
9579
|
+
if (scrollTop === compareHeight) {
|
|
9580
|
+
ctx.emit("load-more");
|
|
9581
|
+
}
|
|
9582
|
+
};
|
|
9583
|
+
onMounted(() => {
|
|
9584
|
+
nextTick(() => {
|
|
9585
|
+
dropdownContainer.value.addEventListener("scroll", scrollToBottom);
|
|
9586
|
+
});
|
|
9379
9587
|
});
|
|
9380
9588
|
provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
|
|
9381
9589
|
selectDisabled,
|
|
9382
9590
|
selectSize,
|
|
9383
9591
|
isOpen,
|
|
9592
|
+
isSelectFocus,
|
|
9384
9593
|
selectedOptions,
|
|
9385
9594
|
filterQuery,
|
|
9595
|
+
dropdownWidth,
|
|
9386
9596
|
valueChange,
|
|
9387
9597
|
handleClear,
|
|
9388
9598
|
updateInjectOptions,
|
|
@@ -9396,7 +9606,7 @@ var Select = defineComponent({
|
|
|
9396
9606
|
"class": selectCls.value,
|
|
9397
9607
|
"onClick": withModifiers(() => {
|
|
9398
9608
|
toggleChange(!isOpen.value);
|
|
9399
|
-
}, [
|
|
9609
|
+
}, [])
|
|
9400
9610
|
}, [createVNode(SelectContent, {
|
|
9401
9611
|
"ref": selectRef
|
|
9402
9612
|
}, null), createVNode(Teleport, {
|
|
@@ -9410,9 +9620,9 @@ var Select = defineComponent({
|
|
|
9410
9620
|
"onUpdate:modelValue": ($event) => isRender.value = $event,
|
|
9411
9621
|
"ref": dropdownRef,
|
|
9412
9622
|
"origin": originRef.value,
|
|
9413
|
-
"align": "start",
|
|
9414
9623
|
"offset": 4,
|
|
9415
|
-
"
|
|
9624
|
+
"place-strategy": "no-space",
|
|
9625
|
+
"position": props.position,
|
|
9416
9626
|
"style": {
|
|
9417
9627
|
visibility: isOpen.value ? "visible" : "hidden",
|
|
9418
9628
|
"z-index": isOpen.value ? "var(--devui-z-index-dropdown, 1052)" : -1
|
|
@@ -9423,11 +9633,15 @@ var Select = defineComponent({
|
|
|
9423
9633
|
return [createVNode("div", {
|
|
9424
9634
|
"class": dropdownCls,
|
|
9425
9635
|
"style": {
|
|
9426
|
-
width: `${dropdownWidth.value}`,
|
|
9636
|
+
width: `${dropdownWidth.value}px`,
|
|
9427
9637
|
visibility: isOpen.value ? "visible" : "hidden"
|
|
9428
9638
|
}
|
|
9429
9639
|
}, [withDirectives(createVNode("ul", {
|
|
9430
|
-
"class": listCls
|
|
9640
|
+
"class": listCls,
|
|
9641
|
+
"style": {
|
|
9642
|
+
padding: isShowEmptyText.value ? "0" : "12px"
|
|
9643
|
+
},
|
|
9644
|
+
"ref": dropdownContainer
|
|
9431
9645
|
}, [isShowCreateOption.value && createVNode(Option, {
|
|
9432
9646
|
"value": filterQuery.value,
|
|
9433
9647
|
"name": filterQuery.value,
|
|
@@ -9446,7 +9660,8 @@ var Select = defineComponent({
|
|
|
9446
9660
|
default: () => [props.multiple ? createVNode(Checkbox, {
|
|
9447
9661
|
"modelValue": item._checked,
|
|
9448
9662
|
"label": item.name,
|
|
9449
|
-
"disabled": isDisabled(item)
|
|
9663
|
+
"disabled": isDisabled(item),
|
|
9664
|
+
"class": "select-checkbox"
|
|
9450
9665
|
}, null) : item.name || item.value]
|
|
9451
9666
|
}))]), [[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", {
|
|
9452
9667
|
"class": dropdownEmptyCls
|