vue-devui 1.6.13 → 1.6.15

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 (66) hide show
  1. package/auto-complete/index.es.js +20 -39
  2. package/auto-complete/index.umd.js +10 -10
  3. package/breadcrumb/index.es.js +25 -39
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/category-search/index.es.js +27 -41
  6. package/category-search/index.umd.js +13 -13
  7. package/category-search/style.css +1 -1
  8. package/checkbox/index.es.js +20 -39
  9. package/checkbox/index.umd.js +11 -11
  10. package/code-review/index.es.js +20 -39
  11. package/code-review/index.umd.js +17 -17
  12. package/data-grid/index.es.js +27 -41
  13. package/data-grid/index.umd.js +12 -12
  14. package/date-picker-pro/index.es.js +20 -39
  15. package/date-picker-pro/index.umd.js +13 -13
  16. package/dropdown/index.es.js +25 -39
  17. package/dropdown/index.umd.js +1 -1
  18. package/editable-select/index.es.js +20 -39
  19. package/editable-select/index.umd.js +14 -14
  20. package/editor-md/index.es.js +27 -41
  21. package/editor-md/index.umd.js +23 -23
  22. package/form/index.es.js +20 -39
  23. package/form/index.umd.js +12 -12
  24. package/input/index.es.js +20 -39
  25. package/input/index.umd.js +10 -10
  26. package/input-number/index.es.js +20 -39
  27. package/input-number/index.umd.js +18 -18
  28. package/mention/index.es.js +20 -39
  29. package/mention/index.umd.js +18 -18
  30. package/modal/index.es.js +18 -37
  31. package/modal/index.umd.js +2 -2
  32. package/overlay/index.es.js +18 -37
  33. package/overlay/index.umd.js +1 -1
  34. package/package.json +2 -2
  35. package/pagination/index.es.js +27 -41
  36. package/pagination/index.umd.js +13 -13
  37. package/popover/index.es.js +20 -39
  38. package/popover/index.umd.js +14 -14
  39. package/radio/index.es.js +20 -39
  40. package/radio/index.umd.js +17 -17
  41. package/search/index.es.js +20 -39
  42. package/search/index.umd.js +12 -12
  43. package/select/index.es.js +20 -39
  44. package/select/index.umd.js +16 -16
  45. package/splitter/index.es.js +20 -39
  46. package/splitter/index.umd.js +16 -16
  47. package/style.css +1 -1
  48. package/switch/index.es.js +20 -39
  49. package/switch/index.umd.js +12 -12
  50. package/table/index.es.js +27 -41
  51. package/table/index.umd.js +14 -14
  52. package/textarea/index.es.js +20 -39
  53. package/textarea/index.umd.js +15 -15
  54. package/time-picker/index.es.js +20 -39
  55. package/time-picker/index.umd.js +16 -16
  56. package/time-select/index.es.js +20 -39
  57. package/time-select/index.umd.js +10 -10
  58. package/tooltip/index.es.js +20 -39
  59. package/tooltip/index.umd.js +17 -17
  60. package/tree/index.es.js +20 -39
  61. package/tree/index.umd.js +12 -12
  62. package/types/dropdown/src/dropdown-types.d.ts +4 -0
  63. package/types/dropdown/src/dropdown.d.ts +9 -0
  64. package/types/tooltip/src/tooltip.d.ts +1 -1
  65. package/vue-devui.es.js +26 -40
  66. package/vue-devui.umd.js +63 -63
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  };
24
24
  import { toRefs, onMounted, onUnmounted, watch, defineComponent, ref, renderSlot, useSlots, createVNode, reactive, computed, nextTick, onBeforeUnmount, onBeforeMount, Transition, mergeProps, unref, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow, createTextVNode, isVNode } from "vue";
25
25
  import "clipboard";
26
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
26
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
27
27
  import { onClickOutside } from "@vueuse/core";
28
28
  import hljs from "highlight.js";
29
29
  import MarkdownIt from "markdown-it";
@@ -5691,7 +5691,7 @@ var lodash = { exports: {} };
5691
5691
  var delay = baseRest(function(func, wait, args) {
5692
5692
  return baseDelay(func, toNumber(wait) || 0, args);
5693
5693
  });
