vue-devui 1.0.0-beta.3 → 1.0.0-beta.7

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.
Files changed (182) hide show
  1. package/accordion/index.d.ts +7 -0
  2. package/accordion/index.es.js +186 -139
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.d.ts +7 -0
  6. package/anchor/index.d.ts +7 -0
  7. package/avatar/index.d.ts +7 -0
  8. package/back-top/index.d.ts +7 -0
  9. package/back-top/index.es.js +128 -0
  10. package/back-top/index.umd.js +1 -0
  11. package/back-top/package.json +7 -0
  12. package/back-top/style.css +1 -0
  13. package/badge/index.d.ts +7 -0
  14. package/breadcrumb/index.d.ts +7 -0
  15. package/button/index.d.ts +7 -0
  16. package/button/index.es.js +3 -3
  17. package/button/index.umd.js +1 -1
  18. package/card/index.d.ts +7 -0
  19. package/carousel/index.d.ts +7 -0
  20. package/carousel/index.es.js +3 -3
  21. package/carousel/index.umd.js +1 -1
  22. package/cascader/index.d.ts +7 -0
  23. package/cascader/index.es.js +1239 -83
  24. package/cascader/index.umd.js +1 -1
  25. package/cascader/style.css +1 -1
  26. package/checkbox/index.d.ts +7 -0
  27. package/checkbox/index.es.js +42 -7
  28. package/checkbox/index.umd.js +1 -1
  29. package/comment/index.d.ts +7 -0
  30. package/comment/index.es.js +57 -0
  31. package/comment/index.umd.js +1 -0
  32. package/comment/package.json +7 -0
  33. package/comment/style.css +1 -0
  34. package/date-picker/index.d.ts +7 -0
  35. package/date-picker/index.es.js +18 -17
  36. package/date-picker/index.umd.js +1 -1
  37. package/date-picker/style.css +1 -1
  38. package/dragdrop/index.d.ts +7 -0
  39. package/dragdrop/index.es.js +32 -0
  40. package/dragdrop/index.umd.js +1 -0
  41. package/dragdrop/package.json +7 -0
  42. package/drawer/index.d.ts +7 -0
  43. package/drawer/index.es.js +112 -45
  44. package/drawer/index.umd.js +1 -1
  45. package/drawer/style.css +1 -1
  46. package/dropdown/index.d.ts +7 -0
  47. package/dropdown/index.es.js +528 -0
  48. package/dropdown/index.umd.js +1 -0
  49. package/dropdown/package.json +7 -0
  50. package/dropdown/style.css +1 -0
  51. package/editable-select/index.d.ts +7 -0
  52. package/editable-select/index.es.js +5648 -434
  53. package/editable-select/index.umd.js +27 -1
  54. package/editable-select/style.css +1 -1
  55. package/form/index.d.ts +7 -0
  56. package/form/index.es.js +446 -5558
  57. package/form/index.umd.js +1 -27
  58. package/form/style.css +1 -1
  59. package/fullscreen/index.d.ts +7 -0
  60. package/gantt/index.d.ts +7 -0
  61. package/gantt/index.es.js +535 -0
  62. package/gantt/index.umd.js +1 -0
  63. package/gantt/package.json +7 -0
  64. package/gantt/style.css +1 -0
  65. package/grid/index.d.ts +7 -0
  66. package/grid/index.es.js +269 -0
  67. package/grid/index.umd.js +1 -0
  68. package/grid/package.json +7 -0
  69. package/grid/style.css +1 -0
  70. package/icon/index.d.ts +7 -0
  71. package/icon/index.es.js +3 -3
  72. package/icon/index.umd.js +1 -1
  73. package/image-preview/index.d.ts +7 -0
  74. package/image-preview/index.es.js +22 -1
  75. package/image-preview/index.umd.js +1 -1
  76. package/index.d.ts +7 -0
  77. package/input/index.d.ts +7 -0
  78. package/input/index.es.js +15 -14
  79. package/input/index.umd.js +1 -1
  80. package/input-icon/index.d.ts +7 -0
  81. package/input-icon/index.es.js +331 -0
  82. package/input-icon/index.umd.js +1 -0
  83. package/input-icon/package.json +7 -0
  84. package/input-icon/style.css +1 -0
  85. package/input-number/index.d.ts +7 -0
  86. package/input-number/index.es.js +3 -3
  87. package/input-number/index.umd.js +1 -1
  88. package/layout/index.d.ts +7 -0
  89. package/loading/index.d.ts +7 -0
  90. package/modal/index.d.ts +7 -0
  91. package/modal/index.es.js +102 -84
  92. package/modal/index.umd.js +1 -1
  93. package/modal/style.css +1 -1
  94. package/nav-sprite/index.d.ts +7 -0
  95. package/overlay/index.d.ts +7 -0
  96. package/overlay/index.es.js +100 -82
  97. package/overlay/index.umd.js +1 -1
  98. package/overlay/style.css +1 -1
  99. package/package.json +4 -33
  100. package/pagination/index.d.ts +7 -0
  101. package/panel/index.d.ts +7 -0
  102. package/popover/index.d.ts +7 -0
  103. package/progress/index.d.ts +7 -0
  104. package/quadrant-diagram/index.d.ts +7 -0
  105. package/radio/index.d.ts +7 -0
  106. package/rate/index.d.ts +7 -0
  107. package/read-tip/index.d.ts +7 -0
  108. package/read-tip/index.es.js +244 -0
  109. package/read-tip/index.umd.js +1 -0
  110. package/read-tip/package.json +7 -0
  111. package/read-tip/style.css +1 -0
  112. package/ripple/index.d.ts +7 -0
  113. package/search/index.d.ts +7 -0
  114. package/search/index.es.js +15 -14
  115. package/search/index.umd.js +1 -1
  116. package/select/index.d.ts +7 -0
  117. package/select/index.es.js +45 -10
  118. package/select/index.umd.js +1 -1
  119. package/skeleton/index.d.ts +7 -0
  120. package/skeleton/index.es.js +147 -25
  121. package/skeleton/index.umd.js +1 -1
  122. package/skeleton/style.css +1 -1
  123. package/slider/index.d.ts +7 -0
  124. package/slider/index.es.js +8 -6
  125. package/slider/index.umd.js +1 -1
  126. package/splitter/index.d.ts +7 -0
  127. package/status/index.d.ts +7 -0
  128. package/steps-guide/index.d.ts +7 -0
  129. package/steps-guide/index.es.js +99 -73
  130. package/steps-guide/index.umd.js +1 -1
  131. package/steps-guide/style.css +1 -1
  132. package/sticky/index.d.ts +7 -0
  133. package/style.css +1 -1
  134. package/switch/index.d.ts +7 -0
  135. package/table/index.d.ts +7 -0
  136. package/table/index.es.js +1490 -157
  137. package/table/index.umd.js +1 -1
  138. package/table/style.css +1 -1
  139. package/tabs/index.d.ts +7 -0
  140. package/tabs/index.es.js +1 -0
  141. package/tabs/index.umd.js +1 -1
  142. package/tag/index.d.ts +7 -0
  143. package/tag/index.es.js +105 -0
  144. package/tag/index.umd.js +1 -0
  145. package/tag/package.json +7 -0
  146. package/tag/style.css +1 -0
  147. package/tag-input/index.d.ts +7 -0
  148. package/textarea/index.d.ts +7 -0
  149. package/textarea/index.es.js +132 -0
  150. package/textarea/index.umd.js +1 -0
  151. package/textarea/package.json +7 -0
  152. package/textarea/style.css +1 -0
  153. package/time-axis/index.d.ts +7 -0
  154. package/time-axis/index.es.js +238 -21
  155. package/time-axis/index.umd.js +1 -1
  156. package/time-axis/style.css +1 -1
  157. package/time-picker/index.d.ts +7 -0
  158. package/time-picker/index.es.js +45 -22
  159. package/time-picker/index.umd.js +1 -1
  160. package/time-picker/style.css +1 -1
  161. package/toast/index.d.ts +7 -0
  162. package/toast/index.es.js +3 -3
  163. package/toast/index.umd.js +1 -1
  164. package/toast/style.css +1 -1
  165. package/tooltip/index.d.ts +7 -0
  166. package/transfer/index.d.ts +7 -0
  167. package/transfer/index.es.js +345 -70
  168. package/transfer/index.umd.js +1 -1
  169. package/transfer/style.css +1 -1
  170. package/tree/index.d.ts +7 -0
  171. package/tree/index.es.js +11 -4
  172. package/tree/index.umd.js +1 -1
  173. package/tree-select/index.d.ts +7 -0
  174. package/tree-select/index.es.js +435 -110
  175. package/tree-select/index.umd.js +1 -1
  176. package/tree-select/style.css +1 -1
  177. package/upload/index.d.ts +7 -0
  178. package/upload/index.es.js +4 -4
  179. package/upload/index.umd.js +1 -1
  180. package/upload/style.css +1 -1
  181. package/vue-devui.es.js +17873 -14511
  182. package/vue-devui.umd.js +17 -17
