vue-devui 1.6.15 → 1.6.17

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 +48 -8
  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 +122 -44
  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 { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, 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 { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, 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";
@@ -5843,6 +5843,10 @@ const flexibleOverlayProps = {
5843
5843
  clickEventBubble: {
5844
5844
  type: Boolean,
5845
5845
  default: false
5846
+ },
5847
+ fitOriginWidth: {
5848
+ type: Boolean,
5849
+ default: false
5846
5850
  }
5847
5851
  };
5848
5852
  function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
@@ -5865,9 +5869,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
5865
5869
  return { x, y };
5866
5870
  }
5867
5871
  function useOverlay(props, emit) {
5868
- const { position, showArrow } = toRefs(props);
5872
+ const { fitOriginWidth, position, showArrow } = toRefs(props);
5869
5873
  const overlayRef = ref();
5870
5874
  const arrowRef = ref();
5875
+ const overlayWidth = ref(0);
5876
+ let originObserver;
5877
+ const styles = computed(() => {
5878
+ if (fitOriginWidth.value) {
5879
+ return { width: overlayWidth.value + "px" };
5880
+ } else {
5881
+ return {};
5882
+ }
5883
+ });
5871
5884
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
5872
5885
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
5873
5886
  const staticSide = {
@@ -5912,21 +5925,43 @@ function useOverlay(props, emit) {
5912
5925
  updatePosition();
5913
5926
  }
5914
5927
  };
5928
+ const updateWidth = (originEl) => {
5929
+ overlayWidth.value = originEl.getBoundingClientRect().width;
5930
+ updatePosition();
5931
+ };
5932
+ const observeOrigin = () => {
5933
+ var _a, _b;
5934
+ if (fitOriginWidth.value && typeof window !== "undefined") {
5935
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
5936
+ if (originEl) {
5937
+ originObserver = new window.ResizeObserver(() => updateWidth(originEl));
5938
+ originObserver.observe(originEl);
5939
+ }
5940
+ }
5941
+ };
5942
+ const unobserveOrigin = () => {
5943
+ var _a, _b;
5944
+ const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
5945
+ originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
5946
+ };
5915
5947
  watch(() => props.modelValue, () => {
5916
5948
  if (props.modelValue && props.origin) {
5917
5949
  nextTick(updatePosition);
5918
5950
  window.addEventListener("scroll", scrollCallback, true);
5919
5951
  window.addEventListener("resize", updatePosition);
5952
+ observeOrigin();
5920
5953
  } else {
5921
5954
  window.removeEventListener("scroll", scrollCallback, true);
5922
5955
  window.removeEventListener("resize", updatePosition);
5956
+ unobserveOrigin();
5923
5957
  }
5924
5958
  });
5925
5959
  onUnmounted(() => {
5926
5960
  window.removeEventListener("scroll", scrollCallback, true);
5927
5961
  window.removeEventListener("resize", updatePosition);
5962
+ unobserveOrigin();
5928
5963
  });
5929
- return { arrowRef, overlayRef, updatePosition };
5964
+ return { arrowRef, overlayRef, styles, updatePosition };
5930
5965
  }
5931
5966
  var flexibleOverlay = "";
5932
5967
  const FlexibleOverlay = defineComponent({
@@ -5947,6 +5982,7 @@ const FlexibleOverlay = defineComponent({
5947
5982
  const {
5948
5983
  arrowRef,
5949
5984
  overlayRef,
5985
+ styles,
5950
5986
  updatePosition
5951
5987
  } = useOverlay(props, emit);
5952
5988
  expose({
@@ -5956,7 +5992,8 @@ const FlexibleOverlay = defineComponent({
5956
5992
  var _a;
5957
5993
  return props.modelValue && createVNode("div", mergeProps({
5958
5994
  "ref": overlayRef,
5959
- "class": ns2.b()
5995
+ "class": ns2.b(),
5996
+ "style": styles.value
5960
5997
  }, attrs, {
5961
5998
  "onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
5962
5999
  "onPointerup": withModifiers(() => ({}), ["stop"])
@@ -8233,6 +8270,13 @@ const selectProps = {
8233
8270
  showGlowStyle: {
8234
8271
  type: Boolean,
8235
8272
  default: true
8273
+ },
8274
+ menuClass: {
8275
+ type: String,
8276
+ default: ""
8277
+ },
8278
+ maxLength: {
8279
+ type: Number
8236
8280
  }
8237
8281
  };
8238
8282
  const optionProps = {
@@ -9223,6 +9267,7 @@ function useSelectContent() {
9223
9267
  }
9224
9268
  };
9225
9269
  return {
9270
+ select: select2,
9226
9271
  searchQuery,
9227
9272
  selectedData,
9228
9273
  isSelectDisable,
@@ -9258,6 +9303,7 @@ var SelectContent = defineComponent({
9258
9303
  const multipleCls = ns2.e("multiple");
9259
9304
  const multipleInputCls = ns2.em("multiple", "input");
9260
9305
  const {
9306
+ select: select2,
9261
9307
  searchQuery,
9262
9308
  selectedData,
9263
9309
  isSelectDisable,
@@ -9321,6 +9367,7 @@ var SelectContent = defineComponent({
9321
9367
  "placeholder": placeholder.value,
9322
9368
  "readonly": isReadOnly.value,
9323
9369
  "disabled": isSelectDisable.value,
9370
+ "maxlength": select2 == null ? void 0 : select2.maxLength,
9324
9371
  "onInput": queryFilter,
9325
9372
  "onFocus": onFocus,
9326
9373
  "onBlur": onBlur
@@ -9332,6 +9379,7 @@ var SelectContent = defineComponent({
9332
9379
  "placeholder": placeholder.value,
9333
9380
  "readonly": isReadOnly.value,
9334
9381
  "disabled": isSelectDisable.value,
9382
+ "maxlength": select2 == null ? void 0 : select2.maxLength,
9335
9383
  "onFocus": onFocus,
9336
9384
  "onBlur": onBlur,
9337
9385
  "onInput": queryFilter
@@ -9630,7 +9678,6 @@ var Select = defineComponent({
9630
9678
  const isRender = ref(false);
9631
9679
  const currentPosition = ref("bottom");
9632
9680
  const position = ref(["bottom-start", "top-start"]);
9633
- const dropdownWidth = ref("0");
9634
9681
  const handlePositionChange = (pos) => {
9635
9682
  currentPosition.value = pos.split("-")[0] === "top" ? "top" : "bottom";
9636
9683
  };
@@ -9638,14 +9685,9 @@ var Select = defineComponent({
9638
9685
  transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%",
9639
9686
  "z-index": "var(--devui-z-index-dropdown, 1052)"
9640
9687
  }));
9641
- const updateDropdownWidth = () => {
9642
- var _a;
9643
- dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
9644
- };
9645
9688
  watch(selectRef, (val) => {
9646
9689
  if (val) {
9647
9690
  originRef.value = val.$el;
9648
- updateDropdownWidth();
9649
9691
  }
9650
9692
  });
9651
9693
  const scrollToBottom = () => {
@@ -9657,15 +9699,11 @@ var Select = defineComponent({
9657
9699
  };
9658
9700
  onMounted(() => {
9659
9701
  isRender.value = true;
9660
- updateDropdownWidth();
9661
- window.addEventListener("resize", updateDropdownWidth);
9662
9702
  nextTick(() => {
9663
- dropdownContainer.value.addEventListener("scroll", scrollToBottom);
9703
+ var _a;
9704
+ (_a = dropdownContainer.value) == null ? void 0 : _a.addEventListener("scroll", scrollToBottom);
9664
9705
  });
9665
9706
  });
9666
- onUnmounted(() => {
9667
- window.removeEventListener("resize", updateDropdownWidth);
9668
- });
9669
9707
  provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
9670
9708
  selectDisabled,
9671
9709
  selectSize,
@@ -9701,17 +9739,16 @@ var Select = defineComponent({
9701
9739
  "origin": originRef.value,
9702
9740
  "align": "start",
9703
9741
  "offset": 4,
9742
+ "fit-origin-width": true,
9704
9743
  "position": position.value,
9705
9744
  "onPositionChange": handlePositionChange,
9706
- "style": styles.value
9745
+ "style": styles.value,
9746
+ "class": props.menuClass
9707
9747
  }, {
9708
9748
  default: () => {
9709
9749
  var _a, _b, _c, _d;
9710
9750
  return [withDirectives(createVNode("div", {
9711
- "class": dropdownCls,
9712
- "style": {
9713
- width: `${dropdownWidth.value}`
9714
- }
9751
+ "class": dropdownCls
9715
9752
  }, [withDirectives(createVNode("ul", {
9716
9753
  "class": listCls,
9717
9754
  "ref": dropdownContainer