vue-devui 1.0.0-beta.18 → 1.0.0-beta.19

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 (161) hide show
  1. package/README.md +200 -187
  2. package/accordion/index.es.js +221 -6
  3. package/accordion/index.umd.js +1 -1
  4. package/alert/index.es.js +28 -30
  5. package/alert/index.umd.js +1 -1
  6. package/auto-complete/index.es.js +131 -269
  7. package/auto-complete/index.umd.js +1 -1
  8. package/auto-complete/style.css +1 -1
  9. package/back-top/index.es.js +4 -2
  10. package/badge/index.es.js +13 -19
  11. package/badge/index.umd.js +1 -1
  12. package/badge/style.css +1 -1
  13. package/breadcrumb/index.es.js +2 -1
  14. package/button/index.es.js +39 -40
  15. package/button/index.umd.js +1 -1
  16. package/carousel/index.es.js +38 -53
  17. package/carousel/index.umd.js +1 -1
  18. package/cascader/index.es.js +16 -8
  19. package/cascader/style.css +1 -1
  20. package/color-picker/index.es.js +97 -89
  21. package/color-picker/index.umd.js +7 -7
  22. package/countdown/index.es.js +2 -1
  23. package/date-picker/index.es.js +40 -57
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +162 -5741
  27. package/drawer/index.umd.js +1 -27
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +459 -301
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/editable-select/index.es.js +6 -3
  33. package/form/index.es.js +1953 -1550
  34. package/form/index.umd.js +18 -18
  35. package/form/style.css +1 -1
  36. package/fullscreen/index.es.js +112 -133
  37. package/fullscreen/index.umd.js +1 -1
  38. package/fullscreen/style.css +1 -1
  39. package/icon/index.es.js +39 -57
  40. package/icon/index.umd.js +1 -1
  41. package/image-preview/index.es.js +2 -1
  42. package/input/style.css +1 -1
  43. package/input-icon/index.es.js +38 -37
  44. package/input-icon/index.umd.js +1 -1
  45. package/input-icon/style.css +1 -1
  46. package/input-number/index.es.js +46 -57
  47. package/input-number/index.umd.js +1 -1
  48. package/input-number/style.css +1 -1
  49. package/{time-axis → list}/index.d.ts +0 -0
  50. package/list/index.es.js +39 -0
  51. package/list/index.umd.js +1 -0
  52. package/{toast → list}/package.json +1 -1
  53. package/list/style.css +1 -0
  54. package/modal/index.es.js +300 -934
  55. package/modal/index.umd.js +1 -1
  56. package/modal/style.css +1 -1
  57. package/{toast → notification}/index.d.ts +0 -0
  58. package/notification/index.es.js +284 -0
  59. package/notification/index.umd.js +1 -0
  60. package/notification/package.json +7 -0
  61. package/notification/style.css +1 -0
  62. package/nuxt/components/DropdownMenu.js +3 -0
  63. package/nuxt/components/IFileOptions.js +3 -0
  64. package/nuxt/components/IUploadOptions.js +3 -0
  65. package/nuxt/components/List.js +3 -0
  66. package/nuxt/components/ListItem.js +3 -0
  67. package/nuxt/components/Notification.js +3 -0
  68. package/nuxt/components/NotificationService.js +3 -0
  69. package/nuxt/components/PanelBody.js +3 -0
  70. package/nuxt/components/PanelFooter.js +3 -0
  71. package/nuxt/components/PanelHeader.js +3 -0
  72. package/nuxt/components/Timeline.js +3 -0
  73. package/nuxt/components/TimelineItem.js +3 -0
  74. package/nuxt/components/UploadStatus.js +3 -0
  75. package/nuxt/components/alertProps.js +3 -0
  76. package/nuxt/components/badgeProps.js +3 -0
  77. package/nuxt/components/dropdownMenuProps.js +3 -0
  78. package/nuxt/components/fixedOverlayProps.js +3 -0
  79. package/nuxt/components/flexibleOverlayProps.js +3 -0
  80. package/nuxt/components/fullscreenProps.js +3 -0
  81. package/nuxt/components/iconProps.js +2 -0
  82. package/nuxt/components/notificationProps.js +3 -0
  83. package/nuxt/components/overlayEmits.js +3 -0
  84. package/nuxt/components/overlayProps.js +3 -0
  85. package/nuxt/components/paginationProps.js +3 -0
  86. package/nuxt/components/panelProps.js +3 -0
  87. package/nuxt/components/popoverProps.js +3 -0
  88. package/nuxt/components/searchProps.js +3 -0
  89. package/nuxt/components/tooltipProps.js +3 -0
  90. package/nuxt/components/uploadProps.js +3 -0
  91. package/overlay/index.es.js +152 -198
  92. package/overlay/index.umd.js +1 -1
  93. package/overlay/style.css +1 -1
  94. package/package.json +40 -87
  95. package/pagination/index.es.js +10 -12
  96. package/pagination/index.umd.js +1 -1
  97. package/panel/index.es.js +45 -32
  98. package/panel/index.umd.js +1 -1
  99. package/popover/index.es.js +5954 -201
  100. package/popover/index.umd.js +27 -1
  101. package/popover/style.css +1 -1
  102. package/read-tip/index.es.js +6 -3
  103. package/result/index.es.js +38 -53
  104. package/result/index.umd.js +1 -1
  105. package/ripple/index.es.js +9 -5
  106. package/search/index.es.js +19 -29
  107. package/search/index.umd.js +6 -6
  108. package/search/style.css +1 -1
  109. package/select/index.es.js +42 -42
  110. package/select/index.umd.js +1 -1
  111. package/select/style.css +1 -1
  112. package/skeleton/index.es.js +17 -17
  113. package/skeleton/index.umd.js +1 -1
  114. package/slider/index.es.js +2 -1
  115. package/splitter/index.es.js +5814 -98
  116. package/splitter/index.umd.js +27 -1
  117. package/splitter/style.css +1 -1
  118. package/status/index.es.js +1 -4
  119. package/status/index.umd.js +1 -1
  120. package/status/style.css +1 -1
  121. package/steps-guide/index.es.js +6 -3
  122. package/style.css +1 -1
  123. package/table/index.es.js +456 -299
  124. package/table/index.umd.js +1 -1
  125. package/table/style.css +1 -1
  126. package/tabs/index.es.js +3 -4
  127. package/tabs/index.umd.js +1 -1
  128. package/tag/index.es.js +2 -1
  129. package/tag-input/index.es.js +4 -2
  130. package/textarea/style.css +1 -1
  131. package/time-picker/index.es.js +43 -42
  132. package/time-picker/index.umd.js +1 -1
  133. package/timeline/index.d.ts +7 -0
  134. package/{time-axis → timeline}/index.es.js +65 -78
  135. package/timeline/index.umd.js +1 -0
  136. package/{time-axis → timeline}/package.json +1 -1
  137. package/timeline/style.css +1 -0
  138. package/tooltip/index.es.js +5804 -94
  139. package/tooltip/index.umd.js +27 -1
  140. package/tooltip/style.css +1 -1
  141. package/transfer/index.es.js +440 -165
  142. package/transfer/index.umd.js +17 -17
  143. package/transfer/style.css +1 -1
  144. package/tree/index.es.js +12 -7
  145. package/tree/index.umd.js +10 -10
  146. package/tree-select/index.es.js +10 -6
  147. package/tree-select/index.umd.js +1 -1
  148. package/upload/index.es.js +335 -6068
  149. package/upload/index.umd.js +1 -27
  150. package/upload/style.css +1 -1
  151. package/vue-devui.es.js +2555 -2799
  152. package/vue-devui.umd.js +16 -16
  153. package/nuxt/components/TimeAxis.js +0 -3
  154. package/nuxt/components/TimeAxisItem.js +0 -3
  155. package/nuxt/components/Toast.js +0 -3
  156. package/nuxt/components/ToastService.js +0 -3
  157. package/time-axis/index.umd.js +0 -1
  158. package/time-axis/style.css +0 -1
  159. package/toast/index.es.js +0 -5918
  160. package/toast/index.umd.js +0 -27
  161. package/toast/style.css +0 -1
