vue-devui 1.6.14 → 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 (61) 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 +18 -37
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/category-search/index.es.js +20 -39
  6. package/category-search/index.umd.js +12 -12
  7. package/checkbox/index.es.js +20 -39
  8. package/checkbox/index.umd.js +11 -11
  9. package/code-review/index.es.js +20 -39
  10. package/code-review/index.umd.js +17 -17
  11. package/data-grid/index.es.js +20 -39
  12. package/data-grid/index.umd.js +9 -9
  13. package/date-picker-pro/index.es.js +20 -39
  14. package/date-picker-pro/index.umd.js +13 -13
  15. package/dropdown/index.es.js +18 -37
  16. package/dropdown/index.umd.js +1 -1
  17. package/editable-select/index.es.js +20 -39
  18. package/editable-select/index.umd.js +14 -14
  19. package/editor-md/index.es.js +20 -39
  20. package/editor-md/index.umd.js +22 -22
  21. package/form/index.es.js +20 -39
  22. package/form/index.umd.js +12 -12
  23. package/input/index.es.js +20 -39
  24. package/input/index.umd.js +10 -10
  25. package/input-number/index.es.js +20 -39
  26. package/input-number/index.umd.js +18 -18
  27. package/mention/index.es.js +20 -39
  28. package/mention/index.umd.js +18 -18
  29. package/modal/index.es.js +18 -37
  30. package/modal/index.umd.js +2 -2
  31. package/overlay/index.es.js +18 -37
  32. package/overlay/index.umd.js +1 -1
  33. package/package.json +2 -2
  34. package/pagination/index.es.js +20 -39
  35. package/pagination/index.umd.js +10 -10
  36. package/popover/index.es.js +20 -39
  37. package/popover/index.umd.js +14 -14
  38. package/radio/index.es.js +20 -39
  39. package/radio/index.umd.js +17 -17
  40. package/search/index.es.js +20 -39
  41. package/search/index.umd.js +12 -12
  42. package/select/index.es.js +20 -39
  43. package/select/index.umd.js +16 -16
  44. package/splitter/index.es.js +20 -39
  45. package/splitter/index.umd.js +16 -16
  46. package/switch/index.es.js +20 -39
  47. package/switch/index.umd.js +12 -12
  48. package/table/index.es.js +20 -39
  49. package/table/index.umd.js +10 -10
  50. package/textarea/index.es.js +20 -39
  51. package/textarea/index.umd.js +15 -15
  52. package/time-picker/index.es.js +20 -39
  53. package/time-picker/index.umd.js +16 -16
  54. package/time-select/index.es.js +20 -39
  55. package/time-select/index.umd.js +10 -10
  56. package/tooltip/index.es.js +20 -39
  57. package/tooltip/index.umd.js +17 -17
  58. package/tree/index.es.js +20 -39
  59. package/tree/index.umd.js +12 -12
  60. package/vue-devui.es.js +19 -38
  61. package/vue-devui.umd.js +63 -63
package/tree/index.es.js CHANGED
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
  import { ref, onUnmounted, computed, reactive, createVNode, defineComponent, toRefs, inject, getCurrentInstance, watch, provide, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, renderSlot, useSlots, resolveComponent, isVNode, onUpdated, shallowRef, toRaw, watchEffect, TransitionGroup } from "vue";
33
33
  import "clipboard";
34
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
34
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
35
35
  const USE_TREE_TOKEN = "use-tree-token";
36
36
  const TREE_INSTANCE = "tree-instance";
37
37
  const NODE_HEIGHT = 30;
@@ -5562,7 +5562,7 @@ var lodash = { exports: {} };
5562
5562
  var delay = baseRest(function(func, wait, args) {
5563
5563
  return baseDelay(func, toNumber(wait) || 0, args);
5564
5564
  });
