vue-devui 1.6.13 → 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 (66) 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 +25 -39
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/category-search/index.es.js +27 -41
  6. package/category-search/index.umd.js +13 -13
  7. package/category-search/style.css +1 -1
  8. package/checkbox/index.es.js +20 -39
  9. package/checkbox/index.umd.js +11 -11
  10. package/code-review/index.es.js +20 -39
  11. package/code-review/index.umd.js +17 -17
  12. package/data-grid/index.es.js +27 -41
  13. package/data-grid/index.umd.js +12 -12
  14. package/date-picker-pro/index.es.js +20 -39
  15. package/date-picker-pro/index.umd.js +13 -13
  16. package/dropdown/index.es.js +25 -39
  17. package/dropdown/index.umd.js +1 -1
  18. package/editable-select/index.es.js +20 -39
  19. package/editable-select/index.umd.js +14 -14
  20. package/editor-md/index.es.js +27 -41
  21. package/editor-md/index.umd.js +23 -23
  22. package/form/index.es.js +20 -39
  23. package/form/index.umd.js +12 -12
  24. package/input/index.es.js +20 -39
  25. package/input/index.umd.js +10 -10
  26. package/input-number/index.es.js +20 -39
  27. package/input-number/index.umd.js +18 -18
  28. package/mention/index.es.js +20 -39
  29. package/mention/index.umd.js +18 -18
  30. package/modal/index.es.js +18 -37
  31. package/modal/index.umd.js +2 -2
  32. package/overlay/index.es.js +18 -37
  33. package/overlay/index.umd.js +1 -1
  34. package/package.json +2 -2
  35. package/pagination/index.es.js +27 -41
  36. package/pagination/index.umd.js +13 -13
  37. package/popover/index.es.js +20 -39
  38. package/popover/index.umd.js +14 -14
  39. package/radio/index.es.js +20 -39
  40. package/radio/index.umd.js +17 -17
  41. package/search/index.es.js +20 -39
  42. package/search/index.umd.js +12 -12
  43. package/select/index.es.js +20 -39
  44. package/select/index.umd.js +16 -16
  45. package/splitter/index.es.js +20 -39
  46. package/splitter/index.umd.js +16 -16
  47. package/style.css +1 -1
  48. package/switch/index.es.js +20 -39
  49. package/switch/index.umd.js +12 -12
  50. package/table/index.es.js +27 -41
  51. package/table/index.umd.js +14 -14
  52. package/textarea/index.es.js +20 -39
  53. package/textarea/index.umd.js +15 -15
  54. package/time-picker/index.es.js +20 -39
  55. package/time-picker/index.umd.js +16 -16
  56. package/time-select/index.es.js +20 -39
  57. package/time-select/index.umd.js +10 -10
  58. package/tooltip/index.es.js +20 -39
  59. package/tooltip/index.umd.js +17 -17
  60. package/tree/index.es.js +20 -39
  61. package/tree/index.umd.js +12 -12
  62. package/types/dropdown/src/dropdown-types.d.ts +4 -0
  63. package/types/dropdown/src/dropdown.d.ts +9 -0
  64. package/types/tooltip/src/tooltip.d.ts +1 -1
  65. package/vue-devui.es.js +26 -40
  66. 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: {
@@ -923,6 +923,10 @@ const dropdownProps = {
923
923
  destroyOnHide: {
924
924
  type: Boolean,
925
925
  default: true
926
+ },
927
+ teleport: {
928
+ type: [String, Object],
929
+ default: "body"
926
930
  }
927
931
  };
928
932
  const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
@@ -1167,16 +1171,6 @@ const flexibleOverlayProps = {
1167
1171
  default: false
1168
1172
  }
1169
1173
  };
1170
- function getScrollParent(element) {
1171
- const overflowRegex = /(auto|scroll|hidden)/;
1172
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
1173
- const style = window.getComputedStyle(parent);
1174
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
1175
- return parent;
1176
- }
1177
- }
1178
- return window;
1179
- }
1180
1174
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
1181
1175
  let { x, y } = point;
1182
1176
  if (!isArrowCenter) {
@@ -1197,9 +1191,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
1197
1191
  return { x, y };
1198
1192
  }