@@ -21,7 +21,8 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, reactive, onMounted, onBeforeUnmount, renderSlot, useSlots, isVNode, onUnmounted, createTextVNode, h, render, toRefs } from "vue";
24
+ import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, Teleport, Transition, renderSlot, isVNode, onMounted, onUnmounted, unref, nextTick, toRefs, Fragment, createTextVNode, h, render, reactive } from "vue";
25
+ import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
25
26
  const transferCommon = {
26
27
  showTooltip: {
27
28
  type: Boolean,
@@ -546,10 +547,6 @@ const searchProps = {
546
547
  type: String,
547
548
  default: ""
548
549
  },
549
- onSearch: {
550
- type: Function,
551
- default: void 0
552
- },
553
550
  "onUpdate:modelValue": {
554
551
  type: Function,
555
552
  default: void 0
@@ -581,9 +578,7 @@ const keywordsHandles = (ctx, props) => {
581
578
  keywords.value = "";
582
579
  ctx.emit("update:modelValue", "");
583
580
  };
584
- const clearIconShow = computed(() => {
585
- return keywords.value.length > 0;
586
- });
581
+ const clearIconShow = computed(() => keywords.value.length > 0);
587
582
  return {
588
583
  keywords,
589
584
  clearIconShow,
@@ -1020,9 +1015,9 @@ var lodash = { exports: {} };
1020
1015
  return result;
1021
1016
  }
1022
1017
  function arrayPush(array, values) {
1023
- var index2 = -1, length = values.length, offset = array.length;
1018
+ var index2 = -1, length = values.length, offset2 = array.length;
1024
1019
  while (++index2 < length) {
1025
- array[offset + index2] = values[index2];
1020
+ array[offset2 + index2] = values[index2];
1026
1021
  }
1027
1022
  return array;
1028
1023
  }
@@ -2629,13 +2624,13 @@ var lodash = { exports: {} };
2629
2624
  while (++argsIndex < rangeLength) {
2630
2625
  result2[argsIndex] = args[argsIndex];
2631
2626
  }
2632
- var offset = argsIndex;
2627
+ var offset2 = argsIndex;
2633
2628
  while (++rightIndex < rightLength) {
2634
- result2[offset + rightIndex] = partials[rightIndex];
2629
+ result2[offset2 + rightIndex] = partials[rightIndex];
2635
2630
  }
2636
2631
  while (++holdersIndex < holdersLength) {
2637
2632
  if (isUncurried || argsIndex < argsLength) {
2638
- result2[offset + holders[holdersIndex]] = args[argsIndex++];
2633
+ result2[offset2 + holders[holdersIndex]] = args[argsIndex++];
2639
2634
  }
2640
2635
  }
2641
2636
  return result2;
@@ -5182,9 +5177,9 @@ var lodash = { exports: {} };
5182
5177
  var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
5183
5178
  var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
5184
5179
  var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
5185
- string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
5180
+ string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
5186
5181
  interpolateValue || (interpolateValue = esTemplateValue);
5187
- source += string.slice(index2, offset).replace(reUnescapedString, escapeStringChar);
5182
+ source += string.slice(index2, offset2).replace(reUnescapedString, escapeStringChar);
5188
5183
  if (escapeValue) {
5189
5184
  isEscaping = true;
5190
5185
  source += "' +\n__e(" + escapeValue + ") +\n'";
@@ -5196,7 +5191,7 @@ var lodash = { exports: {} };
5196
5191
  if (interpolateValue) {
5197
5192
  source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
5198
5193
  }
5199
- index2 = offset + match.length;
5194
+ index2 = offset2 + match.length;
5200
5195
  return match;
5201
5196
  });
5202
5197
  source += "';\n";
@@ -6002,17 +5997,10 @@ var lodash = { exports: {} };
6002
5997
  }
6003
5998
  }).call(commonjsGlobal);