5565
- function flip(func) {
5565
+ function flip2(func) {
5566
5566
  return createWrap(func, WRAP_FLIP_FLAG);
5567
5567
  }
5568
5568
  function memoize(func, resolver) {
@@ -6686,7 +6686,7 @@ var lodash = { exports: {} };
6686
6686
  lodash2.flatten = flatten;
6687
6687
  lodash2.flattenDeep = flattenDeep;
6688
6688
  lodash2.flattenDepth = flattenDepth;
6689
- lodash2.flip = flip;
6689
+ lodash2.flip = flip2;
6690
6690
  lodash2.flow = flow;
6691
6691
  lodash2.flowRight = flowRight;
6692
6692
  lodash2.fromPairs = fromPairs;
@@ -8084,16 +8084,6 @@ const flexibleOverlayProps = {
8084
8084
  default: false
8085
8085
  }
8086
8086
  };
8087
- function getScrollParent(element) {
8088
- const overflowRegex = /(auto|scroll|hidden)/;
8089
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
8090
- const style = window.getComputedStyle(parent);
8091
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
8092
- return parent;
8093
- }
8094
- }
8095
- return window;
8096
- }
8097
8087
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8098
8088
  let { x, y } = point;
8099
8089
  if (!isArrowCenter) {
@@ -8114,9 +8104,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8114
8104
  return { x, y };
8115
8105
  }
8116
8106
  function useOverlay(props, emit) {
8107
+ const { position, showArrow } = toRefs(props);
8117
8108
  const overlayRef = ref();
8118
8109
  const arrowRef = ref();
8119
- let originParent = null;
8120
8110
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
8121
8111
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
8122
8112
  const staticSide = {
@@ -8137,51 +8127,42 @@ function useOverlay(props, emit) {
8137
8127
  const hostEl = props.origin;
8138
8128
  const overlayEl = unref(overlayRef.value);
8139
8129
  const arrowEl = unref(arrowRef.value);
8140
- const middleware = [
8141
- offset(props.offset),
8142
- autoPlacement({
8143
- alignment: props.align,
8144
- allowedPlacements: props.position
8145
- })
8146
- ];
8147
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
8148
- props.shiftOffset !== void 0 && middleware.push(shift());
8149
- if (!overlayEl) {
8150
- return;
8130
+ const [mainPosition, ...fallbackPosition] = position.value;
8131
+ const middleware = [offset(props.offset)];
8132
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
8133
+ if (showArrow.value) {
8134
+ middleware.push(arrow({ element: arrowRef.value }));
8151
8135
  }
8152
8136
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
8153
8137
  strategy: "fixed",
8138
+ placement: mainPosition,
8154
8139
  middleware
8155
8140
  });
8156
8141
  let applyX = x;
8157
8142
  let applyY = y;
8158
- if (props.shiftOffset !== void 0) {
8159
- const { x: shiftX, y: shiftY } = middlewareData.shift;
8160
- shiftX < 0 && (applyX -= props.shiftOffset);
8161
- shiftX > 0 && (applyX += props.shiftOffset);
8162
- shiftY < 0 && (applyY -= props.shiftOffset);
8163
- shiftY > 0 && (applyY += props.shiftOffset);
8164
- }
8165
8143
  emit("positionChange", placement);
8166
8144
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
8167
8145
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
8168
8146
  };
8147
+ const scrollCallback = (e) => {
8148
+ var _a, _b;
8149
+ const scrollElement = e.target;
8150
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
8151
+ updatePosition();
8152
+ }
8153
+ };
8169
8154
  watch(() => props.modelValue, () => {
8170
8155
  if (props.modelValue && props.origin) {
8171
- originParent = getScrollParent(props.origin);
8172
8156
  nextTick(updatePosition);
8173
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
8174
- originParent !== window && window.addEventListener("scroll", updatePosition);
8157
+ window.addEventListener("scroll", scrollCallback, true);
8175
8158
  window.addEventListener("resize", updatePosition);
8176
8159
  } else {
8177
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8178
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8160
+ window.removeEventListener("scroll", scrollCallback, true);
8179
8161
  window.removeEventListener("resize", updatePosition);
8180
8162
  }
8181
8163
  });
8182
8164
  onUnmounted(() => {
8183
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8184
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8165
+ window.removeEventListener("scroll", scrollCallback, true);
8185
8166
  window.removeEventListener("resize", updatePosition);
8186
8167
  });
8187
8168
  return { arrowRef, overlayRef, updatePosition };