1199
1193
  function useOverlay(props, emit) {
1194
+ const { position, showArrow } = toRefs(props);
1200
1195
  const overlayRef = ref();
1201
1196
  const arrowRef = ref();
1202
- let originParent = null;
1203
1197
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
1204
1198
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
1205
1199
  const staticSide = {
@@ -1220,51 +1214,42 @@ function useOverlay(props, emit) {
1220
1214
  const hostEl = props.origin;
1221
1215
  const overlayEl = unref(overlayRef.value);
1222
1216
  const arrowEl = unref(arrowRef.value);
1223
- const middleware = [
1224
- offset(props.offset),
1225
- autoPlacement({
1226
- alignment: props.align,
1227
- allowedPlacements: props.position
1228
- })
1229
- ];
1230
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
1231
- props.shiftOffset !== void 0 && middleware.push(shift());
1232
- if (!overlayEl) {
1233
- 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 }));
1234
1222
  }
1235
1223
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
1236
1224
  strategy: "fixed",
1225
+ placement: mainPosition,
1237
1226
  middleware
1238
1227
  });
1239
1228
  let applyX = x;
1240
1229
  let applyY = y;
1241
- if (props.shiftOffset !== void 0) {
1242
- const { x: shiftX, y: shiftY } = middlewareData.shift;
1243
- shiftX < 0 && (applyX -= props.shiftOffset);
1244
- shiftX > 0 && (applyX += props.shiftOffset);
1245
- shiftY < 0 && (applyY -= props.shiftOffset);
1246
- shiftY > 0 && (applyY += props.shiftOffset);
1247
- }
1248
1230
  emit("positionChange", placement);
1249
1231
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
1250
1232
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
1251
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
+ };
1252
1241
  watch(() => props.modelValue, () => {
1253
1242
  if (props.modelValue && props.origin) {
1254
- originParent = getScrollParent(props.origin);
1255
1243
  nextTick(updatePosition);
1256
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
1257
- originParent !== window && window.addEventListener("scroll", updatePosition);
1244
+ window.addEventListener("scroll", scrollCallback, true);
1258
1245
  window.addEventListener("resize", updatePosition);
1259
1246
  } else {
1260
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
1261
- originParent !== window && window.removeEventListener("scroll", updatePosition);
1247
+ window.removeEventListener("scroll", scrollCallback, true);
1262
1248
  window.removeEventListener("resize", updatePosition);
1263
1249
  }
1264
1250
  });
1265
1251
  onUnmounted(() => {
1266
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
1267
- originParent !== window && window.removeEventListener("scroll", updatePosition);
1252
+ window.removeEventListener("scroll", scrollCallback, true);
1268
1253
  window.removeEventListener("resize", updatePosition);
1269
1254
  });
1270
1255
  return { arrowRef, overlayRef, updatePosition };
@@ -1383,7 +1368,8 @@ var Dropdown = defineComponent({
1383
1368
  offset: offset2,
1384
1369
  destroyOnHide,
1385
1370
  shiftOffset,
1386
- showAnimation
1371
+ showAnimation,
1372
+ teleport
1387
1373
  } = toRefs(props);
1388
1374
  const origin = ref();
1389
1375
  const dropdownRef = ref();
@@ -1425,7 +1411,7 @@ var Dropdown = defineComponent({
1425
1411
  return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
1426
1412
  }
1427
1413
  }), createVNode(Teleport, {
1428
- "to": "body"
1414
+ "to": teleport.value
1429
1415
  }, {
1430
1416
  default: () => [createVNode(Transition, {
1431
1417
  "name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""
@@ -5826,7 +5812,7 @@ var lodash = { exports: {} };
5826
5812
  var delay = baseRest(function(func, wait, args) {
5827
5813
  return baseDelay(func, toNumber(wait) || 0, args);
5828
5814
  });
5829
- function flip(func) {
5815
+ function flip2(func) {
5830
5816
  return createWrap(func, WRAP_FLIP_FLAG);
5831
5817
  }
5832
5818
  function memoize(func, resolver) {
@@ -6950,7 +6936,7 @@ var lodash = { exports: {} };
6950
6936
  lodash2.flatten = flatten;
6951
6937
  lodash2.flattenDeep = flattenDeep;
6952
6938
  lodash2.flattenDepth = flattenDepth;
6953
- lodash2.flip = flip;
6939
+ lodash2.flip = flip2;
6954
6940
  lodash2.flow = flow;
6955
6941
  lodash2.flowRight = flowRight;
6956
6942
  lodash2.fromPairs = fromPairs;