vue-devui 1.0.0-rc.1 → 1.0.0-rc.4
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 +132 -200
- package/auto-complete/index.es.js +150 -110
- package/auto-complete/index.umd.js +5 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +77 -81
- package/avatar/index.umd.js +1 -1
- package/button/index.es.js +23 -15
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/card/index.es.js +3 -6
- package/card/index.umd.js +1 -1
- package/checkbox/index.es.js +5 -11
- package/checkbox/index.umd.js +1 -1
- package/comment/index.es.js +4 -6
- package/comment/index.umd.js +1 -1
- package/countdown/index.es.js +3 -6
- package/countdown/index.umd.js +1 -1
- package/editable-select/index.es.js +120 -167
- package/editable-select/index.umd.js +1 -1
- package/grid/index.es.js +30 -36
- package/grid/index.umd.js +1 -1
- package/image-preview/index.es.js +19 -19
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +2 -5
- package/input/index.umd.js +1 -1
- package/layout/index.es.js +9 -22
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +40 -25
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +55 -47
- package/modal/index.umd.js +1 -1
- package/notification/index.es.js +100 -10
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/commentProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/readTipProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tagInputProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/overlay/index.es.js +5 -5
- package/overlay/index.umd.js +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +14 -13
- package/pagination/index.umd.js +1 -1
- package/popover/index.es.js +7 -7
- package/popover/index.umd.js +12 -12
- package/progress/index.es.js +34 -36
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +8 -2
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +4 -7
- package/rate/index.umd.js +1 -1
- package/read-tip/index.es.js +34 -34
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/result/index.es.js +2 -5
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +43 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +11 -11
- package/search/index.umd.js +8 -8
- package/skeleton/index.es.js +9 -12
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +59 -62
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +176 -136
- package/splitter/index.umd.js +13 -13
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +4 -7
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/tag/index.es.js +13 -17
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.es.js +3 -6
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.es.js +2 -5
- package/textarea/index.umd.js +1 -1
- package/timeline/index.es.js +10 -16
- package/timeline/index.umd.js +1 -1
- package/upload/index.es.js +160 -67
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12182 -24718
- package/vue-devui.umd.js +24 -20
- package/accordion/index.d.ts +0 -7
- package/accordion/index.es.js +0 -723
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.d.ts +0 -7
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/package.json +0 -7
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -130
- package/back-top/index.umd.js +0 -1
- package/back-top/package.json +0 -7
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -128
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -314
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5971
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8196
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/date-picker/index.d.ts +0 -7
- package/date-picker/index.es.js +0 -1154
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/drawer/index.d.ts +0 -7
- package/drawer/index.es.js +0 -234
- package/drawer/index.umd.js +0 -1
- package/drawer/package.json +0 -7
- package/drawer/style.css +0 -1
- package/dropdown/index.d.ts +0 -7
- package/dropdown/index.es.js +0 -693
- package/dropdown/index.umd.js +0 -1
- package/dropdown/package.json +0 -7
- package/dropdown/style.css +0 -1
- package/form/index.d.ts +0 -7
- package/form/index.es.js +0 -7876
- package/form/index.umd.js +0 -27
- package/form/package.json +0 -7
- package/form/style.css +0 -1
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -332
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/input-number/index.d.ts +0 -7
- package/input-number/index.es.js +0 -229
- package/input-number/index.umd.js +0 -1
- package/input-number/package.json +0 -7
- package/input-number/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Column.js +0 -3
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/Drawer.js +0 -3
- package/nuxt/components/DrawerService.js +0 -3
- package/nuxt/components/Dropdown.js +0 -3
- package/nuxt/components/DropdownMenu.js +0 -3
- package/nuxt/components/Form.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormItem.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/FormOperation.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/InputNumber.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/Select.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/Table.js +0 -3
- package/nuxt/components/Tabs.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Tooltip.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/Tree.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/dropdownMenuProps.js +0 -3
- package/nuxt/components/tooltipProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/select/index.d.ts +0 -7
- package/select/index.es.js +0 -706
- package/select/index.umd.js +0 -1
- package/select/package.json +0 -7
- package/select/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -242
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/table/index.d.ts +0 -7
- package/table/index.es.js +0 -2024
- package/table/index.umd.js +0 -1
- package/table/package.json +0 -7
- package/table/style.css +0 -1
- package/tabs/index.d.ts +0 -7
- package/tabs/index.es.js +0 -194
- package/tabs/index.umd.js +0 -1
- package/tabs/package.json +0 -7
- package/tabs/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1238
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/tooltip/index.d.ts +0 -7
- package/tooltip/index.es.js +0 -5835
- package/tooltip/index.umd.js +0 -27
- package/tooltip/package.json +0 -7
- package/tooltip/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7615
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree/index.d.ts +0 -7
- package/tree/index.es.js +0 -6495
- package/tree/index.umd.js +0 -27
- package/tree/package.json +0 -7
- package/tree/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -627
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
|
@@ -18,9 +18,14 @@ 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, toRefs, provide,
|
|
21
|
+
import { ref, nextTick, defineComponent, createVNode, h, render, inject, withDirectives, createTextVNode, resolveDirective, vShow, unref, watch, onUnmounted, mergeProps, toRefs, provide, Teleport, Transition, isVNode } from "vue";
|
|
22
22
|
import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
23
|
-
const defaultFormatter = (item) =>
|
|
23
|
+
const defaultFormatter = (item) => {
|
|
24
|
+
if (typeof item === "string") {
|
|
25
|
+
return item;
|
|
26
|
+
}
|
|
27
|
+
return item !== null ? item.label || item.toString() : "";
|
|
28
|
+
};
|
|
24
29
|
const defaultValueParse = (item) => item;
|
|
25
30
|
const autoCompleteProps = {
|
|
26
31
|
modelValue: {
|
|
@@ -39,14 +44,9 @@ const autoCompleteProps = {
|
|
|
39
44
|
type: Boolean,
|
|
40
45
|
default: false
|
|
41
46
|
},
|
|
42
|
-
|
|
43
|
-
type:
|
|
44
|
-
default:
|
|
45
|
-
originX: "left",
|
|
46
|
-
originY: "bottom",
|
|
47
|
-
overlayX: "left",
|
|
48
|
-
overlayY: "top"
|
|
49
|
-
})
|
|
47
|
+
position: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default: ["bottom-end"]
|
|
50
50
|
},
|
|
51
51
|
disabled: {
|
|
52
52
|
type: Boolean,
|
|
@@ -92,9 +92,9 @@ const autoCompleteProps = {
|
|
|
92
92
|
type: Boolean,
|
|
93
93
|
default: false
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
width: {
|
|
96
96
|
type: Number,
|
|
97
|
-
default:
|
|
97
|
+
default: 400
|
|
98
98
|
},
|
|
99
99
|
showAnimation: {
|
|
100
100
|
type: Boolean,
|
|
@@ -121,32 +121,32 @@ const DropdownPropsKey = Symbol("DropdownPropsKey");
|
|
|
121
121
|
function useCustomTemplate(ctx2, modelValue) {
|
|
122
122
|
const itemTemplate = (item, index2) => {
|
|
123
123
|
const arr = { item, index: index2 };
|
|
124
|
-
if (ctx2.slots.
|
|
125
|
-
return ctx2.slots.
|
|
124
|
+
if (ctx2.slots.item) {
|
|
125
|
+
return ctx2.slots.item(arr);
|
|
126
126
|
}
|
|
127
127
|
return null;
|
|
128
128
|
};
|
|
129
129
|
const noResultItemTemplate = () => {
|
|
130
|
-
if (ctx2.slots.
|
|
131
|
-
return ctx2.slots.
|
|
130
|
+
if (ctx2.slots.nothing) {
|
|
131
|
+
return ctx2.slots.nothing(modelValue.value);
|
|
132
132
|
}
|
|
133
133
|
return null;
|
|
134
134
|
};
|
|
135
135
|
const searchingTemplate = () => {
|
|
136
|
-
if (ctx2.slots.
|
|
137
|
-
return ctx2.slots.
|
|
136
|
+
if (ctx2.slots.searching) {
|
|
137
|
+
return ctx2.slots.searching(modelValue.value);
|
|
138
138
|
}
|
|
139
139
|
return null;
|
|
140
140
|
};
|
|
141
141
|
const customRenderSolts = () => {
|
|
142
142
|
const slots = {};
|
|
143
|
-
if (ctx2.slots.
|
|
143
|
+
if (ctx2.slots.item) {
|
|
144
144
|
slots["itemTemplate"] = itemTemplate;
|
|
145
145
|
}
|
|
146
|
-
if (ctx2.slots.
|
|
146
|
+
if (ctx2.slots.nothing) {
|
|
147
147
|
slots["noResultItemTemplate"] = noResultItemTemplate;
|
|
148
148
|
}
|
|
149
|
-
if (ctx2.slots.
|
|
149
|
+
if (ctx2.slots.searching) {
|
|
150
150
|
slots["searchingTemplate"] = searchingTemplate;
|
|
151
151
|
}
|
|
152
152
|
return slots;
|
|
@@ -156,8 +156,19 @@ function useCustomTemplate(ctx2, modelValue) {
|
|
|
156
156
|
function useSearchFn(ctx2, allowEmptyValueSearch, source, searchFn, formatter) {
|
|
157
157
|
const searchList = ref([]);
|
|
158
158
|
const showNoResultItemTemplate = ref(false);
|
|
159
|
-
const
|
|
160
|
-
|
|
159
|
+
const defaultSearchFn = (term) => {
|
|
160
|
+
const arr = [];
|
|
161
|
+
source.value.forEach((item) => {
|
|
162
|
+
let cur = formatter.value(item);
|
|
163
|
+
cur = cur.toLowerCase();
|
|
164
|
+
if (cur.startsWith(term)) {
|
|
165
|
+
arr.push(item);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return arr;
|
|
169
|
+
};
|
|
170
|
+
const handleSearch = async (term, enableLazyLoad = false) => {
|
|
171
|
+
if (term === "" && !allowEmptyValueSearch.value) {
|
|
161
172
|
searchList.value = [];
|
|
162
173
|
showNoResultItemTemplate.value = false;
|
|
163
174
|
return;
|
|
@@ -167,18 +178,12 @@ function useSearchFn(ctx2, allowEmptyValueSearch, source, searchFn, formatter) {
|
|
|
167
178
|
if (enableLazyLoad) {
|
|
168
179
|
arr = source.value;
|
|
169
180
|
} else if (!searchFn.value) {
|
|
170
|
-
|
|
171
|
-
let cur = formatter.value(item);
|
|
172
|
-
cur = cur.toLowerCase();
|
|
173
|
-
if (cur.startsWith(term)) {
|
|
174
|
-
arr.push(item);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
181
|
+
arr = defaultSearchFn(term);
|
|
177
182
|
} else {
|
|
178
183
|
arr = await searchFn.value(term);
|
|
179
184
|
}
|
|
180
185
|
searchList.value = arr;
|
|
181
|
-
if (searchList.value.length
|
|
186
|
+
if (searchList.value.length === 0) {
|
|
182
187
|
showNoResultItemTemplate.value = true;
|
|
183
188
|
} else {
|
|
184
189
|
showNoResultItemTemplate.value = false;
|
|
@@ -202,13 +207,13 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
202
207
|
const searchStatus = ref(false);
|
|
203
208
|
const debounce = (cb, time) => {
|
|
204
209
|
let timer;
|
|
205
|
-
return (
|
|
210
|
+
return (arg) => {
|
|
206
211
|
if (timer) {
|
|
207
212
|
clearTimeout(timer);
|
|
208
213
|
}
|
|
209
214
|
timer = setTimeout(async () => {
|
|
210
215
|
searchStatus.value = true;
|
|
211
|
-
await cb(
|
|
216
|
+
await cb(arg);
|
|
212
217
|
searchStatus.value = false;
|
|
213
218
|
}, time);
|
|
214
219
|
};
|
|
@@ -227,7 +232,7 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
227
232
|
};
|
|
228
233
|
const onFocus = () => {
|
|
229
234
|
handleSearch(modelValue.value);
|
|
230
|
-
recentlyFocus(latestSource.value);
|
|
235
|
+
recentlyFocus(latestSource == null ? void 0 : latestSource.value);
|
|
231
236
|
transInputFocusEmit.value && transInputFocusEmit.value();
|
|
232
237
|
};
|
|
233
238
|
const handleClose = () => {
|
|
@@ -241,7 +246,7 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
241
246
|
handleClose();
|
|
242
247
|
} else {
|
|
243
248
|
visible.value = true;
|
|
244
|
-
if (ctx2.slots.noResultItemTemplate && searchList.value.length
|
|
249
|
+
if (ctx2.slots.noResultItemTemplate && searchList.value.length === 0 && modelValue.value.trim() !== "") {
|
|
245
250
|
showNoResultItemTemplate.value = true;
|
|
246
251
|
}
|
|
247
252
|
}
|
|
@@ -259,12 +264,23 @@ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue,
|
|
|
259
264
|
}
|
|
260
265
|
function useSelectHandle(ctx2, searchList, selectValue, handleSearch, formatter, handleClose) {
|
|
261
266
|
const selectedIndex = ref(0);
|
|
262
|
-
const getListIndex = (
|
|
263
|
-
if (searchList.value.length
|
|
267
|
+
const getListIndex = (cur) => {
|
|
268
|
+
if (searchList.value.length === 0) {
|
|
264
269
|
return 0;
|
|
265
270
|
}
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
let ind = 0;
|
|
272
|
+
searchList.value.forEach((item, index2) => {
|
|
273
|
+
if (typeof item === "string") {
|
|
274
|
+
if (item === cur) {
|
|
275
|
+
ind = index2;
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
if (String(item.label) === cur) {
|
|
279
|
+
ind = index2;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return ind === -1 ? 0 : ind;
|
|
268
284
|
};
|
|
269
285
|
const selectOptionClick = async (item) => {
|
|
270
286
|
const cur = formatter.value(item);
|
|
@@ -272,7 +288,7 @@ function useSelectHandle(ctx2, searchList, selectValue, handleSearch, formatter,
|
|
|
272
288
|
handleClose();
|
|
273
289
|
await handleSearch(cur);
|
|
274
290
|
selectedIndex.value = getListIndex(cur);
|
|
275
|
-
selectValue.value && selectValue.value();
|
|
291
|
+
selectValue.value && selectValue.value(cur);
|
|
276
292
|
};
|
|
277
293
|
return {
|
|
278
294
|
selectedIndex,
|
|
@@ -294,11 +310,11 @@ function useLazyHandle(props, ctx2, handleSearch) {
|
|
|
294
310
|
showLoading.value = true;
|
|
295
311
|
}
|
|
296
312
|
};
|
|
297
|
-
ctx2.expose({ loadFinish });
|
|
298
313
|
async function loadFinish() {
|
|
299
314
|
await handleSearch(props.modelValue, props.enableLazyLoad);
|
|
300
315
|
showLoading.value = false;
|
|
301
316
|
}
|
|
317
|
+
ctx2.expose({ loadFinish });
|
|
302
318
|
return {
|
|
303
319
|
showLoading,
|
|
304
320
|
dropDownRef,
|
|
@@ -359,14 +375,13 @@ function useKeyBoardHandle(dropDownRef, visible, searchList, selectedIndex, sear
|
|
|
359
375
|
handlekeyDown
|
|
360
376
|
};
|
|
361
377
|
}
|
|
362
|
-
var autoComplete = "";
|
|
363
378
|
class View {
|
|
364
379
|
constructor() {
|
|
365
380
|
__publicField(this, "top", "50%");
|
|
366
381
|
__publicField(this, "left", "50%");
|
|
367
382
|
}
|
|
368
383
|
}
|
|
369
|
-
const
|
|
384
|
+
const loadingProps = {
|
|
370
385
|
message: String,
|
|
371
386
|
backdrop: Boolean,
|
|
372
387
|
view: {
|
|
@@ -379,7 +394,7 @@ const componentProps = {
|
|
|
379
394
|
default: false
|
|
380
395
|
}
|
|
381
396
|
};
|
|
382
|
-
class
|
|
397
|
+
class LoadingOptions {
|
|
383
398
|
constructor() {
|
|
384
399
|
__publicField(this, "target");
|
|
385
400
|
__publicField(this, "message");
|
|
@@ -394,7 +409,7 @@ var loading = "";
|
|
|
394
409
|
var Loading = defineComponent({
|
|
395
410
|
name: "DLoading",
|
|
396
411
|
inheritAttrs: false,
|
|
397
|
-
props:
|
|
412
|
+
props: loadingProps,
|
|
398
413
|
setup(props) {
|
|
399
414
|
const style = {
|
|
400
415
|
top: props.view.top,
|
|
@@ -453,8 +468,8 @@ var Loading = defineComponent({
|
|
|
453
468
|
}
|
|
454
469
|
});
|
|
455
470
|
const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
|
|
456
|
-
function createComponent(
|
|
457
|
-
const vnode = h(
|
|
471
|
+
function createComponent(component, props, children = null) {
|
|
472
|
+
const vnode = h(component, __spreadValues({}, props), children);
|
|
458
473
|
const container = document.createElement("div");
|
|
459
474
|
vnode[COMPONENT_CONTAINER_SYMBOL] = container;
|
|
460
475
|
render(vnode, container);
|
|
@@ -466,14 +481,18 @@ function unmountComponent(ComponnetInstance) {
|
|
|
466
481
|
const loadingConstructor = defineComponent(Loading);
|
|
467
482
|
const cacheInstance = /* @__PURE__ */ new WeakSet();
|
|
468
483
|
const isEmpty = (val) => {
|
|
469
|
-
if (!val)
|
|
484
|
+
if (!val) {
|
|
470
485
|
return true;
|
|
471
|
-
|
|
486
|
+
}
|
|
487
|
+
if (Array.isArray(val)) {
|
|
472
488
|
return val.length === 0;
|
|
473
|
-
|
|
489
|
+
}
|
|
490
|
+
if (val instanceof Set || val instanceof Map) {
|
|
474
491
|
return val.size === 0;
|
|
475
|
-
|
|
492
|
+
}
|
|
493
|
+
if (val instanceof Promise) {
|
|
476
494
|
return false;
|
|
495
|
+
}
|
|
477
496
|
if (typeof val === "object") {
|
|
478
497
|
try {
|
|
479
498
|
return Object.keys(val).length === 0;
|
|
@@ -507,11 +526,13 @@ const unmount = (el) => {
|
|
|
507
526
|
unmountComponent(el.instance);
|
|
508
527
|
};
|
|
509
528
|
const toggleLoading = (el, binding) => {
|
|
529
|
+
var _a, _b, _c;
|
|
510
530
|
if (binding.value) {
|
|
511
531
|
const vals = isPromise(binding.value);
|
|
512
|
-
if (vals === "error")
|
|
532
|
+
if (vals === "error") {
|
|
513
533
|
return;
|
|
514
|
-
|
|
534
|
+
}
|
|
535
|
+
(_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
|
|
515
536
|
el.appendChild(el.mask);
|
|
516
537
|
cacheInstance.add(el);
|
|
517
538
|
if (vals) {
|
|
@@ -534,13 +555,14 @@ const removeAttribute = (el) => {
|
|
|
534
555
|
el.removeAttribute("loadingtemplateref");
|
|
535
556
|
};
|
|
536
557
|
const handleProps = (el, vprops) => {
|
|
537
|
-
|
|
558
|
+
var _a;
|
|
559
|
+
const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
|
|
538
560
|
const loadingTemplateRef = props.loadingTemplateRef;
|
|
539
561
|
const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
540
562
|
el.style.position = props.positionType;
|
|
541
563
|
el.options = props;
|
|
542
564
|
el.instance = loadingInstance;
|
|
543
|
-
el.mask = loadingInstance.proxy.$el;
|
|
565
|
+
el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
|
|
544
566
|
};
|
|
545
567
|
const loadingDirective = {
|
|
546
568
|
mounted: function(el, binding, vnode) {
|
|
@@ -549,8 +571,9 @@ const loadingDirective = {
|
|
|
549
571
|
!isEmpty(binding.value) && toggleLoading(el, binding);
|
|
550
572
|
},
|
|
551
573
|
updated: function(el, binding, vnode) {
|
|
552
|
-
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
|
|
574
|
+
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
|
|
553
575
|
return;
|
|
576
|
+
}
|
|
554
577
|
!cacheInstance.has(el) && handleProps(el, vnode.props);
|
|
555
578
|
removeAttribute(el);
|
|
556
579
|
toggleLoading(el, binding);
|
|
@@ -575,25 +598,26 @@ var DAutoCompleteDropdown = defineComponent({
|
|
|
575
598
|
showNoResultItemTemplate,
|
|
576
599
|
latestSource,
|
|
577
600
|
modelValue,
|
|
578
|
-
hoverIndex
|
|
601
|
+
hoverIndex,
|
|
602
|
+
valueParser
|
|
579
603
|
} = propsData;
|
|
580
604
|
const {
|
|
581
605
|
disabled,
|
|
582
606
|
maxHeight,
|
|
583
|
-
appendToBody,
|
|
584
607
|
formatter,
|
|
585
608
|
disabledKey,
|
|
586
609
|
isSearching
|
|
587
610
|
} = propsData.props;
|
|
588
611
|
const onSelect = (item) => {
|
|
589
|
-
|
|
612
|
+
item = valueParser.value(item);
|
|
613
|
+
if (typeof item === "object" && item[disabledKey]) {
|
|
590
614
|
return;
|
|
591
615
|
}
|
|
592
616
|
selectOptionClick(item);
|
|
593
617
|
};
|
|
594
618
|
return () => {
|
|
595
619
|
return withDirectives(createVNode("div", {
|
|
596
|
-
"class": ["devui-dropdown-menu",
|
|
620
|
+
"class": ["devui-dropdown-menu", "devui-dropdown-menu-cdk", disabled && "disabled", latestSource.value && "devui-dropdown-latestSource"]
|
|
597
621
|
}, [createVNode("ul", {
|
|
598
622
|
"ref": dropDownRef,
|
|
599
623
|
"class": "devui-list-unstyled scroll-height",
|
|
@@ -601,28 +625,28 @@ var DAutoCompleteDropdown = defineComponent({
|
|
|
601
625
|
maxHeight: `${maxHeight}px`
|
|
602
626
|
},
|
|
603
627
|
"onScroll": loadMore
|
|
604
|
-
}, [isSearching && ctx2.slots.searchingTemplate && searchStatus.value && createVNode("li", {
|
|
628
|
+
}, [isSearching && ctx2.slots.searchingTemplate && (searchStatus == null ? void 0 : searchStatus.value) && createVNode("li", {
|
|
605
629
|
"class": "devui-is-searching-template"
|
|
606
630
|
}, [createVNode("div", {
|
|
607
631
|
"class": "devui-no-data-tip"
|
|
608
632
|
}, [ctx2.slots.searchingTemplate()])]), latestSource.value && !modelValue.value && createVNode("li", {
|
|
609
633
|
"class": "devui-popup-tips"
|
|
610
|
-
}, [createTextVNode("\u6700\u8FD1\u8F93\u5165")]), !showNoResultItemTemplate.value && !searchStatus.value && searchList != null && searchList.value.length > 0 && searchList.value.map((item, index2) => {
|
|
634
|
+
}, [createTextVNode("\u6700\u8FD1\u8F93\u5165")]), !showNoResultItemTemplate.value && !(searchStatus == null ? void 0 : searchStatus.value) && searchList != null && searchList.value.length > 0 && searchList.value.map((item, index2) => {
|
|
611
635
|
return createVNode("li", {
|
|
612
636
|
"onClick": () => onSelect(item),
|
|
613
|
-
"class": ["devui-dropdown-item", selectedIndex.value
|
|
614
|
-
"disabled": disabledKey && item[disabledKey]
|
|
637
|
+
"class": ["devui-dropdown-item", selectedIndex.value === index2 && "selected", {
|
|
638
|
+
"disabled": disabledKey && typeof item === "object" && item[disabledKey]
|
|
615
639
|
}, {
|
|
616
|
-
"devui-dropdown-bg": hoverIndex.value
|
|
640
|
+
"devui-dropdown-bg": hoverIndex.value === index2
|
|
617
641
|
}],
|
|
618
642
|
"title": formatter(item),
|
|
619
643
|
"key": formatter(item)
|
|
620
644
|
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(item, index2) : formatter(item)]);
|
|
621
|
-
}), !searchStatus.value && searchList.value.length
|
|
645
|
+
}), !(searchStatus == null ? void 0 : searchStatus.value) && searchList.value.length === 0 && ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value && createVNode("li", {
|
|
622
646
|
"class": "devui-no-result-template"
|
|
623
647
|
}, [createVNode("div", {
|
|
624
648
|
"class": "devui-no-data-tip"
|
|
625
|
-
}, [ctx2.slots.noResultItemTemplate()])])])]), [[resolveDirective("dLoading"), showLoading.value], [vShow, visible.value && searchList.value.length > 0 || ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value || isSearching && ctx2.slots.searchingTemplate && searchStatus.value]]);
|
|
649
|
+
}, [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)]]);
|
|
626
650
|
};
|
|
627
651
|
}
|
|
628
652
|
});
|
|
@@ -743,6 +767,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
743
767
|
function useOverlay(props, emit) {
|
|
744
768
|
const overlayRef = ref();
|
|
745
769
|
const arrowRef = ref();
|
|
770
|
+
let originParent = null;
|
|
746
771
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
747
772
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
748
773
|
const staticSide = {
|
|
@@ -781,21 +806,20 @@ function useOverlay(props, emit) {
|
|
|
781
806
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
782
807
|
};
|
|
783
808
|
watch(() => props.modelValue, () => {
|
|
784
|
-
const originParent = getScrollParent(props.origin);
|
|
785
809
|
if (props.modelValue && props.origin) {
|
|
810
|
+
originParent = getScrollParent(props.origin);
|
|
786
811
|
nextTick(updatePosition);
|
|
787
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
812
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
788
813
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
789
814
|
window.addEventListener("resize", updatePosition);
|
|
790
815
|
} else {
|
|
791
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
816
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
792
817
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
793
818
|
window.removeEventListener("resize", updatePosition);
|
|
794
819
|
}
|
|
795
820
|
});
|
|
796
821
|
onUnmounted(() => {
|
|
797
|
-
|
|
798
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
822
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
799
823
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
800
824
|
window.removeEventListener("resize", updatePosition);
|
|
801
825
|
});
|
|
@@ -833,6 +857,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
833
857
|
};
|
|
834
858
|
}
|
|
835
859
|
});
|
|
860
|
+
var autoComplete = "";
|
|
836
861
|
function _isSlot(s) {
|
|
837
862
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
838
863
|
}
|
|
@@ -847,18 +872,19 @@ var AutoComplete = defineComponent({
|
|
|
847
872
|
const {
|
|
848
873
|
disabled,
|
|
849
874
|
modelValue,
|
|
850
|
-
|
|
851
|
-
dAutoCompleteWidth,
|
|
875
|
+
width,
|
|
852
876
|
delay,
|
|
853
877
|
allowEmptyValueSearch,
|
|
878
|
+
appendToBody,
|
|
854
879
|
formatter,
|
|
855
880
|
transInputFocusEmit,
|
|
856
881
|
selectValue,
|
|
857
882
|
source,
|
|
858
883
|
searchFn,
|
|
859
|
-
|
|
884
|
+
position,
|
|
860
885
|
latestSource,
|
|
861
|
-
showAnimation
|
|
886
|
+
showAnimation,
|
|
887
|
+
valueParser
|
|
862
888
|
} = toRefs(props);
|
|
863
889
|
const {
|
|
864
890
|
handleSearch,
|
|
@@ -905,46 +931,63 @@ var AutoComplete = defineComponent({
|
|
|
905
931
|
latestSource,
|
|
906
932
|
modelValue,
|
|
907
933
|
showNoResultItemTemplate,
|
|
908
|
-
hoverIndex
|
|
934
|
+
hoverIndex,
|
|
935
|
+
valueParser
|
|
909
936
|
});
|
|
910
937
|
const origin = ref();
|
|
911
|
-
const position = reactive({
|
|
912
|
-
appendToBodyDirections: {}
|
|
913
|
-
});
|
|
914
|
-
position.appendToBodyDirections = appendToBodyDirections;
|
|
915
938
|
const renderDropdown = () => {
|
|
916
939
|
if (appendToBody.value) {
|
|
917
940
|
let _slot;
|
|
918
|
-
return createVNode(
|
|
919
|
-
"
|
|
920
|
-
"origin": origin,
|
|
921
|
-
"position": position.appendToBodyDirections,
|
|
922
|
-
"visible": visible.value,
|
|
923
|
-
"onUpdate:visible": ($event) => visible.value = $event
|
|
941
|
+
return createVNode(Teleport, {
|
|
942
|
+
"to": "body"
|
|
924
943
|
}, {
|
|
925
|
-
default: () => [createVNode(
|
|
926
|
-
"
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
944
|
+
default: () => [createVNode(Transition, {
|
|
945
|
+
"name": showAnimation ? "fade" : ""
|
|
946
|
+
}, {
|
|
947
|
+
default: () => [createVNode(FlexibleOverlay, {
|
|
948
|
+
"show-arrow": true,
|
|
949
|
+
"origin": origin.value,
|
|
950
|
+
"position": position.value,
|
|
951
|
+
"modelValue": visible.value,
|
|
952
|
+
"onUpdate:modelValue": ($event) => visible.value = $event
|
|
953
|
+
}, {
|
|
954
|
+
default: () => [createVNode("div", {
|
|
955
|
+
"class": "devui-auto-complete-menu",
|
|
956
|
+
"style": {
|
|
957
|
+
width: `
|
|
958
|
+
${width.value + "px"}
|
|
959
|
+
`
|
|
960
|
+
}
|
|
961
|
+
}, [createVNode(DAutoCompleteDropdown, null, _isSlot(_slot = customRenderSolts()) ? _slot : {
|
|
962
|
+
default: () => [_slot]
|
|
963
|
+
})])]
|
|
964
|
+
})]
|
|
965
|
+
})]
|
|
933
966
|
});
|
|
934
967
|
} else {
|
|
935
968
|
let _slot2;
|
|
936
|
-
return createVNode(
|
|
937
|
-
"class": "devui-dropdown",
|
|
938
|
-
"style": {
|
|
939
|
-
width: dAutoCompleteWidth.value > 0 && dAutoCompleteWidth.value + "px"
|
|
940
|
-
}
|
|
941
|
-
}, [createVNode(Transition, {
|
|
969
|
+
return createVNode(Transition, {
|
|
942
970
|
"name": showAnimation ? "fade" : ""
|
|
943
971
|
}, {
|
|
944
|
-
default: () => [createVNode(
|
|
945
|
-
|
|
972
|
+
default: () => [createVNode(FlexibleOverlay, {
|
|
973
|
+
"show-arrow": true,
|
|
974
|
+
"origin": origin.value,
|
|
975
|
+
"position": position.value,
|
|
976
|
+
"modelValue": visible.value,
|
|
977
|
+
"onUpdate:modelValue": ($event) => visible.value = $event
|
|
978
|
+
}, {
|
|
979
|
+
default: () => [createVNode("div", {
|
|
980
|
+
"class": "devui-auto-complete-menu",
|
|
981
|
+
"style": {
|
|
982
|
+
width: `
|
|
983
|
+
${width.value + "px"}
|
|
984
|
+
`
|
|
985
|
+
}
|
|
986
|
+
}, [createVNode(DAutoCompleteDropdown, null, _isSlot(_slot2 = customRenderSolts()) ? _slot2 : {
|
|
987
|
+
default: () => [_slot2]
|
|
988
|
+
})])]
|
|
946
989
|
})]
|
|
947
|
-
})
|
|
990
|
+
});
|
|
948
991
|
}
|
|
949
992
|
};
|
|
950
993
|
return () => {
|
|
@@ -952,7 +995,7 @@ var AutoComplete = defineComponent({
|
|
|
952
995
|
"class": ["devui-auto-complete", "devui-form-group", "devui-has-feedback", visible.value && "devui-select-open"],
|
|
953
996
|
"ref": origin,
|
|
954
997
|
"style": {
|
|
955
|
-
width:
|
|
998
|
+
width: `${width.value + "px"}`
|
|
956
999
|
}
|
|
957
1000
|
}, [createVNode("input", {
|
|
958
1001
|
"disabled": disabled.value,
|
|
@@ -969,15 +1012,12 @@ var AutoComplete = defineComponent({
|
|
|
969
1012
|
};
|
|
970
1013
|
}
|
|
971
1014
|
});
|
|
972
|
-
AutoComplete.install = function(app) {
|
|
973
|
-
app.component(AutoComplete.name, AutoComplete);
|
|
974
|
-
};
|
|
975
1015
|
var index = {
|
|
976
1016
|
title: "AutoComplete \u81EA\u52A8\u8865\u5168",
|
|
977
1017
|
category: "\u6570\u636E\u5F55\u5165",
|
|
978
1018
|
status: "100%",
|
|
979
1019
|
install(app) {
|
|
980
|
-
app.
|
|
1020
|
+
app.component(AutoComplete.name, AutoComplete);
|
|
981
1021
|
}
|
|
982
1022
|
};
|
|
983
|
-
export { AutoComplete, index as default };
|
|
1023
|
+
export { AutoComplete, DropdownPropsKey, autoCompleteProps, index as default };
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
var Be=Object.defineProperty;var re=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var O=(p,t,m)=>t in p?Be(p,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[t]=m,E=(p,t)=>{for(var m in t||(t={}))Oe.call(t,m)&&O(p,m,t[m]);if(re)for(var m of re(t))je.call(t,m)&&O(p,m,t[m]);return p};var C=(p,t,m)=>(O(p,typeof t!="symbol"?t+"":t,m),m);(function(p,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):(p=typeof globalThis!="undefined"?globalThis:p||self,t(p.index={},p.Vue,p.dom))})(this,function(p,t,m){"use strict";const se={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},appendToBodyDirections:{type:Object,default:()=>({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"})},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?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},dAutoCompleteWidth:{type:Number,default:null},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}},j=Symbol("DropdownPropsKey");function ie(e,n){const o=(r,u)=>{const i={item:r,index:u};return e.slots.itemTemplate?e.slots.itemTemplate(i):null},l=()=>e.slots.noResultItemTemplate?e.slots.noResultItemTemplate(n.value):null,s=()=>e.slots.searchingTemplate?e.slots.searchingTemplate(n.value):null;return{customRenderSolts:()=>{const r={};return e.slots.itemTemplate&&(r.itemTemplate=o),e.slots.noResultItemTemplate&&(r.noResultItemTemplate=l),e.slots.searchingTemplate&&(r.searchingTemplate=s),r}}}function ue(e,n,o,l,s){const a=t.ref([]),r=t.ref(!1);return{handleSearch:async(d,c)=>{if(d==""&&!n.value){a.value=[],r.value=!1;return}let v=[];d=d.toLowerCase(),c?v=o.value:l.value?v=await l.value(d):o.value.forEach(f=>{let y=s.value(f);y=y.toLowerCase(),y.startsWith(d)&&v.push(f)}),a.value=v,a.value.length==0?r.value=!0:r.value=!1},recentlyFocus:d=>{d&&(a.value=d)},searchList:a,showNoResultItemTemplate:r}}function de(e,n,o,l,s,a,r,u,i,d){const c=t.ref(!1),v=t.ref(),f=t.ref(!1),h=((S,D)=>{let g;return(...b)=>{g&&clearTimeout(g),g=setTimeout(async()=>{f.value=!0,await S(...b),f.value=!1},D)}})(async S=>{await r(S),c.value=!0},a.value),T=S=>{const D=S.target;f.value=!1,o.value=!1,e.emit("update:modelValue",D.value),h(D.value)},A=()=>{r(l.value),i(d.value),u.value&&u.value()},V=()=>{c.value=!1,f.value=!1,o.value=!1};return{handleClose:V,toggleMenu:()=>{s.value||(c.value?V():(c.value=!0,e.slots.noResultItemTemplate&&n.value.length==0&&l.value.trim()!=""&&(o.value=!0)))},onInput:T,onFocus:A,inputRef:v,visible:c,searchStatus:f}}function ce(e,n,o,l,s,a){const r=t.ref(0),u=d=>{if(n.value.length==0)return 0;const c=n.value.indexOf(d);return c==-1?0:c};return{selectedIndex:r,selectOptionClick:async d=>{const c=s.value(d);e.emit("update:modelValue",c),a(),await l(c),r.value=u(c),o.value&&o.value()}}}function fe(e,n,o){const l=t.ref(!1),s=t.ref(),a=()=>{if(!e.enableLazyLoad&&l)return;const u=s.value,i=u.scrollHeight,d=u.clientHeight+u.scrollTop;d>=i&&d>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:r});async function r(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:s,loadMore:a}}function pe(e,n,o,l,s,a,r,u){var v;const i=t.ref((v=l.value)!=null?v:0),d=f=>{const y=e.value,w=y.children[f];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=y.getBoundingClientRect(),T=w.getBoundingClientRect();(T.bottom>h.bottom||T.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:f=>{var h;const y=f.key||f.code;if(y==="Escape"&&(n.value&&o.value.length||s.value||a.value)){u();return}const w=n.value&&o.value.length&&!s.value&&!a.value;if(y==="ArrowDown"&&w){if(i.value===o.value.length-1){i.value=0,d(i.value);return}i.value=i.value+1,d(i.value)}else if(y==="ArrowUp"&&w){if(i.value===0){i.value=o.value.length-1,d(i.value);return}i.value=i.value-1,d(i.value)}if(y==="Enter"&&w){r(o.value[i.value]),i.value=(h=l.value)!=null?h:0;return}}}}var ze="";class M{constructor(){C(this,"top","50%");C(this,"left","50%")}}const ve={message:String,backdrop:Boolean,view:{type:Object,default:()=>new M},zIndex:Number,isFull:{type:Boolean,default:!1}};class me{constructor(){C(this,"target");C(this,"message");C(this,"loadingTemplateRef");C(this,"backdrop",!0);C(this,"positionType","relative");C(this,"view",new M);C(this,"zIndex")}}var _e="",ye=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ve,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:l,message:s,$slots:a}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((r=a.default)==null?void 0:r.call(a))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,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)]),s?t.createVNode("span",{class:"devui-loading-text"},[s]):null])])])}});const H=Symbol("dev_component_container");function ge(e,n,o=null){const l=t.h(e,E({},n),o),s=document.createElement("div");return l[H]=s,t.render(l,s),l.component}function we(e){t.render(null,e==null?void 0:e.vnode[H])}const he=t.defineComponent(ye),F=new WeakSet,R=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},z=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),be=e=>{switch(z(e)){case"promise":return[e];case"array":return e.some(o=>z(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},_=e=>{F.delete(e),e.instance.proxy.close(),we(e.instance)},K=(e,n)=>{if(n.value){const o=be(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),F.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{_(e)})}else _(e)},$=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},W=(e,n)=>{const o=E(E({},new me),n),l=o.loadingTemplateRef,s=ge(he,E({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=s,e.mask=s.proxy.$el},Te={mounted:function(e,n,o){W(e,o.props),$(e),!R(n.value)&&K(e,n)},updated:function(e,n,o){!R(n.value)&&F.has(e)||R(n.value)&&!F.has(e)||(!F.has(e)&&W(e,o.props),$(e),K(e,n))}};var Y=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Te},setup(e,n){const o=t.inject(j),{visible:l,selectedIndex:s,selectOptionClick:a,searchList:r,searchStatus:u,dropDownRef:i,loadMore:d,showLoading:c,showNoResultItemTemplate:v,latestSource:f,modelValue:y,hoverIndex:w}=o,{disabled:h,maxHeight:T,appendToBody:A,formatter:V,disabledKey:k,isSearching:S}=o.props,D=g=>{g[k]||a(g)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu",A&&"devui-dropdown-menu-cdk",h&&"disabled",f.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:d},[S&&n.slots.searchingTemplate&&u.value&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),f.value&&!y.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!v.value&&!u.value&&r!=null&&r.value.length>0&&r.value.map((g,b)=>t.createVNode("li",{onClick:()=>D(g),class:["devui-dropdown-item",s.value==b&&"selected",{disabled:k&&g[k]},{"devui-dropdown-bg":w.value==b}],title:V(g),key:V(g)},[n.slots.itemTemplate?n.slots.itemTemplate(g,b):V(g)])),!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"),c.value],[t.vShow,l.value&&r.value.length>0||n.slots.noResultItemTemplate&&v.value||S&&n.slots.searchingTemplate&&u.value]])}});const Ve=typeof window!="undefined";function q(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const N=Symbol("@@clickoutside"),x=new Map;let U,P=0,X=!0;function G(e,n,o){return Ve&&X&&(X=!1,q(document,"mousedown",l=>{U=l}),q(document,"mouseup",l=>{for(const[s,a]of x)a[N].documentHandler(l,U)})),function(l,s){!o||!n.instance||!l.target||!s.target||e.contains(l.target)||e.contains(s.target)||e===l.target||e[N].bindingFn&&e[N].bindingFn()}}const Se={beforeMount:function(e,n,o){P++,x.set(P,e),e[N]={nid:P,documentHandler:G(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[N].documentHandler=G(e,n,o),e[N].bindingFn=n.value},unmounted:function(e){x.delete(e[N].nid),delete e[N]}},Ce={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function J(e){const n=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const l=window.getComputedStyle(o);if(n.test(l.overflow+l.overflowX+l.overflowY))return o}return window}function Ne(e,n,o,l){let{x:s,y:a}=n;if(!e){const{width:r,height:u}=l;s&&o.includes("start")&&(s=12),s&&o.includes("end")&&(s=Math.round(r-24)),a&&o.includes("start")&&(a=10),a&&o.includes("end")&&(a=u-14)}return{x:s,y:a}}function Ae(e,n){const o=t.ref(),l=t.ref(),s=(r,u,i,d)=>{const{x:c,y:v}=Ne(e.isArrowCenter,i,u,d.getBoundingClientRect()),f={top:"bottom",right:"left",bottom:"top",left:"right"}[u.split("-")[0]];Object.assign(r.style,{left:c?`${c}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[f]:"-4px"})},a=async()=>{const r=e.origin,u=t.unref(o.value),i=t.unref(l.value),d=[m.shift(),m.offset(e.offset),m.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(m.arrow({element:i}));const{x:c,y:v,placement:f,middlewareData:y}=await m.computePosition(r,u,{strategy:"fixed",middleware:d});n("positionChange",f),Object.assign(u.style,{top:`${v}px`,left:`${c}px`}),e.showArrow&&s(i,f,y.arrow,u)};return t.watch(()=>e.modelValue,()=>{const r=J(e.origin);e.modelValue&&e.origin?(t.nextTick(a),r.addEventListener("scroll",a),r!==window&&window.addEventListener("scroll",a),window.addEventListener("resize",a)):(r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a))}),t.onUnmounted(()=>{const r=J(e.origin);r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}),{arrowRef:l,overlayRef:o,updatePosition:a}}var Ke="";const De=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Ce,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:l,expose:s}){const{arrowRef:a,overlayRef:r,updatePosition:u}=Ae(e,l);return s({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:a,class:"devui-flexible-overlay-arrow"},null)])}}});function Q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var L=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Se},props:se,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,appendToBody:s,dAutoCompleteWidth:a,delay:r,allowEmptyValueSearch:u,formatter:i,transInputFocusEmit:d,selectValue:c,source:v,searchFn:f,appendToBodyDirections:y,latestSource:w,showAnimation:h}=t.toRefs(e),{handleSearch:T,searchList:A,showNoResultItemTemplate:V,recentlyFocus:k}=ue(n,u,v,f,i),{onInput:S,onFocus:D,inputRef:g,visible:b,searchStatus:Z,handleClose:B,toggleMenu:ke}=de(n,A,V,l,o,r,T,d,k,w),{selectedIndex:ee,selectOptionClick:te}=ce(n,A,c,T,i,B),{showLoading:Fe,dropDownRef:oe,loadMore:Le}=fe(e,n,T),{customRenderSolts:ne}=ie(n,l),{hoverIndex:Ee,handlekeyDown:Re}=pe(oe,b,A,ee,Z,V,te,B);t.provide(j,{props:e,visible:b,term:"",searchList:A,selectedIndex:ee,searchStatus:Z,selectOptionClick:te,dropDownRef:oe,showLoading:Fe,loadMore:Le,latestSource:w,modelValue:l,showNoResultItemTemplate:V,hoverIndex:Ee});const le=t.ref(),ae=t.reactive({appendToBodyDirections:{}});ae.appendToBodyDirections=y;const xe=()=>{if(s.value){let I;return t.createVNode(De,{hasBackdrop:!1,origin:le,position:ae.appendToBodyDirections,visible:b.value,"onUpdate:visible":Pe=>b.value=Pe},{default:()=>[t.createVNode("div",{class:"devui-dropdown devui-auto-complete-menu",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})])]})}else{let I;return t.createVNode("div",{class:"devui-dropdown",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})]})])}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",b.value&&"devui-select-open"],ref:le,style:{width:a.value>0&&a.value+"px"}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:ke,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:S,onFocus:D,value:l.value,ref:g,onKeydown:Re},null),xe()]),[[t.resolveDirective("click-outside"),B]])}});L.install=function(e){e.component(L.name,L)};var Ie={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(L)}};p.AutoComplete=L,p.default=Ie,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module"});
|
|
1
|
+
var Pe=Object.defineProperty;var ie=Object.getOwnPropertySymbols;var Be=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var z=(v,t,y)=>t in v?Pe(v,t,{enumerable:!0,configurable:!0,writable:!0,value:y}):v[t]=y,I=(v,t)=>{for(var y in t||(t={}))Be.call(t,y)&&z(v,y,t[y]);if(ie)for(var y of ie(t))je.call(t,y)&&z(v,y,t[y]);return v};var T=(v,t,y)=>(z(v,typeof t!="symbol"?t+"":t,y),y);(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,y){"use strict";const _={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 ue(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 de(e,n,o,a,l){const s=t.ref([]),r=t.ref(!1),u=d=>{const p=[];return o.value.forEach(c=>{let m=l.value(c);m=m.toLowerCase(),m.startsWith(d)&&p.push(c)}),p};return{handleSearch:async(d,p=!1)=>{if(d===""&&!n.value){s.value=[],r.value=!1;return}let c=[];d=d.toLowerCase(),p?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 ce(e,n,o,a,l,s,r,u,i,f){const d=t.ref(!1),p=t.ref(),c=t.ref(!1),h=((V,F)=>{let g;return E=>{g&&clearTimeout(g),g=setTimeout(async()=>{c.value=!0,await V(E),c.value=!1},F)}})(async V=>{await r(V),d.value=!0},s.value),C=V=>{const F=V.target;c.value=!1,o.value=!1,e.emit("update:modelValue",F.value),h(F.value)},S=()=>{r(a.value),i(f==null?void 0:f.value),u.value&&u.value()},b=()=>{d.value=!1,c.value=!1,o.value=!1};return{handleClose:b,toggleMenu:()=>{l.value||(d.value?b():(d.value=!0,e.slots.noResultItemTemplate&&n.value.length===0&&a.value.trim()!==""&&(o.value=!0)))},onInput:C,onFocus:S,inputRef:p,visible:d,searchStatus:c}}function fe(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((p,c)=>{typeof p=="string"?p===f&&(d=c):String(p.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 pe(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 ve(e,n,o,a,l,s,r,u){var p;const i=t.ref((p=a.value)!=null?p:0),f=c=>{const m=e.value,w=m.children[c];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=m.getBoundingClientRect(),C=w.getBoundingClientRect();(C.bottom>h.bottom||C.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:c=>{var h;const m=c.key||c.code;if(m==="Escape"&&(n.value&&o.value.length||l.value||s.value)){u();return}const w=n.value&&o.value.length&&!l.value&&!s.value;if(m==="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(m==="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(m==="Enter"&&w){r(o.value[i.value]),i.value=(h=a.value)!=null?h:0;return}}}}class ${constructor(){T(this,"top","50%");T(this,"left","50%")}}const me={message:String,backdrop:Boolean,view:{type:Object,default:()=>new $},zIndex:Number,isFull:{type:Boolean,default:!1}};class ye{constructor(){T(this,"target");T(this,"message");T(this,"loadingTemplateRef");T(this,"backdrop",!0);T(this,"positionType","relative");T(this,"view",new $);T(this,"zIndex")}}var ze="",ge=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:me,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 K=Symbol("dev_component_container");function we(e,n,o=null){const a=t.h(e,I({},n),o),l=document.createElement("div");return a[K]=l,t.render(a,l),a.component}function he(e){t.render(null,e==null?void 0:e.vnode[K])}const be=t.defineComponent(ge),D=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},U=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),Ve=e=>{switch(U(e)){case"promise":return[e];case"array":return e.some(o=>U(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},q=e=>{D.delete(e),e.instance.proxy.close(),he(e.instance)},W=(e,n)=>{var o,a,l;if(n.value){const s=Ve(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),D.add(e),s&&Promise.all(s).catch(r=>{console.error(new Error("Promise handling errors"),r)}).finally(()=>{q(e)})}else q(e)},Y=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},X=(e,n)=>{var s;const o=I(I({},new ye),n),a=o.loadingTemplateRef,l=we(be,I({},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},Te={mounted:function(e,n,o){X(e,o.props),Y(e),!x(n.value)&&W(e,n)},updated:function(e,n,o){!x(n.value)&&D.has(e)||x(n.value)&&!D.has(e)||(!D.has(e)&&X(e,o.props),Y(e),W(e,n))}};var G=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Te},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:p,latestSource:c,modelValue:m,hoverIndex:w,valueParser:h}=o,{disabled:C,maxHeight:S,formatter:b,disabledKey:A,isSearching:V}=o.props,F=g=>{g=h.value(g),!(typeof g=="object"&&g[A])&&s(g)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu","devui-dropdown-menu-cdk",C&&"disabled",c.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${S}px`},onScroll:f},[V&&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&&!m.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!p.value&&!(u==null?void 0:u.value)&&r!=null&&r.value.length>0&&r.value.map((g,E)=>t.createVNode("li",{onClick:()=>F(g),class:["devui-dropdown-item",l.value===E&&"selected",{disabled:A&&typeof g=="object"&&g[A]},{"devui-dropdown-bg":w.value===E}],title:b(g),key:b(g)},[n.slots.itemTemplate?n.slots.itemTemplate(g,E):b(g)])),!(u==null?void 0:u.value)&&r.value.length===0&&n.slots.noResultItemTemplate&&p.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&&p.value||V&&n.slots.searchingTemplate&&(u==null?void 0:u.value)]])}});const Ne=typeof window!="undefined";function J(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const N=Symbol("@@clickoutside"),O=new Map;let Q,P=0,Z=!0;function ee(e,n,o){return Ne&&Z&&(Z=!1,J(document,"mousedown",a=>{Q=a}),J(document,"mouseup",a=>{for(const[l,s]of O)s[N].documentHandler(a,Q)})),function(a,l){!o||!n.instance||!a.target||!l.target||e.contains(a.target)||e.contains(l.target)||e===a.target||e[N].bindingFn&&e[N].bindingFn()}}const Ce={beforeMount:function(e,n,o){P++,O.set(P,e),e[N]={nid:P,documentHandler:ee(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[N].documentHandler=ee(e,n,o),e[N].bindingFn=n.value},unmounted:function(e){O.delete(e[N].nid),delete e[N]}},Ae={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function Fe(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 Se(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 Ee(e,n){const o=t.ref(),a=t.ref();let l=null;const s=(u,i,f,d)=>{const{x:p,y:c}=Se(e.isArrowCenter,f,i,d.getBoundingClientRect()),m={top:"bottom",right:"left",bottom:"top",left:"right"}[i.split("-")[0]];Object.assign(u.style,{left:p?`${p}px`:"",top:c?`${c}px`:"",right:"",bottom:"",[m]:"-4px"})},r=async()=>{const u=e.origin,i=t.unref(o.value),f=t.unref(a.value),d=[y.shift(),y.offset(e.offset),y.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(y.arrow({element:f}));const{x:p,y:c,placement:m,middlewareData:w}=await y.computePosition(u,i,{strategy:"fixed",middleware:d});n("positionChange",m),Object.assign(i.style,{top:`${c}px`,left:`${p}px`}),e.showArrow&&s(f,m,w.arrow,i)};return t.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(l=Fe(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 _e="";const te=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Ae,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:a,expose:l}){const{arrowRef:s,overlayRef:r,updatePosition:u}=Ee(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 $e="";function oe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var B=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Ce},props:_,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:p,searchFn:c,position:m,latestSource:w,showAnimation:h,valueParser:C}=t.toRefs(e),{handleSearch:S,searchList:b,showNoResultItemTemplate:A,recentlyFocus:V}=de(n,r,p,c,i),{onInput:F,onFocus:g,inputRef:E,visible:L,searchStatus:ne,handleClose:j,toggleMenu:ke}=ce(n,b,A,a,o,s,S,f,V,w),{selectedIndex:le,selectOptionClick:ae}=fe(n,b,d,S,i,j),{showLoading:De,dropDownRef:re,loadMore:Ie}=pe(e,n,S),{customRenderSolts:se}=ue(n,a),{hoverIndex:Re,handlekeyDown:xe}=ve(re,L,b,le,ne,A,ae,j);t.provide(R,{props:e,visible:L,term:"",searchList:b,selectedIndex:le,searchStatus:ne,selectOptionClick:ae,dropDownRef:re,showLoading:De,loadMore:Ie,latestSource:w,modelValue:a,showNoResultItemTemplate:A,hoverIndex:Re,valueParser:C});const M=t.ref(),Oe=()=>{if(u.value){let k;return t.createVNode(t.Teleport,{to:"body"},{default:()=>[t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(te,{"show-arrow":!0,origin:M.value,position:m.value,modelValue:L.value,"onUpdate:modelValue":H=>L.value=H},{default:()=>[t.createVNode("div",{class:"devui-auto-complete-menu",style:{width:`
|
|
2
|
+
${l.value+"px"}
|
|
3
|
+
`}},[t.createVNode(G,null,oe(k=se())?k:{default:()=>[k]})])]})]})]})}else{let k;return t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(te,{"show-arrow":!0,origin:M.value,position:m.value,modelValue:L.value,"onUpdate:modelValue":H=>L.value=H},{default:()=>[t.createVNode("div",{class:"devui-auto-complete-menu",style:{width:`
|
|
4
|
+
${l.value+"px"}
|
|
5
|
+
`}},[t.createVNode(G,null,oe(k=se())?k:{default:()=>[k]})])]})]})}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",L.value&&"devui-select-open"],ref:M,style:{width:`${l.value+"px"}`}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:ke,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:F,onFocus:g,value:a.value,ref:E,onKeydown:xe},null),Oe()]),[[t.resolveDirective("click-outside"),j]])}}),Le={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(B.name,B)}};v.AutoComplete=B,v.DropdownPropsKey=R,v.autoCompleteProps=_,v.default=Le,Object.defineProperty(v,"__esModule",{value:!0}),v[Symbol.toStringTag]="Module"});
|