vue-devui 1.6.15 → 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 +41 -4
  2. package/auto-complete/index.umd.js +12 -12
  3. package/breadcrumb/index.es.js +40 -3
  4. package/breadcrumb/index.umd.js +1 -1
  5. package/category-search/index.es.js +74 -6
  6. package/category-search/index.umd.js +21 -21
  7. package/checkbox/index.es.js +41 -4
  8. package/checkbox/index.umd.js +16 -16
  9. package/code-review/index.es.js +41 -4
  10. package/code-review/index.umd.js +17 -17
  11. package/data-grid/index.es.js +41 -4
  12. package/data-grid/index.umd.js +14 -14
  13. package/date-picker-pro/index.es.js +41 -4
  14. package/date-picker-pro/index.umd.js +8 -8
  15. package/dropdown/index.es.js +40 -3
  16. package/dropdown/index.umd.js +1 -1
  17. package/editable-select/index.es.js +47 -5
  18. package/editable-select/index.umd.js +15 -15
  19. package/editor-md/index.es.js +50 -6
  20. package/editor-md/index.umd.js +26 -26
  21. package/form/index.es.js +41 -4
  22. package/form/index.umd.js +14 -14
  23. package/input/index.es.js +40 -3
  24. package/input/index.umd.js +19 -19
  25. package/input-number/index.es.js +41 -4
  26. package/input-number/index.umd.js +18 -18
  27. package/mention/index.es.js +41 -4
  28. package/mention/index.umd.js +19 -19
  29. package/message/index.es.js +13 -13
  30. package/message/index.umd.js +1 -1
  31. package/modal/index.es.js +40 -3
  32. package/modal/index.umd.js +2 -2
  33. package/overlay/index.es.js +41 -4
  34. package/overlay/index.umd.js +1 -1
  35. package/package.json +2 -1
  36. package/pagination/index.es.js +58 -21
  37. package/pagination/index.umd.js +17 -17
  38. package/pagination/style.css +1 -1
  39. package/popover/index.es.js +41 -4
  40. package/popover/index.umd.js +9 -9
  41. package/radio/index.es.js +41 -4
  42. package/radio/index.umd.js +17 -17
  43. package/search/index.es.js +41 -4
  44. package/search/index.umd.js +17 -17
  45. package/select/index.es.js +58 -21
  46. package/select/index.umd.js +19 -19
  47. package/select/style.css +1 -1
  48. package/splitter/index.es.js +41 -4
  49. package/splitter/index.umd.js +15 -15
  50. package/style.css +1 -1
  51. package/switch/index.es.js +41 -4
  52. package/switch/index.umd.js +14 -14
  53. package/table/index.es.js +40 -3
  54. package/table/index.umd.js +15 -15
  55. package/textarea/index.es.js +41 -4
  56. package/textarea/index.umd.js +16 -16
  57. package/time-picker/index.es.js +40 -3
  58. package/time-picker/index.umd.js +15 -15
  59. package/time-select/index.es.js +58 -21
  60. package/time-select/index.umd.js +17 -17
  61. package/time-select/style.css +1 -1
  62. package/tooltip/index.es.js +41 -4
  63. package/tooltip/index.umd.js +12 -12
  64. package/tree/index.es.js +40 -3
  65. package/tree/index.umd.js +10 -10
  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 +121 -41
  75. package/vue-devui.umd.js +74 -74
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, render, resolveDirective } from "vue";
36
+ import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, computed, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, render, resolveDirective } from "vue";
37
37
  import { onClickOutside } from "@vueuse/core";
38
38
  import "clipboard";
39
39
  import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
@@ -6006,6 +6006,10 @@ const flexibleOverlayProps = {
6006
6006
  clickEventBubble: {
6007
6007
  type: Boolean,
6008
6008
  default: false
6009
+ },
6010
+ fitOriginWidth: {
6011
+ type: Boolean,
6012
+ default: false
6009
6013
  }
6010
6014
  };
6011
6015
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
@@ -6028,9 +6032,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
6028
6032
  return { x, y };
6029
6033
  }
