vue-devui 1.6.14 → 1.6.16

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 (75) hide show
  1. package/auto-complete/index.es.js +60 -42
  2. package/auto-complete/index.umd.js +13 -13
  3. package/breadcrumb/index.es.js +57 -39
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/category-search/index.es.js +93 -44
  6. package/category-search/index.umd.js +21 -21
  7. package/checkbox/index.es.js +60 -42
  8. package/checkbox/index.umd.js +18 -18
  9. package/code-review/index.es.js +60 -42
  10. package/code-review/index.umd.js +20 -20
  11. package/data-grid/index.es.js +60 -42
  12. package/data-grid/index.umd.js +15 -15
  13. package/date-picker-pro/index.es.js +60 -42
  14. package/date-picker-pro/index.umd.js +13 -13
  15. package/dropdown/index.es.js +57 -39
  16. package/dropdown/index.umd.js +1 -1
  17. package/editable-select/index.es.js +66 -43
  18. package/editable-select/index.umd.js +10 -10
  19. package/editor-md/index.es.js +69 -44
  20. package/editor-md/index.umd.js +28 -28
  21. package/form/index.es.js +60 -42
  22. package/form/index.umd.js +17 -17
  23. package/input/index.es.js +59 -41
  24. package/input/index.umd.js +20 -20
  25. package/input-number/index.es.js +60 -42
  26. package/input-number/index.umd.js +19 -19
  27. package/mention/index.es.js +60 -42
  28. package/mention/index.umd.js +17 -17
  29. package/message/index.es.js +13 -13
  30. package/message/index.umd.js +1 -1
  31. package/modal/index.es.js +57 -39
  32. package/modal/index.umd.js +2 -2
  33. package/overlay/index.es.js +58 -40
  34. package/overlay/index.umd.js +1 -1
  35. package/package.json +3 -2
  36. package/pagination/index.es.js +77 -59
  37. package/pagination/index.umd.js +18 -18
  38. package/pagination/style.css +1 -1
  39. package/popover/index.es.js +60 -42
  40. package/popover/index.umd.js +15 -15
  41. package/radio/index.es.js +60 -42
  42. package/radio/index.umd.js +16 -16
  43. package/search/index.es.js +60 -42
  44. package/search/index.umd.js +16 -16
  45. package/select/index.es.js +77 -59
  46. package/select/index.umd.js +20 -20
  47. package/select/style.css +1 -1
  48. package/splitter/index.es.js +60 -42
  49. package/splitter/index.umd.js +14 -14
  50. package/style.css +1 -1
  51. package/switch/index.es.js +60 -42
  52. package/switch/index.umd.js +17 -17
  53. package/table/index.es.js +59 -41
  54. package/table/index.umd.js +16 -16
  55. package/textarea/index.es.js +60 -42
  56. package/textarea/index.umd.js +19 -19
  57. package/time-picker/index.es.js +59 -41
  58. package/time-picker/index.umd.js +14 -14
  59. package/time-select/index.es.js +77 -59
  60. package/time-select/index.umd.js +18 -18
  61. package/time-select/style.css +1 -1
  62. package/tooltip/index.es.js +60 -42
  63. package/tooltip/index.umd.js +15 -15
  64. package/tree/index.es.js +59 -41
  65. package/tree/index.umd.js +14 -14
  66. package/types/category-search/src/category-search-types.d.ts +5 -0
  67. package/types/editable-select/src/editable-select-types.d.ts +3 -0
  68. package/types/overlay/src/flexible-overlay/flexible-overlay-types.d.ts +5 -6
  69. package/types/overlay/src/flexible-overlay/index.d.ts +9 -0
  70. package/types/overlay/src/flexible-overlay/use-flexible-overlay.d.ts +11 -2
  71. package/types/select/src/composables/use-select-content.d.ts +21 -2
  72. package/types/select/src/select-types.d.ts +7 -44
  73. package/types/select/src/use-select.d.ts +26 -2
  74. package/vue-devui.es.js +138 -77
  75. package/vue-devui.umd.js +74 -74
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  };
24
24
  import { toRefs, onMounted, onUnmounted, watch, defineComponent, ref, renderSlot, useSlots, createVNode, reactive, computed, nextTick, onBeforeUnmount, onBeforeMount, Transition, mergeProps, unref, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow, createTextVNode, isVNode } from "vue";
25
25
  import "clipboard";
26
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
26
+ import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
27
27
  import { onClickOutside } from "@vueuse/core";
28
28
  import hljs from "highlight.js";
29
29
  import MarkdownIt from "markdown-it";