6004
5999
  })(lodash, lodash.exports);
6005
- const KEYS_MAP = {
6006
- enter: "Enter"
6007
- };
6008
- const keydownHandles = (ctx, keywords, delay) => {
6009
- const onInputKeydown = ($event) => {
6010
- switch ($event.key) {
6011
- case KEYS_MAP.enter:
6012
- handleEnter($event);
6013
- break;
6014
- }
6015
- };
6000
+ const keydownHandles = (ctx, keywords, props) => {
6001
+ const useEmitKeyword = lodash.exports.debounce((value) => {
6002
+ ctx.emit("search", value);
6003
+ }, props.delay);
6016
6004
  const handleEnter = ($event) => {
6017
6005
  if ($event.target instanceof HTMLInputElement) {
6018
6006
  const value = $event.target.value;
@@ -6020,11 +6008,17 @@ const keydownHandles = (ctx, keywords, delay) => {
6020
6008
  }
6021
6009
  };
6022
6010
  const onClickHandle = () => {
6023
- useEmitKeyword(keywords.value);
6011
+ if (!props.disabled) {
6012
+ ctx.emit("search", keywords.value);
6013
+ }
6014
+ };
6015
+ const KEYS_MAP = {
6016
+ Enter: handleEnter
6017
+ };
6018
+ const onInputKeydown = ($event) => {
6019
+ var _a;
6020
+ (_a = KEYS_MAP[$event.key]) == null ? void 0 : _a.call(KEYS_MAP, $event);
6024
6021
  };
6025
- const useEmitKeyword = lodash.exports.debounce((value) => {
6026
- ctx.emit("onSearch", value);
6027
- }, delay);
6028
6022
  return {
6029
6023
  onInputKeydown,
6030
6024
  useEmitKeyword,
@@ -6211,7 +6205,7 @@ var search = "";
6211
6205
  var DSearch = defineComponent({
6212
6206
  name: "DSearch",
6213
6207
  props: searchProps,
6214
- emits: ["update:modelValue", "onSearch"],
6208
+ emits: ["update:modelValue", "search"],
6215
6209
  setup(props, ctx) {
6216
6210
  const rootClasses = getRootClass(props);
6217
6211
  const {
@@ -6223,7 +6217,7 @@ var DSearch = defineComponent({
6223
6217
  onInputKeydown,
6224
6218
  onClickHandle,
6225
6219
  useEmitKeyword
6226
- } = keydownHandles(ctx, keywords, props.delay);
6220
+ } = keydownHandles(ctx, keywords, props);
6227
6221
  const onInputUpdate = (event) => {
6228
6222
  if (props.isKeyupSearch) {
6229
6223
  useEmitKeyword(event);
@@ -6278,115 +6272,396 @@ const transferDragProps = __spreadProps(__spreadValues(__spreadValues({}, transf
6278
6272
  default: () => null
6279
6273
  }
6280
6274
  });
6281
- const tooltipProps = {
6275
+ var baseOverlay = "";
6276
+ function _isSlot$2(s) {
6277
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6278
+ }
6279
+ const CommonOverlay = defineComponent({
6280
+ setup(props, ctx) {
6281
+ return () => {
6282
+ let _slot;
6283
+ return createVNode(Teleport, {
6284
+ "to": "#d-overlay-anchor"
6285
+ }, {
6286
+ default: () => [createVNode(Transition, {
6287
+ "name": "devui-overlay-fade"
6288
+ }, _isSlot$2(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
6289
+ default: () => [_slot]
6290
+ })]
6291
+ });
6292
+ };
6293
+ }
6294
+ });
6295
+ const overlayProps = {
6296
+ visible: {
6297
+ type: Boolean
6298
+ },
6299
+ backgroundBlock: {
6300
+ type: Boolean,
6301
+ default: false
6302
+ },
6303
+ backgroundClass: {
6304
+ type: String,
6305
+ default: ""
6306
+ },
6307
+ backgroundStyle: {
6308
+ type: [String, Object]
6309
+ },
6310
+ onBackdropClick: {
6311
+ type: Function
6312
+ },
6313
+ backdropClose: {
6314
+ type: Boolean,
6315
+ default: true
6316
+ },
6317
+ hasBackdrop: {
6318
+ type: Boolean,
6319
+ default: true
6320
+ }
6321
+ };
6322
+ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
6323
+ overlayStyle: {
6324
+ type: [String, Object],
6325
+ default: void 0
6326
+ }
6327
+ });
6328
+ const overlayEmits = ["update:visible", "backdropClick"];
6329
+ function useOverlayLogic(props, ctx) {
6330
+ const backgroundClass = computed(() => {
6331
+ return [
6332
+ "devui-overlay-background",
6333
+ props.backgroundClass,
6334
+ !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
6335
+ ];
6336
+ });
6337
+ const overlayClass = computed(() => {
6338
+ return "devui-overlay";
6339
+ });
6340
+ const handleBackdropClick = (event) => {
6341
+ var _a;
6342
+ event.preventDefault();
6343
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
6344
+ if (props.backdropClose) {
6345
+ ctx.emit("update:visible", false);
6346
+ }
6347
+ };
6348
+ const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
6349
+ onMounted(() => {
6350
+ const body = document.body;
6351
+ const originOverflow = body.style.overflow;
6352
+ const originPosition = body.style.position;
6353
+ watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
6354
+ if (backgroundBlock) {
6355
+ const top = body.getBoundingClientRect().y;
6356
+ if (visible) {
6357
+ body.style.overflowY = "scroll";
6358
+ body.style.position = visible ? "fixed" : "";
6359
+ body.style.top = `${top}px`;
6360
+ } else {
6361
+ body.style.overflowY = originOverflow;
6362
+ body.style.position = originPosition;
6363
+ body.style.top = "";
6364
+ window.scrollTo(0, -top);
6365
+ }
6366
+ }
6367
+ });
6368
+ onUnmounted(() => {
6369
+ document.body.style.overflow = originOverflow;
6370
+ });
6371
+ });
6372
+ return {
6373
+ backgroundClass,
6374
+ overlayClass,
6375
+ handleBackdropClick,
6376
+ handleOverlayBubbleCancel
6377
+ };
6378
+ }
6379
+ var fixedOverlay = "";
6380
+ defineComponent({
6381
+ name: "DFixedOverlay",
6382
+ props: fixedOverlayProps,
6383
+ emits: overlayEmits,
6384
+ setup(props, ctx) {
6385
+ const {
6386
+ backgroundClass,
6387
+ overlayClass,
6388
+ handleBackdropClick,
6389
+ handleOverlayBubbleCancel
6390
+ } = useOverlayLogic(props, ctx);
6391
+ return () => createVNode(CommonOverlay, null, {
6392
+ default: () => [props.visible && createVNode("div", {
6393
+ "class": backgroundClass.value,
6394
+ "style": props.backgroundStyle,
6395
+ "onClick": handleBackdropClick
6396
+ }, [createVNode("div", {
6397
+ "class": overlayClass.value,
6398
+ "style": props.overlayStyle,
6399
+ "onClick": handleOverlayBubbleCancel
6400
+ }, [renderSlot(ctx.slots, "default")])])]
6401
+ });
6402
+ }
6403
+ });
6404
+ const flexibleOverlayProps = {
6405
+ modelValue: {
6406
+ type: Boolean,
6407
+ default: false
6408
+ },
6409
+ origin: {
6410
+ type: Object,
6411
+ require: true
6412
+ },
6282
6413
  position: {
6414
+ type: Array,
6415
+ default: ["bottom"]
6416
+ },
6417
+ offset: {
6418
+ type: [Number, Object],
6419
+ default: 8
6420
+ },
6421
+ align: {
6422
+ type: String,
6423
+ default: null
6424
+ },
6425
+ showArrow: {
6426
+ type: Boolean,
6427
+ default: false
6428
+ },
6429
+ isArrowCenter: {
6430
+ type: Boolean,
6431
+ default: true
6432
+ }
6433
+ };
6434
+ function getScrollParent(element) {
6435
+ const overflowRegex = /(auto|scroll|hidden)/;
6436
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
6437
+ const style = window.getComputedStyle(parent);
6438
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
6439
+ return parent;
6440
+ }
6441
+ }
6442
+ return window;
6443
+ }
6444
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
6445
+ let { x, y } = point;
6446
+ if (!isArrowCenter) {
6447
+ const { width, height } = originRect;
6448
+ if (x && placement.includes("start")) {
6449
+ x = 12;
6450
+ }
6451
+ if (x && placement.includes("end")) {
6452
+ x = Math.round(width - 24);
6453
+ }
6454
+ if (y && placement.includes("start")) {
6455
+ y = 10;
6456
+ }
6457
+ if (y && placement.includes("end")) {
6458
+ y = height - 14;
6459
+ }
6460
+ }
6461
+ return { x, y };
6462
+ }
6463
+ function useOverlay(props, emit) {
6464
+ const overlayRef = ref();
6465
+ const arrowRef = ref();
6466
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
6467
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
6468
+ const staticSide = {
6469
+ top: "bottom",
6470
+ right: "left",
6471
+ bottom: "top",
6472
+ left: "right"
6473
+ }[placement.split("-")[0]];
6474
+ Object.assign(arrowEl.style, {
6475
+ left: x ? `${x}px` : "",
6476
+ top: y ? `${y}px` : "",
6477
+ right: "",
6478
+ bottom: "",
6479
+ [staticSide]: "-4px"
6480
+ });
6481
+ };
6482
+ const updatePosition = async () => {
6483
+ const hostEl = props.origin;
6484
+ const overlayEl = unref(overlayRef.value);
6485
+ const arrowEl = unref(arrowRef.value);
6486
+ const middleware = [
6487
+ shift(),
6488
+ offset(props.offset),
6489
+ autoPlacement({
6490
+ alignment: props.align,
6491
+ allowedPlacements: props.position
6492
+ })
6493
+ ];
6494
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
6495
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
6496
+ strategy: "fixed",
6497
+ middleware
6498
+ });
6499
+ emit("positionChange", placement);
6500
+ Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
6501
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
6502
+ };
6503
+ watch(() => props.modelValue, () => {
6504
+ const originParent = getScrollParent(props.origin);
6505
+ if (props.modelValue && props.origin) {
6506
+ nextTick(updatePosition);
6507
+ originParent.addEventListener("scroll", updatePosition);
6508
+ originParent !== window && window.addEventListener("scroll", updatePosition);
6509
+ window.addEventListener("resize", updatePosition);
6510
+ } else {
6511
+ originParent.removeEventListener("scroll", updatePosition);
6512
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
6513
+ window.removeEventListener("resize", updatePosition);
6514
+ }
6515
+ });
6516
+ onUnmounted(() => {
6517
+ const originParent = getScrollParent(props.origin);
6518
+ originParent.removeEventListener("scroll", updatePosition);
6519
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
6520
+ window.removeEventListener("resize", updatePosition);
6521
+ });
6522
+ return { arrowRef, overlayRef, updatePosition };
6523
+ }
6524
+ var flexibleOverlay = "";
6525
+ const FlexibleOverlay = defineComponent({
6526
+ name: "DFlexibleOverlay",
6527
+ inheritAttrs: false,
6528
+ props: flexibleOverlayProps,
6529
+ emits: ["update:modelValue", "positionChange"],
6530
+ setup(props, {
6531
+ slots,
6532
+ attrs,
6533
+ emit,
6534
+ expose
6535
+ }) {
6536
+ const {
6537
+ arrowRef,
6538
+ overlayRef,
6539
+ updatePosition
6540
+ } = useOverlay(props, emit);
6541
+ expose({
6542
+ updatePosition
6543
+ });
6544
+ return () => {
6545
+ var _a;
6546
+ return props.modelValue && createVNode("div", mergeProps({
6547
+ "ref": overlayRef,
6548
+ "class": "devui-flexible-overlay"
6549
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
6550
+ "ref": arrowRef,
6551
+ "class": "devui-flexible-overlay-arrow"
6552
+ }, null)]);
6553
+ };
6554
+ }
6555
+ });
6556
+ const tooltipProps = {
6557
+ content: {
6283
6558
  type: String,
6559
+ default: ""
6560
+ },
6561
+ position: {
6562
+ type: [String, Array],
6284
6563
  default: "top"
6285
6564
  },
6286
6565
  showAnimation: {
6287
6566
  type: Boolean,
6288
6567
  default: true
6289
6568
  },
6290
- content: {
6291
- type: String
6569
+ mouseEnterDelay: {
6570
+ type: Number,
6571
+ default: 150
6292
6572
  },
6293
6573
  mouseLeaveDelay: {
6294
- type: String,
6295
- default: "150"
6296
- },
6297
- mouseEnterDelay: {
6298
- type: String,
6299
- default: "100"
6574
+ type: Number,
6575
+ default: 100
6300
6576
  }
6301
6577
  };
6578
+ const TransformOriginMap = {
6579
+ top: "50% calc(100% + 8px)",
6580
+ bottom: "50% -8px",
6581
+ left: "calc(100% + 8px)",
6582
+ right: "-8px 50%"
6583
+ };
6584
+ function useTooltip(origin, props) {
6585
+ const { position, mouseEnterDelay, mouseLeaveDelay } = toRefs(props);
6586
+ const visible = ref(false);
6587
+ const isEnter = ref(false);
6588
+ const positionArr = computed(() => typeof position.value === "string" ? [position.value] : position.value);
6589
+ const placement = ref(positionArr.value[0]);
6590
+ const overlayStyles = computed(() => ({
6591
+ transformOrigin: TransformOriginMap[placement.value]
6592
+ }));
6593
+ const enter = lodash.exports.debounce(() => {
6594
+ isEnter.value && (visible.value = true);
6595
+ }, mouseEnterDelay.value);
6596
+ const leave = lodash.exports.debounce(() => {
6597
+ !isEnter.value && (visible.value = false);
6598
+ }, mouseLeaveDelay.value);
6599
+ const onMouseenter = () => {
6600
+ isEnter.value = true;
6601
+ enter();
6602
+ };
6603
+ const onMouseleave = () => {
6604
+ isEnter.value = false;
6605
+ leave();
6606
+ };
6607
+ const onPositionChange = (pos) => {
6608
+ placement.value = pos;
6609
+ };
6610
+ onMounted(() => {
6611
+ origin.value.addEventListener("mouseenter", onMouseenter);
6612
+ origin.value.addEventListener("mouseleave", onMouseleave);
6613
+ });
6614
+ return { visible, placement, positionArr, overlayStyles, onPositionChange };
6615
+ }
6302
6616
  var tooltip = "";
6303
6617
  var DTooltip = defineComponent({
6304
6618
  name: "DTooltip",
6305
6619
  props: tooltipProps,
6306
- setup(props) {
6307
- const position = reactive({
6308
- left: 0,
6309
- top: 0
6310
- });
6311
- const arrowStyle = (attr, value) => {
6312
- document.getElementById("devui-arrow").style[attr] = value;
6313
- };
6314
- const slotElement = ref(null);
6315
- onMounted(() => {
6316
- slotElement.value.children[0].onmouseenter = function() {
6317
- const tooltip2 = document.createElement("div");
6318
- const arrow = document.createElement("div");
6319
- const tooltipcontent = document.createElement("div");
6320
- tooltip2.classList.add("tooltip");
6321
- arrow.classList.add("arrow");
6322
- tooltipcontent.classList.add("tooltipcontent");
6323
- arrow.id = "devui-arrow";
6324
- tooltip2.id = "devui-tooltip1";
6325
- setTimeout(() => {
6326
- document.getElementById("devui-tooltip").appendChild(tooltip2);
6327
- tooltip2.appendChild(arrow);
6328
- tooltip2.appendChild(tooltipcontent);
6329
- tooltipcontent.innerHTML = props.content;
6330
- tooltip2.style.opacity = "1";
6331
- tooltip2.style.zIndex = "999";
6332
- arrow.style.border = "5px solid transparent";
6333
- switch (props.position) {
6334
- case "top":
6335
- position.left = slotElement.value.children[0].offsetLeft - tooltip2.offsetWidth / 2 + slotElement.value.children[0].offsetWidth / 2 - 5;
6336
- position.top = slotElement.value.children[0].offsetTop - 10 - tooltipcontent.offsetHeight;
6337
- arrow.style.top = `${tooltipcontent.offsetHeight}px`;
6338
- arrow.style.left = `${tooltipcontent.offsetWidth / 2 + 5}px`;
6339
- arrow.style.borderTop = "5px solid rgb(70, 77, 110)";
6340
- break;
6341
- case "bottom":
6342
- position.top = slotElement.value.children[0].offsetHeight + slotElement.value.children[0].offsetTop + 10;
6343
- position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth / 2 - tooltipcontent.offsetWidth / 2 - 5;
6344
- arrowStyle("borderBottom", "5px solid rgb(70, 77, 110)");
6345
- arrow.style.top = "-10px";
6346
- arrow.style.left = `${tooltipcontent.offsetWidth / 2 + 5}px`;
6347
- arrow.style.borderBottom = "5px solid rgb(70, 77, 110)";
6348
- break;
6349
- case "left":
6350
- position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.offsetHeight / 2;
6351
- position.left = slotElement.value.children[0].offsetLeft - 20 - tooltipcontent.offsetWidth;
6352
- arrowStyle("borderLeft", "5px solid rgb(70, 77, 110)");
6353
- arrow.style.left = `${tooltipcontent.offsetWidth + 10}px`;
6354
- arrow.style.top = `${tooltipcontent.offsetHeight / 2 - 5}px`;
6355
- arrow.style.borderLeft = "5px solid rgb(70, 77, 110)";
6356
- break;
6357
- case "right":
6358
- position.left = slotElement.value.children[0].offsetLeft + slotElement.value.children[0].offsetWidth;
6359
- position.top = slotElement.value.children[0].offsetTop + slotElement.value.children[0].offsetHeight / 2 - tooltipcontent.offsetHeight / 2;
6360
- arrowStyle("borderRight", "5px solid rgb(70, 77, 110)");
6361
- arrow.style.top = `${tooltipcontent.offsetHeight / 2 - 5}px`;
6362
- arrow.style.left = "-0px";
6363
- arrow.style.borderRight = "5px solid rgb(70, 77, 110)";
6364
- break;
6365
- }
6366
- tooltip2.style.top = position.top + 5 + "px";
6367
- tooltip2.style.left = position.left + "px";
6368
- }, props.mouseEnterDelay);
6369
- };
6370
- slotElement.value.children[0].onmouseleave = function() {
6371
- setTimeout(() => {
6372
- document.getElementById("devui-tooltip1").removeChild(document.getElementById("devui-arrow"));
6373
- document.getElementById("devui-tooltip").removeChild(document.getElementById("devui-tooltip1"));
6374
- }, props.mouseLeaveDelay);
6375
- };
6376
- });
6377
- onBeforeUnmount(() => {
6378
- slotElement.value.children[0].onmouseenter = null;
6379
- slotElement.value.children[0].onmouseleave = null;
6380
- });
6620
+ setup(props, {
6621
+ slots
6622
+ }) {
6623
+ const {
6624
+ showAnimation,
6625
+ content
6626
+ } = toRefs(props);
6627
+ const origin = ref();
6628
+ const tooltipRef = ref();
6629
+ const {
6630
+ visible,
6631
+ placement,
6632
+ positionArr,
6633
+ overlayStyles,
6634
+ onPositionChange
6635
+ } = useTooltip(origin, props);
6381
6636
  return () => {
6382
- const defaultSlot = renderSlot(useSlots(), "default");
6383
- return createVNode("div", {
6384
- "class": "devui-tooltip",
6385
- "id": "devui-tooltip"
6386
- }, [createVNode("div", {
6387
- "class": "slotElement",
6388
- "ref": slotElement
6389
- }, [defaultSlot])]);
6637
+ var _a;
6638
+ return createVNode(Fragment, null, [createVNode("div", {
6639
+ "ref": origin,
6640
+ "class": "devui-tooltip-reference"
6641
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
6642
+ "to": "body"
6643
+ }, {
6644
+ default: () => [createVNode(Transition, {
6645
+ "name": showAnimation.value ? `devui-tooltip-fade-${placement.value}` : ""
6646
+ }, {
6647
+ default: () => [createVNode(FlexibleOverlay, {
6648
+ "modelValue": visible.value,
6649
+ "onUpdate:modelValue": ($event) => visible.value = $event,
6650
+ "ref": tooltipRef,
6651
+ "class": "devui-tooltip",
6652
+ "origin": origin.value,
6653
+ "position": positionArr.value,
6654
+ "offset": 6,
6655
+ "show-arrow": true,
6656
+ "style": overlayStyles.value,
6657
+ "onPositionChange": onPositionChange
6658
+ }, {
6659
+ default: () => [createVNode("span", {
6660
+ "innerHTML": content.value
6661
+ }, null)]
6662
+ })]
6663
+ })]
6664
+ })]);
6390
6665
  };
6391
6666
  }
6392
6667
  });
@@ -6678,55 +6953,53 @@ var DTransferBase = defineComponent({
6678
6953
  }, [createTextVNode("\u65E0\u6570\u636E")])])])]);
