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
@@ -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;
@@ -8030,16 +8030,6 @@ const flexibleOverlayProps = {
8030
8030
  default: false
8031
8031
  }
8032
8032
  };
8033
- function getScrollParent(element) {
8034
- const overflowRegex = /(auto|scroll|hidden)/;
8035
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
8036
- const style = window.getComputedStyle(parent);
8037
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
8038
- return parent;
8039
- }
8040
- }
8041
- return window;
8042
- }
8043
8033
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8044
8034
  let { x, y } = point;
8045
8035
  if (!isArrowCenter) {
@@ -8060,9 +8050,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8060
8050
  return { x, y };
8061
8051
  }
8062
8052
  function useOverlay(props, emit) {
8053
+ const { position, showArrow } = toRefs(props);
8063
8054
  const overlayRef = ref();
8064
8055
  const arrowRef = ref();
8065
- let originParent = null;
8066
8056
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
8067
8057
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
8068
8058
  const staticSide = {
@@ -8083,51 +8073,42 @@ function useOverlay(props, emit) {
8083
8073
  const hostEl = props.origin;
8084
8074
  const overlayEl = unref(overlayRef.value);
8085
8075
  const arrowEl = unref(arrowRef.value);
8086
- const middleware = [
8087
- offset(props.offset),
8088
- autoPlacement({
8089
- alignment: props.align,
8090
- allowedPlacements: props.position
8091
- })
8092
- ];
8093
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
8094
- props.shiftOffset !== void 0 && middleware.push(shift());
8095
- if (!overlayEl) {
8096
- 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 }));
8097
8081
  }
8098
8082
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
8099
8083
  strategy: "fixed",
8084
+ placement: mainPosition,
8100
8085
  middleware
8101
8086
  });
8102
8087
  let applyX = x;
8103
8088
  let applyY = y;
8104
- if (props.shiftOffset !== void 0) {
8105
- const { x: shiftX, y: shiftY } = middlewareData.shift;
8106
- shiftX < 0 && (applyX -= props.shiftOffset);
8107
- shiftX > 0 && (applyX += props.shiftOffset);
8108
- shiftY < 0 && (applyY -= props.shiftOffset);
8109
- shiftY > 0 && (applyY += props.shiftOffset);
8110
- }
8111
8089
  emit("positionChange", placement);
8112
8090
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
8113
8091
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
8114
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
+ };
8115
8100
  watch(() => props.modelValue, () => {
8116
8101
  if (props.modelValue && props.origin) {
8117
- originParent = getScrollParent(props.origin);
8118
8102
  nextTick(updatePosition);
8119
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
8120
- originParent !== window && window.addEventListener("scroll", updatePosition);
8103
+ window.addEventListener("scroll", scrollCallback, true);
8121
8104
  window.addEventListener("resize", updatePosition);
8122
8105
  } else {
8123
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8124
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8106
+ window.removeEventListener("scroll", scrollCallback, true);
8125
8107
  window.removeEventListener("resize", updatePosition);
8126
8108
  }
8127
8109
  });
8128
8110
  onUnmounted(() => {
8129
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8130
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8111
+ window.removeEventListener("scroll", scrollCallback, true);
8131
8112
  window.removeEventListener("resize", updatePosition);
8132
8113
  });
8133
8114
  return { arrowRef, overlayRef, updatePosition };