@@ -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, isVNode, createTextVNode, Fragment, reactive } from "vue";
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
- query: {
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
- query: "",
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.value).then((res) => res && toggle());
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
- const index2 = valList.value.findIndex((item) => item === val);
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) => valList.value.includes(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
- const mergedOpt = Object.assign({}, defaultOpt, opt);
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
  }
@@ -741,27 +788,27 @@ const inputProps = {
741
788
  type: Boolean,
742
789
  default: false
743
790
  },
744
- value: {
791
+ modelValue: {
745
792
  type: String,
746
793
  default: ""
747
794
  },
748
- "onUpdate:value": {
795
+ "update:modelValue": {
749
796
  type: Function,
750
797
  default: void 0
751
798
  },
752
- "onChange": {
799
+ onChange: {
753
800
  type: Function,
754
801
  default: void 0
755
802
  },
756
- "onKeydown": {
803
+ onKeydown: {
757
804
  type: Function,
758
805
  default: void 0
759
806
  },
760
- "onFocus": {
807
+ onFocus: {
761
808
  type: Function,
762
809
  default: void 0
763
810
  },
764
- "onBlur": {
811
+ onBlur: {
765
812
  type: Function,
766
813
  default: void 0
767
814
  }
@@ -785,9 +832,10 @@ var DInput = defineComponent({
785
832
  }
786
833
  },
787
834
  props: inputProps,
788
- emits: ["update:value", "focus", "blur", "change", "keydown"],
835
+ emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
789
836
  setup(props, ctx) {
790
837
  const formItem = inject(formItemInjectionKey, {});
838
+ const hasFormItem = Object.keys(formItem).length > 0;
791
839
  const sizeCls = computed(() => `devui-input-${props.size}`);
792
840
  const showPwdIcon = ref(false);
793
841
  const inputType = ref("text");
@@ -804,20 +852,20 @@ var DInput = defineComponent({
804
852
  }, {
805
853
  immediate: true
806
854
  });
807
- watch(() => props.value, (value) => {
855
+ watch(() => props.modelValue, (value) => {
808
856
  value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
809
857
  });
810
858
  const onInput = ($event) => {
811
- ctx.emit("update:value", $event.target.value);
812
- formItem.formItemMitt.emit(dFormItemEvents.input);
859
+ ctx.emit("update:modelValue", $event.target.value);
860
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
813
861
  }, onFocus = () => {
814
862
  ctx.emit("focus");
815
863
  }, onBlur = () => {
816
864
  ctx.emit("blur");
817
- formItem.formItemMitt.emit(dFormItemEvents.blur);
865
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
818
866
  }, onChange = ($event) => {
819
867
  ctx.emit("change", $event.target.value);
820
- formItem.formItemMitt.emit(dFormItemEvents.change);
868
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
821
869
  }, onKeydown = ($event) => {
822
870
  ctx.emit("keydown", $event);
823
871
  }, onChangeInputType = () => {
@@ -838,7 +886,7 @@ var DInput = defineComponent({
838
886
  },
839
887
  render() {
840
888
  const {
841
- value,
889
+ modelValue,
842
890
  showPreviewIcon,
843
891
  showPwdIcon,
844
892
  inputCls,
@@ -859,7 +907,7 @@ var DInput = defineComponent({
859
907
  }, [withDirectives(createVNode("input", mergeProps({
860
908
  dinput: true
861
909
  }, {
862
- "value": value,
910
+ "value": modelValue,
863
911
  "disabled": disabled,
864
912
  "type": inputType,
865
913
  "maxlength": maxLength,
@@ -943,6 +991,164 @@ var DSearch = defineComponent({
943
991
  };
944
992
  }
945
993
  });
994
+ const tooltipProps = {
995
+ position: {
996
+ type: String,
997
+ default: "top"
998
+ },
999
+ showAnimation: {
1000
+ type: Boolean,
1001
+ default: true
1002
+ },
1003
+ content: {
1004
+ type: String
1005
+ },
1006
+ mouseLeaveDelay: {
1007
+ type: String,
1008
+ default: "150"
1009
+ },
1010
+ mouseEnterDelay: {
1011
+ type: String,
1012
+ default: "100"
1013
+ }
1014
+ };
1015
+ const EventListener = {
1016
+ listen: function(target, eventType, callback) {
1017
+ if (target.addEventListener) {
1018
+ target.addEventListener(eventType, callback, false);
1019
+ return {
1020
+ remove() {
1021
+ target.removeEventListener(target, callback, false);
1022
+ }
1023
+ };
1024
+ } else {
1025
+ target.attchEvent(eventType, callback);
1026
+ return {
1027
+ remove() {
1028
+ target.detachEvent(eventType, callback);
1029
+ }
1030
+ };
1031
+ }
1032
+ }
1033
+ };
1034
+ var tooltip = "";
1035
+ var DTooltip = defineComponent({
1036
+ name: "DTooltip",
1037
+ props: tooltipProps,
1038
+ setup(props, ctx) {
1039
+ const position = reactive({
1040
+ left: 0,
1041
+ top: 0
1042
+ });
1043
+ const show = ref(false);
1044
+ const slotElement = ref(null);
1045
+ const tooltip2 = ref(null);
1046
+ const arrow = ref(null);
1047
+ const tooltipcontent = ref(null);
1048
+ let enterEvent;
1049
+ let leaveEvent;
1050
+ const arrowStyle = (attr, value) => {
1051
+ arrow.value.style[attr] = value;
1052
+ };
1053
+ const delayShowTrue = function(fn, delay = props.mouseEnterDelay) {
1054
+ let start;
1055
+ if (parseInt(delay) >= 0) {
1056
+ return function() {
1057
+ if (start) {
1058
+ clearTimeout(start);
1059
+ }
1060
+ start = setTimeout(fn, parseInt(delay));
1061
+ };
1062
+ } else {
1063
+ console.error("the value of delay is bigger than 0 and the type of delay must be string!");
1064
+ return;
1065
+ }
1066
+ };
1067
+ onMounted(() => {
1068
+ if (!show.value) {
1069
+ tooltip2.value.style.opacity = "0";
1070
+ }
1071
+ enterEvent = EventListener.listen(slotElement.value.children[0], "mouseenter", delayShowTrue(function() {
1072
+ show.value = true;
1073
+ }, props.mouseEnterDelay));
1074
+ leaveEvent = EventListener.listen(slotElement.value.children[0], "mouseleave", function() {
1075
+ if (show.value) {
1076
+ setTimeout(function() {
1077
+ show.value = false;
1078
+ }, props.mouseLeaveDelay);
1079
+ }
1080
+ });
1081
+ });
1082
+ watch(show, function(newValue, oldValue) {
1083
+ if (newValue) {
1084
+ tooltip2.value.style.opacity = "1";
1085
+ tooltip2.value.style.zIndex = "999";
1086
+ arrow.value.style.border = "5px solid transparent";
1087
+ switch (props.position) {
1088
+ case "top":
1089
+ position.left = slotElement.value.children[0].offsetLeft - tooltip2.value.offsetWidth / 2 + slotElement.value.children[0].offsetWidth / 2 - 5;
1090
+ position.top = slotElement.value.children[0].offsetTop - 10 - tooltipcontent.value.offsetHeight;
1091
+ arrowStyle("borderTop", "5px solid rgb(70, 77, 110)");
1092
+ arrow.value.style.top = `${tooltipcontent.value.offsetHeight}px`;
1093
+ arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
1094
+ break;
1095
+ case "right":
1096
+ position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth;
1097
+ position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
1098
+ arrowStyle("borderRight", "5px solid rgb(70, 77, 110)");
1099
+ arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
1100
+ arrow.value.style.left = "-0px";
1101
+ break;
1102
+ case "bottom":
1103
+ position.top = slotElement.value.children[0].offsetHeight + slotElement.value.children[0].offsetTop + 10;
1104
+ position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth / 2 - tooltipcontent.value.offsetWidth / 2 - 5;
1105
+ arrowStyle("borderBottom", "5px solid rgb(70, 77, 110)");
1106
+ arrow.value.style.top = "-10px";
1107
+ arrow.value.style.left = `${tooltipcontent.value.offsetWidth / 2 + 5}px`;
1108
+ break;
1109
+ case "left":
1110
+ position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.value.offsetHeight / 2;
1111
+ position.left = slotElement.value.children[0].offsetLeft - 20 - tooltipcontent.value.offsetWidth;
1112
+ arrowStyle("borderLeft", "5px solid rgb(70, 77, 110)");
1113
+ arrow.value.style.left = `${tooltipcontent.value.offsetWidth + 10}px`;
1114
+ arrow.value.style.top = `${tooltipcontent.value.offsetHeight / 2 - 5}px`;
1115
+ break;
1116
+ default:
1117
+ console.error("The attribute position value is wrong, the value is one of top\u3001right\u3001left\u3001bottom");
1118
+ break;
1119
+ }
1120
+ tooltip2.value.style.top = position.top + "px";
1121
+ tooltip2.value.style.left = position.left + "px";
1122
+ } else {
1123
+ position.top = 0;
1124
+ position.left = 0;
1125
+ tooltip2.value.style.opacity = "0";
1126
+ }
1127
+ });
1128
+ onBeforeUnmount(() => {
1129
+ enterEvent.remove();
1130
+ leaveEvent.remove();
1131
+ });
1132
+ return () => {
1133
+ const defaultSlot = renderSlot(useSlots(), "default");
1134
+ return createVNode("div", {
1135
+ "class": "devui-tooltip"
1136
+ }, [createVNode("div", {
1137
+ "class": "slotElement",
1138
+ "ref": slotElement
1139
+ }, [defaultSlot]), createVNode("div", {
1140
+ "class": "tooltip",
1141
+ "ref": tooltip2
1142
+ }, [createVNode("div", {
1143
+ "class": "arrow",
1144
+ "ref": arrow
1145
+ }, null), createVNode("div", {
1146
+ "class": "tooltipcontent",
1147
+ "ref": tooltipcontent
1148
+ }, [props.content])])]);
1149
+ };
1150
+ }
1151
+ });
946
1152
  function _isSlot(s) {
947
1153
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
948
1154
  }
@@ -951,19 +1157,36 @@ var DTransferBase = defineComponent({
951
1157
  components: {
952
1158
  DSearch,
953
1159
  DCheckboxGroup,
954
- DCheckbox
1160
+ DCheckbox,
1161
+ DTooltip
955
1162
  },
956
1163
  props: transferBaseProps,
957
1164
  setup(props, ctx) {
958
1165
  const modelValues = computed(() => props.checkedValues);
959
- const searchQuery = computed(() => props.query);
1166
+ const searchQuery = computed(() => props.filter);
960
1167
  const baseClass = TransferBaseClass(props);
961
1168
  const updateSearchQuery = (val) => ctx.emit("changeQuery", val);
1169
+ const renderCheckbox = (props2, key, showTooltip = false, tooltipPosition = "top") => {
1170
+ const checkbox2 = createVNode(DCheckbox, {
1171
+ "class": "devui-transfer-panel-body-list-item",
1172
+ "label": props2.key,
1173
+ "value": props2.value,
1174
+ "disabled": props2.disabled,
1175
+ "key": key
1176
+ }, null);
1177
+ return !showTooltip ? checkbox2 : createVNode(DTooltip, {
1178
+ "position": tooltipPosition,
1179
+ "content": props2.key
1180
+ }, _isSlot(checkbox2) ? checkbox2 : {
1181
+ default: () => [checkbox2]
1182
+ });
1183
+ };
962
1184
  return {
963
1185
  baseClass,
964
1186
  searchQuery,
965
1187
  modelValues,
966
- updateSearchQuery
1188
+ updateSearchQuery,
1189
+ renderCheckbox
967
1190
  };
968
1191
  },
969
1192
  render() {
@@ -978,7 +1201,11 @@ var DTransferBase = defineComponent({
978
1201
  updateSearchQuery,
979
1202
  search: search2,
980
1203
  searchQuery,
981
- modelValues
1204
+ modelValues,
1205
+ height,
1206
+ showTooltip,
1207
+ tooltipPosition,
1208
+ renderCheckbox
982
1209
  } = this;
983
1210
  return createVNode("div", {
984
1211
  "class": baseClass
@@ -1003,19 +1230,13 @@ var DTransferBase = defineComponent({
1003
1230
  }, null)]), createVNode("div", {
1004
1231
  "class": "devui-transfer-panel-body-list",
1005
1232
  "style": {
1006
- height: `calc(100% - 40px - ${search2 ? 42 : 0}px)`
1233
+ height
1007
1234
  }
1008
1235
  }, [sourceOption.length ? createVNode(DCheckboxGroup, {
1009
1236
  "modelValue": modelValues,
1010
1237
  "onChange": (values) => this.$emit("updateCheckeds", values)
1011
1238
  }, _isSlot(_slot = sourceOption.map((item, idx) => {
1012
- return createVNode(DCheckbox, {
1013
- "class": "devui-transfer-panel-body-list-item",
1014
- "label": item.key,
1015
- "value": item.value,
1016
- "disabled": item.disabled,
1017
- "key": idx
1018
- }, null);
1239
+ return renderCheckbox(item, idx, showTooltip, tooltipPosition);
1019
1240
  })) ? _slot : {
1020
1241
  default: () => [_slot]
1021
1242
  }) : createVNode("div", {
@@ -1053,7 +1274,7 @@ var Icon = defineComponent({
1053
1274
  color,
1054
1275
  classPrefix
1055
1276
  } = this;
1056
- return createVNode(Fragment, null, [/^((https?):)?\/\//.test(name) ? createVNode("img", {
1277
+ return /^((https?):)?\/\//.test(name) ? createVNode("img", {
1057
1278
  "src": name,
1058
1279
  "alt": name.split("/")[name.split("/").length - 1],
1059
1280
  "style": {
@@ -1065,7 +1286,7 @@ var Icon = defineComponent({
1065
1286
  fontSize: size,
1066
1287
  color
1067
1288
  }
1068
- }, null)]);
1289
+ }, null);
1069
1290
  }
1070
1291
  });
1071
1292
  Icon.install = function(app) {
@@ -1260,30 +1481,52 @@ const transferProps = {
1260
1481
  },
1261
1482
  height: {
1262
1483
  type: String,
1263
- default: "320px"
1484
+ default: () => "320px"
1264
1485
  },
1265
1486
  isSearch: {
1266
1487
  type: Boolean,
1267
- default: false
1488
+ default: () => false
1268
1489
  },
1269
1490
  isSourceDroppable: {
1270
1491
  type: Boolean,
1271
- default: false
1492
+ default: () => false
1272
1493
  },
1273
1494
  isTargetDroppable: {
1274
1495
  type: Boolean,
1275
- default: false
1496
+ default: () => false
1276
1497
  },
1277
1498
  disabled: {
1278
1499
  type: Boolean,
1279
- default: false
1500
+ default: () => false
1280
1501
  },
1281
- showOptionTitle: {
1502
+ showTooltip: {
1282
1503
  type: Boolean,
1283
- default: false
1504
+ default: () => false
1505
+ },
1506
+ tooltipPosition: {
1507
+ type: String,
1508
+ default: () => "top"
1509
+ },
1510
+ beforeTransfer: {
1511
+ type: Function
1284
1512
  },
1285
1513
  slots: {
1286
1514
  type: Object
1515
+ },
1516
+ searching: {
1517
+ type: Function
1518
+ },
1519
+ transferToSource: {
1520
+ type: Function
1521
+ },
1522
+ transferToTarget: {
1523
+ type: Function
1524
+ },
1525
+ transferring: {
1526
+ type: Function
1527
+ },
1528
+ afterTransfer: {
1529
+ type: Function
1287
1530
  }
1288
1531
  };
1289
1532
  const headerSlot = (ctx, name) => {
@@ -1305,10 +1548,16 @@ var Transfer = defineComponent({
1305
1548
  },
1306
1549
  props: transferProps,
1307
1550
  setup(props, ctx) {
1308
- const leftOptions = reactive(initState(props, "source"));
1309
- const rightOptions = reactive(initState(props, "target"));
1551
+ let leftOptions = reactive(initState(props, "source"));
1552
+ let rightOptions = reactive(initState(props, "target"));
1310
1553
  const origin = ref(null);
1311
- watch(() => leftOptions.query, (nVal) => {
1554
+ watch(() => props.sourceOption, () => {
1555
+ leftOptions = reactive(initState(props, "source"));
1556
+ });
1557
+ watch(() => props.targetOption, () => {
1558
+ rightOptions = reactive(initState(props, "target"));
1559
+ });
1560
+ watch(() => leftOptions.keyword, (nVal) => {
1312
1561
  searchFilterData(leftOptions);
1313
1562
  });
1314
1563
  watch(() => leftOptions.checkedValues, (values) => {
@@ -1317,7 +1566,7 @@ var Transfer = defineComponent({
1317
1566
  }, {
1318
1567
  deep: true
1319
1568
  });
1320
- watch(() => rightOptions.query, (nVal) => {
1569
+ watch(() => rightOptions.keyword, (nVal) => {
1321
1570
  searchFilterData(rightOptions);
1322
1571
  });
1323
1572
  watch(() => rightOptions.checkedValues, (values) => {
@@ -1333,19 +1582,35 @@ var Transfer = defineComponent({
1333
1582
  source.allChecked = value.length === source.data.filter((item) => !item.disabled).length ? true : false;
1334
1583
  }
1335
1584
  };
1336
- const updateFilterData = (source, target) => {
1337
- const newData = [];
1338
- source.data = source.data.filter((item) => {
1339
- const hasInclues = source.checkedValues.includes(item.value);
1340
- hasInclues && newData.push(item);
1341
- return !hasInclues;
1342
- });
1343
- target.data = target.data.concat(newData);
1585
+ const updateFilterData = async (source, target, direction) => {
1586
+ if (isFunction("beforeTransfer")) {
1587
+ const res = await props.beforeTransfer.call(null, source, target);
1588
+ if (typeof res === "boolean" && res === false) {
1589
+ return;
1590
+ }
1591
+ }
1592
+ const hasToSource = isFunction("transferToSource");
1593
+ const hasToTarget = isFunction("transferToTarget");
1594
+ const hasTransfering = isFunction("transferring");
1595
+ if (hasToSource || hasToTarget) {
1596
+ direction === "right" && props.transferToSource.call(null, source, target);
1597
+ direction === "left" && props.transferToTarget.call(null, source, target);
1598
+ } else {
1599
+ source.data = source.data.filter((item) => {
1600
+ const hasInclues = source.checkedValues.includes(item.value);
1601
+ hasInclues && target.data.push(item);
1602
+ return !hasInclues;
1603
+ });
1604
+ }
1605
+ if (hasTransfering) {
1606
+ props.transferring.call(null, target);
1607
+ }
1344
1608
  source.checkedValues = [];
1345
1609
  target.disabled = !target.disabled;
1346
1610
  searchFilterData(source, target);
1347
1611
  searchFilterData(target, source);
1348
1612
  setOrigin("click");
1613
+ isFunction("afterTransfer") && props.afterTransfer.call(null, target);
1349
1614
  };
1350
1615
  const changeAllSource = (source, value) => {
1351
1616
  if (source.filterData.every((item) => item.disabled))
@@ -1367,7 +1632,7 @@ var Transfer = defineComponent({
1367
1632
  setOrigin("change");
1368
1633
  };
1369
1634
  const searchFilterData = (source, target) => {
1370
- source.filterData = source.data.filter((item) => item.key.indexOf(source.query) !== -1);
1635
+ source.filterData = source.data.filter((item) => item.key.indexOf(source.keyword) !== -1);
1371
1636
  if (target) {
1372
1637
  target.allChecked = false;
1373
1638
  }
@@ -1375,25 +1640,35 @@ var Transfer = defineComponent({
1375
1640
  const setOrigin = (value) => {
1376
1641
  origin.value = value;
1377
1642
  };
1643
+ const changeQueryHandle = (source, direction, value) => {
1644
+ if ((props == null ? void 0 : props.searching) && typeof props.searching === "function") {
1645
+ props.searching.call(null, direction, value, source);
1646
+ return;
1647
+ }
1648
+ source.keyword = value;
1649
+ };
1650
+ const isFunction = (type) => {
1651
+ return props[type] && typeof props[type] === "function";
1652
+ };
1378
1653
  return () => {
1379
1654
  return createVNode("div", {
1380
1655
  "class": "devui-transfer"
1381
1656
  }, [createVNode(DTransferBase, {
1382
- "style": {
1383
- height: props.height
1384
- },
1385
1657
  "sourceOption": leftOptions.filterData,
1386
1658
  "title": props.titles[0],
1387
1659
  "type": "source",
1388
1660
  "search": props.isSearch,
1389
1661
  "allChecked": leftOptions.allChecked,
1390
1662
  "checkedNum": leftOptions.checkedNum,
1391
- "query": leftOptions.query,
1663
+ "filter": leftOptions.keyword,
1664
+ "height": props.height,
1392
1665
  "checkedValues": leftOptions.checkedValues,
1393
1666
  "allCount": leftOptions.data.length,
1667
+ "showTooltip": props.showTooltip,
1668
+ "tooltipPosition": props.tooltipPosition,
1394
1669
  "onChangeAllSource": (value) => changeAllSource(leftOptions, value),
1395
1670
  "onUpdateCheckeds": updateLeftCheckeds,
1396
- "onChangeQuery": (value) => leftOptions.query = value
1671
+ "onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value)
1397
1672
  }, {
1398
1673
  header: headerSlot(ctx, "left"),
1399
1674
  body: bodySlot(ctx, "left")
@@ -1402,29 +1677,29 @@ var Transfer = defineComponent({
1402
1677
  "sourceDisabled": rightOptions.checkedNum > 0 ? false : true,
1403
1678
  "targetDisabled": leftOptions.checkedNum > 0 ? false : true,
1404
1679
  "onUpdateSourceData": () => {
1405
- updateFilterData(rightOptions, leftOptions);
1680
+ updateFilterData(rightOptions, leftOptions, "left");
1406
1681
  },
1407
1682
  "onUpdateTargetData": () => {
1408
- updateFilterData(leftOptions, rightOptions);
1683
+ updateFilterData(leftOptions, rightOptions, "right");
1409
1684
  }
1410
1685
  }, {
1411
1686
  operation: opeartionSlot(ctx)
1412
1687
  }), createVNode(DTransferBase, {
1413
- "style": {
1414
- height: props.height
1415
- },
1416
1688
  "sourceOption": rightOptions.filterData,
1417
1689
  "title": props.titles[1],
1418
1690
  "type": "target",
1419
1691
  "search": props.isSearch,
1420
1692
  "allChecked": rightOptions.allChecked,
1421
1693
  "checkedNum": rightOptions.checkedNum,
1422
- "query": rightOptions.query,
1694
+ "filter": rightOptions.keyword,
1695
+ "height": props.height,
1423
1696
  "checkedValues": rightOptions.checkedValues,
1424
1697
  "allCount": rightOptions.data.length,
1698
+ "showTooltip": props.showTooltip,
1699
+ "tooltipPosition": props.tooltipPosition,
1425
1700
  "onChangeAllSource": (value) => changeAllSource(rightOptions, value),
1426
1701
  "onUpdateCheckeds": updateRightCheckeds,
1427
- "onChangeQuery": (value) => rightOptions.query = value
1702
+ "onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value)
1428
1703
  }, {
1429
1704
  header: headerSlot(ctx, "right"),
1430
1705
  body: bodySlot(ctx, "right")