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/vue-devui.es.js CHANGED
@@ -37,7 +37,7 @@ var _a;
37
37
  import { createVNode, getCurrentInstance, defineComponent, toRefs, inject, computed, Fragment, mergeProps, resolveComponent, isVNode, ref, reactive, createTextVNode, provide, onMounted, watch, Transition, withDirectives, vShow, nextTick, onUnmounted, unref, withModifiers, Comment as Comment$1, Text, h, cloneVNode, Teleport, onBeforeUnmount, render as render$1, resolveDirective, resolveDynamicComponent, toRef, shallowRef, onBeforeMount, onUpdated, readonly, toRaw, watchEffect, renderSlot, useSlots, createApp, shallowReactive, effect, TransitionGroup } from "vue";
38
38
  import { useRoute } from "vue-router";
39
39
  import Clipboard from "clipboard";
40
- import { offset, autoPlacement, arrow, shift, computePosition, flip } from "@floating-ui/dom";
40
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
41
41
  import { onClickOutside, toRefs as toRefs$1, useResizeObserver } from "@vueuse/core";
42
42
  import * as Diff2Html from "diff2html";
43
43
  import { Diff2HtmlUI } from "diff2html/lib/ui/js/diff2html-ui";
@@ -7855,16 +7855,6 @@ const flexibleOverlayProps = {
7855
7855
  default: false
7856
7856
  }
7857
7857
  };
7858
- function getScrollParent(element) {
7859
- const overflowRegex = /(auto|scroll|hidden)/;
7860
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
7861
- const style = window.getComputedStyle(parent);
7862
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
7863
- return parent;
7864
- }
7865
- }
7866
- return window;
7867
- }
7868
7858
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
7869
7859
  let { x, y } = point;
7870
7860
  if (!isArrowCenter) {
@@ -7885,9 +7875,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
7885
7875
  return { x, y };
7886
7876
  }
7887
7877
  function useOverlay(props, emit) {
7878
+ const { position, showArrow } = toRefs(props);
7888
7879
  const overlayRef = ref();
7889
7880
  const arrowRef = ref();
7890
- let originParent = null;
7891
7881
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
7892
7882
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
7893
7883
  const staticSide = {
@@ -7908,51 +7898,42 @@ function useOverlay(props, emit) {
7908
7898
  const hostEl = props.origin;
7909
7899
  const overlayEl = unref(overlayRef.value);
7910
7900
  const arrowEl = unref(arrowRef.value);
7911
- const middleware = [
7912
- offset(props.offset),
7913
- autoPlacement({
7914
- alignment: props.align,
7915
- allowedPlacements: props.position
7916
- })
7917
- ];
7918
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
7919
- props.shiftOffset !== void 0 && middleware.push(shift());
7920
- if (!overlayEl) {
7921
- return;
7901
+ const [mainPosition, ...fallbackPosition] = position.value;
7902
+ const middleware = [offset(props.offset)];
7903
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
7904
+ if (showArrow.value) {
7905
+ middleware.push(arrow({ element: arrowRef.value }));
7922
7906
  }
7923
7907
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
7924
7908
  strategy: "fixed",
7909
+ placement: mainPosition,
7925
7910
  middleware
7926
7911
  });
7927
7912
  let applyX = x;
7928
7913
  let applyY = y;
7929
- if (props.shiftOffset !== void 0) {
7930
- const { x: shiftX, y: shiftY } = middlewareData.shift;
7931
- shiftX < 0 && (applyX -= props.shiftOffset);
7932
- shiftX > 0 && (applyX += props.shiftOffset);
7933
- shiftY < 0 && (applyY -= props.shiftOffset);
7934
- shiftY > 0 && (applyY += props.shiftOffset);
7935
- }
7936
7914
  emit("positionChange", placement);
7937
7915
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
7938
7916
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
7939
7917
  };
7918
+ const scrollCallback = (e) => {
7919
+ var _a2, _b;
7920
+ const scrollElement = e.target;
7921
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a2 = props.origin) == null ? void 0 : _a2.$el) != null ? _b : props.origin)) {
7922
+ updatePosition();
7923
+ }
7924
+ };
7940
7925
  watch(() => props.modelValue, () => {
7941
7926
  if (props.modelValue && props.origin) {
7942
- originParent = getScrollParent(props.origin);
7943
7927
  nextTick(updatePosition);
7944
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
7945
- originParent !== window && window.addEventListener("scroll", updatePosition);
7928
+ window.addEventListener("scroll", scrollCallback, true);
7946
7929
  window.addEventListener("resize", updatePosition);
7947
7930
  } else {
7948
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
7949
- originParent !== window && window.removeEventListener("scroll", updatePosition);
7931
+ window.removeEventListener("scroll", scrollCallback, true);
7950
7932
  window.removeEventListener("resize", updatePosition);
7951
7933
  }
7952
7934
  });
7953
7935
  onUnmounted(() => {
7954
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
7955
- originParent !== window && window.removeEventListener("scroll", updatePosition);
7936
+ window.removeEventListener("scroll", scrollCallback, true);
7956
7937
  window.removeEventListener("resize", updatePosition);
7957
7938
  });
7958
7939
  return { arrowRef, overlayRef, updatePosition };
@@ -54375,7 +54356,7 @@ const installs = [
54375
54356
  VirtualListInstall
54376
54357
  ];
54377
54358
  var vueDevui = {
54378
- version: "1.6.14",
54359
+ version: "1.6.15",
54379
54360
  install(app) {
54380
54361
  installs.forEach((p) => app.use(p));
54381
54362
  }