vue-devui 1.0.0-rc.9 → 1.0.2
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 +189 -149
- package/alert/index.es.js +12 -7
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8036 -260
- package/auto-complete/index.umd.js +29 -3
- package/auto-complete/style.css +1 -1
- package/badge/index.es.js +8 -2
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +110 -45
- package/button/index.umd.js +15 -15
- package/button/style.css +1 -1
- package/card/index.es.js +5 -1
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +7778 -81
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{date-picker → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{date-picker → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +56 -13
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12022 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.es.js +22 -5
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +92 -123
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +374 -149
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +102 -123
- package/form/index.umd.js +14 -14
- package/form/style.css +1 -1
- package/icon/index.es.js +107 -41
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8097 -170
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +34 -32
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +51 -51
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8326 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +921 -0
- package/menu/index.umd.js +1 -0
- package/menu/package.json +7 -0
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +539 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +390 -185
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +148 -79
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/paginationInjectionKey.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/overlay/index.es.js +87 -140
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +7 -4
- package/pagination/index.es.js +10180 -129
- package/pagination/index.umd.js +27 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +4 -0
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +111 -164
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/style.css +1 -1
- package/radio/index.es.js +7860 -58
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +93 -41
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3737 -1206
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +4446 -2499
- package/select/index.umd.js +17 -17
- package/select/style.css +1 -1
- package/skeleton/index.es.js +87 -261
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +116 -143
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +284 -152
- package/splitter/index.umd.js +16 -16
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +34 -16
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +4 -0
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +387 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.es.js +7785 -60
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +4224 -1502
- package/table/index.umd.js +17 -17
- package/table/style.css +1 -1
- package/tabs/index.es.js +281 -83
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +5 -1
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +3362 -1061
- package/textarea/index.umd.js +19 -19
- package/textarea/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9549 -0
- package/time-picker/index.umd.js +27 -0
- package/time-picker/package.json +7 -0
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9610 -0
- package/time-select/index.umd.js +27 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +93 -41
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +127 -168
- package/tooltip/index.umd.js +16 -16
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11045 -607
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +394 -111
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +19687 -11762
- package/vue-devui.umd.js +24 -23
- package/date-picker/index.es.js +0 -1298
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/Loading.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/formControlProps.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,24 +16,30 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
var __publicField = (obj, key, value) => {
|
|
18
21
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
22
|
return value;
|
|
20
23
|
};
|
|
21
|
-
import { defineComponent, ref, createVNode, h, render, computed, nextTick, unref, watch, onUnmounted,
|
|
24
|
+
import { defineComponent, ref, createVNode, h, render, computed, nextTick, unref, watch, onUnmounted, toRefs, mergeProps, withModifiers, reactive, getCurrentInstance, withDirectives, resolveComponent, Teleport, Transition, vShow, resolveDirective } from "vue";
|
|
22
25
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
23
26
|
const editableSelectProps = {
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
24
31
|
options: {
|
|
25
32
|
type: Array,
|
|
26
33
|
default: () => []
|
|
27
34
|
},
|
|
28
|
-
|
|
29
|
-
type: Boolean
|
|
35
|
+
allowClear: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
30
38
|
},
|
|
31
|
-
|
|
39
|
+
disabled: {
|
|
32
40
|
type: Boolean
|
|
33
41
|
},
|
|
34
|
-
|
|
42
|
+
disabledKey: {
|
|
35
43
|
type: String,
|
|
36
44
|
default: ""
|
|
37
45
|
},
|
|
@@ -39,18 +47,21 @@ const editableSelectProps = {
|
|
|
39
47
|
type: String,
|
|
40
48
|
default: "Search"
|
|
41
49
|
},
|
|
42
|
-
modelValue: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: ""
|
|
45
|
-
},
|
|
46
50
|
width: {
|
|
47
51
|
type: Number
|
|
48
52
|
},
|
|
49
53
|
maxHeight: {
|
|
50
54
|
type: Number
|
|
51
55
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
56
|
+
loading: {
|
|
57
|
+
type: Boolean
|
|
58
|
+
},
|
|
59
|
+
enableLazyLoad: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
searchFn: {
|
|
64
|
+
type: Function
|
|
54
65
|
}
|
|
55
66
|
};
|
|
56
67
|
const inBrowser = typeof window !== "undefined";
|
|
@@ -163,7 +174,7 @@ function useNamespace(block, needDot = false) {
|
|
|
163
174
|
}
|
|
164
175
|
var loading = "";
|
|
165
176
|
var Loading = defineComponent({
|
|
166
|
-
name: "
|
|
177
|
+
name: "Loading",
|
|
167
178
|
inheritAttrs: false,
|
|
168
179
|
props: loadingProps,
|
|
169
180
|
setup(props) {
|
|
@@ -316,12 +327,12 @@ const handleProps = (el, vprops) => {
|
|
|
316
327
|
const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
|
|
317
328
|
const loadingTemplateRef = props.loadingTemplateRef;
|
|
318
329
|
const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
319
|
-
el.style.position = props.positionType;
|
|
330
|
+
el.style.position = props.positionType || "relative";
|
|
320
331
|
el.options = props;
|
|
321
332
|
el.instance = loadingInstance;
|
|
322
333
|
el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
|
|
323
334
|
};
|
|
324
|
-
const
|
|
335
|
+
const LoadingDirective = {
|
|
325
336
|
mounted: function(el, binding, vnode) {
|
|
326
337
|
handleProps(el, vnode.props);
|
|
327
338
|
removeAttribute(el);
|
|
@@ -346,51 +357,68 @@ function className(classStr, classOpt) {
|
|
|
346
357
|
return classname;
|
|
347
358
|
}
|
|
348
359
|
var editableSelect = "";
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
360
|
+
function useSelect(props) {
|
|
361
|
+
const normalizeOptions = computed(() => {
|
|
362
|
+
return props.options.map((option) => {
|
|
363
|
+
let res;
|
|
364
|
+
if (option !== "null" && typeof option === "object") {
|
|
365
|
+
res = __spreadProps(__spreadValues({}, option), {
|
|
366
|
+
label: option.label || "",
|
|
367
|
+
value: option.value !== void 0 ? option.value : option.label || ""
|
|
368
|
+
});
|
|
369
|
+
} else {
|
|
370
|
+
res = {
|
|
371
|
+
label: String(option),
|
|
372
|
+
value: option
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
return res;
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
return { normalizeOptions };
|
|
379
|
+
}
|
|
380
|
+
function useFilterOptions(enableLazyLoad, normalizeOptions, inputValue, searchFn) {
|
|
381
|
+
const filteredOptions = computed(() => {
|
|
382
|
+
if (!inputValue.value || enableLazyLoad) {
|
|
383
|
+
return normalizeOptions.value;
|
|
359
384
|
}
|
|
385
|
+
return normalizeOptions.value.filter((option) => {
|
|
386
|
+
return searchFn(option, inputValue.value);
|
|
387
|
+
});
|
|
360
388
|
});
|
|
361
|
-
return filteredOptions;
|
|
362
|
-
}
|
|
363
|
-
|
|
389
|
+
return { filteredOptions };
|
|
390
|
+
}
|
|
391
|
+
function useInput(inputValue, ctx2) {
|
|
364
392
|
const onInputChange = (value) => {
|
|
365
393
|
ctx2.emit("search", value);
|
|
366
394
|
};
|
|
367
395
|
const handleInput = (event) => {
|
|
368
396
|
const value = event.target.value;
|
|
369
397
|
inputValue.value = value;
|
|
370
|
-
ctx2.emit("update:modelValue", value);
|
|
371
398
|
onInputChange(value);
|
|
372
399
|
};
|
|
373
400
|
return {
|
|
374
401
|
handleInput
|
|
375
402
|
};
|
|
376
|
-
}
|
|
377
|
-
|
|
403
|
+
}
|
|
404
|
+
function useLazyLoad(dropdownRef, enableLazyLoad, ctx2) {
|
|
378
405
|
const loadMore = () => {
|
|
379
406
|
const dropdownVal = dropdownRef.value;
|
|
380
|
-
if (
|
|
407
|
+
if (!enableLazyLoad) {
|
|
381
408
|
return;
|
|
382
409
|
}
|
|
383
|
-
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
|
|
384
|
-
ctx2.emit("loadMore"
|
|
410
|
+
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight - 12) {
|
|
411
|
+
ctx2.emit("loadMore");
|
|
385
412
|
}
|
|
386
413
|
};
|
|
387
414
|
return { loadMore };
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
415
|
+
}
|
|
416
|
+
function useKeyboardSelect(dropdownRef, hoverIndex, filteredOptions, disabledKey, visible, loading2, handleClick, toggleMenu, closeMenu) {
|
|
417
|
+
const handleEscape = () => {
|
|
418
|
+
closeMenu();
|
|
419
|
+
};
|
|
420
|
+
const handleEnter = () => {
|
|
421
|
+
handleClick(filteredOptions.value[hoverIndex.value], hoverIndex.value);
|
|
394
422
|
};
|
|
395
423
|
const scrollToItem = (index2) => {
|
|
396
424
|
const ul = dropdownRef.value;
|
|
@@ -407,55 +435,43 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
|
|
|
407
435
|
}
|
|
408
436
|
});
|
|
409
437
|
};
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
inputValue.value = "";
|
|
413
|
-
} else {
|
|
414
|
-
closeMenu();
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
const handleEnter = () => {
|
|
418
|
-
const len = filteredOptions.value.length;
|
|
419
|
-
if (!visible.value || !len) {
|
|
420
|
-
return toggleMenu();
|
|
421
|
-
}
|
|
422
|
-
len && len === 1 ? handleClick(filteredOptions.value[0]) : handleClick(filteredOptions.value[hoverIndex.value]);
|
|
423
|
-
return closeMenu();
|
|
438
|
+
const updateIndex = (index2) => {
|
|
439
|
+
hoverIndex.value = index2;
|
|
424
440
|
};
|
|
425
|
-
const handleKeyboardNavigation = (direction) => {
|
|
441
|
+
const handleKeyboardNavigation = (direction, index2 = hoverIndex.value) => {
|
|
426
442
|
const len = filteredOptions.value.length;
|
|
427
|
-
if (
|
|
443
|
+
if (len === 0) {
|
|
428
444
|
return;
|
|
429
445
|
}
|
|
430
|
-
if (!["
|
|
446
|
+
if (!["ArrowUp", "ArrowDown"].includes(direction)) {
|
|
431
447
|
return;
|
|
432
448
|
}
|
|
433
|
-
if (filterOption === false && loading2.value) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
let newIndex = 0;
|
|
437
|
-
newIndex = hoverIndex.value;
|
|
438
449
|
if (direction === "ArrowUp") {
|
|
439
|
-
|
|
440
|
-
if (
|
|
441
|
-
|
|
450
|
+
index2 -= 1;
|
|
451
|
+
if (index2 === -1) {
|
|
452
|
+
index2 = len - 1;
|
|
442
453
|
}
|
|
443
454
|
} else if (direction === "ArrowDown") {
|
|
444
|
-
|
|
445
|
-
if (
|
|
446
|
-
|
|
455
|
+
index2 += 1;
|
|
456
|
+
if (index2 === len) {
|
|
457
|
+
index2 = 0;
|
|
447
458
|
}
|
|
448
459
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
return handleKeyboardNavigation(direction);
|
|
460
|
+
const option = filteredOptions.value[index2];
|
|
461
|
+
if (option[disabledKey]) {
|
|
462
|
+
return handleKeyboardNavigation(direction, index2);
|
|
453
463
|
}
|
|
454
|
-
|
|
455
|
-
scrollToItem(
|
|
464
|
+
updateIndex(index2);
|
|
465
|
+
scrollToItem(index2);
|
|
456
466
|
};
|
|
457
467
|
const handleKeydown = (event) => {
|
|
458
468
|
const keyCode = event.key || event.code;
|
|
469
|
+
if (loading2.value) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (!visible.value) {
|
|
473
|
+
return toggleMenu();
|
|
474
|
+
}
|
|
459
475
|
switch (keyCode) {
|
|
460
476
|
case "Escape":
|
|
461
477
|
handleEscape();
|
|
@@ -467,8 +483,10 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
|
|
|
467
483
|
handleKeyboardNavigation(keyCode);
|
|
468
484
|
}
|
|
469
485
|
};
|
|
470
|
-
return {
|
|
471
|
-
|
|
486
|
+
return {
|
|
487
|
+
handleKeydown
|
|
488
|
+
};
|
|
489
|
+
}
|
|
472
490
|
const flexibleOverlayProps = {
|
|
473
491
|
modelValue: {
|
|
474
492
|
type: Boolean,
|
|
@@ -500,6 +518,10 @@ const flexibleOverlayProps = {
|
|
|
500
518
|
isArrowCenter: {
|
|
501
519
|
type: Boolean,
|
|
502
520
|
default: true
|
|
521
|
+
},
|
|
522
|
+
clickEventBubble: {
|
|
523
|
+
type: Boolean,
|
|
524
|
+
default: false
|
|
503
525
|
}
|
|
504
526
|
};
|
|
505
527
|
function getScrollParent(element) {
|
|
@@ -614,6 +636,9 @@ const FlexibleOverlay = defineComponent({
|
|
|
614
636
|
expose
|
|
615
637
|
}) {
|
|
616
638
|
const ns = useNamespace("flexible-overlay");
|
|
639
|
+
const {
|
|
640
|
+
clickEventBubble
|
|
641
|
+
} = toRefs(props);
|
|
617
642
|
const {
|
|
618
643
|
arrowRef,
|
|
619
644
|
overlayRef,
|
|
@@ -627,49 +652,234 @@ const FlexibleOverlay = defineComponent({
|
|
|
627
652
|
return props.modelValue && createVNode("div", mergeProps({
|
|
628
653
|
"ref": overlayRef,
|
|
629
654
|
"class": ns.b()
|
|
630
|
-
}, attrs
|
|
655
|
+
}, attrs, {
|
|
656
|
+
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
657
|
+
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
658
|
+
}), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
631
659
|
"ref": arrowRef,
|
|
632
660
|
"class": ns.e("arrow")
|
|
633
661
|
}, null)]);
|
|
634
662
|
};
|
|
635
663
|
}
|
|
636
664
|
});
|
|
665
|
+
function useCacheFilteredOptions(filteredOptions) {
|
|
666
|
+
const cacheFilteredOptions = computed(() => {
|
|
667
|
+
const map = /* @__PURE__ */ new Map();
|
|
668
|
+
filteredOptions.value.forEach((item) => {
|
|
669
|
+
map.set(item, item.value);
|
|
670
|
+
});
|
|
671
|
+
return map;
|
|
672
|
+
});
|
|
673
|
+
const getOptionValue = (option) => cacheFilteredOptions.value.get(option);
|
|
674
|
+
return {
|
|
675
|
+
getOptionValue
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function deepAssign(...objects) {
|
|
679
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
680
|
+
return objects.reduce((prev, from) => {
|
|
681
|
+
Object.keys(from).forEach((key) => {
|
|
682
|
+
const pVal = prev[key];
|
|
683
|
+
const oVal = from[key];
|
|
684
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
685
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
686
|
+
} else if (isObject(pVal) && isObject(oVal)) {
|
|
687
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
688
|
+
} else {
|
|
689
|
+
prev[key] = oVal;
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
return prev;
|
|
693
|
+
}, {});
|
|
694
|
+
}
|
|
695
|
+
var zhCN = {
|
|
696
|
+
pagination: {
|
|
697
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
698
|
+
goToText: "\u8DF3\u81F3",
|
|
699
|
+
perPage: "\u6761/\u9875"
|
|
700
|
+
},
|
|
701
|
+
accordion: {
|
|
702
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
703
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
704
|
+
},
|
|
705
|
+
autoCompleteDropdown: {
|
|
706
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
707
|
+
},
|
|
708
|
+
cascaderList: {
|
|
709
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
710
|
+
},
|
|
711
|
+
colorPicker: {
|
|
712
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
713
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
714
|
+
},
|
|
715
|
+
datePickerPro: {
|
|
716
|
+
ok: "\u786E\u5B9A",
|
|
717
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
718
|
+
month1: "1\u6708",
|
|
719
|
+
month2: "2\u6708",
|
|
720
|
+
month3: "3\u6708",
|
|
721
|
+
month4: "4\u6708",
|
|
722
|
+
month5: "5\u6708",
|
|
723
|
+
month6: "6\u6708",
|
|
724
|
+
month7: "7\u6708",
|
|
725
|
+
month8: "8\u6708",
|
|
726
|
+
month9: "9\u6708",
|
|
727
|
+
month10: "10\u6708",
|
|
728
|
+
month11: "11\u6708",
|
|
729
|
+
month12: "12\u6708",
|
|
730
|
+
year: "\u5E74",
|
|
731
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
732
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
733
|
+
getWeekDays() {
|
|
734
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
735
|
+
},
|
|
736
|
+
getTimeArr() {
|
|
737
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
738
|
+
},
|
|
739
|
+
getYearMonthStr(year, month) {
|
|
740
|
+
return `${year}\u5E74${month}\u6708`;
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
editableSelect: {
|
|
744
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
745
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
746
|
+
},
|
|
747
|
+
input: {
|
|
748
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
749
|
+
},
|
|
750
|
+
splitterBar: {
|
|
751
|
+
collapse: "\u6536\u8D77",
|
|
752
|
+
expand: "\u5C55\u5F00"
|
|
753
|
+
},
|
|
754
|
+
stepsGuide: {
|
|
755
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
756
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
757
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
758
|
+
},
|
|
759
|
+
table: {
|
|
760
|
+
selectAll: "\u5168\u9009",
|
|
761
|
+
ok: "\u786E\u5B9A"
|
|
762
|
+
},
|
|
763
|
+
timePopup: {
|
|
764
|
+
ok: "\u786E\u5B9A"
|
|
765
|
+
},
|
|
766
|
+
transfer: {
|
|
767
|
+
unit: "\u9879",
|
|
768
|
+
panelUnit: "\u9879",
|
|
769
|
+
headerUnit: "\u9879",
|
|
770
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
771
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
772
|
+
},
|
|
773
|
+
tree: {
|
|
774
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
775
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
776
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
777
|
+
},
|
|
778
|
+
upload: {
|
|
779
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
780
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
781
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
782
|
+
},
|
|
783
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
784
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
785
|
+
},
|
|
786
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
787
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
788
|
+
},
|
|
789
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
790
|
+
return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
search: {
|
|
794
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
795
|
+
},
|
|
796
|
+
select: {
|
|
797
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
798
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
799
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
800
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
801
|
+
},
|
|
802
|
+
tagInput: {
|
|
803
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
804
|
+
},
|
|
805
|
+
timeSelect: {
|
|
806
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
const lang = ref("zh-CN");
|
|
810
|
+
let langMessages = reactive({
|
|
811
|
+
[lang.value]: zhCN
|
|
812
|
+
});
|
|
813
|
+
const Locale = {
|
|
814
|
+
messages() {
|
|
815
|
+
return langMessages[lang.value];
|
|
816
|
+
},
|
|
817
|
+
lang() {
|
|
818
|
+
return lang.value;
|
|
819
|
+
},
|
|
820
|
+
use(newLang, newMessages) {
|
|
821
|
+
lang.value = newLang;
|
|
822
|
+
this.add({ [newLang]: newMessages });
|
|
823
|
+
},
|
|
824
|
+
add(newMessages = {}) {
|
|
825
|
+
langMessages = deepAssign(langMessages, newMessages);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
829
|
+
function get(object, path) {
|
|
830
|
+
const keys = path.split(".");
|
|
831
|
+
let result = object;
|
|
832
|
+
keys.forEach((key) => {
|
|
833
|
+
var _a;
|
|
834
|
+
result = (_a = result[key]) != null ? _a : "";
|
|
835
|
+
});
|
|
836
|
+
return result;
|
|
837
|
+
}
|
|
838
|
+
function createI18nTranslate(name, app, newPrefix) {
|
|
839
|
+
const prefix = newPrefix || camelize(name) + ".";
|
|
840
|
+
return (path) => {
|
|
841
|
+
var _a;
|
|
842
|
+
const messages = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
843
|
+
const message = get(messages, prefix + path) || get(messages, path);
|
|
844
|
+
return message;
|
|
845
|
+
};
|
|
846
|
+
}
|
|
637
847
|
var EditableSelect = defineComponent({
|
|
638
848
|
name: "DEditableSelect",
|
|
639
849
|
directives: {
|
|
640
|
-
|
|
641
|
-
|
|
850
|
+
ClickOutside: clickoutsideDirective,
|
|
851
|
+
Loading: LoadingDirective
|
|
642
852
|
},
|
|
643
853
|
props: editableSelectProps,
|
|
644
854
|
emits: ["update:modelValue", "search", "loadMore"],
|
|
645
855
|
setup(props, ctx2) {
|
|
856
|
+
const app = getCurrentInstance();
|
|
857
|
+
const t = createI18nTranslate("DEditableSelect", app);
|
|
858
|
+
const ns = useNamespace("editable-select");
|
|
646
859
|
const dropdownRef = ref();
|
|
647
860
|
const origin = ref();
|
|
861
|
+
const hoverIndex = ref(0);
|
|
862
|
+
const selectedIndex = ref(0);
|
|
648
863
|
const position = ref(["bottom"]);
|
|
649
864
|
const visible = ref(false);
|
|
650
865
|
const inputValue = ref(props.modelValue);
|
|
651
866
|
const loading2 = ref(props.loading);
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
value: option
|
|
663
|
-
};
|
|
664
|
-
});
|
|
665
|
-
});
|
|
666
|
-
const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
|
|
867
|
+
const {
|
|
868
|
+
normalizeOptions
|
|
869
|
+
} = useSelect(props);
|
|
870
|
+
const searchFn = props.searchFn || ((option, term) => option.label.toLocaleLowerCase().includes(term.trim().toLocaleLowerCase()));
|
|
871
|
+
const {
|
|
872
|
+
filteredOptions
|
|
873
|
+
} = useFilterOptions(props.enableLazyLoad, normalizeOptions, inputValue, searchFn);
|
|
874
|
+
const {
|
|
875
|
+
getOptionValue
|
|
876
|
+
} = useCacheFilteredOptions(filteredOptions);
|
|
667
877
|
const emptyText = computed(() => {
|
|
668
|
-
let text
|
|
669
|
-
if (props.
|
|
670
|
-
text = "
|
|
671
|
-
} else
|
|
672
|
-
text = "
|
|
878
|
+
let text;
|
|
879
|
+
if (props.enableLazyLoad) {
|
|
880
|
+
text = t("noData");
|
|
881
|
+
} else {
|
|
882
|
+
text = t("noRelatedRecords");
|
|
673
883
|
}
|
|
674
884
|
return text;
|
|
675
885
|
});
|
|
@@ -684,45 +894,46 @@ var EditableSelect = defineComponent({
|
|
|
684
894
|
};
|
|
685
895
|
const {
|
|
686
896
|
loadMore
|
|
687
|
-
} = useLazyLoad(dropdownRef,
|
|
897
|
+
} = useLazyLoad(dropdownRef, props.enableLazyLoad, ctx2);
|
|
688
898
|
const {
|
|
689
899
|
handleInput
|
|
690
900
|
} = useInput(inputValue, ctx2);
|
|
691
|
-
const handleClick = (option) => {
|
|
901
|
+
const handleClick = (option, index2) => {
|
|
692
902
|
const {
|
|
693
|
-
|
|
903
|
+
disabledKey
|
|
694
904
|
} = props;
|
|
695
905
|
if (disabledKey && !!option[disabledKey]) {
|
|
696
906
|
return;
|
|
697
907
|
}
|
|
698
|
-
|
|
908
|
+
inputValue.value = option.label;
|
|
909
|
+
hoverIndex.value = selectedIndex.value;
|
|
910
|
+
selectedIndex.value = index2;
|
|
911
|
+
const value = getOptionValue(option);
|
|
912
|
+
ctx2.emit("update:modelValue", value + "");
|
|
699
913
|
closeMenu();
|
|
700
914
|
};
|
|
701
915
|
const {
|
|
702
|
-
handleKeydown
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
inputValue.value = newVal;
|
|
709
|
-
}
|
|
710
|
-
});
|
|
916
|
+
handleKeydown
|
|
917
|
+
} = useKeyboardSelect(dropdownRef, hoverIndex, filteredOptions, props.disabledKey, visible, loading2, handleClick, toggleMenu, closeMenu);
|
|
918
|
+
const handleClear = () => {
|
|
919
|
+
inputValue.value = "";
|
|
920
|
+
ctx2.emit("update:modelValue", "");
|
|
921
|
+
};
|
|
711
922
|
const getItemCls = (option, index2) => {
|
|
712
923
|
const {
|
|
713
|
-
|
|
924
|
+
disabledKey
|
|
714
925
|
} = props;
|
|
715
|
-
return className(
|
|
926
|
+
return className(`devui-dropdown-item`, {
|
|
716
927
|
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
717
|
-
selected: index2 === selectedIndex.value,
|
|
718
|
-
"
|
|
928
|
+
selected: filteredOptions.value.length === 1 || index2 === selectedIndex.value,
|
|
929
|
+
[`${ns.em("dropdown", "bg")}`]: index2 === hoverIndex.value
|
|
719
930
|
});
|
|
720
931
|
};
|
|
721
932
|
return () => {
|
|
722
|
-
const selectCls = className(
|
|
723
|
-
"
|
|
933
|
+
const selectCls = className(`${ns.b()} devui-form-group devui-has-feedback ${inputValue.value && props.allowClear && "allow-clear"}`, {
|
|
934
|
+
[`${ns.m("open")}`]: visible.value === true
|
|
724
935
|
});
|
|
725
|
-
const inputCls = className(
|
|
936
|
+
const inputCls = className(`devui-form-control devui-dropdown-origin`, {
|
|
726
937
|
"devui-dropdown-origin-open": visible.value === true
|
|
727
938
|
});
|
|
728
939
|
return withDirectives(createVNode("div", {
|
|
@@ -743,42 +954,56 @@ var EditableSelect = defineComponent({
|
|
|
743
954
|
}, null), createVNode("span", {
|
|
744
955
|
"class": "devui-form-control-feedback"
|
|
745
956
|
}, [createVNode("span", {
|
|
957
|
+
"class": "devui-select-clear-icon",
|
|
958
|
+
"onClick": handleClear
|
|
959
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
960
|
+
"name": "icon-remove"
|
|
961
|
+
}, null)]), createVNode("span", {
|
|
746
962
|
"class": "devui-select-chevron-icon"
|
|
747
963
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
748
964
|
"name": "select-arrow"
|
|
749
|
-
}, null)])]), createVNode(
|
|
750
|
-
"
|
|
751
|
-
"modelValue": visible.value,
|
|
752
|
-
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
753
|
-
"position": position.value,
|
|
754
|
-
"hasBackdrop": false
|
|
965
|
+
}, null)])]), createVNode(Teleport, {
|
|
966
|
+
"to": "body"
|
|
755
967
|
}, {
|
|
756
|
-
default: () => [createVNode(
|
|
757
|
-
"
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
maxHeight: props.maxHeight + "px"
|
|
767
|
-
},
|
|
768
|
-
"onScroll": loadMore
|
|
769
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
770
|
-
return createVNode("li", {
|
|
771
|
-
"class": getItemCls(option, index2),
|
|
772
|
-
"onClick": (e) => {
|
|
773
|
-
e.stopPropagation();
|
|
774
|
-
handleClick(option);
|
|
968
|
+
default: () => [createVNode(Transition, {
|
|
969
|
+
"name": "fade"
|
|
970
|
+
}, {
|
|
971
|
+
default: () => [createVNode(FlexibleOverlay, {
|
|
972
|
+
"origin": origin.value,
|
|
973
|
+
"modelValue": visible.value,
|
|
974
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
975
|
+
"position": position.value,
|
|
976
|
+
"style": {
|
|
977
|
+
zIndex: "var(--devui-z-index-dropdown, 1052)"
|
|
775
978
|
}
|
|
776
|
-
},
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
979
|
+
}, {
|
|
980
|
+
default: () => [createVNode("div", {
|
|
981
|
+
"style": {
|
|
982
|
+
width: props.width + "px"
|
|
983
|
+
},
|
|
984
|
+
"class": `${ns.e("menu")}`
|
|
985
|
+
}, [withDirectives(createVNode("div", {
|
|
986
|
+
"class": `devui-dropdown-menu`
|
|
987
|
+
}, [createVNode("ul", {
|
|
988
|
+
"ref": dropdownRef,
|
|
989
|
+
"class": `${ns.em("list", "unstyled")} devui-scrollbar scroll-height`,
|
|
990
|
+
"style": {
|
|
991
|
+
maxHeight: props.maxHeight + "px"
|
|
992
|
+
},
|
|
993
|
+
"onScroll": loadMore
|
|
994
|
+
}, [filteredOptions.value.map((option, index2) => {
|
|
995
|
+
return createVNode("li", {
|
|
996
|
+
"class": getItemCls(option, index2),
|
|
997
|
+
"onClick": (e) => {
|
|
998
|
+
e.stopPropagation();
|
|
999
|
+
handleClick(option, index2);
|
|
1000
|
+
}
|
|
1001
|
+
}, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
|
|
1002
|
+
}), withDirectives(createVNode("div", {
|
|
1003
|
+
"class": "devui-no-data-tip"
|
|
1004
|
+
}, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem(inputValue.value) : emptyText.value]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value], [resolveDirective("loading"), props.loading]])])]
|
|
1005
|
+
})]
|
|
1006
|
+
})]
|
|
782
1007
|
})]), [[resolveDirective("click-outside"), closeMenu]]);
|
|
783
1008
|
};
|
|
784
1009
|
}
|