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/table/index.es.js CHANGED
@@ -35,7 +35,7 @@ var __publicField = (obj, key, value) => {
35
35
  };
36
36
  import { computed, ref, watchEffect, watch, getCurrentInstance, unref, defineComponent, inject, createVNode, mergeProps, toRefs, onMounted, onUnmounted, Transition, nextTick, withModifiers, Comment, Text, h, Fragment, withDirectives, cloneVNode, provide, Teleport, vShow, resolveDynamicComponent, render, reactive, resolveComponent, toRef, createTextVNode, onBeforeUnmount, isVNode, onBeforeMount, onUpdated, resolveDirective } from "vue";
37
37
  import "clipboard";
38
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
38
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
39
39
  import { onClickOutside } from "@vueuse/core";
40
40
  const tableProps = {
41
41
  data: {
@@ -1171,16 +1171,6 @@ const flexibleOverlayProps = {
1171
1171
  default: false
1172
1172
  }
1173
1173
  };
1174
- function getScrollParent(element) {
1175
- const overflowRegex = /(auto|scroll|hidden)/;
1176
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
1177
- const style = window.getComputedStyle(parent);
1178
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
1179
- return parent;
1180
- }
1181
- }
1182
- return window;
1183
- }
1184
1174
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
1185
1175
  let { x, y } = point;
1186
1176
  if (!isArrowCenter) {
@@ -1201,9 +1191,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
1201
1191
  return { x, y };
1202
1192
  }
1203
1193
  function useOverlay(props, emit) {
1194
+ const { position, showArrow } = toRefs(props);
1204
1195
  const overlayRef = ref();
1205
1196
  const arrowRef = ref();
1206
- let originParent = null;
1207
1197
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
1208
1198
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
1209
1199
  const staticSide = {
@@ -1224,51 +1214,42 @@ function useOverlay(props, emit) {
1224
1214
  const hostEl = props.origin;
1225
1215
  const overlayEl = unref(overlayRef.value);
1226
1216
  const arrowEl = unref(arrowRef.value);
1227
- const middleware = [
1228
- offset(props.offset),
1229
- autoPlacement({
1230
- alignment: props.align,
1231
- allowedPlacements: props.position
1232
- })
1233
- ];
1234
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
1235
- props.shiftOffset !== void 0 && middleware.push(shift());
1236
- if (!overlayEl) {
1237
- return;
1217
+ const [mainPosition, ...fallbackPosition] = position.value;
1218
+ const middleware = [offset(props.offset)];
1219
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
1220
+ if (showArrow.value) {
1221
+ middleware.push(arrow({ element: arrowRef.value }));
1238
1222
  }
1239
1223
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
1240
1224
  strategy: "fixed",
1225
+ placement: mainPosition,
1241
1226
  middleware
1242
1227
  });
1243
1228
  let applyX = x;
1244
1229
  let applyY = y;
1245
- if (props.shiftOffset !== void 0) {
1246
- const { x: shiftX, y: shiftY } = middlewareData.shift;
1247
- shiftX < 0 && (applyX -= props.shiftOffset);
1248
- shiftX > 0 && (applyX += props.shiftOffset);
1249
- shiftY < 0 && (applyY -= props.shiftOffset);
1250
- shiftY > 0 && (applyY += props.shiftOffset);
1251
- }
1252
1230
  emit("positionChange", placement);
1253
1231
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
1254
1232
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
1255
1233
  };
1234
+ const scrollCallback = (e) => {
1235
+ var _a, _b;
1236
+ const scrollElement = e.target;
1237
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
1238
+ updatePosition();
1239
+ }
1240
+ };
1256
1241
  watch(() => props.modelValue, () => {
1257
1242
  if (props.modelValue && props.origin) {
1258
- originParent = getScrollParent(props.origin);
1259
1243
  nextTick(updatePosition);
1260
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
1261
- originParent !== window && window.addEventListener("scroll", updatePosition);
1244
+ window.addEventListener("scroll", scrollCallback, true);
1262
1245
  window.addEventListener("resize", updatePosition);
1263
1246
  } else {
1264
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
1265
- originParent !== window && window.removeEventListener("scroll", updatePosition);
1247
+ window.removeEventListener("scroll", scrollCallback, true);
1266
1248
  window.removeEventListener("resize", updatePosition);
1267
1249
  }
1268
1250
  });
1269
1251
  onUnmounted(() => {
1270
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
1271
- originParent !== window && window.removeEventListener("scroll", updatePosition);
1252
+ window.removeEventListener("scroll", scrollCallback, true);
1272
1253
  window.removeEventListener("resize", updatePosition);
1273
1254
  });
1274
1255
  return { arrowRef, overlayRef, updatePosition };
@@ -5831,7 +5812,7 @@ var lodash = { exports: {} };
5831
5812
  var delay = baseRest(function(func, wait, args) {
5832
5813
  return baseDelay(func, toNumber(wait) || 0, args);
5833
5814
  });
5834
- function flip(func) {
5815
+ function flip2(func) {
5835
5816
  return createWrap(func, WRAP_FLIP_FLAG);
5836
5817
  }
5837
5818
  function memoize(func, resolver) {
@@ -6955,7 +6936,7 @@ var lodash = { exports: {} };
6955
6936
  lodash2.flatten = flatten;
6956
6937
  lodash2.flattenDeep = flattenDeep;
6957
6938
  lodash2.flattenDepth = flattenDepth;
6958
- lodash2.flip = flip;
6939
+ lodash2.flip = flip2;
6959
6940
  lodash2.flow = flow;
6960
6941
  lodash2.flowRight = flowRight;
6961
6942
  lodash2.fromPairs = fromPairs;