6679
6954
  }
6680
6955
  });
6956
+ const iconProps = {
6957
+ name: {
6958
+ type: String,
6959
+ default: "",
6960
+ required: true
6961
+ },
6962
+ size: {
6963
+ type: String,
6964
+ default: "inherit"
6965
+ },
6966
+ color: {
6967
+ type: String,
6968
+ default: "inherit"
6969
+ },
6970
+ classPrefix: {
6971
+ type: String,
6972
+ default: "icon"
6973
+ }
6974
+ };
6681
6975
  var Icon = defineComponent({
6682
6976
  name: "DIcon",
6683
- props: {
6684
- name: {
6685
- type: String,
6686
- required: true
6687
- },
6688
- size: {
6689
- type: String,
6690
- default: "inherit"
6691
- },
6692
- color: {
6693
- type: String,
6694
- default: "inherit"
6695
- },
6696
- classPrefix: {
6697
- type: String,
6698
- default: "icon"
6699
- }
6700
- },
6977
+ props: iconProps,
6701
6978
  setup(props) {
6702
- return __spreadValues({}, props);
6703
- },
6704
- render() {
6705
6979
  const {
6706
6980
  name,
6707
6981
  size,
6708
6982
  color,
6709
6983
  classPrefix
6710
- } = this;
6711
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
6712
- "src": name,
6713
- "alt": name.split("/")[name.split("/").length - 1],
6714
- "style": {
6715
- width: size,
6716
- verticalAlign: "text-bottom"
6717
- }
6718
- }, null) : createVNode("i", {
6719
- "class": `${classPrefix} ${classPrefix}-${name}`,
6720
- "style": {
6721
- fontSize: size,
6722
- color
6723
- }
6724
- }, null);
6984
+ } = toRefs(props);
6985
+ return () => {
6986
+ return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
6987
+ "src": name.value,
6988
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
6989
+ "style": {
6990
+ width: size.value,
6991
+ verticalAlign: "text-bottom"
6992
+ }
6993
+ }, null) : createVNode("i", {
6994
+ "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
6995
+ "style": {
6996
+ fontSize: size.value,
6997
+ color: color.value
6998
+ }
6999
+ }, null);
7000
+ };
6725
7001
  }
6726
7002
  });
6727
- Icon.install = function(app) {
6728
- app.component(Icon.name, Icon);
6729
- };
6730
7003
  class View {
6731
7004
  constructor() {
6732
7005
  __publicField(this, "top", "50%");
@@ -7010,6 +7283,7 @@ var DButton = defineComponent({
7010
7283
  }, [icon.value && createVNode(Icon, {
7011
7284
  "name": icon.value,
7012
7285
  "size": "12px",
7286
+ "color": "",
7013
7287
  "class": iconClass.value
7014
7288
  }, null), createVNode("span", {
7015
7289
  "class": "button-content"
@@ -7221,8 +7495,9 @@ var Transfer = defineComponent({
7221
7495
  isFunction("afterTransfer") && props.afterTransfer.call(null, target);
7222
7496
  };
7223
7497
  const changeAllSource = (source, value) => {
7224
- if (source.filterData.every((item) => item.disabled))
7498
+ if (source.filterData.every((item) => item.disabled)) {
7225
7499
  return;
7500
+ }
7226
7501
  source.allChecked = value;
7227
7502
  if (value) {
7228
7503
  source.checkedValues = source.filterData.filter((item) => !item.disabled).map((item) => item.value);