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
@@ -34,7 +34,7 @@ var __publicField = (obj, key, value) => {
34
34
  return value;
35
35
  };
36
36
  import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick, withModifiers, provide, reactive, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, vShow, resolveDynamicComponent, render, resolveComponent, getCurrentInstance, isVNode, onBeforeMount } from "vue";
37
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
37
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
38
38
  import "clipboard";
39
39
  import { onClickOutside } from "@vueuse/core";
40
40
  function createBem$1(namespace, element, modifier) {
@@ -180,16 +180,6 @@ const flexibleOverlayProps = {
180
180
  default: false
181
181
  }
182
182
  };
183
- function getScrollParent(element) {
184
- const overflowRegex = /(auto|scroll|hidden)/;
185
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
186
- const style = window.getComputedStyle(parent);
187
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
188
- return parent;
189
- }
190
- }
191
- return window;
192
- }
193
183
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
194
184
  let { x, y } = point;
195
185
  if (!isArrowCenter) {
@@ -210,9 +200,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
210
200
  return { x, y };
211
201
  }
212
202
  function useOverlay(props, emit) {
203
+ const { position, showArrow } = toRefs(props);
213
204
  const overlayRef = ref();
214
205
  const arrowRef = ref();
215
- let originParent = null;
216
206
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
217
207
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
218
208
  const staticSide = {
@@ -233,51 +223,42 @@ function useOverlay(props, emit) {
233
223
  const hostEl = props.origin;
234
224
  const overlayEl = unref(overlayRef.value);
235
225
  const arrowEl = unref(arrowRef.value);
236
- const middleware = [
237
- offset(props.offset),
238
- autoPlacement({
239
- alignment: props.align,
240
- allowedPlacements: props.position
241
- })
242
- ];
243
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
244
- props.shiftOffset !== void 0 && middleware.push(shift());
245
- if (!overlayEl) {
246
- return;
226
+ const [mainPosition, ...fallbackPosition] = position.value;
227
+ const middleware = [offset(props.offset)];
228
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
229
+ if (showArrow.value) {
230
+ middleware.push(arrow({ element: arrowRef.value }));
247
231
  }
248
232
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
249
233
  strategy: "fixed",
234
+ placement: mainPosition,
250
235
  middleware
251
236
  });
252
237
  let applyX = x;
253
238
  let applyY = y;
254
- if (props.shiftOffset !== void 0) {
255
- const { x: shiftX, y: shiftY } = middlewareData.shift;
256
- shiftX < 0 && (applyX -= props.shiftOffset);
257
- shiftX > 0 && (applyX += props.shiftOffset);
258
- shiftY < 0 && (applyY -= props.shiftOffset);
259
- shiftY > 0 && (applyY += props.shiftOffset);
260
- }
261
239
  emit("positionChange", placement);
262
240
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
263
241
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
264
242
  };
243
+ const scrollCallback = (e) => {
244
+ var _a, _b;
245
+ const scrollElement = e.target;
246
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
247
+ updatePosition();
248
+ }
249
+ };
265
250
  watch(() => props.modelValue, () => {
266
251
  if (props.modelValue && props.origin) {
267
- originParent = getScrollParent(props.origin);
268
252
  nextTick(updatePosition);
269
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
270
- originParent !== window && window.addEventListener("scroll", updatePosition);
253
+ window.addEventListener("scroll", scrollCallback, true);
271
254
  window.addEventListener("resize", updatePosition);
272
255
  } else {
273
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
274
- originParent !== window && window.removeEventListener("scroll", updatePosition);
256
+ window.removeEventListener("scroll", scrollCallback, true);
275
257
  window.removeEventListener("resize", updatePosition);
276
258
  }
277
259
  });
278
260
  onUnmounted(() => {
279
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
280
- originParent !== window && window.removeEventListener("scroll", updatePosition);
261
+ window.removeEventListener("scroll", scrollCallback, true);
281
262
  window.removeEventListener("resize", updatePosition);
282
263
  });
283
264
  return { arrowRef, overlayRef, updatePosition };
@@ -4381,7 +4362,7 @@ var lodash = { exports: {} };
4381
4362
  var delay = baseRest(function(func, wait, args) {
4382
4363
  return baseDelay(func, toNumber(wait) || 0, args);
4383
4364
  });
4384
- function flip(func) {
4365
+ function flip2(func) {
4385
4366
  return createWrap(func, WRAP_FLIP_FLAG);
4386
4367
  }
4387
4368
  function memoize(func, resolver) {
@@ -5505,7 +5486,7 @@ var lodash = { exports: {} };
5505
5486
  lodash2.flatten = flatten;
5506
5487
  lodash2.flattenDeep = flattenDeep;
5507
5488
  lodash2.flattenDepth = flattenDepth;
5508
- lodash2.flip = flip;
5489
+ lodash2.flip = flip2;
5509
5490
  lodash2.flow = flow;
5510
5491
  lodash2.flowRight = flowRight;
5511
5492
  lodash2.fromPairs = fromPairs;