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/select/index.es.js
CHANGED
|
@@ -29,10 +29,10 @@ 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 } from "vue";
|
|
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, 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 className(classStr, classOpt) {
|
|
37
37
|
let classname = classStr;
|
|
38
38
|
if (typeof classOpt === "object") {
|
|
@@ -42,6 +42,25 @@ 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
|
+
}
|
|
45
64
|
function createBem$1(namespace, element, modifier) {
|
|
46
65
|
let cls = namespace;
|
|
47
66
|
if (element) {
|
|
@@ -1245,7 +1264,7 @@ var lodash = { exports: {} };
|
|
|
1245
1264
|
if (typeof func != "function") {
|
|
1246
1265
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
1247
1266
|
}
|
|
1248
|
-
return
|
|
1267
|
+
return setTimeout2(function() {
|
|
1249
1268
|
func.apply(undefined$1, args);
|
|
1250
1269
|
}, wait);
|
|
1251
1270
|
}
|
|
@@ -3054,7 +3073,7 @@ var lodash = { exports: {} };
|
|
|
3054
3073
|
return object4[key];
|
|
3055
3074
|
}
|
|
3056
3075
|
var setData = shortOut(baseSetData);
|
|
3057
|
-
var
|
|
3076
|
+
var setTimeout2 = ctxSetTimeout || function(func, wait) {
|
|
3058
3077
|
return root.setTimeout(func, wait);
|
|
3059
3078
|
};
|
|
3060
3079
|
var setToString = shortOut(baseSetToString);
|
|
@@ -3846,7 +3865,7 @@ var lodash = { exports: {} };
|
|
|
3846
3865
|
}
|
|
3847
3866
|
function leadingEdge(time) {
|
|
3848
3867
|
lastInvokeTime = time;
|
|
3849
|
-
timerId =
|
|
3868
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
3850
3869
|
return leading ? invokeFunc(time) : result2;
|
|
3851
3870
|
}
|
|
3852
3871
|
function remainingWait(time) {
|
|
@@ -3862,7 +3881,7 @@ var lodash = { exports: {} };
|
|
|
3862
3881
|
if (shouldInvoke(time)) {
|
|
3863
3882
|
return trailingEdge(time);
|
|
3864
3883
|
}
|
|
3865
|
-
timerId =
|
|
3884
|
+
timerId = setTimeout2(timerExpired, remainingWait(time));
|
|
3866
3885
|
}
|
|
3867
3886
|
function trailingEdge(time) {
|
|
3868
3887
|
timerId = undefined$1;
|
|
@@ -3893,12 +3912,12 @@ var lodash = { exports: {} };
|
|
|
3893
3912
|
}
|
|
3894
3913
|
if (maxing) {
|
|
3895
3914
|
clearTimeout(timerId);
|
|
3896
|
-
timerId =
|
|
3915
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
3897
3916
|
return invokeFunc(lastCallTime);
|
|
3898
3917
|
}
|
|
3899
3918
|
}
|
|
3900
3919
|
if (timerId === undefined$1) {
|
|
3901
|
-
timerId =
|
|
3920
|
+
timerId = setTimeout2(timerExpired, wait);
|
|
3902
3921
|
}
|
|
3903
3922
|
return result2;
|
|
3904
3923
|
}
|
|
@@ -5523,9 +5542,18 @@ const formProps = {
|
|
|
5523
5542
|
hideRequiredMark: {
|
|
5524
5543
|
type: Boolean,
|
|
5525
5544
|
default: false
|
|
5545
|
+
},
|
|
5546
|
+
styleType: {
|
|
5547
|
+
type: String,
|
|
5548
|
+
default: "default"
|
|
5549
|
+
},
|
|
5550
|
+
appendToBodyScrollStrategy: {
|
|
5551
|
+
type: String,
|
|
5552
|
+
default: "reposition"
|
|
5526
5553
|
}
|
|
5527
5554
|
};
|
|
5528
5555
|
const FORM_TOKEN = Symbol("dForm");
|
|
5556
|
+
const STYLE_TOKEN = Symbol("dForm");
|
|
5529
5557
|
function useFieldCollection() {
|
|
5530
5558
|
const itemContexts = [];
|
|
5531
5559
|
const addItemContext = (field) => {
|
|
@@ -5620,6 +5648,7 @@ defineComponent({
|
|
|
5620
5648
|
addItemContext,
|
|
5621
5649
|
removeItemContext
|
|
5622
5650
|
})));
|
|
5651
|
+
provide(STYLE_TOKEN, props.styleType);
|
|
5623
5652
|
ctx.expose({
|
|
5624
5653
|
validate,
|
|
5625
5654
|
validateFields,
|
|
@@ -5661,7 +5690,7 @@ const formItemProps = {
|
|
|
5661
5690
|
default: void 0
|
|
5662
5691
|
},
|
|
5663
5692
|
helpTips: {
|
|
5664
|
-
type: String,
|
|
5693
|
+
type: [String, Object],
|
|
5665
5694
|
default: ""
|
|
5666
5695
|
},
|
|
5667
5696
|
feedbackStatus: {
|
|
@@ -5674,12 +5703,6 @@ const formItemProps = {
|
|
|
5674
5703
|
};
|
|
5675
5704
|
const FORM_ITEM_TOKEN = Symbol("dFormItem");
|
|
5676
5705
|
const LABEL_DATA = Symbol("labelData");
|
|
5677
|
-
const formLabelProps = {
|
|
5678
|
-
helpTips: {
|
|
5679
|
-
type: String,
|
|
5680
|
-
default: ""
|
|
5681
|
-
}
|
|
5682
|
-
};
|
|
5683
5706
|
const fixedOverlayProps = {
|
|
5684
5707
|
modelValue: {
|
|
5685
5708
|
type: Boolean,
|
|
@@ -5694,25 +5717,6 @@ const fixedOverlayProps = {
|
|
|
5694
5717
|
default: true
|
|
5695
5718
|
}
|
|
5696
5719
|
};
|
|
5697
|
-
function lockScroll() {
|
|
5698
|
-
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
5699
|
-
const scrollTop = document.documentElement.scrollTop;
|
|
5700
|
-
const style = document.documentElement.getAttribute("style");
|
|
5701
|
-
document.documentElement.style.position = "fixed";
|
|
5702
|
-
document.documentElement.style.top = `-${scrollTop}px`;
|
|
5703
|
-
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
5704
|
-
document.documentElement.style.overflowY = "scroll";
|
|
5705
|
-
return () => {
|
|
5706
|
-
if (style) {
|
|
5707
|
-
document.documentElement.setAttribute("style", style);
|
|
5708
|
-
} else {
|
|
5709
|
-
document.documentElement.removeAttribute("style");
|
|
5710
|
-
}
|
|
5711
|
-
document.documentElement.scrollTop = scrollTop;
|
|
5712
|
-
};
|
|
5713
|
-
}
|
|
5714
|
-
return;
|
|
5715
|
-
}
|
|
5716
5720
|
function useFixedOverlay(props, ctx) {
|
|
5717
5721
|
let lockScrollCb;
|
|
5718
5722
|
const onClick = (event) => {
|
|
@@ -5735,6 +5739,29 @@ function useFixedOverlay(props, ctx) {
|
|
|
5735
5739
|
onUnmounted(removeBodyAdditions);
|
|
5736
5740
|
return { onClick };
|
|
5737
5741
|
}
|
|
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
|
+
}
|
|
5738
5765
|
var fixedOverlay = "";
|
|
5739
5766
|
defineComponent({
|
|
5740
5767
|
name: "DFixedOverlay",
|
|
@@ -5745,7 +5772,7 @@ defineComponent({
|
|
|
5745
5772
|
const {
|
|
5746
5773
|
modelValue
|
|
5747
5774
|
} = toRefs(props);
|
|
5748
|
-
const ns2 = useNamespace
|
|
5775
|
+
const ns2 = useNamespace("fixed-overlay");
|
|
5749
5776
|
const {
|
|
5750
5777
|
onClick
|
|
5751
5778
|
} = useFixedOverlay(props, ctx);
|
|
@@ -5911,7 +5938,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
5911
5938
|
emit,
|
|
5912
5939
|
expose
|
|
5913
5940
|
}) {
|
|
5914
|
-
const ns2 = useNamespace
|
|
5941
|
+
const ns2 = useNamespace("flexible-overlay");
|
|
5915
5942
|
const {
|
|
5916
5943
|
clickEventBubble
|
|
5917
5944
|
} = toRefs(props);
|
|
@@ -5940,7 +5967,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
5940
5967
|
});
|
|
5941
5968
|
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
5942
5969
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
5943
|
-
const ns$1 = useNamespace
|
|
5970
|
+
const ns$1 = useNamespace("popper-trigger");
|
|
5944
5971
|
function wrapContent(content) {
|
|
5945
5972
|
return h("span", { class: ns$1.b() }, content);
|
|
5946
5973
|
}
|
|
@@ -6127,7 +6154,7 @@ function usePopoverEvent(props, visible, origin) {
|
|
|
6127
6154
|
});
|
|
6128
6155
|
return { placement, handlePositionChange, onMouseenter, onMouseleave };
|
|
6129
6156
|
}
|
|
6130
|
-
const ns = useNamespace
|
|
6157
|
+
const ns = useNamespace("popover");
|
|
6131
6158
|
function SuccessIcon$1() {
|
|
6132
6159
|
return createVNode("svg", {
|
|
6133
6160
|
"class": [ns.e("icon"), ns.em("icon", "success")],
|
|
@@ -6229,7 +6256,7 @@ var PopoverIcon = defineComponent({
|
|
|
6229
6256
|
}
|
|
6230
6257
|
},
|
|
6231
6258
|
setup(props) {
|
|
6232
|
-
const ns2 = useNamespace
|
|
6259
|
+
const ns2 = useNamespace("popover");
|
|
6233
6260
|
return () => props.type && props.type !== "default" && createVNode("span", {
|
|
6234
6261
|
"class": ns2.e("icon-wrap")
|
|
6235
6262
|
}, [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)]);
|
|
@@ -6266,7 +6293,7 @@ var Popover = defineComponent({
|
|
|
6266
6293
|
const {
|
|
6267
6294
|
overlayStyles
|
|
6268
6295
|
} = usePopover(props, visible, placement, origin, popoverRef);
|
|
6269
|
-
const ns2 = useNamespace
|
|
6296
|
+
const ns2 = useNamespace("popover");
|
|
6270
6297
|
provide(POPPER_TRIGGER_TOKEN, origin);
|
|
6271
6298
|
watch(visible, (newVal) => {
|
|
6272
6299
|
if (newVal) {
|
|
@@ -6400,6 +6427,12 @@ function useFormLabel() {
|
|
|
6400
6427
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
6401
6428
|
const labelData = inject(LABEL_DATA);
|
|
6402
6429
|
const ns2 = useNamespace$1("form");
|
|
6430
|
+
const defaultTipsPopover = {
|
|
6431
|
+
content: "",
|
|
6432
|
+
position: ["top"],
|
|
6433
|
+
trigger: "hover",
|
|
6434
|
+
popType: "info"
|
|
6435
|
+
};
|
|
6403
6436
|
const labelClasses = computed(() => ({
|
|
6404
6437
|
[`${ns2.e("label")}`]: true,
|
|
6405
6438
|
[`${ns2.em("label", "vertical")}`]: labelData.value.layout === "vertical",
|
|
@@ -6411,17 +6444,24 @@ function useFormLabel() {
|
|
|
6411
6444
|
[`${ns2.em("label", "required")}`]: formItemContext.isRequired,
|
|
6412
6445
|
[`${ns2.em("label", "required-hide")}`]: formItemContext.isRequired && formContext.hideRequiredMark
|
|
6413
6446
|
}));
|
|
6414
|
-
|
|
6447
|
+
const tipsPopover = computed(() => {
|
|
6448
|
+
if (typeof labelData.value.helpTips === "string") {
|
|
6449
|
+
return __spreadProps(__spreadValues({}, defaultTipsPopover), { content: labelData.value.helpTips });
|
|
6450
|
+
} else {
|
|
6451
|
+
return __spreadValues(__spreadValues({}, defaultTipsPopover), labelData.value.helpTips);
|
|
6452
|
+
}
|
|
6453
|
+
});
|
|
6454
|
+
return { labelClasses, labelInnerClasses, tipsPopover };
|
|
6415
6455
|
}
|
|
6416
6456
|
var formLabel = "";
|
|
6417
6457
|
var FormLabel = defineComponent({
|
|
6418
6458
|
name: "DFormLabel",
|
|
6419
|
-
|
|
6420
|
-
setup(props, ctx) {
|
|
6459
|
+
setup(_, ctx) {
|
|
6421
6460
|
const ns2 = useNamespace$1("form");
|
|
6422
6461
|
const {
|
|
6423
6462
|
labelClasses,
|
|
6424
|
-
labelInnerClasses
|
|
6463
|
+
labelInnerClasses,
|
|
6464
|
+
tipsPopover
|
|
6425
6465
|
} = useFormLabel();
|
|
6426
6466
|
return () => {
|
|
6427
6467
|
var _a, _b;
|
|
@@ -6429,12 +6469,9 @@ var FormLabel = defineComponent({
|
|
|
6429
6469
|
"class": labelClasses.value
|
|
6430
6470
|
}, [createVNode("span", {
|
|
6431
6471
|
"class": labelInnerClasses.value
|
|
6432
|
-
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]),
|
|
6433
|
-
"
|
|
6434
|
-
|
|
6435
|
-
"trigger": "hover",
|
|
6436
|
-
"pop-type": "info"
|
|
6437
|
-
}, {
|
|
6472
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), tipsPopover.value.content && createVNode(Popover, mergeProps({
|
|
6473
|
+
"class": ns2.e("label-tips-popover")
|
|
6474
|
+
}, tipsPopover.value), {
|
|
6438
6475
|
default: () => [createVNode(HelpTipsIcon, {
|
|
6439
6476
|
"class": ns2.e("label-help")
|
|
6440
6477
|
}, null), createTextVNode(",")]
|
|
@@ -6465,7 +6502,7 @@ function useFormControl(props) {
|
|
|
6465
6502
|
[ns2.em("control-container", "has-feedback")]: Boolean(feedbackStatus == null ? void 0 : feedbackStatus.value),
|
|
6466
6503
|
[ns2.em("control-container", "feedback-error")]: Boolean((feedbackStatus == null ? void 0 : feedbackStatus.value) === "error")
|
|
6467
6504
|
}));
|
|
6468
|
-
return { controlClasses, controlContainerClasses };
|
|
6505
|
+
return { controlClasses, controlContainerClasses, labelData };
|
|
6469
6506
|
}
|
|
6470
6507
|
function useFormControlValidate() {
|
|
6471
6508
|
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
@@ -6482,11 +6519,15 @@ var FormControl = defineComponent({
|
|
|
6482
6519
|
name: "DFormControl",
|
|
6483
6520
|
props: formControlProps,
|
|
6484
6521
|
setup(props, ctx) {
|
|
6522
|
+
const formContext = inject(FORM_TOKEN);
|
|
6485
6523
|
const formControl2 = ref();
|
|
6524
|
+
const popoverRef = ref();
|
|
6486
6525
|
const ns2 = useNamespace$1("form");
|
|
6526
|
+
const showPopoverClick = ref(true);
|
|
6487
6527
|
const {
|
|
6488
6528
|
controlClasses,
|
|
6489
|
-
controlContainerClasses
|
|
6529
|
+
controlContainerClasses,
|
|
6530
|
+
labelData
|
|
6490
6531
|
} = useFormControl(props);
|
|
6491
6532
|
const {
|
|
6492
6533
|
feedbackStatus,
|
|
@@ -6496,17 +6537,52 @@ var FormControl = defineComponent({
|
|
|
6496
6537
|
errorMessage,
|
|
6497
6538
|
popPosition
|
|
6498
6539
|
} = useFormControlValidate();
|
|
6540
|
+
const align = computed(() => {
|
|
6541
|
+
var _a, _b;
|
|
6542
|
+
if ((_a = popPosition.value) == null ? void 0 : _a.some((item) => item.includes("start"))) {
|
|
6543
|
+
return "start";
|
|
6544
|
+
}
|
|
6545
|
+
if ((_b = popPosition.value) == null ? void 0 : _b.some((item) => item.includes("end"))) {
|
|
6546
|
+
return "end";
|
|
6547
|
+
}
|
|
6548
|
+
return void 0;
|
|
6549
|
+
});
|
|
6550
|
+
const onDocumentClick = (e) => {
|
|
6551
|
+
const composedPath = e.composedPath();
|
|
6552
|
+
if (composedPath.includes(popoverRef.value.triggerEl)) {
|
|
6553
|
+
showPopoverClick.value = true;
|
|
6554
|
+
} else {
|
|
6555
|
+
showPopoverClick.value = false;
|
|
6556
|
+
}
|
|
6557
|
+
};
|
|
6558
|
+
watch(showPopover, (val) => {
|
|
6559
|
+
if (val) {
|
|
6560
|
+
setTimeout(() => {
|
|
6561
|
+
document.addEventListener("click", onDocumentClick);
|
|
6562
|
+
});
|
|
6563
|
+
} else {
|
|
6564
|
+
showPopoverClick.value = true;
|
|
6565
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6566
|
+
}
|
|
6567
|
+
});
|
|
6568
|
+
onUnmounted(() => {
|
|
6569
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6570
|
+
});
|
|
6499
6571
|
return () => createVNode("div", {
|
|
6500
6572
|
"class": controlClasses.value,
|
|
6501
6573
|
"ref": formControl2
|
|
6502
6574
|
}, [createVNode("div", {
|
|
6503
6575
|
"class": controlContainerClasses.value
|
|
6504
6576
|
}, [createVNode(Popover, {
|
|
6505
|
-
"
|
|
6577
|
+
"ref": popoverRef,
|
|
6578
|
+
"is-open": showPopover.value && showPopoverClick.value,
|
|
6506
6579
|
"trigger": "manually",
|
|
6507
6580
|
"content": errorMessage.value,
|
|
6508
6581
|
"pop-type": "error",
|
|
6509
|
-
"position": popPosition.value
|
|
6582
|
+
"position": popPosition.value,
|
|
6583
|
+
"align": align.value,
|
|
6584
|
+
"scroll-element": "auto",
|
|
6585
|
+
"append-to-body-scroll-strategy": formContext.appendToBodyScrollStrategy
|
|
6510
6586
|
}, {
|
|
6511
6587
|
default: () => {
|
|
6512
6588
|
var _a, _b;
|
|
@@ -6518,7 +6594,7 @@ var FormControl = defineComponent({
|
|
|
6518
6594
|
"class": ns2.e("control-info")
|
|
6519
6595
|
}, [showMessage.value && createVNode("div", {
|
|
6520
6596
|
"class": "error-message"
|
|
6521
|
-
}, [errorMessage.value]), props.extraInfo && createVNode("div", {
|
|
6597
|
+
}, [errorMessage.value]), labelData.value.formItemCtx.slots.extraInfo ? labelData.value.formItemCtx.slots.extraInfo() : props.extraInfo && createVNode("div", {
|
|
6522
6598
|
"class": ns2.e("control-extra")
|
|
6523
6599
|
}, [props.extraInfo])])]);
|
|
6524
6600
|
}
|
|
@@ -7701,7 +7777,9 @@ defineComponent({
|
|
|
7701
7777
|
const labelData = computed(() => ({
|
|
7702
7778
|
layout: formContext.layout,
|
|
7703
7779
|
labelSize: formContext.labelSize,
|
|
7704
|
-
labelAlign: formContext.labelAlign
|
|
7780
|
+
labelAlign: formContext.labelAlign,
|
|
7781
|
+
helpTips: helpTips.value,
|
|
7782
|
+
formItemCtx: ctx
|
|
7705
7783
|
}));
|
|
7706
7784
|
provide(LABEL_DATA, labelData);
|
|
7707
7785
|
const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
|
|
@@ -7717,6 +7795,7 @@ defineComponent({
|
|
|
7717
7795
|
}));
|
|
7718
7796
|
provide(FORM_ITEM_TOKEN, context);
|
|
7719
7797
|
ctx.expose({
|
|
7798
|
+
validate,
|
|
7720
7799
|
resetField,
|
|
7721
7800
|
clearValidate
|
|
7722
7801
|
});
|
|
@@ -7730,9 +7809,7 @@ defineComponent({
|
|
|
7730
7809
|
});
|
|
7731
7810
|
return () => createVNode("div", {
|
|
7732
7811
|
"class": itemClasses.value
|
|
7733
|
-
}, [createVNode(FormLabel, {
|
|
7734
|
-
"help-tips": helpTips.value
|
|
7735
|
-
}, {
|
|
7812
|
+
}, [createVNode(FormLabel, null, {
|
|
7736
7813
|
default: () => [ctx.slots.label ? ctx.slots.label() : label == null ? void 0 : label.value]
|
|
7737
7814
|
}), createVNode(FormControl, {
|
|
7738
7815
|
"feedback-status": feedbackStatus == null ? void 0 : feedbackStatus.value,
|
|
@@ -7775,7 +7852,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7775
7852
|
const selectDisabled = computed(() => (formContext == null ? void 0 : formContext.disabled) || props.disabled);
|
|
7776
7853
|
const selectSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
|
|
7777
7854
|
const isObjectOption = ref(false);
|
|
7778
|
-
const originRef = ref();
|
|
7779
7855
|
const isOpen = ref(false);
|
|
7780
7856
|
const toggleChange = (bool) => {
|
|
7781
7857
|
if (selectDisabled.value) {
|
|
@@ -7785,7 +7861,14 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7785
7861
|
ctx.emit("toggle-change", bool);
|
|
7786
7862
|
};
|
|
7787
7863
|
onClickOutside(dropdownRef, () => {
|
|
7788
|
-
|
|
7864
|
+
var _a;
|
|
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
|
+
}
|
|
7789
7872
|
}, { ignore: [selectRef] });
|
|
7790
7873
|
const dropdownMenuMultipleNs = useNamespace$1("dropdown-menu-multiple");
|
|
7791
7874
|
const selectCls = computed(() => {
|
|
@@ -7898,8 +7981,11 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7898
7981
|
}
|
|
7899
7982
|
};
|
|
7900
7983
|
const valueChange = (item) => {
|
|
7984
|
+
var _a;
|
|
7901
7985
|
const { multiple } = props;
|
|
7902
7986
|
let { modelValue } = props;
|
|
7987
|
+
filterQuery.value = "";
|
|
7988
|
+
handlerQueryFunc("");
|
|
7903
7989
|
if (multiple) {
|
|
7904
7990
|
const checkedItems = Array.isArray(modelValue) ? modelValue.slice() : [];
|
|
7905
7991
|
const index2 = checkedItems.indexOf(item.value);
|
|
@@ -7926,6 +8012,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7926
8012
|
}
|
|
7927
8013
|
getMultipleSelected(checkedItems);
|
|
7928
8014
|
} else {
|
|
8015
|
+
(_a = selectRef.value) == null ? void 0 : _a.clearSingleSearchKey();
|
|
7929
8016
|
ctx.emit("update:modelValue", item.value);
|
|
7930
8017
|
getSingleSelected(item);
|
|
7931
8018
|
toggleChange(false);
|
|
@@ -7936,6 +8023,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7936
8023
|
ctx.emit("toggle-change", false);
|
|
7937
8024
|
};
|
|
7938
8025
|
const handleClear = () => {
|
|
8026
|
+
filterQuery.value = "";
|
|
8027
|
+
handlerQueryFunc("");
|
|
7939
8028
|
if (props.multiple) {
|
|
7940
8029
|
ctx.emit("update:modelValue", []);
|
|
7941
8030
|
ctx.emit("value-change", []);
|
|
@@ -7948,7 +8037,6 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7948
8037
|
handleClose();
|
|
7949
8038
|
blur();
|
|
7950
8039
|
}
|
|
7951
|
-
filterQuery.value = "";
|
|
7952
8040
|
};
|
|
7953
8041
|
const tagDelete = (data) => {
|
|
7954
8042
|
let { modelValue } = props;
|
|
@@ -7966,15 +8054,17 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
7966
8054
|
ctx.emit("remove-tag", data.value);
|
|
7967
8055
|
getMultipleSelected(checkedItems);
|
|
7968
8056
|
};
|
|
7969
|
-
const onFocus = (
|
|
7970
|
-
ctx.emit("focus", e);
|
|
8057
|
+
const onFocus = () => {
|
|
7971
8058
|
if (!selectDisabled.value) {
|
|
7972
8059
|
isSelectFocus.value = true;
|
|
7973
8060
|
}
|
|
7974
8061
|
};
|
|
7975
|
-
const onBlur = (
|
|
7976
|
-
ctx.emit("blur", e);
|
|
8062
|
+
const onBlur = () => {
|
|
7977
8063
|
if (!selectDisabled.value) {
|
|
8064
|
+
setTimeout(() => {
|
|
8065
|
+
filterQuery.value = "";
|
|
8066
|
+
handlerQueryFunc("");
|
|
8067
|
+
}, 150);
|
|
7978
8068
|
isSelectFocus.value = false;
|
|
7979
8069
|
}
|
|
7980
8070
|
};
|
|
@@ -8007,7 +8097,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8007
8097
|
const emptyText = computed(() => {
|
|
8008
8098
|
const visibleOptionsCount = injectOptionsArray.value.filter((item) => {
|
|
8009
8099
|
const label = item.name || item.value;
|
|
8010
|
-
return label.toString().toLocaleLowerCase().includes(filterQuery.value.
|
|
8100
|
+
return label.toString().toLocaleLowerCase().includes(filterQuery.value.trim().toLocaleLowerCase());
|
|
8011
8101
|
}).length;
|
|
8012
8102
|
if (isLoading.value) {
|
|
8013
8103
|
return props.loadingText || t("loadingText");
|
|
@@ -8034,7 +8124,8 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8034
8124
|
}
|
|
8035
8125
|
};
|
|
8036
8126
|
watch(() => props.modelValue, () => {
|
|
8037
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch((
|
|
8127
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch(() => {
|
|
8128
|
+
});
|
|
8038
8129
|
updateInjectOptionsStatus();
|
|
8039
8130
|
}, { deep: true });
|
|
8040
8131
|
watch(injectOptions, () => {
|
|
@@ -8049,10 +8140,17 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8049
8140
|
(_a = dropdownRef.value) == null ? void 0 : _a.updatePosition();
|
|
8050
8141
|
}
|
|
8051
8142
|
}, { flush: "post" });
|
|
8143
|
+
watch(isSelectFocus, (val) => {
|
|
8144
|
+
if (val) {
|
|
8145
|
+
ctx.emit("focus");
|
|
8146
|
+
} else {
|
|
8147
|
+
ctx.emit("blur");
|
|
8148
|
+
}
|
|
8149
|
+
});
|
|
8150
|
+
onMounted(updateInjectOptionsStatus);
|
|
8052
8151
|
return {
|
|
8053
8152
|
selectDisabled,
|
|
8054
8153
|
selectSize,
|
|
8055
|
-
originRef,
|
|
8056
8154
|
dropdownRef,
|
|
8057
8155
|
isOpen,
|
|
8058
8156
|
selectCls,
|
|
@@ -8077,7 +8175,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
|
|
|
8077
8175
|
}
|
|
8078
8176
|
const selectProps = {
|
|
8079
8177
|
modelValue: {
|
|
8080
|
-
type: [String, Number, Array],
|
|
8178
|
+
type: [String, Number, Array, Boolean],
|
|
8081
8179
|
default: ""
|
|
8082
8180
|
},
|
|
8083
8181
|
"onUpdate:modelValue": {
|
|
@@ -8092,6 +8190,10 @@ const selectProps = {
|
|
|
8092
8190
|
type: String,
|
|
8093
8191
|
default: ""
|
|
8094
8192
|
},
|
|
8193
|
+
position: {
|
|
8194
|
+
type: Array,
|
|
8195
|
+
default: () => ["bottom", "top"]
|
|
8196
|
+
},
|
|
8095
8197
|
overview: {
|
|
8096
8198
|
type: String,
|
|
8097
8199
|
default: "border"
|
|
@@ -8163,6 +8265,10 @@ const selectProps = {
|
|
|
8163
8265
|
multipleLimit: {
|
|
8164
8266
|
type: Number,
|
|
8165
8267
|
default: 0
|
|
8268
|
+
},
|
|
8269
|
+
showEmptyWhenUnmatched: {
|
|
8270
|
+
type: Boolean,
|
|
8271
|
+
default: true
|
|
8166
8272
|
}
|
|
8167
8273
|
};
|
|
8168
8274
|
const optionProps = {
|
|
@@ -8301,29 +8407,6 @@ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
8301
8407
|
}
|
|
8302
8408
|
});
|
|
8303
8409
|
const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
|
|
8304
|
-
function createBem(namespace, element, modifier) {
|
|
8305
|
-
let cls = namespace;
|
|
8306
|
-
if (element) {
|
|
8307
|
-
cls += `__${element}`;
|
|
8308
|
-
}
|
|
8309
|
-
if (modifier) {
|
|
8310
|
-
cls += `--${modifier}`;
|
|
8311
|
-
}
|
|
8312
|
-
return cls;
|
|
8313
|
-
}
|
|
8314
|
-
function useNamespace(block, needDot = false) {
|
|
8315
|
-
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
8316
|
-
const b = () => createBem(namespace);
|
|
8317
|
-
const e = (element) => element ? createBem(namespace, element) : "";
|
|
8318
|
-
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
8319
|
-
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
8320
|
-
return {
|
|
8321
|
-
b,
|
|
8322
|
-
e,
|
|
8323
|
-
m,
|
|
8324
|
-
em
|
|
8325
|
-
};
|
|
8326
|
-
}
|
|
8327
8410
|
function useCheckbox(props, ctx) {
|
|
8328
8411
|
const formContext = inject(FORM_TOKEN, void 0);
|
|
8329
8412
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
@@ -8482,7 +8565,7 @@ var Checkbox = defineComponent({
|
|
|
8482
8565
|
props: checkboxProps,
|
|
8483
8566
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8484
8567
|
setup(props, ctx) {
|
|
8485
|
-
const ns2 = useNamespace("checkbox");
|
|
8568
|
+
const ns2 = useNamespace$1("checkbox");
|
|
8486
8569
|
const {
|
|
8487
8570
|
mergedChecked,
|
|
8488
8571
|
mergedDisabled,
|
|
@@ -8583,7 +8666,7 @@ defineComponent({
|
|
|
8583
8666
|
props: checkboxGroupProps,
|
|
8584
8667
|
emits: ["change", "update:modelValue"],
|
|
8585
8668
|
setup(props, ctx) {
|
|
8586
|
-
const ns2 = useNamespace("checkbox");
|
|
8669
|
+
const ns2 = useNamespace$1("checkbox");
|
|
8587
8670
|
const {
|
|
8588
8671
|
defaultOpt
|
|
8589
8672
|
} = useCheckboxGroup(props, ctx);
|
|
@@ -8629,7 +8712,7 @@ defineComponent({
|
|
|
8629
8712
|
props: checkboxProps,
|
|
8630
8713
|
emits: ["change", "update:checked", "update:modelValue"],
|
|
8631
8714
|
setup(props, ctx) {
|
|
8632
|
-
const ns2 = useNamespace("checkbox-button");
|
|
8715
|
+
const ns2 = useNamespace$1("checkbox-button");
|
|
8633
8716
|
const {
|
|
8634
8717
|
mergedChecked,
|
|
8635
8718
|
mergedDisabled,
|
|
@@ -8692,20 +8775,23 @@ function useOption(props) {
|
|
|
8692
8775
|
return select2.modelValue === props.value;
|
|
8693
8776
|
}
|
|
8694
8777
|
});
|
|
8778
|
+
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8695
8779
|
const optionItem = computed(() => {
|
|
8696
8780
|
return {
|
|
8697
8781
|
name: props.name || props.value + "" || "",
|
|
8698
8782
|
value: props.value,
|
|
8699
8783
|
create: props.create,
|
|
8700
|
-
_checked: false
|
|
8784
|
+
_checked: false,
|
|
8785
|
+
disabled: isDisabled.value
|
|
8701
8786
|
};
|
|
8702
8787
|
});
|
|
8703
|
-
const isDisabled = computed(() => props.disabled || ((optionGroup == null ? void 0 : optionGroup.disabled) ? true : false));
|
|
8704
8788
|
const isObjectOption = ref(!!props.name);
|
|
8705
8789
|
const selectOptionCls = computed(() => {
|
|
8706
8790
|
return className(ns2.e("item"), {
|
|
8707
8791
|
active: isOptionSelected.value,
|
|
8708
|
-
disabled: isDisabled.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"
|
|
8709
8795
|
});
|
|
8710
8796
|
});
|
|
8711
8797
|
const optionSelect = () => {
|
|
@@ -8821,7 +8907,7 @@ const tagProps = {
|
|
|
8821
8907
|
}
|
|
8822
8908
|
};
|
|
8823
8909
|
function useClass(props) {
|
|
8824
|
-
const ns2 = useNamespace
|
|
8910
|
+
const ns2 = useNamespace("tag");
|
|
8825
8911
|
return computed(() => {
|
|
8826
8912
|
const { type: type4, color, deletable } = props;
|
|
8827
8913
|
return `${ns2.e("item")} ${ns2.m(type4 || (color ? "colorful" : "") || "default")} ${deletable ? ns2.m("deletable") : ""} ${ns2.m(props.size)}`;
|
|
@@ -8863,7 +8949,7 @@ var Tag = defineComponent({
|
|
|
8863
8949
|
slots,
|
|
8864
8950
|
emit
|
|
8865
8951
|
}) {
|
|
8866
|
-
const ns2 = useNamespace
|
|
8952
|
+
const ns2 = useNamespace("tag");
|
|
8867
8953
|
const {
|
|
8868
8954
|
type: type4,
|
|
8869
8955
|
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
|