@@ -5691,7 +5691,7 @@ var lodash = { exports: {} };
5691
5691
  var delay = baseRest(function(func, wait, args) {
5692
5692
  return baseDelay(func, toNumber(wait) || 0, args);
5693
5693
  });
5694
- function flip(func) {
5694
+ function flip2(func) {
5695
5695
  return createWrap(func, WRAP_FLIP_FLAG);
5696
5696
  }
5697
5697
  function memoize(func, resolver) {
@@ -6815,7 +6815,7 @@ var lodash = { exports: {} };
6815
6815
  lodash2.flatten = flatten;
6816
6816
  lodash2.flattenDeep = flattenDeep;
6817
6817
  lodash2.flattenDepth = flattenDepth;
6818
- lodash2.flip = flip;
6818
+ lodash2.flip = flip2;
6819
6819
  lodash2.flow = flow;
6820
6820
  lodash2.flowRight = flowRight;
6821
6821
  lodash2.fromPairs = fromPairs;
@@ -8028,18 +8028,12 @@ const flexibleOverlayProps = {
8028
8028
  clickEventBubble: {
8029
8029
  type: Boolean,
8030
8030
  default: false
8031
+ },
8032
+ fitOriginWidth: {
8033
+ type: Boolean,
8034
+ default: false
8031
8035
  }
8032
8036
  };
8033
- function getScrollParent(element) {
8034
- const overflowRegex = /(auto|scroll|hidden)/;
8035
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
8036
- const style = window.getComputedStyle(parent);
8037
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
8038
- return parent;
8039
- }
8040
- }
8041
- return window;
8042
- }
8043
8037
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8044
8038
  let { x, y } = point;
8045
8039
  if (!isArrowCenter) {
@@ -8060,9 +8054,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
8060
8054
  return { x, y };
8061
8055
  }
8062
8056
  function useOverlay(props, emit) {
8057
+ const { fitOriginWidth, position, showArrow } = toRefs(props);
8063
8058
  const overlayRef = ref();
8064
8059
  const arrowRef = ref();
8065
- let originParent = null;
8060
+ const overlayWidth = ref(0);
8061
+ let originObserver;
8062
+ const styles = computed(() => {
8063
+ if (fitOriginWidth.value) {
8064
+ return { width: overlayWidth.value + "px" };
8065
+ } else {
8066
+ return {};
8067
+ }
8068
+ });
8066
8069
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
8067
8070
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
8068
8071
  const staticSide = {
@@ -8083,54 +8086,67 @@ function useOverlay(props, emit) {
8083
8086
  const hostEl = props.origin;
8084
8087
  const overlayEl = unref(overlayRef.value);
8085
8088
  const arrowEl = unref(arrowRef.value);
8086
- const middleware = [
8087
- offset(props.offset),
8088
- autoPlacement({
8089
- alignment: props.align,
8090
- allowedPlacements: props.position
8091
- })
8092
- ];
8093
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
8094
- props.shiftOffset !== void 0 && middleware.push(shift());
8095
- if (!overlayEl) {
8096
- return;
8089
+ const [mainPosition, ...fallbackPosition] = position.value;
8090
+ const middleware = [offset(props.offset)];
8091
+ middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
8092
+ if (showArrow.value) {
8093
+ middleware.push(arrow({ element: arrowRef.value }));
8097
8094
  }
8098
8095
  const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
8099
8096
  strategy: "fixed",
8097
+ placement: mainPosition,
8100
8098
  middleware
8101
8099
  });
8102
8100
  let applyX = x;
8103
8101
  let applyY = y;
8104
- if (props.shiftOffset !== void 0) {
8105
- const { x: shiftX, y: shiftY } = middlewareData.shift;
8106
- shiftX < 0 && (applyX -= props.shiftOffset);
8107
- shiftX > 0 && (applyX += props.shiftOffset);
8108
- shiftY < 0 && (applyY -= props.shiftOffset);
8109
- shiftY > 0 && (applyY += props.shiftOffset);
8110
- }
8111
8102
  emit("positionChange", placement);
8112
8103
  Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
8113
8104
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
8114
8105
  };
8106
+ const scrollCallback = (e) => {
8107
+ var _a, _b;
8108
+ const scrollElement = e.target;
8109
+ if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
8110
+ updatePosition();
8111
+ }
8112
+ };
8113
+ const updateWidth = (originEl) => {
8114
+ overlayWidth.value = originEl.getBoundingClientRect().width;
8115
+ updatePosition();
8116
+ };
8117
+ const observeOrigin = () => {
8118
+ var _a, _b;
8119
+ if (fitOriginWidth.value && typeof window !== "undefined") {
8120
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
8121
+ if (originEl) {
8122
+ originObserver = new window.ResizeObserver(() => updateWidth(originEl));
8123
+ originObserver.observe(originEl);
8124
+ }
8125
+ }
8126
+ };
8127
+ const unobserveOrigin = () => {
8128
+ var _a, _b;
8129
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
8130
+ originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
8131
+ };
8115
8132
  watch(() => props.modelValue, () => {
8116
8133
  if (props.modelValue && props.origin) {
8117
- originParent = getScrollParent(props.origin);
8118
8134
  nextTick(updatePosition);
8119
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
8120
- originParent !== window && window.addEventListener("scroll", updatePosition);
8135
+ window.addEventListener("scroll", scrollCallback, true);
8121
8136
  window.addEventListener("resize", updatePosition);
8137
+ observeOrigin();
8122
8138
  } else {
8123
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8124
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8139
+ window.removeEventListener("scroll", scrollCallback, true);
8125
8140
  window.removeEventListener("resize", updatePosition);
8141
+ unobserveOrigin();
8126
8142
  }
8127
8143
  });