6030
6034
  function useOverlay(props, emit) {
6031
- const { position, showArrow } = toRefs(props);
6035
+ const { fitOriginWidth, position, showArrow } = toRefs(props);
6032
6036
  const overlayRef = ref();
6033
6037
  const arrowRef = ref();
6038
+ const overlayWidth = ref(0);
6039
+ let originObserver;
6040
+ const styles = computed(() => {
6041
+ if (fitOriginWidth.value) {
6042
+ return { width: overlayWidth.value + "px" };
6043
+ } else {
6044
+ return {};
6045
+ }
6046
+ });
6034
6047
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
6035
6048
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
6036
6049
  const staticSide = {
@@ -6075,21 +6088,43 @@ function useOverlay(props, emit) {
6075
6088
  updatePosition();
6076
6089
  }
6077
6090
  };
6091
+ const updateWidth = (originEl) => {
6092
+ overlayWidth.value = originEl.getBoundingClientRect().width;
6093
+ updatePosition();
6094
+ };
6095
+ const observeOrigin = () => {
6096
+ var _a, _b;
6097
+ if (fitOriginWidth.value && typeof window !== "undefined") {
6098
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
6099
+ if (originEl) {
6100
+ originObserver = new window.ResizeObserver(() => updateWidth(originEl));
6101
+ originObserver.observe(originEl);
6102
+ }
6103
+ }
6104
+ };
6105
+ const unobserveOrigin = () => {
6106
+ var _a, _b;
6107
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
6108
+ originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
6109
+ };
6078
6110
  watch(() => props.modelValue, () => {
6079
6111
  if (props.modelValue && props.origin) {
6080
6112
  nextTick(updatePosition);
6081
6113
  window.addEventListener("scroll", scrollCallback, true);
6082
6114
  window.addEventListener("resize", updatePosition);
6115
+ observeOrigin();
6083
6116
  } else {
6084
6117
  window.removeEventListener("scroll", scrollCallback, true);
6085
6118
  window.removeEventListener("resize", updatePosition);
6119
+ unobserveOrigin();
6086
6120
  }
6087
6121
  });
6088
6122
  onUnmounted(() => {
6089
6123
  window.removeEventListener("scroll", scrollCallback, true);
6090
6124
  window.removeEventListener("resize", updatePosition);
6125
+ unobserveOrigin();
6091
6126
  });
6092
- return { arrowRef, overlayRef, updatePosition };
6127
+ return { arrowRef, overlayRef, styles, updatePosition };
6093
6128
  }
6094
6129
  var flexibleOverlay = "";
