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
@@ -36,7 +36,7 @@ var __publicField = (obj, key, value) => {
36
36
  import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, render, resolveDirective } from "vue";
37
37
  import { onClickOutside } from "@vueuse/core";
38
38
  import "clipboard";
39
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
39
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
40
40
  function className(classStr, classOpt) {
41
41
  let classname = classStr;
42
42
  if (typeof classOpt === "object") {
@@ -3916,7 +3916,7 @@ var lodash = { exports: {} };
3916
3916
  var delay = baseRest(function(func, wait, args) {
3917
3917
  return baseDelay(func, toNumber(wait) || 0, args);
3918
3918
  });
3919
- function flip(func) {
3919
+ function flip2(func) {
3920
3920
  return createWrap(func, WRAP_FLIP_FLAG);
3921
3921
  }
3922
3922
  function memoize(func, resolver) {
@@ -5040,7 +5040,7 @@ var lodash = { exports: {} };
5040
5040
  lodash2.flatten = flatten;
5041
5041
  lodash2.flattenDeep = flattenDeep;
5042
5042
  lodash2.flattenDepth = flattenDepth;
5043
- lodash2.flip = flip;
5043
+ lodash2.flip = flip2;
5044
5044
  lodash2.flow = flow;
5045
5045
  lodash2.flowRight = flowRight;
5046
5046
  lodash2.fromPairs = fromPairs;
@@ -5835,16 +5835,6 @@ const flexibleOverlayProps = {
5835
5835
  default: false
5836
5836
  }
5837
5837
  };
5838
- function getScrollParent(element) {
5839
- const overflowRegex = /(auto|scroll|hidden)/;
5840
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
5841
- const style = window.getComputedStyle(parent);
5842
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
5843
- return parent;
5844
- }
5845
- }
5846
- return window;
5847
- }
5848
5838
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
5849
5839
  let { x, y } = point;
5850
5840
  if (!isArrowCenter) {
@@ -5865,9 +5855,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
5865
5855
  return { x, y };
5866
5856
  }
5867
5857
  function useOverlay(props, emit) {
5858
+ const { position, showArrow } = toRefs(props);
5868
5859
  const overlayRef = ref();
5869
5860
  const arrowRef = ref();
5870
- let originParent = null;
5871
5861
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
5872
5862
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
5873
5863
  const staticSide = {
@@ -5888,51 +5878,42 @@ function useOverlay(props, emit) {
5888
5878
  const hostEl = props.origin;
5889
5879
  const overlayEl = unref(overlayRef.value);
5890
5880
  const arrowEl = unref(arrowRef.value);
5891
- const middleware = [
5892
- offset(props.offset),
5893
- autoPlacement({
5894
- alignment: props.align,
5895
- allowedPlacements: props.position
5896
- })
5897
- ];
5898
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
5899
- props.shiftOffset !== void 0 && middleware.push(shift());
5900
- if (!overlayEl) {
5901
- return;
5881
+ const [mainPosition, ...fallbackPosition] = position.value;
5882
+ const middleware = [offset(props.offset)];
5883
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
5884
+ if (showArrow.value) {
5885
+ middleware.push(arrow({ element: arrowRef.value }));
5902
5886
  }
5903
5887
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
5904
5888
  strategy: "fixed",
5889
+ placement: mainPosition,
5905
5890
  middleware
5906
5891
  });
5907
5892
  let applyX = x;
5908
5893
  let applyY = y;
5909
- if (props.shiftOffset !== void 0) {
5910
- const { x: shiftX, y: shiftY } = middlewareData.shift;
5911
- shiftX < 0 && (applyX -= props.shiftOffset);
5912
- shiftX > 0 && (applyX += props.shiftOffset);
5913
- shiftY < 0 && (applyY -= props.shiftOffset);
5914
- shiftY > 0 && (applyY += props.shiftOffset);
5915
- }
5916
5894
  emit("positionChange", placement);
5917
5895
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
5918
5896
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
5919
5897
  };
5898
+ const scrollCallback = (e) => {
5899
+ var _a, _b;
5900
+ const scrollElement = e.target;
5901
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
5902
+ updatePosition();
5903
+ }
5904
+ };
5920
5905
  watch(() => props.modelValue, () => {
5921
5906
  if (props.modelValue && props.origin) {
5922
- originParent = getScrollParent(props.origin);
5923
5907
  nextTick(updatePosition);
5924
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
5925
- originParent !== window && window.addEventListener("scroll", updatePosition);
5908
+ window.addEventListener("scroll", scrollCallback, true);
5926
5909
  window.addEventListener("resize", updatePosition);
5927
5910
  } else {
5928
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
5929
- originParent !== window && window.removeEventListener("scroll", updatePosition);
5911
+ window.removeEventListener("scroll", scrollCallback, true);
5930
5912
  window.removeEventListener("resize", updatePosition);
5931
5913
  }
5932
5914
  });
5933
5915
  onUnmounted(() => {
5934
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
5935
- originParent !== window && window.removeEventListener("scroll", updatePosition);
5916
+ window.removeEventListener("scroll", scrollCallback, true);
5936
5917
  window.removeEventListener("resize", updatePosition);
5937
5918
  });
5938
5919
  return { arrowRef, overlayRef, updatePosition };