8128
8144
  onUnmounted(() => {
8129
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
8130
- originParent !== window && window.removeEventListener("scroll", updatePosition);
8145
+ window.removeEventListener("scroll", scrollCallback, true);
8131
8146
  window.removeEventListener("resize", updatePosition);
8147
+ unobserveOrigin();
8132
8148
  });
8133
- return { arrowRef, overlayRef, updatePosition };
8149
+ return { arrowRef, overlayRef, styles, updatePosition };
8134
8150
  }
8135
8151
  var flexibleOverlay = "";
8136
8152
  const FlexibleOverlay = defineComponent({
@@ -8151,6 +8167,7 @@ const FlexibleOverlay = defineComponent({
8151
8167
  const {
8152
8168
  arrowRef,
8153
8169
  overlayRef,
8170
+ styles,
8154
8171
  updatePosition
8155
8172
  } = useOverlay(props, emit);
8156
8173
  expose({
@@ -8160,7 +8177,8 @@ const FlexibleOverlay = defineComponent({
8160
8177
  var _a;
8161
8178
  return props.modelValue && createVNode("div", mergeProps({
8162
8179
  "ref": overlayRef,
8163
- "class": ns2.b()
8180
+ "class": ns2.b(),
8181
+ "style": styles.value
8164
8182
  }, attrs, {
8165
8183
  "onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
8166
8184
  "onPointerup": withModifiers(() => ({}), ["stop"])
@@ -9263,6 +9281,13 @@ var EditorMd = defineComponent({
9263
9281
  fullscreenZIndex
9264
9282
  } = toRefs(props);
9265
9283
  const showFullscreen = ref(false);
9284
+ const finalModelValue = computed(() => {
9285
+ if (typeof maxlength.value === "number") {
9286
+ return modelValue.value.substring(0, maxlength.value);
9287
+ } else {
9288
+ return modelValue.value;
9289
+ }
9290
+ });
9266
9291
  const {
9267
9292
  editorRef,
9268
9293
  overlayRef,
@@ -9320,7 +9345,7 @@ var EditorMd = defineComponent({
9320
9345
  }, [createVNode("textarea", {
9321
9346
  "ref": editorRef,
9322
9347
  "placeholder": placeholder.value
9323
- }, [modelValue.value]), createVNode(FlexibleOverlay, {
9348
+ }, [finalModelValue.value]), createVNode(FlexibleOverlay, {
9324
9349
  "ref": overlayRef,
9325
9350
  "modelValue": isHintShow.value,
9326
9351
  "onUpdate:modelValue": ($event) => isHintShow.value = $event,
@@ -9336,11 +9361,11 @@ var EditorMd = defineComponent({
9336
9361
  }
9337
9362
  }), Boolean(maxlength == null ? void 0 : maxlength.value) && createVNode("div", {
9338
9363
  "class": "dp-md-count"
9339
- }, [modelValue.value.length || 0, createTextVNode("/"), maxlength.value])]), createVNode(MdRender, {
9364
+ }, [finalModelValue.value.length || 0, createTextVNode("/"), maxlength.value])]), createVNode(MdRender, {
9340
9365
  "ref": renderRef,
9341
9366
  "base-url": baseUrl.value,
9342
9367
  "breaks": breaks.value,
9343
- "content": modelValue.value,
9368
+ "content": finalModelValue.value,
9344
9369
  "custom-parse": customParse.value,
9345
9370
  "render-parse": renderParse.value,
9346
9371
  "md-rules": mdRules.value,