6095
6130
  const FlexibleOverlay = defineComponent({
@@ -6110,6 +6145,7 @@ const FlexibleOverlay = defineComponent({
6110
6145
  const {
6111
6146
  arrowRef,
6112
6147
  overlayRef,
6148
+ styles,
6113
6149
  updatePosition
6114
6150
  } = useOverlay(props, emit);
6115
6151
  expose({
@@ -6119,7 +6155,8 @@ const FlexibleOverlay = defineComponent({
6119
6155
  var _a;
6120
6156
  return props.modelValue && createVNode("div", mergeProps({
6121
6157
  "ref": overlayRef,
6122
- "class": ns2.b()
6158
+ "class": ns2.b(),
6159
+ "style": styles.value
6123
6160
  }, attrs, {
6124
6161
  "onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
6125
6162
  "onPointerup": withModifiers(() => ({}), ["stop"])
@@ -8396,6 +8433,13 @@ const selectProps = {
8396
8433
  showGlowStyle: {
8397
8434
  type: Boolean,
8398
8435
  default: true
8436
+ },
8437
+ menuClass: {
8438
+ type: String,
8439
+ default: ""
8440
+ },
8441
+ maxLength: {
8442
+ type: Number
8399
8443
  }
8400
8444
  };
8401
8445
  const optionProps = {
@@ -9213,6 +9257,7 @@ function useSelectContent() {
9213
9257
  }
9214
9258
  };
9215
9259
  return {
9260
+ select: select2,
9216
9261
  searchQuery,
9217
9262
  selectedData,
9218
9263
  isSelectDisable,
@@ -9248,6 +9293,7 @@ var SelectContent = defineComponent({
9248
9293
  const multipleCls = ns2.e("multiple");
9249
9294
  const multipleInputCls = ns2.em("multiple", "input");
9250
9295
  const {
9296
+ select: select2,
9251
9297
  searchQuery,
9252
9298
  selectedData,
9253
9299
  isSelectDisable,
@@ -9311,6 +9357,7 @@ var SelectContent = defineComponent({
9311
9357
  "placeholder": placeholder.value,
9312
9358
  "readonly": isReadOnly.value,
9313
9359
  "disabled": isSelectDisable.value,
9360
+ "maxlength": select2 == null ? void 0 : select2.maxLength,
9314
9361
  "onInput": queryFilter,
9315
9362
  "onFocus": onFocus,
9316
9363
  "onBlur": onBlur
@@ -9322,6 +9369,7 @@ var SelectContent = defineComponent({
9322
9369
  "placeholder": placeholder.value,
9323
9370
  "readonly": isReadOnly.value,
9324
9371
  "disabled": isSelectDisable.value,
9372
+ "maxlength": select2 == null ? void 0 : select2.maxLength,
9325
9373
  "onFocus": onFocus,
9326
9374
  "onBlur": onBlur,
9327
9375
  "onInput": queryFilter
@@ -9620,7 +9668,6 @@ var Select = defineComponent({
9620
9668
  const isRender = ref(false);
9621
9669
  const currentPosition = ref("bottom");
9622
9670
  const position = ref(["bottom-start", "top-start"]);
9623
- const dropdownWidth = ref("0");
9624
9671
  const handlePositionChange = (pos) => {
9625
9672
  currentPosition.value = pos.split("-")[0] === "top" ? "top" : "bottom";
9626
9673
  };
@@ -9628,14 +9675,9 @@ var Select = defineComponent({
9628
9675
  transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%",
9629
9676
  "z-index": "var(--devui-z-index-dropdown, 1052)"
9630
9677
  }));
9631
- const updateDropdownWidth = () => {
9632
- var _a;
9633
- dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
9634
- };
9635
9678
  watch(selectRef, (val) => {
9636
9679
  if (val) {
9637
9680
  originRef.value = val.$el;
9638
- updateDropdownWidth();
9639
9681
  }
9640
9682
  });
9641
9683
  const scrollToBottom = () => {
@@ -9647,15 +9689,11 @@ var Select = defineComponent({
9647
9689
  };
9648
9690
  onMounted(() => {
9649
9691
  isRender.value = true;
9650
- updateDropdownWidth();
9651
- window.addEventListener("resize", updateDropdownWidth);
9652
9692
  nextTick(() => {
9653
- dropdownContainer.value.addEventListener("scroll", scrollToBottom);
9693
+ var _a;
9694
+ (_a = dropdownContainer.value) == null ? void 0 : _a.addEventListener("scroll", scrollToBottom);
9654
9695
  });
9655
9696
  });
9656
- onUnmounted(() => {
9657
- window.removeEventListener("resize", updateDropdownWidth);
9658
- });
9659
9697
  provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
9660
9698
  selectDisabled,
9661
9699
  selectSize,
@@ -9691,17 +9729,16 @@ var Select = defineComponent({
9691
9729
  "origin": originRef.value,
9692
9730
  "align": "start",
9693
9731
  "offset": 4,
9732
+ "fit-origin-width": true,
9694
9733
  "position": position.value,
9695
9734
  "onPositionChange": handlePositionChange,
9696
- "style": styles.value
9735
+ "style": styles.value,
9736
+ "class": props.menuClass
9697
9737
  }, {
9698
9738
  default: () => {
9699
9739
  var _a, _b, _c, _d;
9700
9740
  return [withDirectives(createVNode("div", {
9701
- "class": dropdownCls,
9702
- "style": {
9703
- width: `${dropdownWidth.value}`
9704
- }
9741
+ "class": dropdownCls
9705
9742
  }, [withDirectives(createVNode("ul", {
9706
9743
  "class": listCls,
9707
9744
  "ref": dropdownContainer