vue-devui 1.0.0-beta.1 → 1.0.0-beta.10
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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +186 -139
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +2 -3
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +1 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +1 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/button/index.d.ts +7 -0
- package/button/index.es.js +9 -8
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +1 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +5 -4
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1239 -83
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +43 -8
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +32 -21
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +161 -41
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5718 -469
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +14 -4
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +6 -5
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +72 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +24 -13
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +5 -4
- package/input-number/index.umd.js +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +1 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +117 -99
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +110 -93
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +6 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +3 -3
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +25 -22
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +5 -2
- package/popover/index.umd.js +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +1 -1
- package/progress/index.umd.js +2 -2
- package/quadrant-diagram/index.d.ts +7 -0
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +1 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +1 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +5 -2
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +35 -21
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +47 -11
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +148 -26
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +30 -177
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +107 -89
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +2 -2
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +101 -73
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +1 -1
- package/switch/index.umd.js +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1498 -156
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +6 -3
- package/tabs/index.umd.js +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +1 -13
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +241 -21
- package/time-axis/index.umd.js +1 -1
- package/time-axis/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +50 -26
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +8 -7
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +368 -79
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +171 -35
- package/tree/index.umd.js +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +8 -7
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +19214 -7637
- package/vue-devui.umd.js +29 -3
package/transfer/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent,
|
|
20
|
+
import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, reactive, onMounted, onBeforeUnmount, renderSlot, useSlots, isVNode, createTextVNode } from "vue";
|
|
21
21
|
const transferBaseProps = {
|
|
22
22
|
sourceOption: {
|
|
23
23
|
type: Array,
|
|
@@ -47,10 +47,14 @@ const transferBaseProps = {
|
|
|
47
47
|
type: Boolean,
|
|
48
48
|
default: () => false
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
filter: {
|
|
51
51
|
type: String,
|
|
52
52
|
default: () => ""
|
|
53
53
|
},
|
|
54
|
+
height: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: () => "320px"
|
|
57
|
+
},
|
|
54
58
|
alltargetState: {
|
|
55
59
|
type: Boolean,
|
|
56
60
|
default: () => false
|
|
@@ -67,6 +71,14 @@ const transferBaseProps = {
|
|
|
67
71
|
type: Number,
|
|
68
72
|
default: () => 0
|
|
69
73
|
},
|
|
74
|
+
showTooltip: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: () => false
|
|
77
|
+
},
|
|
78
|
+
tooltipPosition: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: () => "top"
|
|
81
|
+
},
|
|
70
82
|
scopedSlots: {
|
|
71
83
|
type: Object
|
|
72
84
|
},
|
|
@@ -100,7 +112,7 @@ const initState = (props, type) => {
|
|
|
100
112
|
allChecked: false,
|
|
101
113
|
disabled: false,
|
|
102
114
|
checkedNum: initModel.model.length,
|
|
103
|
-
|
|
115
|
+
keyword: "",
|
|
104
116
|
checkedValues: initModel.model,
|
|
105
117
|
filterData: initModel.data
|
|
106
118
|
};
|
|
@@ -117,10 +129,17 @@ const commonProps = {
|
|
|
117
129
|
type: String,
|
|
118
130
|
default: void 0
|
|
119
131
|
},
|
|
132
|
+
halfchecked: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: false
|
|
135
|
+
},
|
|
120
136
|
isShowTitle: {
|
|
121
137
|
type: Boolean,
|
|
122
138
|
default: true
|
|
123
139
|
},
|
|
140
|
+
title: {
|
|
141
|
+
type: String
|
|
142
|
+
},
|
|
124
143
|
color: {
|
|
125
144
|
type: String,
|
|
126
145
|
default: void 0
|
|
@@ -216,15 +235,15 @@ var DCheckbox = defineComponent({
|
|
|
216
235
|
});
|
|
217
236
|
const mergedIsShowTitle = computed(() => {
|
|
218
237
|
var _a;
|
|
219
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle) != null ? _a : props.isShowTitle;
|
|
238
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
|
|
220
239
|
});
|
|
221
240
|
const mergedShowAnimation = computed(() => {
|
|
222
241
|
var _a;
|
|
223
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation) != null ? _a : props.showAnimation;
|
|
242
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
|
|
224
243
|
});
|
|
225
244
|
const mergedColor = computed(() => {
|
|
226
245
|
var _a;
|
|
227
|
-
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color) != null ? _a : props.color;
|
|
246
|
+
return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
|
|
228
247
|
});
|
|
229
248
|
const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
|
|
230
249
|
const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
|
|
@@ -251,7 +270,7 @@ var DCheckbox = defineComponent({
|
|
|
251
270
|
ctx.emit("change", current);
|
|
252
271
|
};
|
|
253
272
|
const handleClick = () => {
|
|
254
|
-
canChange(!isChecked.value, props.
|
|
273
|
+
canChange(!isChecked.value, props.label).then((res) => res && toggle());
|
|
255
274
|
};
|
|
256
275
|
return {
|
|
257
276
|
itemWidth,
|
|
@@ -366,8 +385,20 @@ var DCheckboxGroup = defineComponent({
|
|
|
366
385
|
disabled: false
|
|
367
386
|
};
|
|
368
387
|
const toggleGroupVal = (val) => {
|
|
369
|
-
|
|
388
|
+
let index2 = -1;
|
|
389
|
+
if (typeof valList.value[0] === "string") {
|
|
390
|
+
index2 = valList.value.findIndex((item) => item === val);
|
|
391
|
+
} else if (typeof valList.value[0] === "object") {
|
|
392
|
+
index2 = valList.value.findIndex((item) => item.value === val);
|
|
393
|
+
}
|
|
370
394
|
if (index2 === -1) {
|
|
395
|
+
if (typeof props.options[0] === "object") {
|
|
396
|
+
const newOne = props.options.find((item) => item.value === val);
|
|
397
|
+
const res2 = [...valList.value, newOne];
|
|
398
|
+
ctx.emit("update:modelValue", res2);
|
|
399
|
+
ctx.emit("change", res2);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
371
402
|
const res = [...valList.value, val];
|
|
372
403
|
ctx.emit("update:modelValue", res);
|
|
373
404
|
ctx.emit("change", res);
|
|
@@ -377,7 +408,13 @@ var DCheckboxGroup = defineComponent({
|
|
|
377
408
|
ctx.emit("update:modelValue", valList.value);
|
|
378
409
|
ctx.emit("change", valList.value);
|
|
379
410
|
};
|
|
380
|
-
const isItemChecked = (itemVal) =>
|
|
411
|
+
const isItemChecked = (itemVal) => {
|
|
412
|
+
if (typeof valList.value[0] === "string") {
|
|
413
|
+
return valList.value.includes(itemVal);
|
|
414
|
+
} else if (typeof valList.value[0] === "object") {
|
|
415
|
+
return valList.value.some((item) => item.value === itemVal);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
381
418
|
provide(checkboxGroupInjectionKey, {
|
|
382
419
|
disabled: toRef(props, "disabled"),
|
|
383
420
|
isShowTitle: toRef(props, "isShowTitle"),
|
|
@@ -404,7 +441,17 @@ var DCheckboxGroup = defineComponent({
|
|
|
404
441
|
let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
|
|
405
442
|
if ((options == null ? void 0 : options.length) > 0) {
|
|
406
443
|
children = options.map((opt) => {
|
|
407
|
-
|
|
444
|
+
let mergedOpt = null;
|
|
445
|
+
if (typeof opt === "string") {
|
|
446
|
+
mergedOpt = Object.assign({}, defaultOpt, {
|
|
447
|
+
label: opt,
|
|
448
|
+
value: opt
|
|
449
|
+
});
|
|
450
|
+
} else if (typeof opt === "object") {
|
|
451
|
+
mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
|
|
452
|
+
label: opt.name
|
|
453
|
+
}));
|
|
454
|
+
}
|
|
408
455
|
return createVNode(DCheckbox, mergedOpt, null);
|
|
409
456
|
});
|
|
410
457
|
}
|
|
@@ -462,7 +509,7 @@ const searchProps = {
|
|
|
462
509
|
type: String,
|
|
463
510
|
default: ""
|
|
464
511
|
},
|
|
465
|
-
|
|
512
|
+
onSearch: {
|
|
466
513
|
type: Function,
|
|
467
514
|
default: void 0
|
|
468
515
|
},
|
|
@@ -700,7 +747,7 @@ const keydownHandles = (ctx, keywords, delay) => {
|
|
|
700
747
|
useEmitKeyword(keywords.value);
|
|
701
748
|
};
|
|
702
749
|
const useEmitKeyword = debounce((value) => {
|
|
703
|
-
ctx.emit("
|
|
750
|
+
ctx.emit("onSearch", value);
|
|
704
751
|
}, delay);
|
|
705
752
|
return {
|
|
706
753
|
onInputKeydown,
|
|
@@ -741,32 +788,38 @@ const inputProps = {
|
|
|
741
788
|
type: Boolean,
|
|
742
789
|
default: false
|
|
743
790
|
},
|
|
744
|
-
|
|
791
|
+
modelValue: {
|
|
745
792
|
type: String,
|
|
746
793
|
default: ""
|
|
747
794
|
},
|
|
748
|
-
"
|
|
795
|
+
"update:modelValue": {
|
|
749
796
|
type: Function,
|
|
750
797
|
default: void 0
|
|
751
798
|
},
|
|
752
|
-
|
|
799
|
+
onChange: {
|
|
753
800
|
type: Function,
|
|
754
801
|
default: void 0
|
|
755
802
|
},
|
|
756
|
-
|
|
803
|
+
onKeydown: {
|
|
757
804
|
type: Function,
|
|
758
805
|
default: void 0
|
|
759
806
|
},
|
|
760
|
-
|
|
807
|
+
onFocus: {
|
|
761
808
|
type: Function,
|
|
762
809
|
default: void 0
|
|
763
810
|
},
|
|
764
|
-
|
|
811
|
+
onBlur: {
|
|
765
812
|
type: Function,
|
|
766
813
|
default: void 0
|
|
767
814
|
}
|
|
768
815
|
};
|
|
769
816
|
var input = "";
|
|
817
|
+
const formItemInjectionKey = Symbol("dFormItem");
|
|
818
|
+
const dFormItemEvents = {
|
|
819
|
+
blur: "d.form.blur",
|
|
820
|
+
change: "d.form.change",
|
|
821
|
+
input: "d.form.input"
|
|
822
|
+
};
|
|
770
823
|
var DInput = defineComponent({
|
|
771
824
|
name: "DInput",
|
|
772
825
|
directives: {
|
|
@@ -779,8 +832,10 @@ var DInput = defineComponent({
|
|
|
779
832
|
}
|
|
780
833
|
},
|
|
781
834
|
props: inputProps,
|
|
782
|
-
emits: ["update:
|
|
835
|
+
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
783
836
|
setup(props, ctx) {
|
|
837
|
+
const formItem = inject(formItemInjectionKey, {});
|
|
838
|
+
const hasFormItem = Object.keys(formItem).length > 0;
|
|
784
839
|
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
785
840
|
const showPwdIcon = ref(false);
|
|
786
841
|
const inputType = ref("text");
|
|
@@ -797,17 +852,20 @@ var DInput = defineComponent({
|
|
|
797
852
|
}, {
|
|
798
853
|
immediate: true
|
|
799
854
|
});
|
|
800
|
-
watch(() => props.
|
|
855
|
+
watch(() => props.modelValue, (value) => {
|
|
801
856
|
value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
|
|
802
857
|
});
|
|
803
858
|
const onInput = ($event) => {
|
|
804
|
-
ctx.emit("update:
|
|
859
|
+
ctx.emit("update:modelValue", $event.target.value);
|
|
860
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
|
|
805
861
|
}, onFocus = () => {
|
|
806
862
|
ctx.emit("focus");
|
|
807
863
|
}, onBlur = () => {
|
|
808
864
|
ctx.emit("blur");
|
|
865
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
|
|
809
866
|
}, onChange = ($event) => {
|
|
810
867
|
ctx.emit("change", $event.target.value);
|
|
868
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
|
|
811
869
|
}, onKeydown = ($event) => {
|
|
812
870
|
ctx.emit("keydown", $event);
|
|
813
871
|
}, onChangeInputType = () => {
|
|
@@ -828,7 +886,7 @@ var DInput = defineComponent({
|
|
|
828
886
|
},
|
|
829
887
|
render() {
|
|
830
888
|
const {
|
|
831
|
-
|
|
889
|
+
modelValue,
|
|
832
890
|
showPreviewIcon,
|
|
833
891
|
showPwdIcon,
|
|
834
892
|
inputCls,
|
|
@@ -849,7 +907,7 @@ var DInput = defineComponent({
|
|
|
849
907
|
}, [withDirectives(createVNode("input", mergeProps({
|
|
850
908
|
dinput: true
|
|
851
909
|
}, {
|
|
852
|
-
"value":
|
|
910
|
+
"value": modelValue,
|
|
853
911
|
"disabled": disabled,
|
|
854
912
|
"type": inputType,
|
|
855
913
|
"maxlength": maxLength,
|
|
@@ -878,7 +936,7 @@ var search = "";
|
|
|
878
936
|
var DSearch = defineComponent({
|
|
879
937
|
name: "DSearch",
|
|
880
938
|
props: searchProps,
|
|
881
|
-
emits: ["update:modelValue", "
|
|
939
|
+
emits: ["update:modelValue", "onSearch"],
|
|
882
940
|
setup(props, ctx) {
|
|
883
941
|
const rootClasses = getRootClass(props);
|
|
884
942
|
const {
|
|
@@ -906,33 +964,194 @@ var DSearch = defineComponent({
|
|
|
906
964
|
"onClick": onClickHandle
|
|
907
965
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
908
966
|
"name": "search",
|
|
909
|
-
"size": "inherit"
|
|
967
|
+
"size": "inherit",
|
|
968
|
+
"key": "search"
|
|
910
969
|
}, null)]), createVNode(DInput, {
|
|
911
970
|
"size": props.size,
|
|
912
971
|
"disabled": props.disabled,
|
|
913
972
|
"autoFocus": props.autoFocus,
|
|
914
|
-
"
|
|
973
|
+
"modelValue": keywords.value,
|
|
915
974
|
"maxLength": props.maxLength,
|
|
916
975
|
"placeholder": props.placeholder,
|
|
917
976
|
"cssClass": props.cssClass,
|
|
918
977
|
"onKeydown": onInputKeydown,
|
|
919
|
-
"onUpdate:
|
|
978
|
+
"onUpdate:modelValue": onInputUpdate
|
|
920
979
|
}, null), clearIconShow.value && createVNode("div", {
|
|
921
980
|
"class": "devui-search__clear",
|
|
922
981
|
"onClick": onClearHandle
|
|
923
982
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
924
983
|
"name": "close",
|
|
925
|
-
"size": "inherit"
|
|
984
|
+
"size": "inherit",
|
|
985
|
+
"key": "close"
|
|
926
986
|
}, null)]), props.iconPosition === "right" && createVNode("div", {
|
|
927
987
|
"class": "devui-search__icon",
|
|
928
988
|
"onClick": onClickHandle
|
|
929
989
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
930
990
|
"name": "search",
|
|
931
|
-
"size": "inherit"
|
|
991
|
+
"size": "inherit",
|
|
992
|
+
"key": "search"
|
|
932
993
|
}, null)])]);
|
|
933
994
|
};
|
|
934
995
|
}
|
|
935
996
|
});
|
|
997
|
+
const tooltipProps = {
|
|
998
|
+
position: {
|
|
999
|
+
type: String,
|
|
1000
|
+
default: "top"
|
|
1001
|
+
},
|
|
1002
|
+
showAnimation: {
|
|
1003
|
+
type: Boolean,
|
|
1004
|
+
default: true
|
|
1005
|
+
},
|
|
1006
|
+
content: {
|
|
1007
|
+
type: String
|
|
1008
|
+
},
|
|
1009
|
+
mouseLeaveDelay: {
|
|
1010
|
+
type: String,
|
|
1011
|
+
default: "150"
|
|
1012
|
+
},
|
|
1013
|
+
mouseEnterDelay: {
|
|
1014
|
+
type: String,
|
|
1015
|
+
default: "100"
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
const EventListener = {
|
|
1019
|
+
listen: function(target, eventType, callback) {
|
|
1020
|
+
if (target.addEventListener) {
|
|
1021
|
+
target.addEventListener(eventType, callback, false);
|
|
1022
|
+
return {
|
|
1023
|
+
remove() {
|
|
1024
|
+
target.removeEventListener(target, callback, false);
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
} else {
|
|
1028
|
+
target.attchEvent(eventType, callback);
|
|
1029
|
+
return {
|
|
1030
|
+
remove() {
|
|
1031
|
+
target.detachEvent(eventType, callback);
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var tooltip = "";
|
|
1038
|
+
var DTooltip = defineComponent({
|
|
1039
|
+
name: "DTooltip",
|
|
1040
|
+
props: tooltipProps,
|
|
1041
|
+
setup(props, ctx) {
|
|
1042
|
+
const position = reactive({
|
|
1043
|
+
left: 0,
|
|
1044
|
+
top: 0
|
|
1045
|
+
});
|
|
1046
|
+
const show = ref(false);
|
|
1047
|
+
const slotElement = ref(null);
|
|
1048
|
+
const tooltip2 = ref(null);
|
|
1049
|
+
const arrow = ref(null);
|
|
1050
|
+
const tooltipcontent = ref(null);
|
|
1051
|
+
let enterEvent;
|
|
1052
|
+
let leaveEvent;
|
|
1053
|
+
const arrowStyle = (attr, value) => {
|
|
1054
|
+
arrow.value.style[attr] = value;
|
|
1055
|
+
};
|
|
1056
|
+
const delayShowTrue = function(fn, delay = props.mouseEnterDelay) {
|
|
1057
|
+
let start;
|
|
1058
|
+
if (parseInt(delay) >= 0) {
|
|
1059
|
+
return function() {
|
|
1060
|
+
if (start) {
|
|
1061
|
+
clearTimeout(start);
|
|
1062
|
+
}
|
|
1063
|
+
start = setTimeout(fn, parseInt(delay));
|
|
1064
|
+
};
|
|
1065
|
+
} else {
|
|
1066
|
+
console.error("the value of delay is bigger than 0 and the type of delay must be string!");
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
onMounted(() => {
|
|
1071
|
+
if (!show.value) {
|
|
1072
|
+
tooltip2.value.style.opacity = "0";
|
|
1073
|
+
}
|
|
1074
|
+
enterEvent = EventListener.listen(slotElement.value.children[0], "mouseenter", delayShowTrue(function() {
|
|
1075
|
+
show.value = true;
|
|
1076
|
+
}, props.mouseEnterDelay));
|
|
1077
|
+
leaveEvent = EventListener.listen(slotElement.value.children[0], "mouseleave", function() {
|
|
1078
|
+
if (show.value) {
|
|
1079
|
+
setTimeout(function() {
|
|
1080
|
+
show.value = false;
|
|
1081
|
+
}, props.mouseLeaveDelay);
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
watch(show, function(newValue, oldValue) {
|
|
1086
|
+
if (newValue) {
|
|
1087
|
+
tooltip2.value.style.opacity = "1";
|
|
1088
|
+
tooltip2.value.style.zIndex = "999";
|
|
1089
|
+
arrow.value.style.border = "5px solid transparent";
|
|
1090
|
+
switch (props.position) {
|
|
1091
|
+
case "top":
|
|
1092
|
+
position.left = slotElement.value.children[0].offsetLeft - tooltip2.value.offsetWidth / 2 + slotElement.value.children[0].offsetWidth / 2 - 5;
|
|
1093
|
+
position.top = slotElement.value.children[0].offsetTop - 10 - tooltipcontent.value.offsetHeight;
|
|
1094
|
+
arrowStyle("borderTop", "5px solid rgb(70, 77, 110)");
|
|
1095
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight}px`;
|
|
1096
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
|
|
1097
|
+
break;
|
|
1098
|
+
case "right":
|
|
1099
|
+
position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth;
|
|
1100
|
+
position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
|
|
1101
|
+
arrowStyle("borderRight", "5px solid rgb(70, 77, 110)");
|
|
1102
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
|
|
1103
|
+
arrow.value.style.left = "-0px";
|
|
1104
|
+
break;
|
|
1105
|
+
case "bottom":
|
|
1106
|
+
position.top = slotElement.value.children[0].offsetHeight + slotElement.value.children[0].offsetTop + 10;
|
|
1107
|
+
position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth / 2 - tooltipcontent.value.offsetWidth / 2 - 5;
|
|
1108
|
+
arrowStyle("borderBottom", "5px solid rgb(70, 77, 110)");
|
|
1109
|
+
arrow.value.style.top = "-10px";
|
|
1110
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
|
|
1111
|
+
break;
|
|
1112
|
+
case "left":
|
|
1113
|
+
position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
|
|
1114
|
+
position.left = slotElement.value.children[0].offsetLeft - 20 - tooltipcontent.value.offsetWidth;
|
|
1115
|
+
arrowStyle("borderLeft", "5px solid rgb(70, 77, 110)");
|
|
1116
|
+
arrow.value.style.left = `${tooltipcontent.value.offsetWidth + 10}px`;
|
|
1117
|
+
arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
|
|
1118
|
+
break;
|
|
1119
|
+
default:
|
|
1120
|
+
console.error("The attribute position value is wrong, the value is one of top\u3001right\u3001left\u3001bottom");
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
tooltip2.value.style.top = position.top + "px";
|
|
1124
|
+
tooltip2.value.style.left = position.left + "px";
|
|
1125
|
+
} else {
|
|
1126
|
+
position.top = 0;
|
|
1127
|
+
position.left = 0;
|
|
1128
|
+
tooltip2.value.style.opacity = "0";
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
onBeforeUnmount(() => {
|
|
1132
|
+
enterEvent.remove();
|
|
1133
|
+
leaveEvent.remove();
|
|
1134
|
+
});
|
|
1135
|
+
return () => {
|
|
1136
|
+
const defaultSlot = renderSlot(useSlots(), "default");
|
|
1137
|
+
return createVNode("div", {
|
|
1138
|
+
"class": "devui-tooltip"
|
|
1139
|
+
}, [createVNode("div", {
|
|
1140
|
+
"class": "slotElement",
|
|
1141
|
+
"ref": slotElement
|
|
1142
|
+
}, [defaultSlot]), createVNode("div", {
|
|
1143
|
+
"class": "tooltip",
|
|
1144
|
+
"ref": tooltip2
|
|
1145
|
+
}, [createVNode("div", {
|
|
1146
|
+
"class": "arrow",
|
|
1147
|
+
"ref": arrow
|
|
1148
|
+
}, null), createVNode("div", {
|
|
1149
|
+
"class": "tooltipcontent",
|
|
1150
|
+
"ref": tooltipcontent
|
|
1151
|
+
}, [props.content])])]);
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
936
1155
|
function _isSlot(s) {
|
|
937
1156
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
938
1157
|
}
|
|
@@ -941,19 +1160,36 @@ var DTransferBase = defineComponent({
|
|
|
941
1160
|
components: {
|
|
942
1161
|
DSearch,
|
|
943
1162
|
DCheckboxGroup,
|
|
944
|
-
DCheckbox
|
|
1163
|
+
DCheckbox,
|
|
1164
|
+
DTooltip
|
|
945
1165
|
},
|
|
946
1166
|
props: transferBaseProps,
|
|
947
1167
|
setup(props, ctx) {
|
|
948
1168
|
const modelValues = computed(() => props.checkedValues);
|
|
949
|
-
const searchQuery = computed(() => props.
|
|
1169
|
+
const searchQuery = computed(() => props.filter);
|
|
950
1170
|
const baseClass = TransferBaseClass(props);
|
|
951
1171
|
const updateSearchQuery = (val) => ctx.emit("changeQuery", val);
|
|
1172
|
+
const renderCheckbox = (props2, key, showTooltip = false, tooltipPosition = "top") => {
|
|
1173
|
+
const checkbox2 = createVNode(DCheckbox, {
|
|
1174
|
+
"class": "devui-transfer-panel-body-list-item",
|
|
1175
|
+
"label": props2.key,
|
|
1176
|
+
"value": props2.value,
|
|
1177
|
+
"disabled": props2.disabled,
|
|
1178
|
+
"key": key
|
|
1179
|
+
}, null);
|
|
1180
|
+
return !showTooltip ? checkbox2 : createVNode(DTooltip, {
|
|
1181
|
+
"position": tooltipPosition,
|
|
1182
|
+
"content": props2.key
|
|
1183
|
+
}, _isSlot(checkbox2) ? checkbox2 : {
|
|
1184
|
+
default: () => [checkbox2]
|
|
1185
|
+
});
|
|
1186
|
+
};
|
|
952
1187
|
return {
|
|
953
1188
|
baseClass,
|
|
954
1189
|
searchQuery,
|
|
955
1190
|
modelValues,
|
|
956
|
-
updateSearchQuery
|
|
1191
|
+
updateSearchQuery,
|
|
1192
|
+
renderCheckbox
|
|
957
1193
|
};
|
|
958
1194
|
},
|
|
959
1195
|
render() {
|
|
@@ -968,7 +1204,11 @@ var DTransferBase = defineComponent({
|
|
|
968
1204
|
updateSearchQuery,
|
|
969
1205
|
search: search2,
|
|
970
1206
|
searchQuery,
|
|
971
|
-
modelValues
|
|
1207
|
+
modelValues,
|
|
1208
|
+
height,
|
|
1209
|
+
showTooltip,
|
|
1210
|
+
tooltipPosition,
|
|
1211
|
+
renderCheckbox
|
|
972
1212
|
} = this;
|
|
973
1213
|
return createVNode("div", {
|
|
974
1214
|
"class": baseClass
|
|
@@ -993,19 +1233,13 @@ var DTransferBase = defineComponent({
|
|
|
993
1233
|
}, null)]), createVNode("div", {
|
|
994
1234
|
"class": "devui-transfer-panel-body-list",
|
|
995
1235
|
"style": {
|
|
996
|
-
height
|
|
1236
|
+
height
|
|
997
1237
|
}
|
|
998
1238
|
}, [sourceOption.length ? createVNode(DCheckboxGroup, {
|
|
999
1239
|
"modelValue": modelValues,
|
|
1000
1240
|
"onChange": (values) => this.$emit("updateCheckeds", values)
|
|
1001
1241
|
}, _isSlot(_slot = sourceOption.map((item, idx) => {
|
|
1002
|
-
return
|
|
1003
|
-
"class": "devui-transfer-panel-body-list-item",
|
|
1004
|
-
"label": item.key,
|
|
1005
|
-
"value": item.value,
|
|
1006
|
-
"disabled": item.disabled,
|
|
1007
|
-
"key": idx
|
|
1008
|
-
}, null);
|
|
1242
|
+
return renderCheckbox(item, idx, showTooltip, tooltipPosition);
|
|
1009
1243
|
})) ? _slot : {
|
|
1010
1244
|
default: () => [_slot]
|
|
1011
1245
|
}) : createVNode("div", {
|
|
@@ -1043,11 +1277,12 @@ var Icon = defineComponent({
|
|
|
1043
1277
|
color,
|
|
1044
1278
|
classPrefix
|
|
1045
1279
|
} = this;
|
|
1046
|
-
return
|
|
1280
|
+
return /^((https?):)?\/\//.test(name) ? createVNode("img", {
|
|
1047
1281
|
"src": name,
|
|
1048
1282
|
"alt": name.split("/")[name.split("/").length - 1],
|
|
1049
1283
|
"style": {
|
|
1050
|
-
width: size
|
|
1284
|
+
width: size,
|
|
1285
|
+
verticalAlign: "text-bottom"
|
|
1051
1286
|
}
|
|
1052
1287
|
}, null) : createVNode("i", {
|
|
1053
1288
|
"class": `${classPrefix} ${classPrefix}-${name}`,
|
|
@@ -1055,7 +1290,7 @@ var Icon = defineComponent({
|
|
|
1055
1290
|
fontSize: size,
|
|
1056
1291
|
color
|
|
1057
1292
|
}
|
|
1058
|
-
}, null)
|
|
1293
|
+
}, null);
|
|
1059
1294
|
}
|
|
1060
1295
|
});
|
|
1061
1296
|
Icon.install = function(app) {
|
|
@@ -1153,7 +1388,7 @@ var DButton = defineComponent({
|
|
|
1153
1388
|
showLoading,
|
|
1154
1389
|
width
|
|
1155
1390
|
} = props;
|
|
1156
|
-
return createVNode("div", mergeProps({
|
|
1391
|
+
return withDirectives(createVNode("div", mergeProps({
|
|
1157
1392
|
"class": "devui-btn-host"
|
|
1158
1393
|
}, ctx.attrs), [createVNode("button", {
|
|
1159
1394
|
"class": btnClass.value,
|
|
@@ -1164,12 +1399,12 @@ var DButton = defineComponent({
|
|
|
1164
1399
|
},
|
|
1165
1400
|
"onClick": onClick
|
|
1166
1401
|
}, [!!icon ? createVNode(Icon, {
|
|
1167
|
-
"name":
|
|
1402
|
+
"name": icon,
|
|
1168
1403
|
"class": iconClass.value
|
|
1169
1404
|
}, null) : null, createVNode("span", {
|
|
1170
1405
|
"class": "button-content",
|
|
1171
1406
|
"ref": buttonContent
|
|
1172
|
-
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]);
|
|
1407
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]), [[resolveDirective("dLoading"), showLoading]]);
|
|
1173
1408
|
};
|
|
1174
1409
|
}
|
|
1175
1410
|
});
|
|
@@ -1250,30 +1485,52 @@ const transferProps = {
|
|
|
1250
1485
|
},
|
|
1251
1486
|
height: {
|
|
1252
1487
|
type: String,
|
|
1253
|
-
default: "320px"
|
|
1488
|
+
default: () => "320px"
|
|
1254
1489
|
},
|
|
1255
1490
|
isSearch: {
|
|
1256
1491
|
type: Boolean,
|
|
1257
|
-
default: false
|
|
1492
|
+
default: () => false
|
|
1258
1493
|
},
|
|
1259
1494
|
isSourceDroppable: {
|
|
1260
1495
|
type: Boolean,
|
|
1261
|
-
default: false
|
|
1496
|
+
default: () => false
|
|
1262
1497
|
},
|
|
1263
1498
|
isTargetDroppable: {
|
|
1264
1499
|
type: Boolean,
|
|
1265
|
-
default: false
|
|
1500
|
+
default: () => false
|
|
1266
1501
|
},
|
|
1267
1502
|
disabled: {
|
|
1268
1503
|
type: Boolean,
|
|
1269
|
-
default: false
|
|
1504
|
+
default: () => false
|
|
1270
1505
|
},
|
|
1271
|
-
|
|
1506
|
+
showTooltip: {
|
|
1272
1507
|
type: Boolean,
|
|
1273
|
-
default: false
|
|
1508
|
+
default: () => false
|
|
1509
|
+
},
|
|
1510
|
+
tooltipPosition: {
|
|
1511
|
+
type: String,
|
|
1512
|
+
default: () => "top"
|
|
1513
|
+
},
|
|
1514
|
+
beforeTransfer: {
|
|
1515
|
+
type: Function
|
|
1274
1516
|
},
|
|
1275
1517
|
slots: {
|
|
1276
1518
|
type: Object
|
|
1519
|
+
},
|
|
1520
|
+
searching: {
|
|
1521
|
+
type: Function
|
|
1522
|
+
},
|
|
1523
|
+
transferToSource: {
|
|
1524
|
+
type: Function
|
|
1525
|
+
},
|
|
1526
|
+
transferToTarget: {
|
|
1527
|
+
type: Function
|
|
1528
|
+
},
|
|
1529
|
+
transferring: {
|
|
1530
|
+
type: Function
|
|
1531
|
+
},
|
|
1532
|
+
afterTransfer: {
|
|
1533
|
+
type: Function
|
|
1277
1534
|
}
|
|
1278
1535
|
};
|
|
1279
1536
|
const headerSlot = (ctx, name) => {
|
|
@@ -1295,10 +1552,16 @@ var Transfer = defineComponent({
|
|
|
1295
1552
|
},
|
|
1296
1553
|
props: transferProps,
|
|
1297
1554
|
setup(props, ctx) {
|
|
1298
|
-
|
|
1299
|
-
|
|
1555
|
+
let leftOptions = reactive(initState(props, "source"));
|
|
1556
|
+
let rightOptions = reactive(initState(props, "target"));
|
|
1300
1557
|
const origin = ref(null);
|
|
1301
|
-
watch(() =>
|
|
1558
|
+
watch(() => props.sourceOption, () => {
|
|
1559
|
+
leftOptions = reactive(initState(props, "source"));
|
|
1560
|
+
});
|
|
1561
|
+
watch(() => props.targetOption, () => {
|
|
1562
|
+
rightOptions = reactive(initState(props, "target"));
|
|
1563
|
+
});
|
|
1564
|
+
watch(() => leftOptions.keyword, (nVal) => {
|
|
1302
1565
|
searchFilterData(leftOptions);
|
|
1303
1566
|
});
|
|
1304
1567
|
watch(() => leftOptions.checkedValues, (values) => {
|
|
@@ -1307,7 +1570,7 @@ var Transfer = defineComponent({
|
|
|
1307
1570
|
}, {
|
|
1308
1571
|
deep: true
|
|
1309
1572
|
});
|
|
1310
|
-
watch(() => rightOptions.
|
|
1573
|
+
watch(() => rightOptions.keyword, (nVal) => {
|
|
1311
1574
|
searchFilterData(rightOptions);
|
|
1312
1575
|
});
|
|
1313
1576
|
watch(() => rightOptions.checkedValues, (values) => {
|
|
@@ -1323,19 +1586,35 @@ var Transfer = defineComponent({
|
|
|
1323
1586
|
source.allChecked = value.length === source.data.filter((item) => !item.disabled).length ? true : false;
|
|
1324
1587
|
}
|
|
1325
1588
|
};
|
|
1326
|
-
const updateFilterData = (source, target) => {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1589
|
+
const updateFilterData = async (source, target, direction) => {
|
|
1590
|
+
if (isFunction("beforeTransfer")) {
|
|
1591
|
+
const res = await props.beforeTransfer.call(null, source, target);
|
|
1592
|
+
if (typeof res === "boolean" && res === false) {
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
const hasToSource = isFunction("transferToSource");
|
|
1597
|
+
const hasToTarget = isFunction("transferToTarget");
|
|
1598
|
+
const hasTransfering = isFunction("transferring");
|
|
1599
|
+
if (hasToSource || hasToTarget) {
|
|
1600
|
+
direction === "right" && props.transferToSource.call(null, source, target);
|
|
1601
|
+
direction === "left" && props.transferToTarget.call(null, source, target);
|
|
1602
|
+
} else {
|
|
1603
|
+
source.data = source.data.filter((item) => {
|
|
1604
|
+
const hasInclues = source.checkedValues.includes(item.value);
|
|
1605
|
+
hasInclues && target.data.push(item);
|
|
1606
|
+
return !hasInclues;
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
if (hasTransfering) {
|
|
1610
|
+
props.transferring.call(null, target);
|
|
1611
|
+
}
|
|
1334
1612
|
source.checkedValues = [];
|
|
1335
1613
|
target.disabled = !target.disabled;
|
|
1336
1614
|
searchFilterData(source, target);
|
|
1337
1615
|
searchFilterData(target, source);
|
|
1338
1616
|
setOrigin("click");
|
|
1617
|
+
isFunction("afterTransfer") && props.afterTransfer.call(null, target);
|
|
1339
1618
|
};
|
|
1340
1619
|
const changeAllSource = (source, value) => {
|
|
1341
1620
|
if (source.filterData.every((item) => item.disabled))
|
|
@@ -1357,7 +1636,7 @@ var Transfer = defineComponent({
|
|
|
1357
1636
|
setOrigin("change");
|
|
1358
1637
|
};
|
|
1359
1638
|
const searchFilterData = (source, target) => {
|
|
1360
|
-
source.filterData = source.data.filter((item) => item.key.indexOf(source.
|
|
1639
|
+
source.filterData = source.data.filter((item) => item.key.indexOf(source.keyword) !== -1);
|
|
1361
1640
|
if (target) {
|
|
1362
1641
|
target.allChecked = false;
|
|
1363
1642
|
}
|
|
@@ -1365,25 +1644,35 @@ var Transfer = defineComponent({
|
|
|
1365
1644
|
const setOrigin = (value) => {
|
|
1366
1645
|
origin.value = value;
|
|
1367
1646
|
};
|
|
1647
|
+
const changeQueryHandle = (source, direction, value) => {
|
|
1648
|
+
if ((props == null ? void 0 : props.searching) && typeof props.searching === "function") {
|
|
1649
|
+
props.searching.call(null, direction, value, source);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
source.keyword = value;
|
|
1653
|
+
};
|
|
1654
|
+
const isFunction = (type) => {
|
|
1655
|
+
return props[type] && typeof props[type] === "function";
|
|
1656
|
+
};
|
|
1368
1657
|
return () => {
|
|
1369
1658
|
return createVNode("div", {
|
|
1370
1659
|
"class": "devui-transfer"
|
|
1371
1660
|
}, [createVNode(DTransferBase, {
|
|
1372
|
-
"style": {
|
|
1373
|
-
height: props.height
|
|
1374
|
-
},
|
|
1375
1661
|
"sourceOption": leftOptions.filterData,
|
|
1376
1662
|
"title": props.titles[0],
|
|
1377
1663
|
"type": "source",
|
|
1378
1664
|
"search": props.isSearch,
|
|
1379
1665
|
"allChecked": leftOptions.allChecked,
|
|
1380
1666
|
"checkedNum": leftOptions.checkedNum,
|
|
1381
|
-
"
|
|
1667
|
+
"filter": leftOptions.keyword,
|
|
1668
|
+
"height": props.height,
|
|
1382
1669
|
"checkedValues": leftOptions.checkedValues,
|
|
1383
1670
|
"allCount": leftOptions.data.length,
|
|
1671
|
+
"showTooltip": props.showTooltip,
|
|
1672
|
+
"tooltipPosition": props.tooltipPosition,
|
|
1384
1673
|
"onChangeAllSource": (value) => changeAllSource(leftOptions, value),
|
|
1385
1674
|
"onUpdateCheckeds": updateLeftCheckeds,
|
|
1386
|
-
"onChangeQuery": (value) => leftOptions
|
|
1675
|
+
"onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value)
|
|
1387
1676
|
}, {
|
|
1388
1677
|
header: headerSlot(ctx, "left"),
|
|
1389
1678
|
body: bodySlot(ctx, "left")
|
|
@@ -1392,29 +1681,29 @@ var Transfer = defineComponent({
|
|
|
1392
1681
|
"sourceDisabled": rightOptions.checkedNum > 0 ? false : true,
|
|
1393
1682
|
"targetDisabled": leftOptions.checkedNum > 0 ? false : true,
|
|
1394
1683
|
"onUpdateSourceData": () => {
|
|
1395
|
-
updateFilterData(rightOptions, leftOptions);
|
|
1684
|
+
updateFilterData(rightOptions, leftOptions, "left");
|
|
1396
1685
|
},
|
|
1397
1686
|
"onUpdateTargetData": () => {
|
|
1398
|
-
updateFilterData(leftOptions, rightOptions);
|
|
1687
|
+
updateFilterData(leftOptions, rightOptions, "right");
|
|
1399
1688
|
}
|
|
1400
1689
|
}, {
|
|
1401
1690
|
operation: opeartionSlot(ctx)
|
|
1402
1691
|
}), createVNode(DTransferBase, {
|
|
1403
|
-
"style": {
|
|
1404
|
-
height: props.height
|
|
1405
|
-
},
|
|
1406
1692
|
"sourceOption": rightOptions.filterData,
|
|
1407
1693
|
"title": props.titles[1],
|
|
1408
1694
|
"type": "target",
|
|
1409
1695
|
"search": props.isSearch,
|
|
1410
1696
|
"allChecked": rightOptions.allChecked,
|
|
1411
1697
|
"checkedNum": rightOptions.checkedNum,
|
|
1412
|
-
"
|
|
1698
|
+
"filter": rightOptions.keyword,
|
|
1699
|
+
"height": props.height,
|
|
1413
1700
|
"checkedValues": rightOptions.checkedValues,
|
|
1414
1701
|
"allCount": rightOptions.data.length,
|
|
1702
|
+
"showTooltip": props.showTooltip,
|
|
1703
|
+
"tooltipPosition": props.tooltipPosition,
|
|
1415
1704
|
"onChangeAllSource": (value) => changeAllSource(rightOptions, value),
|
|
1416
1705
|
"onUpdateCheckeds": updateRightCheckeds,
|
|
1417
|
-
"onChangeQuery": (value) => rightOptions
|
|
1706
|
+
"onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value)
|
|
1418
1707
|
}, {
|
|
1419
1708
|
header: headerSlot(ctx, "right"),
|
|
1420
1709
|
body: bodySlot(ctx, "right")
|