vue-devui 1.0.0-rc.6 → 1.0.0-rc.9
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/README.md +5 -0
- package/alert/index.es.js +37 -11
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +311 -77
- package/auto-complete/index.umd.js +3 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5632 -87
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +56 -29
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +364 -234
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +310 -157
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +28 -3
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +125 -45
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +437 -22
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +490 -605
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +109 -13
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +330 -130
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +272 -199
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +126 -27
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +125 -25
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/overlay/index.es.js +31 -9
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +2 -1
- package/pagination/index.es.js +135 -124
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +198 -83
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/index.es.js +76 -20
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +161 -140
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +48 -16
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +108 -12
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +379 -167
- package/search/index.umd.js +17 -17
- package/search/style.css +1 -1
- package/select/index.es.js +7339 -556
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +37 -12
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +34 -10
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +201 -84
- package/splitter/index.umd.js +14 -14
- package/splitter/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +30 -6
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +6808 -585
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +136 -70
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +31 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +5631 -80
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/timeline/index.es.js +108 -12
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +190 -74
- package/tooltip/index.umd.js +17 -17
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +376 -256
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +138 -34
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +6770 -5769
- package/vue-devui.umd.js +27 -21
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/commentProps.js +0 -3
- package/nuxt/components/readTipProps.js +0 -3
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
|
@@ -18,7 +18,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18
18
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
|
-
import { ref, nextTick, defineComponent, createVNode, h, render, inject, withDirectives, createTextVNode, resolveDirective, vShow, unref, watch, onUnmounted, mergeProps,
|
|
21
|
+
import { ref, nextTick, toRefs, computed, defineComponent, createVNode, h, render, inject, withDirectives, createTextVNode, resolveDirective, vShow, unref, watch, onUnmounted, mergeProps, resolveDynamicComponent, provide, Teleport, Transition, isVNode } from "vue";
|
|
22
22
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
23
23
|
const defaultFormatter = (item) => {
|
|
24
24
|
if (typeof item === "string") {
|
|
@@ -115,6 +115,26 @@ const autoCompleteProps = {
|
|
|
115
115
|
loadMore: {
|
|
116
116
|
type: Function,
|
|
117
117
|
default: null
|
|
118
|
+
},
|
|
119
|
+
placeholder: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "Search"
|
|
122
|
+
},
|
|
123
|
+
prefix: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: ""
|
|
126
|
+
},
|
|
127
|
+
suffix: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: ""
|
|
130
|
+
},
|
|
131
|
+
size: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "md"
|
|
134
|
+
},
|
|
135
|
+
clearable: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: false
|
|
118
138
|
}
|
|
119
139
|
};
|
|
120
140
|
const DropdownPropsKey = Symbol("DropdownPropsKey");
|
|
@@ -239,6 +259,11 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
239
259
|
};
|
|
240
260
|
const onBlur = () => {
|
|
241
261
|
isFocus.value = false;
|
|
262
|
+
ctx2.emit("blur");
|
|
263
|
+
};
|
|
264
|
+
const onClear = () => {
|
|
265
|
+
ctx2.emit("update:modelValue", "");
|
|
266
|
+
ctx2.emit("clear");
|
|
242
267
|
};
|
|
243
268
|
const handleClose = () => {
|
|
244
269
|
visible.value = false;
|
|
@@ -263,6 +288,7 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
263
288
|
onInput,
|
|
264
289
|
onFocus,
|
|
265
290
|
onBlur,
|
|
291
|
+
onClear,
|
|
266
292
|
isFocus,
|
|
267
293
|
inputRef,
|
|
268
294
|
visible,
|
|
@@ -382,6 +408,69 @@ function useKeyBoardHandle(dropDownRef, visible, searchList, selectedIndex, sear
|
|
|
382
408
|
handlekeyDown
|
|
383
409
|
};
|
|
384
410
|
}
|
|
411
|
+
function createBem(namespace, element, modifier) {
|
|
412
|
+
let cls = namespace;
|
|
413
|
+
if (element) {
|
|
414
|
+
cls += `__${element}`;
|
|
415
|
+
}
|
|
416
|
+
if (modifier) {
|
|
417
|
+
cls += `--${modifier}`;
|
|
418
|
+
}
|
|
419
|
+
return cls;
|
|
420
|
+
}
|
|
421
|
+
function useNamespace(block, needDot = false) {
|
|
422
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
423
|
+
const b = () => createBem(namespace);
|
|
424
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
425
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
426
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
427
|
+
return {
|
|
428
|
+
b,
|
|
429
|
+
e,
|
|
430
|
+
m,
|
|
431
|
+
em
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function useAutoCompleteRender(props, ctx2, visible, isFocus) {
|
|
435
|
+
const ns = useNamespace("auto-complete");
|
|
436
|
+
const inputNs = useNamespace("auto-complete-input");
|
|
437
|
+
const slotNs = useNamespace("auto-complete-slot");
|
|
438
|
+
const formNs = useNamespace("form-group");
|
|
439
|
+
const feedbackNs = useNamespace("has-feedback");
|
|
440
|
+
const selectNs = useNamespace("select-open");
|
|
441
|
+
const formControlNs = useNamespace("form-control");
|
|
442
|
+
const dropdownNs = useNamespace("dropdown-origin");
|
|
443
|
+
const dropdownOpenNs = useNamespace("dropdown-origin-open");
|
|
444
|
+
const { disabled } = toRefs(props);
|
|
445
|
+
const slots = ctx2.slots;
|
|
446
|
+
const autoCompleteTopClasses = computed(() => ({
|
|
447
|
+
[ns.b()]: true,
|
|
448
|
+
[ns.m(props.size)]: true,
|
|
449
|
+
[formNs.b()]: true,
|
|
450
|
+
[feedbackNs.b()]: true,
|
|
451
|
+
[selectNs.b()]: visible.value
|
|
452
|
+
}));
|
|
453
|
+
const inputClasses = computed(() => ({
|
|
454
|
+
[inputNs.b()]: true,
|
|
455
|
+
[ns.m("focus")]: isFocus.value,
|
|
456
|
+
[slotNs.b()]: slots.prepend || slots.append || props.prefix || props.suffix,
|
|
457
|
+
[ns.m("append")]: slots.append,
|
|
458
|
+
[ns.m("prepend")]: slots.prepend
|
|
459
|
+
}));
|
|
460
|
+
const inputWrapperClasses = computed(() => ({
|
|
461
|
+
[inputNs.e("wrapper")]: true,
|
|
462
|
+
[ns.m("disabled")]: disabled.value
|
|
463
|
+
}));
|
|
464
|
+
const inputInnerClasses = computed(() => [
|
|
465
|
+
{
|
|
466
|
+
[formControlNs.b()]: true,
|
|
467
|
+
[dropdownNs.b()]: true,
|
|
468
|
+
[dropdownOpenNs.b()]: isFocus.value,
|
|
469
|
+
["disabled"]: disabled.value
|
|
470
|
+
}
|
|
471
|
+
]);
|
|
472
|
+
return { autoCompleteTopClasses, inputClasses, inputWrapperClasses, inputInnerClasses };
|
|
473
|
+
}
|
|
385
474
|
class View {
|
|
386
475
|
constructor() {
|
|
387
476
|
__publicField(this, "top", "50%");
|
|
@@ -450,27 +539,28 @@ var Loading = defineComponent({
|
|
|
450
539
|
message,
|
|
451
540
|
$slots
|
|
452
541
|
} = this;
|
|
542
|
+
const ns = useNamespace("loading");
|
|
453
543
|
return isShow && createVNode("div", {
|
|
454
|
-
"class": [
|
|
544
|
+
"class": [ns.b(), isFull ? ns.m("full") : ""]
|
|
455
545
|
}, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
|
|
456
|
-
"class": "
|
|
546
|
+
"class": ns.e("wrapper")
|
|
457
547
|
}, [backdrop ? createVNode("div", {
|
|
458
|
-
"class": "
|
|
548
|
+
"class": ns.e("mask")
|
|
459
549
|
}, null) : null, createVNode("div", {
|
|
460
550
|
"style": style,
|
|
461
|
-
"class": "
|
|
551
|
+
"class": ns.e("area")
|
|
462
552
|
}, [createVNode("div", {
|
|
463
|
-
"class": "
|
|
553
|
+
"class": ns.e("busy-default-spinner")
|
|
464
554
|
}, [createVNode("div", {
|
|
465
|
-
"class": "
|
|
555
|
+
"class": ns.e("bar1")
|
|
466
556
|
}, null), createVNode("div", {
|
|
467
|
-
"class": "
|
|
557
|
+
"class": ns.e("bar2")
|
|
468
558
|
}, null), createVNode("div", {
|
|
469
|
-
"class": "
|
|
559
|
+
"class": ns.e("bar3")
|
|
470
560
|
}, null), createVNode("div", {
|
|
471
|
-
"class": "
|
|
561
|
+
"class": ns.e("bar4")
|
|
472
562
|
}, null)]), message ? createVNode("span", {
|
|
473
|
-
"class": "
|
|
563
|
+
"class": ns.e("text")
|
|
474
564
|
}, [message]) : null])])]);
|
|
475
565
|
}
|
|
476
566
|
});
|
|
@@ -615,6 +705,10 @@ var DAutoCompleteDropdown = defineComponent({
|
|
|
615
705
|
disabledKey,
|
|
616
706
|
isSearching
|
|
617
707
|
} = propsData.props;
|
|
708
|
+
const ns = useNamespace("auto-complete");
|
|
709
|
+
const noDataNs = useNamespace("no-data-tip");
|
|
710
|
+
const dropdownMenuNs = useNamespace("dropdown-menu");
|
|
711
|
+
const dropdownItemNs = useNamespace("dropdown-item");
|
|
618
712
|
const onSelect = (item) => {
|
|
619
713
|
item = valueParser.value(item);
|
|
620
714
|
if (typeof item === "object" && item[disabledKey]) {
|
|
@@ -624,35 +718,35 @@ var DAutoCompleteDropdown = defineComponent({
|
|
|
624
718
|
};
|
|
625
719
|
return () => {
|
|
626
720
|
return withDirectives(createVNode("div", {
|
|
627
|
-
"class": [
|
|
721
|
+
"class": [dropdownMenuNs.b(), ns.e("dropdown-menu-cdk"), disabled && "disabled", latestSource.value && ns.e("dropdown-latestSource")]
|
|
628
722
|
}, [createVNode("ul", {
|
|
629
723
|
"ref": dropDownRef,
|
|
630
|
-
"class": "
|
|
724
|
+
"class": [ns.e("list-unstyled"), "scroll-height"],
|
|
631
725
|
"style": {
|
|
632
726
|
maxHeight: `${maxHeight}px`
|
|
633
727
|
},
|
|
634
728
|
"onScroll": loadMore
|
|
635
729
|
}, [isSearching && ctx2.slots.searchingTemplate && (searchStatus == null ? void 0 : searchStatus.value) && createVNode("li", {
|
|
636
|
-
"class": "
|
|
730
|
+
"class": ns.e("searching-template")
|
|
637
731
|
}, [createVNode("div", {
|
|
638
|
-
"class":
|
|
732
|
+
"class": noDataNs.b()
|
|
639
733
|
}, [ctx2.slots.searchingTemplate()])]), latestSource.value && !modelValue.value && createVNode("li", {
|
|
640
|
-
"class": "
|
|
734
|
+
"class": ns.e("popup-tips")
|
|
641
735
|
}, [createTextVNode("\u6700\u8FD1\u8F93\u5165")]), !showNoResultItemTemplate.value && !(searchStatus == null ? void 0 : searchStatus.value) && searchList != null && searchList.value.length > 0 && searchList.value.map((item, index2) => {
|
|
642
736
|
return createVNode("li", {
|
|
643
737
|
"onClick": () => onSelect(item),
|
|
644
|
-
"class": [
|
|
645
|
-
|
|
738
|
+
"class": [dropdownItemNs.b(), selectedIndex.value === index2 && "selected", {
|
|
739
|
+
disabled: disabledKey && typeof item === "object" && item[disabledKey]
|
|
646
740
|
}, {
|
|
647
|
-
"
|
|
741
|
+
[ns.e("dropdown-bg")]: hoverIndex.value === index2
|
|
648
742
|
}],
|
|
649
743
|
"title": formatter(item),
|
|
650
744
|
"key": formatter(item)
|
|
651
745
|
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(item, index2) : formatter(item)]);
|
|
652
746
|
}), !(searchStatus == null ? void 0 : searchStatus.value) && searchList.value.length === 0 && ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value && createVNode("li", {
|
|
653
|
-
"class": "
|
|
747
|
+
"class": ns.e("no-result-template")
|
|
654
748
|
}, [createVNode("div", {
|
|
655
|
-
"class":
|
|
749
|
+
"class": noDataNs.b()
|
|
656
750
|
}, [ctx2.slots.noResultItemTemplate()])])])]), [[resolveDirective("dLoading"), showLoading.value], [vShow, visible.value && searchList.value.length > 0 || ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value || isSearching && ctx2.slots.searchingTemplate && (searchStatus == null ? void 0 : searchStatus.value)]]);
|
|
657
751
|
};
|
|
658
752
|
}
|
|
@@ -856,6 +950,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
856
950
|
emit,
|
|
857
951
|
expose
|
|
858
952
|
}) {
|
|
953
|
+
const ns = useNamespace("flexible-overlay");
|
|
859
954
|
const {
|
|
860
955
|
arrowRef,
|
|
861
956
|
overlayRef,
|
|
@@ -868,15 +963,135 @@ const FlexibleOverlay = defineComponent({
|
|
|
868
963
|
var _a;
|
|
869
964
|
return props.modelValue && createVNode("div", mergeProps({
|
|
870
965
|
"ref": overlayRef,
|
|
871
|
-
"class":
|
|
966
|
+
"class": ns.b()
|
|
872
967
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
873
968
|
"ref": arrowRef,
|
|
874
|
-
"class": "
|
|
969
|
+
"class": ns.e("arrow")
|
|
875
970
|
}, null)]);
|
|
876
971
|
};
|
|
877
972
|
}
|
|
878
973
|
});
|
|
879
974
|
var autoComplete = "";
|
|
975
|
+
function isUrl(value) {
|
|
976
|
+
return /^((http|https):)?\/\//.test(value);
|
|
977
|
+
}
|
|
978
|
+
const DEFAULT_PREFIX = "icon";
|
|
979
|
+
const iconProps = {
|
|
980
|
+
name: {
|
|
981
|
+
type: String,
|
|
982
|
+
default: "",
|
|
983
|
+
required: true
|
|
984
|
+
},
|
|
985
|
+
size: {
|
|
986
|
+
type: [Number, String],
|
|
987
|
+
default: "inherit"
|
|
988
|
+
},
|
|
989
|
+
color: {
|
|
990
|
+
type: String,
|
|
991
|
+
default: "inherit"
|
|
992
|
+
},
|
|
993
|
+
component: {
|
|
994
|
+
type: Object,
|
|
995
|
+
default: null
|
|
996
|
+
},
|
|
997
|
+
classPrefix: {
|
|
998
|
+
type: String,
|
|
999
|
+
default: DEFAULT_PREFIX
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
const svgIconProps = {
|
|
1003
|
+
name: {
|
|
1004
|
+
type: String,
|
|
1005
|
+
default: "",
|
|
1006
|
+
required: true
|
|
1007
|
+
},
|
|
1008
|
+
color: {
|
|
1009
|
+
type: String,
|
|
1010
|
+
default: "inherit"
|
|
1011
|
+
},
|
|
1012
|
+
size: {
|
|
1013
|
+
type: [Number, String],
|
|
1014
|
+
default: "inherit"
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
var icon = "";
|
|
1018
|
+
var svgIcon = defineComponent({
|
|
1019
|
+
name: "DSvgIcon",
|
|
1020
|
+
props: svgIconProps,
|
|
1021
|
+
setup(props) {
|
|
1022
|
+
const {
|
|
1023
|
+
name,
|
|
1024
|
+
color,
|
|
1025
|
+
size
|
|
1026
|
+
} = toRefs(props);
|
|
1027
|
+
const ns = useNamespace("svg-icon");
|
|
1028
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
1029
|
+
const iconSize = computed(() => {
|
|
1030
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
1031
|
+
});
|
|
1032
|
+
const styles = {
|
|
1033
|
+
width: iconSize.value,
|
|
1034
|
+
height: iconSize.value
|
|
1035
|
+
};
|
|
1036
|
+
return () => {
|
|
1037
|
+
return createVNode("svg", {
|
|
1038
|
+
"class": ns.b(),
|
|
1039
|
+
"style": styles
|
|
1040
|
+
}, [createVNode("use", {
|
|
1041
|
+
"xlink:href": iconName.value,
|
|
1042
|
+
"fill": color.value
|
|
1043
|
+
}, null)]);
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
var Icon = defineComponent({
|
|
1048
|
+
name: "DIcon",
|
|
1049
|
+
props: iconProps,
|
|
1050
|
+
setup(props, {
|
|
1051
|
+
attrs
|
|
1052
|
+
}) {
|
|
1053
|
+
const {
|
|
1054
|
+
component,
|
|
1055
|
+
name,
|
|
1056
|
+
size,
|
|
1057
|
+
color,
|
|
1058
|
+
classPrefix
|
|
1059
|
+
} = toRefs(props);
|
|
1060
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
1061
|
+
const iconSize = computed(() => {
|
|
1062
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
1063
|
+
});
|
|
1064
|
+
const svgIconDom = () => {
|
|
1065
|
+
return createVNode(IconComponent, mergeProps({
|
|
1066
|
+
"name": name.value,
|
|
1067
|
+
"color": color.value,
|
|
1068
|
+
"size": iconSize.value
|
|
1069
|
+
}, attrs), null);
|
|
1070
|
+
};
|
|
1071
|
+
const imgIconDom = () => {
|
|
1072
|
+
return createVNode("img", mergeProps({
|
|
1073
|
+
"src": name.value,
|
|
1074
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
1075
|
+
"style": {
|
|
1076
|
+
width: iconSize.value || ""
|
|
1077
|
+
}
|
|
1078
|
+
}, attrs), null);
|
|
1079
|
+
};
|
|
1080
|
+
const fontIconDom = () => {
|
|
1081
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
1082
|
+
return createVNode("i", mergeProps({
|
|
1083
|
+
"class": [classPrefix.value, fontIconClass],
|
|
1084
|
+
"style": {
|
|
1085
|
+
fontSize: iconSize.value,
|
|
1086
|
+
color: color.value
|
|
1087
|
+
}
|
|
1088
|
+
}, attrs), null);
|
|
1089
|
+
};
|
|
1090
|
+
return () => {
|
|
1091
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
880
1095
|
function _isSlot(s) {
|
|
881
1096
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
882
1097
|
}
|
|
@@ -886,7 +1101,7 @@ var AutoComplete = defineComponent({
|
|
|
886
1101
|
ClickOutside: clickoutsideDirective
|
|
887
1102
|
},
|
|
888
1103
|
props: autoCompleteProps,
|
|
889
|
-
emits: ["update:modelValue"],
|
|
1104
|
+
emits: ["update:modelValue", "clear", "blur"],
|
|
890
1105
|
setup(props, ctx2) {
|
|
891
1106
|
const {
|
|
892
1107
|
disabled,
|
|
@@ -903,8 +1118,11 @@ var AutoComplete = defineComponent({
|
|
|
903
1118
|
position,
|
|
904
1119
|
latestSource,
|
|
905
1120
|
showAnimation,
|
|
906
|
-
valueParser
|
|
1121
|
+
valueParser,
|
|
1122
|
+
placeholder
|
|
907
1123
|
} = toRefs(props);
|
|
1124
|
+
const ns = useNamespace("auto-complete");
|
|
1125
|
+
const inputNs = useNamespace("auto-complete-input");
|
|
908
1126
|
const {
|
|
909
1127
|
handleSearch,
|
|
910
1128
|
searchList,
|
|
@@ -915,6 +1133,7 @@ var AutoComplete = defineComponent({
|
|
|
915
1133
|
onInput,
|
|
916
1134
|
onFocus,
|
|
917
1135
|
onBlur,
|
|
1136
|
+
onClear,
|
|
918
1137
|
inputRef,
|
|
919
1138
|
isFocus,
|
|
920
1139
|
visible,
|
|
@@ -938,6 +1157,12 @@ var AutoComplete = defineComponent({
|
|
|
938
1157
|
hoverIndex,
|
|
939
1158
|
handlekeyDown
|
|
940
1159
|
} = useKeyBoardHandle(dropDownRef, visible, searchList, selectedIndex, searchStatus, showNoResultItemTemplate, selectOptionClick, handleClose);
|
|
1160
|
+
const {
|
|
1161
|
+
autoCompleteTopClasses,
|
|
1162
|
+
inputClasses,
|
|
1163
|
+
inputWrapperClasses,
|
|
1164
|
+
inputInnerClasses
|
|
1165
|
+
} = useAutoCompleteRender(props, ctx2, visible, isFocus);
|
|
941
1166
|
provide(DropdownPropsKey, {
|
|
942
1167
|
props,
|
|
943
1168
|
visible,
|
|
@@ -956,81 +1181,90 @@ var AutoComplete = defineComponent({
|
|
|
956
1181
|
valueParser
|
|
957
1182
|
});
|
|
958
1183
|
const origin = ref();
|
|
1184
|
+
const prefixVisible = ctx2.slots.prefix || props.prefix;
|
|
1185
|
+
const suffixVisible = ctx2.slots.suffix || props.suffix || props.clearable;
|
|
1186
|
+
const showClearable = computed(() => props.clearable && !props.disabled);
|
|
1187
|
+
const renderBasicDropdown = () => {
|
|
1188
|
+
let _slot;
|
|
1189
|
+
return createVNode(Transition, {
|
|
1190
|
+
"name": showAnimation ? "fade" : ""
|
|
1191
|
+
}, {
|
|
1192
|
+
default: () => [createVNode(FlexibleOverlay, {
|
|
1193
|
+
"show-arrow": true,
|
|
1194
|
+
"origin": origin.value,
|
|
1195
|
+
"position": position.value,
|
|
1196
|
+
"modelValue": visible.value,
|
|
1197
|
+
"onUpdate:modelValue": ($event) => visible.value = $event
|
|
1198
|
+
}, {
|
|
1199
|
+
default: () => [createVNode("div", {
|
|
1200
|
+
"class": ns.e("menu"),
|
|
1201
|
+
"style": {
|
|
1202
|
+
width: `
|
|
1203
|
+
${width.value + "px"}
|
|
1204
|
+
`
|
|
1205
|
+
}
|
|
1206
|
+
}, [createVNode(DAutoCompleteDropdown, null, _isSlot(_slot = customRenderSolts()) ? _slot : {
|
|
1207
|
+
default: () => [_slot]
|
|
1208
|
+
})])]
|
|
1209
|
+
})]
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
959
1212
|
const renderDropdown = () => {
|
|
960
1213
|
if (appendToBody.value) {
|
|
961
|
-
let
|
|
1214
|
+
let _slot2;
|
|
962
1215
|
return createVNode(Teleport, {
|
|
963
1216
|
"to": "body"
|
|
964
|
-
}, {
|
|
965
|
-
default: () => [
|
|
966
|
-
"name": showAnimation ? "fade" : ""
|
|
967
|
-
}, {
|
|
968
|
-
default: () => [createVNode(FlexibleOverlay, {
|
|
969
|
-
"show-arrow": true,
|
|
970
|
-
"origin": origin.value,
|
|
971
|
-
"position": position.value,
|
|
972
|
-
"modelValue": visible.value,
|
|
973
|
-
"onUpdate:modelValue": ($event) => visible.value = $event
|
|
974
|
-
}, {
|
|
975
|
-
default: () => [createVNode("div", {
|
|
976
|
-
"class": "devui-auto-complete-menu",
|
|
977
|
-
"style": {
|
|
978
|
-
width: `
|
|
979
|
-
${width.value + "px"}
|
|
980
|
-
`
|
|
981
|
-
}
|
|
982
|
-
}, [createVNode(DAutoCompleteDropdown, null, _isSlot(_slot = customRenderSolts()) ? _slot : {
|
|
983
|
-
default: () => [_slot]
|
|
984
|
-
})])]
|
|
985
|
-
})]
|
|
986
|
-
})]
|
|
1217
|
+
}, _isSlot(_slot2 = renderBasicDropdown()) ? _slot2 : {
|
|
1218
|
+
default: () => [_slot2]
|
|
987
1219
|
});
|
|
988
1220
|
} else {
|
|
989
|
-
|
|
990
|
-
return createVNode(Transition, {
|
|
991
|
-
"name": showAnimation ? "fade" : ""
|
|
992
|
-
}, {
|
|
993
|
-
default: () => [createVNode(FlexibleOverlay, {
|
|
994
|
-
"show-arrow": true,
|
|
995
|
-
"origin": origin.value,
|
|
996
|
-
"position": position.value,
|
|
997
|
-
"modelValue": visible.value,
|
|
998
|
-
"onUpdate:modelValue": ($event) => visible.value = $event
|
|
999
|
-
}, {
|
|
1000
|
-
default: () => [createVNode("div", {
|
|
1001
|
-
"class": "devui-auto-complete-menu",
|
|
1002
|
-
"style": {
|
|
1003
|
-
width: `
|
|
1004
|
-
${width.value + "px"}
|
|
1005
|
-
`
|
|
1006
|
-
}
|
|
1007
|
-
}, [createVNode(DAutoCompleteDropdown, null, _isSlot(_slot2 = customRenderSolts()) ? _slot2 : {
|
|
1008
|
-
default: () => [_slot2]
|
|
1009
|
-
})])]
|
|
1010
|
-
})]
|
|
1011
|
-
});
|
|
1221
|
+
return renderBasicDropdown();
|
|
1012
1222
|
}
|
|
1013
1223
|
};
|
|
1014
1224
|
return () => {
|
|
1225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1015
1226
|
return withDirectives(createVNode("div", {
|
|
1016
|
-
"class":
|
|
1227
|
+
"class": autoCompleteTopClasses.value,
|
|
1017
1228
|
"ref": origin,
|
|
1018
1229
|
"style": {
|
|
1019
1230
|
width: `${width.value + "px"}`
|
|
1020
1231
|
}
|
|
1021
|
-
}, [createVNode("
|
|
1232
|
+
}, [createVNode("div", {
|
|
1233
|
+
"class": inputClasses.value
|
|
1234
|
+
}, [ctx2.slots.prepend && createVNode("div", {
|
|
1235
|
+
"class": inputNs.e("prepend")
|
|
1236
|
+
}, [(_b = (_a = ctx2.slots).prepend) == null ? void 0 : _b.call(_a)]), createVNode("div", {
|
|
1237
|
+
"class": inputWrapperClasses.value
|
|
1238
|
+
}, [prefixVisible && createVNode("span", {
|
|
1239
|
+
"class": inputNs.e("prefix")
|
|
1240
|
+
}, [ctx2.slots.prefix && createVNode("div", null, [(_d = (_c = ctx2.slots).prefix) == null ? void 0 : _d.call(_c)]), props.prefix && createVNode(Icon, {
|
|
1241
|
+
"size": "inherit",
|
|
1242
|
+
"name": props.prefix
|
|
1243
|
+
}, null)]), createVNode("input", {
|
|
1022
1244
|
"disabled": disabled.value,
|
|
1023
1245
|
"type": "text",
|
|
1024
1246
|
"onClick": toggleMenu,
|
|
1025
|
-
"class":
|
|
1026
|
-
"placeholder":
|
|
1247
|
+
"class": inputInnerClasses.value,
|
|
1248
|
+
"placeholder": placeholder.value,
|
|
1027
1249
|
"onInput": onInput,
|
|
1028
1250
|
"onFocus": onFocus,
|
|
1029
1251
|
"onBlur": onBlur,
|
|
1030
1252
|
"value": modelValue.value,
|
|
1031
1253
|
"ref": inputRef,
|
|
1032
1254
|
"onKeydown": handlekeyDown
|
|
1033
|
-
}, null),
|
|
1255
|
+
}, null), suffixVisible && createVNode("span", {
|
|
1256
|
+
"class": inputNs.e("suffix")
|
|
1257
|
+
}, [props.suffix && createVNode(Icon, {
|
|
1258
|
+
"size": "inherit",
|
|
1259
|
+
"name": props.suffix
|
|
1260
|
+
}, null), ctx2.slots.suffix && createVNode("div", null, [(_f = (_e = ctx2.slots).suffix) == null ? void 0 : _f.call(_e)]), showClearable.value && createVNode(Icon, {
|
|
1261
|
+
"size": props.size,
|
|
1262
|
+
"class": ns.em("clear", "icon"),
|
|
1263
|
+
"name": "close",
|
|
1264
|
+
"onClick": onClear
|
|
1265
|
+
}, null)])]), ctx2.slots.append && createVNode("div", {
|
|
1266
|
+
"class": inputNs.e("append")
|
|
1267
|
+
}, [(_h = (_g = ctx2.slots).append) == null ? void 0 : _h.call(_g)])]), renderDropdown()]), [[resolveDirective("click-outside"), handleClose]]);
|
|
1034
1268
|
};
|
|
1035
1269
|
}
|
|
1036
1270
|
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var je=Object.defineProperty;var de=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable;var $=(m,t,g)=>t in m?je(m,t,{enumerable:!0,configurable:!0,writable:!0,value:g}):m[t]=g,D=(m,t)=>{for(var g in t||(t={}))Me.call(t,g)&&$(m,g,t[g]);if(de)for(var g of de(t))He.call(t,g)&&$(m,g,t[g]);return m};var C=(m,t,g)=>($(m,typeof t!="symbol"?t+"":t,g),g);(function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.index={},m.Vue,m.dom))})(this,function(m,t,g){"use strict";const K={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},position:{type:Array,default:["bottom-end"]},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>typeof e=="string"?e:e!==null?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},width:{type:Number,default:400},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},R=Symbol("DropdownPropsKey");function ce(e,n){const o=(r,u)=>{const i={item:r,index:u};return e.slots.item?e.slots.item(i):null},a=()=>e.slots.nothing?e.slots.nothing(n.value):null,l=()=>e.slots.searching?e.slots.searching(n.value):null;return{customRenderSolts:()=>{const r={};return e.slots.item&&(r.itemTemplate=o),e.slots.nothing&&(r.noResultItemTemplate=a),e.slots.searching&&(r.searchingTemplate=l),r}}}function fe(e,n,o,a,l){const s=t.ref([]),r=t.ref(!1),u=d=>{const v=[];return o.value.forEach(c=>{let p=l.value(c);p=p.toLowerCase(),p.startsWith(d)&&v.push(c)}),v};return{handleSearch:async(d,v=!1)=>{if(d===""&&!n.value){s.value=[],r.value=!1;return}let c=[];d=d.toLowerCase(),v?c=o.value:a.value?c=await a.value(d):c=u(d),s.value=c,s.value.length===0?r.value=!0:r.value=!1},recentlyFocus:d=>{d&&(s.value=d)},searchList:s,showNoResultItemTemplate:r}}function pe(e,n,o,a,l,s,r,u,i,f){const d=t.ref(!1),v=t.ref(),c=t.ref(!1),p=t.ref(!1),V=((y,N)=>{let k;return M=>{k&&clearTimeout(k),k=setTimeout(async()=>{c.value=!0,await y(M),c.value=!1},N)}})(async y=>{await r(y),d.value=!0},s.value),T=y=>{const N=y.target;c.value=!1,o.value=!1,e.emit("update:modelValue",N.value),V(N.value)},b=()=>{p.value=!0,r(a.value),i(f==null?void 0:f.value),u.value&&u.value()},A=()=>{p.value=!1},S=()=>{d.value=!1,c.value=!1,o.value=!1};return{handleClose:S,toggleMenu:()=>{l.value||(d.value?S():(d.value=!0,e.slots.noResultItemTemplate&&n.value.length===0&&a.value.trim()!==""&&(o.value=!0)))},onInput:T,onFocus:b,onBlur:A,isFocus:p,inputRef:v,visible:d,searchStatus:c}}function ve(e,n,o,a,l,s){const r=t.ref(0),u=f=>{if(n.value.length===0)return 0;let d=0;return n.value.forEach((v,c)=>{typeof v=="string"?v===f&&(d=c):String(v.label)===f&&(d=c)}),d===-1?0:d};return{selectedIndex:r,selectOptionClick:async f=>{const d=l.value(f);e.emit("update:modelValue",d),s(),await a(d),r.value=u(d),o.value&&o.value(d)}}}function me(e,n,o){const a=t.ref(!1),l=t.ref(),s=()=>{if(!e.enableLazyLoad&&a)return;const u=l.value,i=u.scrollHeight,f=u.clientHeight+u.scrollTop;f>=i&&f>=e.maxHeight&&(e.loadMore(),a.value=!0)};async function r(){await o(e.modelValue,e.enableLazyLoad),a.value=!1}return n.expose({loadFinish:r}),{showLoading:a,dropDownRef:l,loadMore:s}}function ye(e,n,o,a,l,s,r,u){var v;const i=t.ref((v=a.value)!=null?v:0),f=c=>{const p=e.value,w=p.children[c];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=p.getBoundingClientRect(),V=w.getBoundingClientRect();(V.bottom>h.bottom||V.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:c=>{var h;const p=c.key||c.code;if(p==="Escape"&&(n.value&&o.value.length||l.value||s.value)){u();return}const w=n.value&&o.value.length&&!l.value&&!s.value;if(p==="ArrowDown"&&w){if(i.value===o.value.length-1){i.value=0,f(i.value);return}i.value=i.value+1,f(i.value)}else if(p==="ArrowUp"&&w){if(i.value===0){i.value=o.value.length-1,f(i.value);return}i.value=i.value-1,f(i.value)}if(p==="Enter"&&w){r(o.value[i.value]),i.value=(h=a.value)!=null?h:0;return}}}}class U{constructor(){C(this,"top","50%");C(this,"left","50%")}}const ge={message:String,backdrop:Boolean,view:{type:Object,default:()=>new U},zIndex:Number,isFull:{type:Boolean,default:!1}};class we{constructor(){C(this,"target");C(this,"message");C(this,"loadingTemplateRef");C(this,"backdrop",!0);C(this,"positionType","relative");C(this,"view",new U);C(this,"zIndex")}}var $e="",he=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ge,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var r;const{isShow:e,isFull:n,backdrop:o,style:a,message:l,$slots:s}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((r=s.default)==null?void 0:r.call(s))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:a,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),l?t.createVNode("span",{class:"devui-loading-text"},[l]):null])])])}});const Y=Symbol("dev_component_container");function be(e,n,o=null){const a=t.h(e,D({},n),o),l=document.createElement("div");return a[Y]=l,t.render(a,l),a.component}function Ve(e){t.render(null,e==null?void 0:e.vnode[Y])}const Te=t.defineComponent(he),O=new WeakSet,x=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},q=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),Ne=e=>{switch(q(e)){case"promise":return[e];case"array":return e.some(o=>q(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},X=e=>{O.delete(e),e.instance.proxy.close(),Ve(e.instance)},W=(e,n)=>{var o,a,l;if(n.value){const s=Ne(n.value);if(s==="error")return;(l=(a=(o=e==null?void 0:e.instance)==null?void 0:o.proxy)==null?void 0:a.open)==null||l.call(a),e.appendChild(e.mask),O.add(e),s&&Promise.all(s).catch(r=>{console.error(new Error("Promise handling errors"),r)}).finally(()=>{X(e)})}else X(e)},G=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},J=(e,n)=>{var s;const o=D(D({},new we),n),a=o.loadingTemplateRef,l=be(Te,D({},o),a?()=>a:null);e.style.position=o.positionType,e.options=o,e.instance=l,e.mask=(s=l==null?void 0:l.proxy)==null?void 0:s.$el},Ce={mounted:function(e,n,o){J(e,o.props),G(e),!x(n.value)&&W(e,n)},updated:function(e,n,o){!x(n.value)&&O.has(e)||x(n.value)&&!O.has(e)||(!O.has(e)&&J(e,o.props),G(e),W(e,n))}};var Q=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Ce},setup(e,n){const o=t.inject(R),{visible:a,selectedIndex:l,selectOptionClick:s,searchList:r,searchStatus:u,dropDownRef:i,loadMore:f,showLoading:d,showNoResultItemTemplate:v,latestSource:c,modelValue:p,hoverIndex:w,valueParser:h}=o,{disabled:V,maxHeight:T,formatter:b,disabledKey:A,isSearching:S}=o.props,I=y=>{y=h.value(y),!(typeof y=="object"&&y[A])&&s(y)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu","devui-dropdown-menu-cdk",V&&"disabled",c.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:f},[S&&n.slots.searchingTemplate&&(u==null?void 0:u.value)&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),c.value&&!p.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!v.value&&!(u==null?void 0:u.value)&&r!=null&&r.value.length>0&&r.value.map((y,N)=>t.createVNode("li",{onClick:()=>I(y),class:["devui-dropdown-item",l.value===N&&"selected",{disabled:A&&typeof y=="object"&&y[A]},{"devui-dropdown-bg":w.value===N}],title:b(y),key:b(y)},[n.slots.itemTemplate?n.slots.itemTemplate(y,N):b(y)])),!(u==null?void 0:u.value)&&r.value.length===0&&n.slots.noResultItemTemplate&&v.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),d.value],[t.vShow,a.value&&r.value.length>0||n.slots.noResultItemTemplate&&v.value||S&&n.slots.searchingTemplate&&(u==null?void 0:u.value)]])}});const Ae=typeof window!="undefined";function Z(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const F=Symbol("@@clickoutside"),P=new Map;let ee,B=0,te=!0;function oe(e,n,o){return Ae&&te&&(te=!1,Z(document,"mousedown",a=>{ee=a}),Z(document,"mouseup",a=>{for(const[l,s]of P)s[F].documentHandler(a,ee)})),function(a,l){!o||!n.instance||!a.target||!l.target||e.contains(a.target)||e.contains(l.target)||e===a.target||e[F].bindingFn&&e[F].bindingFn()}}const Fe={beforeMount:function(e,n,o){B++,P.set(B,e),e[F]={nid:B,documentHandler:oe(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[F].documentHandler=oe(e,n,o),e[F].bindingFn=n.value},unmounted:function(e){P.delete(e[F].nid),delete e[F]}},Se={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function Ee(e){const n=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const a=window.getComputedStyle(o);if(n.test(a.overflow+a.overflowX+a.overflowY))return o}return window}function Le(e,n,o,a){let{x:l,y:s}=n;if(!e){const{width:r,height:u}=a;l&&o.includes("start")&&(l=12),l&&o.includes("end")&&(l=Math.round(r-24)),s&&o.includes("start")&&(s=10),s&&o.includes("end")&&(s=u-14)}return{x:l,y:s}}function Oe(e,n){const o=t.ref(),a=t.ref();let l=null;const s=(u,i,f,d)=>{const{x:v,y:c}=Le(e.isArrowCenter,f,i,d.getBoundingClientRect()),p={top:"bottom",right:"left",bottom:"top",left:"right"}[i.split("-")[0]];Object.assign(u.style,{left:v?`${v}px`:"",top:c?`${c}px`:"",right:"",bottom:"",[p]:"-4px"})},r=async()=>{const u=e.origin,i=t.unref(o.value),f=t.unref(a.value),d=[g.offset(e.offset),g.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(g.arrow({element:f})),e.shiftOffset!==void 0&&d.push(g.shift());const{x:v,y:c,placement:p,middlewareData:w}=await g.computePosition(u,i,{strategy:"fixed",middleware:d});let h=v,V=c;if(e.shiftOffset!==void 0){const{x:T,y:b}=w.shift;T<0&&(h-=e.shiftOffset),T>0&&(h+=e.shiftOffset),b<0&&(V-=e.shiftOffset),b>0&&(V+=e.shiftOffset)}n("positionChange",p),Object.assign(i.style,{top:`${V}px`,left:`${h}px`}),e.showArrow&&s(f,p,w.arrow,i)};return t.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(l=Ee(e.origin),t.nextTick(r),l==null||l.addEventListener("scroll",r),l!==window&&window.addEventListener("scroll",r),window.addEventListener("resize",r)):(l==null||l.removeEventListener("scroll",r),l!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r))}),t.onUnmounted(()=>{l==null||l.removeEventListener("scroll",r),l!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}),{arrowRef:a,overlayRef:o,updatePosition:r}}var Ke="";const ne=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Se,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:a,expose:l}){const{arrowRef:s,overlayRef:r,updatePosition:u}=Oe(e,a);return l({updatePosition:u}),()=>{var i;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:r,class:"devui-flexible-overlay"},o),[(i=n.default)==null?void 0:i.call(n),e.showArrow&&t.createVNode("div",{ref:s,class:"devui-flexible-overlay-arrow"},null)])}}});var Ue="";function le(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var j=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Fe},props:K,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:a,width:l,delay:s,allowEmptyValueSearch:r,appendToBody:u,formatter:i,transInputFocusEmit:f,selectValue:d,source:v,searchFn:c,position:p,latestSource:w,showAnimation:h,valueParser:V}=t.toRefs(e),{handleSearch:T,searchList:b,showNoResultItemTemplate:A,recentlyFocus:S}=fe(n,r,v,c,i),{onInput:I,onFocus:y,onBlur:N,inputRef:k,isFocus:M,visible:E,searchStatus:ae,handleClose:H,toggleMenu:De}=pe(n,b,A,a,o,s,T,f,S,w),{selectedIndex:re,selectOptionClick:se}=ve(n,b,d,T,i,H),{showLoading:Ie,dropDownRef:ie,loadMore:Re}=me(e,n,T),{customRenderSolts:ue}=ce(n,a),{hoverIndex:xe,handlekeyDown:Pe}=ye(ie,E,b,re,ae,A,se,H);t.provide(R,{props:e,visible:E,term:"",searchList:b,selectedIndex:re,searchStatus:ae,selectOptionClick:se,dropDownRef:ie,showLoading:Ie,loadMore:Re,latestSource:w,modelValue:a,showNoResultItemTemplate:A,hoverIndex:xe,valueParser:V});const z=t.ref(),Be=()=>{if(u.value){let L;return t.createVNode(t.Teleport,{to:"body"},{default:()=>[t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(ne,{"show-arrow":!0,origin:z.value,position:p.value,modelValue:E.value,"onUpdate:modelValue":_=>E.value=_},{default:()=>[t.createVNode("div",{class:"devui-auto-complete-menu",style:{width:`
|
|
2
|
-
${
|
|
3
|
-
`}},[t.createVNode(
|
|
4
|
-
${l.value+"px"}
|
|
5
|
-
`}},[t.createVNode(Q,null,le(L=ue())?L:{default:()=>[L]})])]})]})}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",E.value&&"devui-select-open"],ref:z,style:{width:`${l.value+"px"}`}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:De,class:["devui-form-control","devui-dropdown-origin",M.value&&"devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:I,onFocus:y,onBlur:N,value:a.value,ref:k,onKeydown:Pe},null),Be()]),[[t.resolveDirective("click-outside"),H]])}}),ke={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(j.name,j)}};m.AutoComplete=j,m.DropdownPropsKey=R,m.autoCompleteProps=K,m.default=ke,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
|
|
1
|
+
var ct=Object.defineProperty;var we=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var X=(v,t,g)=>t in v?ct(v,t,{enumerable:!0,configurable:!0,writable:!0,value:g}):v[t]=g,z=(v,t)=>{for(var g in t||(t={}))dt.call(t,g)&&X(v,g,t[g]);if(we)for(var g of we(t))ft.call(t,g)&&X(v,g,t[g]);return v};var D=(v,t,g)=>(X(v,typeof t!="symbol"?t+"":t,g),g);(function(v,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(v=typeof globalThis!="undefined"?globalThis:v||self,t(v.index={},v.Vue,v.dom))})(this,function(v,t,g){"use strict";const W={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},position:{type:Array,default:["bottom-end"]},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>typeof e=="string"?e:e!==null?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},width:{type:Number,default:400},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null},placeholder:{type:String,default:"Search"},prefix:{type:String,default:""},suffix:{type:String,default:""},size:{type:String,default:"md"},clearable:{type:Boolean,default:!1}},M=Symbol("DropdownPropsKey");function be(e,o){const n=(s,r)=>{const u={item:s,index:r};return e.slots.item?e.slots.item(u):null},l=()=>e.slots.nothing?e.slots.nothing(o.value):null,a=()=>e.slots.searching?e.slots.searching(o.value):null;return{customRenderSolts:()=>{const s={};return e.slots.item&&(s.itemTemplate=n),e.slots.nothing&&(s.noResultItemTemplate=l),e.slots.searching&&(s.searchingTemplate=a),s}}}function Ne(e,o,n,l,a){const i=t.ref([]),s=t.ref(!1),r=c=>{const p=[];return n.value.forEach(d=>{let m=a.value(d);m=m.toLowerCase(),m.startsWith(c)&&p.push(d)}),p};return{handleSearch:async(c,p=!1)=>{if(c===""&&!o.value){i.value=[],s.value=!1;return}let d=[];c=c.toLowerCase(),p?d=n.value:l.value?d=await l.value(c):d=r(c),i.value=d,i.value.length===0?s.value=!0:s.value=!1},recentlyFocus:c=>{c&&(i.value=c)},searchList:i,showNoResultItemTemplate:s}}function Ve(e,o,n,l,a,i,s,r,u,f){const c=t.ref(!1),p=t.ref(),d=t.ref(!1),m=t.ref(!1),V=((A,x)=>{let O;return w=>{O&&clearTimeout(O),O=setTimeout(async()=>{d.value=!0,await A(w),d.value=!1},x)}})(async A=>{await s(A),c.value=!0},i.value),S=A=>{const x=A.target;d.value=!1,n.value=!1,e.emit("update:modelValue",x.value),V(x.value)},C=()=>{m.value=!0,s(l.value),u(f==null?void 0:f.value),r.value&&r.value()},T=()=>{m.value=!1,e.emit("blur")},E=()=>{e.emit("update:modelValue",""),e.emit("clear")},N=()=>{c.value=!1,d.value=!1,n.value=!1};return{handleClose:N,toggleMenu:()=>{a.value||(c.value?N():(c.value=!0,e.slots.noResultItemTemplate&&o.value.length===0&&l.value.trim()!==""&&(n.value=!0)))},onInput:S,onFocus:C,onBlur:T,onClear:E,isFocus:m,inputRef:p,visible:c,searchStatus:d}}function Ce(e,o,n,l,a,i){const s=t.ref(0),r=f=>{if(o.value.length===0)return 0;let c=0;return o.value.forEach((p,d)=>{typeof p=="string"?p===f&&(c=d):String(p.label)===f&&(c=d)}),c===-1?0:c};return{selectedIndex:s,selectOptionClick:async f=>{const c=a.value(f);e.emit("update:modelValue",c),i(),await l(c),s.value=r(c),n.value&&n.value(c)}}}function Se(e,o,n){const l=t.ref(!1),a=t.ref(),i=()=>{if(!e.enableLazyLoad&&l)return;const r=a.value,u=r.scrollHeight,f=r.clientHeight+r.scrollTop;f>=u&&f>=e.maxHeight&&(e.loadMore(),l.value=!0)};async function s(){await n(e.modelValue,e.enableLazyLoad),l.value=!1}return o.expose({loadFinish:s}),{showLoading:l,dropDownRef:a,loadMore:i}}function Te(e,o,n,l,a,i,s,r){var p;const u=t.ref((p=l.value)!=null?p:0),f=d=>{const m=e.value,y=m.children[d];t.nextTick(()=>{if(y.scrollIntoViewIfNeeded)y.scrollIntoViewIfNeeded(!1);else{const b=m.getBoundingClientRect(),V=y.getBoundingClientRect();(V.bottom>b.bottom||V.top<b.top)&&y.scrollIntoView(!1)}})};return{hoverIndex:u,handlekeyDown:d=>{var b;const m=d.key||d.code;if(m==="Escape"&&(o.value&&n.value.length||a.value||i.value)){r();return}const y=o.value&&n.value.length&&!a.value&&!i.value;if(m==="ArrowDown"&&y){if(u.value===n.value.length-1){u.value=0,f(u.value);return}u.value=u.value+1,f(u.value)}else if(m==="ArrowUp"&&y){if(u.value===0){u.value=n.value.length-1,f(u.value);return}u.value=u.value-1,f(u.value)}if(m==="Enter"&&y){s(n.value[u.value]),u.value=(b=l.value)!=null?b:0;return}}}}function B(e,o,n){let l=e;return o&&(l+=`__${o}`),n&&(l+=`--${n}`),l}function h(e,o=!1){const n=o?`.devui-${e}`:`devui-${e}`;return{b:()=>B(n),e:r=>r?B(n,r):"",m:r=>r?B(n,"",r):"",em:(r,u)=>r&&u?B(n,r,u):""}}function Ie(e,o,n,l){const a=h("auto-complete"),i=h("auto-complete-input"),s=h("auto-complete-slot"),r=h("form-group"),u=h("has-feedback"),f=h("select-open"),c=h("form-control"),p=h("dropdown-origin"),d=h("dropdown-origin-open"),{disabled:m}=t.toRefs(e),y=o.slots,b=t.computed(()=>({[a.b()]:!0,[a.m(e.size)]:!0,[r.b()]:!0,[u.b()]:!0,[f.b()]:n.value})),V=t.computed(()=>({[i.b()]:!0,[a.m("focus")]:l.value,[s.b()]:y.prepend||y.append||e.prefix||e.suffix,[a.m("append")]:y.append,[a.m("prepend")]:y.prepend})),S=t.computed(()=>({[i.e("wrapper")]:!0,[a.m("disabled")]:m.value})),C=t.computed(()=>[{[c.b()]:!0,[p.b()]:!0,[d.b()]:l.value,disabled:m.value}]);return{autoCompleteTopClasses:b,inputClasses:V,inputWrapperClasses:S,inputInnerClasses:C}}class Y{constructor(){D(this,"top","50%");D(this,"left","50%")}}const De={message:String,backdrop:Boolean,view:{type:Object,default:()=>new Y},zIndex:Number,isFull:{type:Boolean,default:!1}};class Ae{constructor(){D(this,"target");D(this,"message");D(this,"loadingTemplateRef");D(this,"backdrop",!0);D(this,"positionType","relative");D(this,"view",new Y);D(this,"zIndex")}}var vt="",Fe=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:De,setup(e){const o={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(o.background="none");const n=t.ref(!1);return{style:o,isShow:n,open:()=>{n.value=!0},close:()=>{n.value=!1}}},render(){var r;const{isShow:e,isFull:o,backdrop:n,style:l,message:a,$slots:i}=this,s=h("loading");return e&&t.createVNode("div",{class:[s.b(),o?s.m("full"):""]},[((r=i.default)==null?void 0:r.call(i))||t.createVNode("div",{class:s.e("wrapper")},[n?t.createVNode("div",{class:s.e("mask")},null):null,t.createVNode("div",{style:l,class:s.e("area")},[t.createVNode("div",{class:s.e("busy-default-spinner")},[t.createVNode("div",{class:s.e("bar1")},null),t.createVNode("div",{class:s.e("bar2")},null),t.createVNode("div",{class:s.e("bar3")},null),t.createVNode("div",{class:s.e("bar4")},null)]),a?t.createVNode("span",{class:s.e("text")},[a]):null])])])}});const G=Symbol("dev_component_container");function Ee(e,o,n=null){const l=t.h(e,z({},o),n),a=document.createElement("div");return l[G]=a,t.render(l,a),l.component}function xe(e){t.render(null,e==null?void 0:e.vnode[G])}const Le=t.defineComponent(Fe),R=new WeakSet,$=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},J=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),Oe=e=>{switch(J(e)){case"promise":return[e];case"array":return e.some(n=>J(n)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},Q=e=>{R.delete(e),e.instance.proxy.close(),xe(e.instance)},Z=(e,o)=>{var n,l,a;if(o.value){const i=Oe(o.value);if(i==="error")return;(a=(l=(n=e==null?void 0:e.instance)==null?void 0:n.proxy)==null?void 0:l.open)==null||a.call(l),e.appendChild(e.mask),R.add(e),i&&Promise.all(i).catch(s=>{console.error(new Error("Promise handling errors"),s)}).finally(()=>{Q(e)})}else Q(e)},ee=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},te=(e,o)=>{var i;const n=z(z({},new Ae),o),l=n.loadingTemplateRef,a=Ee(Le,z({},n),l?()=>l:null);e.style.position=n.positionType,e.options=n,e.instance=a,e.mask=(i=a==null?void 0:a.proxy)==null?void 0:i.$el},Re={mounted:function(e,o,n){te(e,n.props),ee(e),!$(o.value)&&Z(e,o)},updated:function(e,o,n){!$(o.value)&&R.has(e)||$(o.value)&&!R.has(e)||(!R.has(e)&&te(e,n.props),ee(e),Z(e,o))}};var ke=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Re},setup(e,o){const n=t.inject(M),{visible:l,selectedIndex:a,selectOptionClick:i,searchList:s,searchStatus:r,dropDownRef:u,loadMore:f,showLoading:c,showNoResultItemTemplate:p,latestSource:d,modelValue:m,hoverIndex:y,valueParser:b}=n,{disabled:V,maxHeight:S,formatter:C,disabledKey:T,isSearching:E}=n.props,N=h("auto-complete"),L=h("no-data-tip"),A=h("dropdown-menu"),x=h("dropdown-item"),O=w=>{w=b.value(w),!(typeof w=="object"&&w[T])&&i(w)};return()=>t.withDirectives(t.createVNode("div",{class:[A.b(),N.e("dropdown-menu-cdk"),V&&"disabled",d.value&&N.e("dropdown-latestSource")]},[t.createVNode("ul",{ref:u,class:[N.e("list-unstyled"),"scroll-height"],style:{maxHeight:`${S}px`},onScroll:f},[E&&o.slots.searchingTemplate&&(r==null?void 0:r.value)&&t.createVNode("li",{class:N.e("searching-template")},[t.createVNode("div",{class:L.b()},[o.slots.searchingTemplate()])]),d.value&&!m.value&&t.createVNode("li",{class:N.e("popup-tips")},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!p.value&&!(r==null?void 0:r.value)&&s!=null&&s.value.length>0&&s.value.map((w,k)=>t.createVNode("li",{onClick:()=>O(w),class:[x.b(),a.value===k&&"selected",{disabled:T&&typeof w=="object"&&w[T]},{[N.e("dropdown-bg")]:y.value===k}],title:C(w),key:C(w)},[o.slots.itemTemplate?o.slots.itemTemplate(w,k):C(w)])),!(r==null?void 0:r.value)&&s.value.length===0&&o.slots.noResultItemTemplate&&p.value&&t.createVNode("li",{class:N.e("no-result-template")},[t.createVNode("div",{class:L.b()},[o.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),c.value],[t.vShow,l.value&&s.value.length>0||o.slots.noResultItemTemplate&&p.value||E&&o.slots.searchingTemplate&&(r==null?void 0:r.value)]])}});const Pe=typeof window!="undefined";function oe(e,o,n){document.addEventListener?e&&o&&n&&e.addEventListener(o,n,!1):e&&o&&n&&e.attachEvent("on"+o,n)}const F=Symbol("@@clickoutside"),H=new Map;let ne,_=0,le=!0;function ae(e,o,n){return Pe&&le&&(le=!1,oe(document,"mousedown",l=>{ne=l}),oe(document,"mouseup",l=>{for(const[a,i]of H)i[F].documentHandler(l,ne)})),function(l,a){!n||!o.instance||!l.target||!a.target||e.contains(l.target)||e.contains(a.target)||e===l.target||e[F].bindingFn&&e[F].bindingFn()}}const ze={beforeMount:function(e,o,n){_++,H.set(_,e),e[F]={nid:_,documentHandler:ae(e,o,n),bindingFn:o.value}},updated:function(e,o,n){e[F].documentHandler=ae(e,o,n),e[F].bindingFn=o.value},unmounted:function(e){H.delete(e[F].nid),delete e[F]}},Be={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function je(e){const o=/(auto|scroll|hidden)/;for(let n=e;n=n.parentElement;n.parentElement!==document.body){const l=window.getComputedStyle(n);if(o.test(l.overflow+l.overflowX+l.overflowY))return n}return window}function Me(e,o,n,l){let{x:a,y:i}=o;if(!e){const{width:s,height:r}=l;a&&n.includes("start")&&(a=12),a&&n.includes("end")&&(a=Math.round(s-24)),i&&n.includes("start")&&(i=10),i&&n.includes("end")&&(i=r-14)}return{x:a,y:i}}function $e(e,o){const n=t.ref(),l=t.ref();let a=null;const i=(r,u,f,c)=>{const{x:p,y:d}=Me(e.isArrowCenter,f,u,c.getBoundingClientRect()),m={top:"bottom",right:"left",bottom:"top",left:"right"}[u.split("-")[0]];Object.assign(r.style,{left:p?`${p}px`:"",top:d?`${d}px`:"",right:"",bottom:"",[m]:"-4px"})},s=async()=>{const r=e.origin,u=t.unref(n.value),f=t.unref(l.value),c=[g.offset(e.offset),g.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&c.push(g.arrow({element:f})),e.shiftOffset!==void 0&&c.push(g.shift());const{x:p,y:d,placement:m,middlewareData:y}=await g.computePosition(r,u,{strategy:"fixed",middleware:c});let b=p,V=d;if(e.shiftOffset!==void 0){const{x:S,y:C}=y.shift;S<0&&(b-=e.shiftOffset),S>0&&(b+=e.shiftOffset),C<0&&(V-=e.shiftOffset),C>0&&(V+=e.shiftOffset)}o("positionChange",m),Object.assign(u.style,{top:`${V}px`,left:`${b}px`}),e.showArrow&&i(f,m,y.arrow,u)};return t.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(a=je(e.origin),t.nextTick(s),a==null||a.addEventListener("scroll",s),a!==window&&window.addEventListener("scroll",s),window.addEventListener("resize",s)):(a==null||a.removeEventListener("scroll",s),a!==window&&window.removeEventListener("scroll",s),window.removeEventListener("resize",s))}),t.onUnmounted(()=>{a==null||a.removeEventListener("scroll",s),a!==window&&window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}),{arrowRef:l,overlayRef:n,updatePosition:s}}var yt="";const He=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Be,emits:["update:modelValue","positionChange"],setup(e,{slots:o,attrs:n,emit:l,expose:a}){const i=h("flexible-overlay"),{arrowRef:s,overlayRef:r,updatePosition:u}=$e(e,l);return a({updatePosition:u}),()=>{var f;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:r,class:i.b()},n),[(f=o.default)==null?void 0:f.call(o),e.showArrow&&t.createVNode("div",{ref:s,class:i.e("arrow")},null)])}}});var gt="";function _e(e){return/^((http|https):)?\/\//.test(e)}const Ke={name:{type:String,default:"",required:!0},size:{type:[Number,String],default:"inherit"},color:{type:String,default:"inherit"},component:{type:Object,default:null},classPrefix:{type:String,default:"icon"}},Ue={name:{type:String,default:"",required:!0},color:{type:String,default:"inherit"},size:{type:[Number,String],default:"inherit"}};var wt="",qe=t.defineComponent({name:"DSvgIcon",props:Ue,setup(e){const{name:o,color:n,size:l}=t.toRefs(e),a=h("svg-icon"),i=t.computed(()=>`#icon-${o.value}`),s=t.computed(()=>typeof l.value=="number"?`${l.value}px`:l.value),r={width:s.value,height:s.value};return()=>t.createVNode("svg",{class:a.b(),style:r},[t.createVNode("use",{"xlink:href":i.value,fill:n.value},null)])}}),K=t.defineComponent({name:"DIcon",props:Ke,setup(e,{attrs:o}){const{component:n,name:l,size:a,color:i,classPrefix:s}=t.toRefs(e),r=n.value?t.resolveDynamicComponent(n.value):t.resolveDynamicComponent(qe),u=t.computed(()=>typeof a.value=="number"?`${a.value}px`:a.value),f=()=>t.createVNode(r,t.mergeProps({name:l.value,color:i.value,size:u.value},o),null),c=()=>t.createVNode("img",t.mergeProps({src:l.value,alt:l.value.split("/")[l.value.split("/").length-1],style:{width:u.value||""}},o),null),p=()=>{const d=/^icon-/.test(l.value)?l.value:`${s.value}-${l.value}`;return t.createVNode("i",t.mergeProps({class:[s.value,d],style:{fontSize:u.value,color:i.value}},o),null)};return()=>n.value?f():_e(l.value)?c():p()}});function se(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var U=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:ze},props:W,emits:["update:modelValue","clear","blur"],setup(e,o){const{disabled:n,modelValue:l,width:a,delay:i,allowEmptyValueSearch:s,appendToBody:r,formatter:u,transInputFocusEmit:f,selectValue:c,source:p,searchFn:d,position:m,latestSource:y,showAnimation:b,valueParser:V,placeholder:S}=t.toRefs(e),C=h("auto-complete"),T=h("auto-complete-input"),{handleSearch:E,searchList:N,showNoResultItemTemplate:L,recentlyFocus:A}=Ne(o,s,p,d,u),{onInput:x,onFocus:O,onBlur:w,onClear:k,inputRef:We,isFocus:Ye,visible:P,searchStatus:re,handleClose:q,toggleMenu:Ge}=Ve(o,N,L,l,n,i,E,f,A,y),{selectedIndex:ie,selectOptionClick:ue}=Ce(o,N,c,E,u,q),{showLoading:Je,dropDownRef:ce,loadMore:Qe}=Se(e,o,E),{customRenderSolts:Ze}=be(o,l),{hoverIndex:et,handlekeyDown:tt}=Te(ce,P,N,ie,re,L,ue,q),{autoCompleteTopClasses:ot,inputClasses:nt,inputWrapperClasses:lt,inputInnerClasses:at}=Ie(e,o,P,Ye);t.provide(M,{props:e,visible:P,term:"",searchList:N,selectedIndex:ie,searchStatus:re,selectOptionClick:ue,dropDownRef:ce,showLoading:Je,loadMore:Qe,latestSource:y,modelValue:l,showNoResultItemTemplate:L,hoverIndex:et,valueParser:V});const de=t.ref(),st=o.slots.prefix||e.prefix,rt=o.slots.suffix||e.suffix||e.clearable,it=t.computed(()=>e.clearable&&!e.disabled),fe=()=>{let I;return t.createVNode(t.Transition,{name:b?"fade":""},{default:()=>[t.createVNode(He,{"show-arrow":!0,origin:de.value,position:m.value,modelValue:P.value,"onUpdate:modelValue":j=>P.value=j},{default:()=>[t.createVNode("div",{class:C.e("menu"),style:{width:`
|
|
2
|
+
${a.value+"px"}
|
|
3
|
+
`}},[t.createVNode(ke,null,se(I=Ze())?I:{default:()=>[I]})])]})]})},ut=()=>{if(r.value){let I;return t.createVNode(t.Teleport,{to:"body"},se(I=fe())?I:{default:()=>[I]})}else return fe()};return()=>{var I,j,pe,me,ve,ye,ge,he;return t.withDirectives(t.createVNode("div",{class:ot.value,ref:de,style:{width:`${a.value+"px"}`}},[t.createVNode("div",{class:nt.value},[o.slots.prepend&&t.createVNode("div",{class:T.e("prepend")},[(j=(I=o.slots).prepend)==null?void 0:j.call(I)]),t.createVNode("div",{class:lt.value},[st&&t.createVNode("span",{class:T.e("prefix")},[o.slots.prefix&&t.createVNode("div",null,[(me=(pe=o.slots).prefix)==null?void 0:me.call(pe)]),e.prefix&&t.createVNode(K,{size:"inherit",name:e.prefix},null)]),t.createVNode("input",{disabled:n.value,type:"text",onClick:Ge,class:at.value,placeholder:S.value,onInput:x,onFocus:O,onBlur:w,value:l.value,ref:We,onKeydown:tt},null),rt&&t.createVNode("span",{class:T.e("suffix")},[e.suffix&&t.createVNode(K,{size:"inherit",name:e.suffix},null),o.slots.suffix&&t.createVNode("div",null,[(ye=(ve=o.slots).suffix)==null?void 0:ye.call(ve)]),it.value&&t.createVNode(K,{size:e.size,class:C.em("clear","icon"),name:"close",onClick:k},null)])]),o.slots.append&&t.createVNode("div",{class:T.e("append")},[(he=(ge=o.slots).append)==null?void 0:he.call(ge)])]),ut()]),[[t.resolveDirective("click-outside"),q]])}}}),Xe={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(U.name,U)}};v.AutoComplete=U,v.DropdownPropsKey=M,v.autoCompleteProps=W,v.default=Xe,Object.defineProperty(v,"__esModule",{value:!0}),v[Symbol.toStringTag]="Module"});
|