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, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, ref, reactive, onMounted, onBeforeUnmount, onUnmounted, Fragment, h, render, inject, withDirectives, resolveComponent, vShow, provide, toRef, getCurrentInstance, watch, withModifiers, isVNode, Transition, unref, nextTick, Comment, Text, cloneVNode, Teleport, createTextVNode, shallowRef, 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
  const timePickerProps = {
41
41
  modelValue: {
42
42
  type: String,
@@ -5047,7 +5047,7 @@ var lodash = { exports: {} };
5047
5047
  var delay = baseRest(function(func, wait, args) {
5048
5048
  return baseDelay(func, toNumber(wait) || 0, args);
5049
5049
  });
5050
- function flip(func) {
5050
+ function flip2(func) {
5051
5051
  return createWrap(func, WRAP_FLIP_FLAG);
5052
5052
  }
5053
5053
  function memoize(func, resolver) {
@@ -6171,7 +6171,7 @@ var lodash = { exports: {} };
6171
6171
  lodash2.flatten = flatten;
6172
6172
  lodash2.flattenDeep = flattenDeep;
6173
6173
  lodash2.flattenDepth = flattenDepth;
6174
- lodash2.flip = flip;
6174
+ lodash2.flip = flip2;
6175
6175
  lodash2.flow = flow;
6176
6176
  lodash2.flowRight = flowRight;
6177
6177
  lodash2.fromPairs = fromPairs;
@@ -7407,16 +7407,6 @@ const flexibleOverlayProps = {
7407
7407
  default: false
7408
7408
  }
7409
7409
  };
7410
- function getScrollParent(element) {
7411
- const overflowRegex = /(auto|scroll|hidden)/;
7412
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
7413
- const style = window.getComputedStyle(parent);
7414
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
7415
- return parent;
7416
- }
7417
- }
7418
- return window;
7419
- }
7420
7410
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
7421
7411
  let { x, y } = point;
7422
7412
  if (!isArrowCenter) {
@@ -7437,9 +7427,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
7437
7427
  return { x, y };
7438
7428
  }
7439
7429
  function useOverlay(props, emit) {
7430
+ const { position, showArrow } = toRefs(props);
7440
7431
  const overlayRef = ref();
7441
7432
  const arrowRef = ref();
7442
- let originParent = null;
7443
7433
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
7444
7434
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
7445
7435
  const staticSide = {
@@ -7460,51 +7450,42 @@ function useOverlay(props, emit) {
7460
7450
  const hostEl = props.origin;
7461
7451
  const overlayEl = unref(overlayRef.value);
7462
7452
  const arrowEl = unref(arrowRef.value);
7463
- const middleware = [
7464
- offset(props.offset),
7465
- autoPlacement({
7466
- alignment: props.align,
7467
- allowedPlacements: props.position
7468
- })
7469
- ];
7470
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
7471
- props.shiftOffset !== void 0 && middleware.push(shift());
7472
- if (!overlayEl) {
7473
- return;
7453
+ const [mainPosition, ...fallbackPosition] = position.value;
7454
+ const middleware = [offset(props.offset)];
7455
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
7456
+ if (showArrow.value) {
7457
+ middleware.push(arrow({ element: arrowRef.value }));
7474
7458
  }
7475
7459
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
7476
7460
  strategy: "fixed",
7461
+ placement: mainPosition,
7477
7462
  middleware
7478
7463
  });
7479
7464
  let applyX = x;
7480
7465
  let applyY = y;
7481
- if (props.shiftOffset !== void 0) {
7482
- const { x: shiftX, y: shiftY } = middlewareData.shift;
7483
- shiftX < 0 && (applyX -= props.shiftOffset);
7484
- shiftX > 0 && (applyX += props.shiftOffset);
7485
- shiftY < 0 && (applyY -= props.shiftOffset);
7486
- shiftY > 0 && (applyY += props.shiftOffset);
7487
- }
7488
7466
  emit("positionChange", placement);
7489
7467
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
7490
7468
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
7491
7469
  };
7470
+ const scrollCallback = (e) => {
7471
+ var _a, _b;
7472
+ const scrollElement = e.target;
7473
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
7474
+ updatePosition();
7475
+ }
7476
+ };
7492
7477
  watch(() => props.modelValue, () => {
7493
7478
  if (props.modelValue && props.origin) {
7494
- originParent = getScrollParent(props.origin);
7495
7479
  nextTick(updatePosition);
7496
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
7497
- originParent !== window && window.addEventListener("scroll", updatePosition);
7480
+ window.addEventListener("scroll", scrollCallback, true);
7498
7481
  window.addEventListener("resize", updatePosition);
7499
7482
  } else {
7500
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
7501
- originParent !== window && window.removeEventListener("scroll", updatePosition);
7483
+ window.removeEventListener("scroll", scrollCallback, true);
7502
7484
  window.removeEventListener("resize", updatePosition);
7503
7485
  }
7504
7486
  });
7505
7487
  onUnmounted(() => {
7506
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
7507
- originParent !== window && window.removeEventListener("scroll", updatePosition);
7488
+ window.removeEventListener("scroll", scrollCallback, true);
7508
7489
  window.removeEventListener("resize", updatePosition);
7509
7490
  });
7510
7491
  return { arrowRef, overlayRef, updatePosition };