5694
- function flip(func) {
5694
+ function flip2(func) {
5695
5695
  return createWrap(func, WRAP_FLIP_FLAG);
5696
5696
  }
5697
5697
  function memoize(func, resolver) {
@@ -6815,7 +6815,7 @@ var lodash = { exports: {} };
6815
6815
  lodash2.flatten = flatten;
6816
6816
  lodash2.flattenDeep = flattenDeep;
6817
6817
  lodash2.flattenDepth = flattenDepth;
6818
- lodash2.flip = flip;
6818
+ lodash2.flip = flip2;
6819
6819
  lodash2.flow = flow;
6820
6820
  lodash2.flowRight = flowRight;
6821
6821
  lodash2.fromPairs = fromPairs;
@@ -7759,6 +7759,10 @@ const dropdownProps = {
7759
7759
  destroyOnHide: {
7760
7760
  type: Boolean,
7761
7761
  default: true
7762
+ },
7763
+ teleport: {
7764
+ type: [String, Object],
7765
+ default: "body"
7762
7766
  }
7763
7767
  };
7764
7768
  const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
@@ -8026,16 +8030,6 @@ const flexibleOverlayProps = {
8026
8030
  default: false
8027
8031
  }
8028
8032
  };
8029
- function getScrollParent(element) {
8030
- const overflowRegex = /(auto|scroll|hidden)/;
8031
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
8032
- const style = window.getComputedStyle(parent);
8033
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
8034
- return parent;
8035
- }
8036
- }
8037
- return window;
8038
- }
8039
8033
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8040
8034
  let { x, y } = point;
8041
8035
  if (!isArrowCenter) {
@@ -8056,9 +8050,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8056
8050
  return { x, y };
8057
8051
  }
8058
8052
  function useOverlay(props, emit) {
8053
+ const { position, showArrow } = toRefs(props);
8059
8054
  const overlayRef = ref();
8060
8055
  const arrowRef = ref();
8061
- let originParent = null;
8062
8056
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
8063
8057
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
8064
8058
  const staticSide = {
@@ -8079,51 +8073,42 @@ function useOverlay(props, emit) {
8079
8073
  const hostEl = props.origin;
8080
8074
  const overlayEl = unref(overlayRef.value);
8081
8075
  const arrowEl = unref(arrowRef.value);
8082
- const middleware = [
8083
- offset(props.offset),
8084
- autoPlacement({
8085
- alignment: props.align,
8086
- allowedPlacements: props.position
8087
- })
8088
- ];
8089
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
8090
- props.shiftOffset !== void 0 && middleware.push(shift());
8091
- if (!overlayEl) {
8092
- return;
8076
+ const [mainPosition, ...fallbackPosition] = position.value;
8077
+ const middleware = [offset(props.offset)];
8078
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
8079
+ if (showArrow.value) {
8080
+ middleware.push(arrow({ element: arrowRef.value }));
8093
8081
  }
8094
8082
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
8095
8083
  strategy: "fixed",
8084
+ placement: mainPosition,
8096
8085
  middleware
8097
8086
  });
8098
8087
  let applyX = x;
8099
8088
  let applyY = y;
8100
- if (props.shiftOffset !== void 0) {
8101
- const { x: shiftX, y: shiftY } = middlewareData.shift;
8102
- shiftX < 0 && (applyX -= props.shiftOffset);
8103
- shiftX > 0 && (applyX += props.shiftOffset);
8104
- shiftY < 0 && (applyY -= props.shiftOffset);
8105
- shiftY > 0 && (applyY += props.shiftOffset);
8106
- }
8107
8089
  emit("positionChange", placement);
8108
8090
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
8109
8091
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
8110
8092
  };
8093
+ const scrollCallback = (e) => {
8094
+ var _a, _b;
8095
+ const scrollElement = e.target;
8096
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
8097
+ updatePosition();
8098
+ }
8099
+ };
8111
8100
  watch(() => props.modelValue, () => {
8112
8101
  if (props.modelValue && props.origin) {
8113
- originParent = getScrollParent(props.origin);
8114
8102
  nextTick(updatePosition);
8115
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
8116
- originParent !== window && window.addEventListener("scroll", updatePosition);
8103
+ window.addEventListener("scroll", scrollCallback, true);
8117
8104
  window.addEventListener("resize", updatePosition);
8118
8105
  } else {
8119
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8120
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8106
+ window.removeEventListener("scroll", scrollCallback, true);
8121
8107
  window.removeEventListener("resize", updatePosition);
8122
8108
  }
8123
8109
  });
8124
8110
  onUnmounted(() => {
8125
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8126
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8111
+ window.removeEventListener("scroll", scrollCallback, true);
8127
8112
  window.removeEventListener("resize", updatePosition);
8128
8113
  });
8129
8114
  return { arrowRef, overlayRef, updatePosition };
@@ -8242,7 +8227,8 @@ var Dropdown = defineComponent({
8242
8227
  offset: offset2,
8243
8228
  destroyOnHide,
8244
8229
  shiftOffset,
8245
- showAnimation
8230
+ showAnimation,
8231
+ teleport
8246
8232
  } = toRefs(props);
8247
8233
  const origin = ref();
8248
8234
  const dropdownRef = ref();
@@ -8284,7 +8270,7 @@ var Dropdown = defineComponent({
8284
8270
  return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
8285
8271
  }
8286
8272
  }), createVNode(Teleport, {
8287
- "to": "body"
8273
+ "to": teleport.value
8288
8274
  }, {
8289
8275
  default: () => [createVNode(Transition, {
8290
8276
  "name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""