vue-devui 1.0.2 → 1.2.0

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 (102) hide show
  1. package/README.md +229 -189
  2. package/auto-complete/style.css +1 -1
  3. package/button/style.css +1 -1
  4. package/checkbox/index.es.js +8 -7
  5. package/checkbox/index.umd.js +1 -1
  6. package/checkbox/style.css +1 -1
  7. package/date-picker-pro/index.es.js +5 -2
  8. package/date-picker-pro/index.umd.js +1 -1
  9. package/date-picker-pro/style.css +1 -1
  10. package/input/index.es.js +5 -2
  11. package/input/index.umd.js +4 -4
  12. package/input/style.css +1 -1
  13. package/menu/index.es.js +144 -131
  14. package/menu/index.umd.js +1 -1
  15. package/menu/style.css +1 -1
  16. package/modal/index.es.js +43 -10
  17. package/modal/index.umd.js +1 -1
  18. package/package.json +1 -1
  19. package/pagination/index.es.js +9 -8
  20. package/pagination/index.umd.js +1 -1
  21. package/pagination/style.css +1 -1
  22. package/radio/style.css +1 -1
  23. package/search/index.es.js +5 -2
  24. package/search/index.umd.js +4 -4
  25. package/search/style.css +1 -1
  26. package/select/index.es.js +9 -8
  27. package/select/index.umd.js +1 -1
  28. package/select/style.css +1 -1
  29. package/style.css +1 -1
  30. package/table/index.es.js +8 -7
  31. package/table/index.umd.js +1 -1
  32. package/table/style.css +1 -1
  33. package/tag/index.es.js +1 -1
  34. package/tag/index.umd.js +1 -1
  35. package/tag/style.css +1 -1
  36. package/time-picker/index.es.js +5 -2
  37. package/time-picker/index.umd.js +4 -4
  38. package/time-picker/style.css +1 -1
  39. package/time-select/index.es.js +9 -8
  40. package/time-select/index.umd.js +1 -1
  41. package/time-select/style.css +1 -1
  42. package/tree/index.es.js +8 -7
  43. package/tree/index.umd.js +1 -1
  44. package/tree/style.css +1 -1
  45. package/vue-devui.es.js +194 -144
  46. package/vue-devui.umd.js +11 -11
  47. package/alert/index.d.ts +0 -7
  48. package/auto-complete/index.d.ts +0 -7
  49. package/avatar/index.d.ts +0 -7
  50. package/badge/index.d.ts +0 -7
  51. package/button/index.d.ts +0 -7
  52. package/card/index.d.ts +0 -7
  53. package/checkbox/index.d.ts +0 -7
  54. package/collapse/index.d.ts +0 -7
  55. package/countdown/index.d.ts +0 -7
  56. package/date-picker-pro/index.d.ts +0 -7
  57. package/drawer/index.d.ts +0 -7
  58. package/dropdown/index.d.ts +0 -7
  59. package/editable-select/index.d.ts +0 -7
  60. package/form/index.d.ts +0 -7
  61. package/fullscreen/index.d.ts +0 -7
  62. package/grid/index.d.ts +0 -7
  63. package/icon/index.d.ts +0 -7
  64. package/image-preview/index.d.ts +0 -7
  65. package/index.d.ts +0 -7
  66. package/input/index.d.ts +0 -7
  67. package/input-number/index.d.ts +0 -7
  68. package/layout/index.d.ts +0 -7
  69. package/loading/index.d.ts +0 -7
  70. package/mention/index.d.ts +0 -7
  71. package/menu/index.d.ts +0 -7
  72. package/message/index.d.ts +0 -7
  73. package/modal/index.d.ts +0 -7
  74. package/notification/index.d.ts +0 -7
  75. package/overlay/index.d.ts +0 -7
  76. package/pagination/index.d.ts +0 -7
  77. package/panel/index.d.ts +0 -7
  78. package/popover/index.d.ts +0 -7
  79. package/progress/index.d.ts +0 -7
  80. package/radio/index.d.ts +0 -7
  81. package/rate/index.d.ts +0 -7
  82. package/result/index.d.ts +0 -7
  83. package/ripple/index.d.ts +0 -7
  84. package/search/index.d.ts +0 -7
  85. package/select/index.d.ts +0 -7
  86. package/skeleton/index.d.ts +0 -7
  87. package/slider/index.d.ts +0 -7
  88. package/splitter/index.d.ts +0 -7
  89. package/statistic/index.d.ts +0 -7
  90. package/status/index.d.ts +0 -7
  91. package/steps/index.d.ts +0 -7
  92. package/switch/index.d.ts +0 -7
  93. package/table/index.d.ts +0 -7
  94. package/tabs/index.d.ts +0 -7
  95. package/tag/index.d.ts +0 -7
  96. package/textarea/index.d.ts +0 -7
  97. package/time-picker/index.d.ts +0 -7
  98. package/time-select/index.d.ts +0 -7
  99. package/timeline/index.d.ts +0 -7
  100. package/tooltip/index.d.ts +0 -7
  101. package/tree/index.d.ts +0 -7
  102. package/upload/index.d.ts +0 -7
package/vue-devui.es.js CHANGED
@@ -10220,7 +10220,9 @@ var Checkbox = defineComponent({
10220
10220
  "fill-rule": "nonzero",
10221
10221
  "points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
10222
10222
  "class": polygonCls
10223
- }, null)])])]), props.label || ((_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a))])])]);
10223
+ }, null)])])]), createVNode("span", {
10224
+ "class": ns2.e("label-text")
10225
+ }, [props.label || ((_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a))])])])]);
10224
10226
  };
10225
10227
  }
10226
10228
  });
@@ -10262,12 +10264,11 @@ var CheckboxGroup = defineComponent({
10262
10264
  }
10263
10265
  };
10264
10266
  return createVNode("div", {
10265
- "class": ns2.e("group")
10266
- }, [createVNode("div", {
10267
- "class": {
10268
- [ns2.m("list-inline")]: props.direction === "row"
10269
- }
10270
- }, [getContent()])]);
10267
+ "class": [ns2.e("group"), {
10268
+ "is-row": props.direction === "row",
10269
+ "is-column": props.direction === "column"
10270
+ }]
10271
+ }, [getContent()]);
10271
10272
  };
10272
10273
  }
10273
10274
  });
@@ -11282,7 +11283,10 @@ var DInput = defineComponent({
11282
11283
  const prefixVisible = ctx2.slots.prefix || props.prefix;
11283
11284
  const suffixVisible = ctx2.slots.suffix || props.suffix || props.showPassword || props.clearable;
11284
11285
  const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value);
11285
- const showClearable = computed(() => props.clearable && !inputDisabled.value);
11286
+ const showClearable = computed(() => {
11287
+ var _a;
11288
+ return props.clearable && !inputDisabled.value && ((_a = modelValue.value) == null ? void 0 : _a.length) > 0;
11289
+ });
11286
11290
  watch(() => props.modelValue, () => {
11287
11291
  if (props.validateEvent) {
11288
11292
  formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
@@ -11329,7 +11333,7 @@ var DInput = defineComponent({
11329
11333
  "class": ns2.em("password", "icon"),
11330
11334
  "name": passwordVisible.value ? "preview" : "preview-forbidden",
11331
11335
  "onClick": clickPasswordIcon
11332
- }, null), showClearable.value && modelValue.value.length > 0 && createVNode(DIcon, {
11336
+ }, null), showClearable.value && createVNode(DIcon, {
11333
11337
  "size": inputSize.value,
11334
11338
  "class": ns2.em("clear", "icon"),
11335
11339
  "name": "close",
@@ -17368,6 +17372,7 @@ var MenuItem = defineComponent({
17368
17372
  e.stopPropagation();
17369
17373
  const ele = e.currentTarget;
17370
17374
  let changeRouteResult = void 0;
17375
+ props.disabled && e.preventDefault();
17371
17376
  if (!props.disabled) {
17372
17377
  if (!multiple) {
17373
17378
  menuStore.emit("menuItem:clear:select");
@@ -17423,7 +17428,9 @@ var MenuItem = defineComponent({
17423
17428
  }, [(_b = (_a = ctx2.slots).icon) == null ? void 0 : _b.call(_a)]);
17424
17429
  const menuItems = ref(null);
17425
17430
  watch(disabled, () => {
17426
- classObject.value[menuItemSelect] = false;
17431
+ if (!multiple) {
17432
+ classObject.value[menuItemSelect] = false;
17433
+ }
17427
17434
  });
17428
17435
  watch(() => defaultSelectKey, (n) => {
17429
17436
  isSelect.value = initSelect(n, key, multiple, disabled);
@@ -17509,61 +17516,12 @@ var MenuItem = defineComponent({
17509
17516
  };
17510
17517
  }
17511
17518
  });
17512
- const ns$a = useNamespace("menu");
17513
- const subNs$1 = useNamespace("submenu");
17514
- const menuItemHorizontalWrapperHidden = `${ns$a.b()}-item-horizontal-wrapper-hidden`;
17515
- const menuItemHorizontalWrapperShow = `${ns$a.b()}-item-horizontal-wrapper-show`;
17516
- function useShowSubMenu(eventName, e, wrapper) {
17517
- const target = e.currentTarget;
17518
- const targetParent = target.parentElement;
17519
- const wrapperChildren = wrapper.children;
17520
- wrapper.style.padding = `0 20px !important`;
17521
- if (eventName === "mouseenter") {
17522
- if ((targetParent == null ? void 0 : targetParent.tagName) === "DIV") {
17523
- wrapper.classList.add(`${ns$a.b()}-item-horizontal-wrapper-level`);
17524
- const { width } = target.getClientRects()[0];
17525
- wrapper.style.top = `0px`;
17526
- wrapper.style.left = `${width}px`;
17527
- } else {
17528
- wrapper.style.top = `26px`;
17529
- wrapper.style.left = `0px`;
17530
- }
17531
- wrapper.classList.remove(menuItemHorizontalWrapperHidden);
17532
- wrapper.classList.add(menuItemHorizontalWrapperShow);
17533
- for (let i = 0; i < wrapperChildren.length; i++) {
17534
- const ul = wrapperChildren[i];
17535
- if (ul.tagName === "UL" && ul.classList.contains(subNs$1.b())) {
17536
- const levelUlWrapper = ul.getElementsByClassName(`${ns$a.b()}-item-horizontal-wrapper`)[0];
17537
- ul.addEventListener("mouseenter", (ev) => {
17538
- ev.stopPropagation();
17539
- useShowSubMenu("mouseenter", ev, levelUlWrapper);
17540
- levelUlWrapper.classList.remove(menuItemHorizontalWrapperHidden);
17541
- levelUlWrapper.classList.add(menuItemHorizontalWrapperShow);
17542
- });
17543
- ul.addEventListener("mouseleave", (ev) => {
17544
- ev.stopPropagation();
17545
- useShowSubMenu("mouseleave", ev, levelUlWrapper);
17546
- levelUlWrapper.classList.remove(menuItemHorizontalWrapperShow);
17547
- levelUlWrapper.classList.add(menuItemHorizontalWrapperHidden);
17548
- });
17549
- }
17550
- }
17551
- }
17552
- if (eventName === "mouseleave") {
17553
- wrapper.classList.remove(menuItemHorizontalWrapperShow);
17554
- wrapper.classList.add(menuItemHorizontalWrapperHidden);
17519
+ function useNearestMenuElement(ele) {
17520
+ while (ele && ele.tagName !== "LI" && ele.tagName !== "UL") {
17521
+ ele = ele.parentElement;
17555
17522
  }
17523
+ return ele;
17556
17524
  }
17557
- const subMenuProps = {
17558
- title: {
17559
- type: String,
17560
- default: ""
17561
- },
17562
- disabled: {
17563
- type: Boolean,
17564
- default: false
17565
- }
17566
- };
17567
17525
  const elTransition = "0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out";
17568
17526
  const TransitionObj = {
17569
17527
  "before-enter"(el) {
@@ -17637,6 +17595,61 @@ var MenuTransition = defineComponent({
17637
17595
  };
17638
17596
  }
17639
17597
  });
17598
+ const subMenuProps = {
17599
+ title: {
17600
+ type: String,
17601
+ default: ""
17602
+ },
17603
+ disabled: {
17604
+ type: Boolean,
17605
+ default: false
17606
+ }
17607
+ };
17608
+ const ns$a = useNamespace("menu");
17609
+ const subNs$1 = useNamespace("submenu");
17610
+ const menuItemHorizontalWrapperHidden = `${ns$a.b()}-item-horizontal-wrapper-hidden`;
17611
+ const menuItemHorizontalWrapperShow = `${ns$a.b()}-item-horizontal-wrapper-show`;
17612
+ function useShowSubMenu(eventName, e, wrapper) {
17613
+ const target = e.currentTarget;
17614
+ const targetParent = target.parentElement;
17615
+ const wrapperChildren = wrapper.children;
17616
+ wrapper.style.padding = `0 20px !important`;
17617
+ if (eventName === "mouseenter") {
17618
+ if ((targetParent == null ? void 0 : targetParent.tagName) === "DIV") {
17619
+ wrapper.classList.add(`${ns$a.b()}-item-horizontal-wrapper-level`);
17620
+ const { width } = target.getClientRects()[0];
17621
+ wrapper.style.top = `0px`;
17622
+ wrapper.style.left = `${width}px`;
17623
+ } else {
17624
+ wrapper.style.top = `26px`;
17625
+ wrapper.style.left = `0px`;
17626
+ }
17627
+ wrapper.classList.remove(menuItemHorizontalWrapperHidden);
17628
+ wrapper.classList.add(menuItemHorizontalWrapperShow);
17629
+ for (let i = 0; i < wrapperChildren.length; i++) {
17630
+ const ul = wrapperChildren[i];
17631
+ if (ul.tagName === "UL" && ul.classList.contains(subNs$1.b())) {
17632
+ const levelUlWrapper = ul.getElementsByClassName(`${ns$a.b()}-item-horizontal-wrapper`)[0];
17633
+ ul.addEventListener("mouseenter", (ev) => {
17634
+ ev.stopPropagation();
17635
+ useShowSubMenu("mouseenter", ev, levelUlWrapper);
17636
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperHidden);
17637
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperShow);
17638
+ });
17639
+ ul.addEventListener("mouseleave", (ev) => {
17640
+ ev.stopPropagation();
17641
+ useShowSubMenu("mouseleave", ev, levelUlWrapper);
17642
+ levelUlWrapper.classList.remove(menuItemHorizontalWrapperShow);
17643
+ levelUlWrapper.classList.add(menuItemHorizontalWrapperHidden);
17644
+ });
17645
+ }
17646
+ }
17647
+ }
17648
+ if (eventName === "mouseleave") {
17649
+ wrapper.classList.remove(menuItemHorizontalWrapperShow);
17650
+ wrapper.classList.add(menuItemHorizontalWrapperHidden);
17651
+ }
17652
+ }
17640
17653
  const ns$9 = useNamespace("menu");
17641
17654
  const subNs = useNamespace("submenu");
17642
17655
  const subMenuClass = subNs.b();
@@ -17650,9 +17663,9 @@ var SubMenu = defineComponent({
17650
17663
  key
17651
17664
  }
17652
17665
  } = getCurrentInstance();
17653
- const key_ = String(key);
17654
- const isOpen = ref(false);
17666
+ let key_ = String(key);
17655
17667
  const defaultOpenKeys = inject("openKeys");
17668
+ const isOpen = ref(defaultOpenKeys.value.includes(key_));
17656
17669
  const indent = inject("defaultIndent");
17657
17670
  const isCollapsed = inject("isCollapsed");
17658
17671
  const mode = inject("mode");
@@ -17661,17 +17674,11 @@ var SubMenu = defineComponent({
17661
17674
  const isHorizontal = mode.value === "horizontal";
17662
17675
  if (key_ === "null") {
17663
17676
  console.warn(`[devui][menu]: Key can not be null`);
17664
- } else {
17665
- if (defaultOpenKeys.value.includes(key_)) {
17666
- isOpen.value = true;
17667
- } else {
17668
- isOpen.value = false;
17669
- }
17677
+ key_ = `randomKey-${randomId(16)}`;
17670
17678
  }
17671
17679
  const clickHandle = (e) => {
17672
- e.preventDefault();
17673
17680
  e.stopPropagation();
17674
- const ele = e.currentTarget;
17681
+ const ele = useNearestMenuElement(e.target);
17675
17682
  if (ele.classList.contains(subMenuClass) && isHorizontal) {
17676
17683
  return;
17677
17684
  }
@@ -17680,30 +17687,21 @@ var SubMenu = defineComponent({
17680
17687
  useClick(e);
17681
17688
  }
17682
17689
  if (!props.disabled && mode.value !== "horizontal") {
17683
- const target = e.target;
17684
- let cur = e.target;
17685
- if (target.tagName === "UL") {
17686
- if (target.classList.contains(`${subMenuClass}-open`)) {
17687
- isOpen.value = !isOpen.value;
17688
- } else {
17689
- isOpen.value = isOpen.value;
17690
- }
17690
+ const cur = useNearestMenuElement(e.target);
17691
+ const idx = defaultOpenKeys.value.indexOf(key_);
17692
+ if (idx >= 0 && cur.tagName === "UL") {
17693
+ defaultOpenKeys.value.splice(idx, 1);
17691
17694
  } else {
17692
- while (cur && cur.tagName !== "UL") {
17693
- if (cur.tagName === "LI") {
17694
- break;
17695
- }
17696
- cur = cur.parentElement;
17697
- }
17698
17695
  if (cur.tagName === "UL") {
17699
- isOpen.value = !isOpen.value;
17696
+ defaultOpenKeys.value.push(key_);
17700
17697
  }
17701
17698
  }
17699
+ isOpen.value = defaultOpenKeys.value.indexOf(key_) >= 0;
17702
17700
  parentEmit("submenu-change", {
17703
17701
  type: "submenu-change",
17704
17702
  state: isOpen.value,
17705
17703
  key: key_,
17706
- el: cur
17704
+ el: ele
17707
17705
  });
17708
17706
  }
17709
17707
  };
@@ -17732,11 +17730,11 @@ var SubMenu = defineComponent({
17732
17730
  });
17733
17731
  onMounted(() => {
17734
17732
  var _a;
17735
- const el = title.value;
17736
- const e = subMenu.value;
17733
+ const subMenuTitle = title.value;
17734
+ const subMenuWrapper = subMenu.value;
17737
17735
  addLayer();
17738
- class_layer.value = `layer_${(_a = Array.from(e.classList).at(-1)) == null ? void 0 : _a.replace("layer_", "")}`;
17739
- if (isHorizontal) {
17736
+ class_layer.value = `layer_${(_a = Array.from(subMenuWrapper.classList).at(-1)) == null ? void 0 : _a.replace("layer_", "")}`;
17737
+ if (isHorizontal && !props.disabled) {
17740
17738
  subMenu.value.addEventListener("mouseenter", (ev) => {
17741
17739
  ev.stopPropagation();
17742
17740
  useShowSubMenu("mouseenter", ev, wrapperDom);
@@ -17747,22 +17745,22 @@ var SubMenu = defineComponent({
17747
17745
  });
17748
17746
  }
17749
17747
  watch(isCollapsed, (newValue) => {
17750
- const layer = Number(getLayer(e));
17748
+ const layer = Number(getLayer(subMenuWrapper));
17751
17749
  if (!Number.isNaN(layer)) {
17752
17750
  layer > 2 && (isShow.value = !isCollapsed.value);
17753
17751
  }
17754
17752
  if (newValue) {
17755
- el.style.padding !== "0" && (oldPadding = el.style.padding);
17753
+ subMenuTitle.style.padding !== "0" && (oldPadding = subMenuTitle.style.padding);
17756
17754
  setTimeout(() => {
17757
- el.style.padding = "0";
17758
- el.style.width = "";
17759
- el.style.textAlign = `center`;
17755
+ subMenuTitle.style.padding = "0";
17756
+ subMenuTitle.style.width = "";
17757
+ subMenuTitle.style.textAlign = `center`;
17760
17758
  }, 300);
17761
- el.style.display = `block`;
17759
+ subMenuTitle.style.display = `block`;
17762
17760
  } else {
17763
- el.style.padding = `${oldPadding}`;
17764
- el.style.textAlign = ``;
17765
- el.style.display = `flex`;
17761
+ subMenuTitle.style.padding = `${oldPadding}`;
17762
+ subMenuTitle.style.textAlign = ``;
17763
+ subMenuTitle.style.display = `flex`;
17766
17764
  }
17767
17765
  });
17768
17766
  });
@@ -17770,10 +17768,10 @@ var SubMenu = defineComponent({
17770
17768
  var _a, _b, _c, _d;
17771
17769
  return withDirectives(createVNode("ul", {
17772
17770
  "onClick": clickHandle,
17773
- "class": [subMenuClass, class_layer.value],
17771
+ "class": [subMenuClass, class_layer.value, props["disabled"] && `${subMenuClass}-disabled`],
17774
17772
  "ref": subMenu
17775
17773
  }, [createVNode("div", {
17776
- "class": [`${subMenuClass}-title`, props["disabled"] && `${subMenuClass}-disabled`],
17774
+ "class": [`${subMenuClass}-title`],
17777
17775
  "style": `padding: 0 ${indent}px`,
17778
17776
  "ref": title
17779
17777
  }, [createVNode("span", {
@@ -17786,10 +17784,10 @@ var SubMenu = defineComponent({
17786
17784
  "icon icon-chevron-right": class_layer.value === `layer_${subMenuClass}`,
17787
17785
  "is-opened": isOpen.value
17788
17786
  }
17789
- }, null), [[vShow, !isCollapsed.value && key !== "overflowContainer"]])]), isHorizontal ? createVNode("div", {
17787
+ }, null), [[vShow, !isCollapsed.value && key !== "overflowContainer"]])]), isHorizontal ? withDirectives(createVNode("div", {
17790
17788
  "class": `${ns$9.b()}-item-horizontal-wrapper ${ns$9.b()}-item-horizontal-wrapper-hidden`,
17791
17789
  "ref": wrapper
17792
- }, [(_d = (_c = ctx2.slots).default) == null ? void 0 : _d.call(_c)]) : createVNode(MenuTransition, null, {
17790
+ }, [(_d = (_c = ctx2.slots).default) == null ? void 0 : _d.call(_c)]), [[vShow, !props.disabled]]) : createVNode(MenuTransition, null, {
17793
17791
  default: () => {
17794
17792
  var _a2, _b2;
17795
17793
  return [withDirectives(createVNode("div", {
@@ -17894,51 +17892,67 @@ var Menu = defineComponent({
17894
17892
  provide("useRouter", props.router);
17895
17893
  setDefaultIndent(props["indentSize"]);
17896
17894
  const menuRoot = ref(null);
17897
- const overflow_container = ref(null);
17898
17895
  const overflowItemLength = ref(0);
17896
+ const overflowContainer = ref(null);
17897
+ const selectClassName = `${ns2.b()}-item-select`;
17899
17898
  const rootClassName = computed(() => ({
17900
17899
  [`${ns2.b()}`]: true,
17901
17900
  [`${ns2.b()}-vertical`]: mode.value === "vertical",
17902
17901
  [`${ns2.b()}-horizontal`]: mode.value === "horizontal",
17903
17902
  [`${ns2.b()}-collapsed`]: collapsed.value
17904
17903
  }));
17904
+ const overflowContainerClassName = reactive({
17905
+ [selectClassName]: false,
17906
+ [`${ns2.b()}-overflow-container`]: true
17907
+ });
17908
+ const resetOverflowContainerSelectState = (e) => {
17909
+ const children = Array.from(e.children);
17910
+ for (const item of children) {
17911
+ if (item.classList.contains(selectClassName)) {
17912
+ overflowContainerClassName[selectClassName] = true;
17913
+ break;
17914
+ } else {
17915
+ overflowContainerClassName[selectClassName] = false;
17916
+ }
17917
+ }
17918
+ };
17905
17919
  onMounted(() => {
17906
17920
  var _a;
17907
17921
  if (props["mode"] === "horizontal") {
17908
17922
  let flag = false;
17909
- const overflowContainer = (_a = overflow_container.value) == null ? void 0 : _a.$el;
17923
+ const overflowContainerElement = (_a = overflowContainer.value) == null ? void 0 : _a.$el;
17910
17924
  const root2 = menuRoot.value;
17911
17925
  const children = root2.children;
17912
- const container = overflowContainer.children[1];
17926
+ const container = overflowContainerElement.children[1];
17913
17927
  const ob = new IntersectionObserver((entries) => {
17914
- entries.forEach((v) => {
17915
- if (!v.isIntersecting) {
17916
- const cloneNode = v.target.cloneNode(true);
17917
- if (v.target.classList.contains(`${ns2.b()}-overflow-container`)) {
17918
- if (flag && v.target.previousElementSibling && container.children.length) {
17919
- root2.appendChild(v.target.previousElementSibling);
17928
+ entries.forEach((entry) => {
17929
+ if (!entry.isIntersecting) {
17930
+ const cloneNode = entry.target.cloneNode(true);
17931
+ if (entry.target.classList.contains(`${ns2.b()}-overflow-container`)) {
17932
+ if (flag && entry.target.previousElementSibling && container.children.length) {
17933
+ root2.appendChild(entry.target.previousElementSibling);
17920
17934
  } else {
17921
17935
  flag = true;
17922
17936
  }
17923
17937
  } else {
17924
17938
  overflowItemLength.value += 1;
17925
- v.target.style.visibility = "hidden";
17926
- if (overflowContainer.nextSibling) {
17927
- root2.insertBefore(v.target, overflowContainer.nextSibling);
17939
+ entry.target.style.visibility = "hidden";
17940
+ if (overflowContainerElement.nextSibling) {
17941
+ root2.insertBefore(entry.target, overflowContainerElement.nextSibling);
17928
17942
  } else {
17929
- root2.appendChild(v.target);
17943
+ root2.appendChild(entry.target);
17930
17944
  }
17931
17945
  container.appendChild(cloneNode);
17946
+ resetOverflowContainerSelectState(container);
17932
17947
  }
17933
17948
  } else {
17934
- if (!v.target.classList.contains(`${ns2.b()}-overflow-container`) && v.target.style.visibility === "hidden") {
17935
- ob.unobserve(v.target);
17936
- const el = container.lastChild;
17937
- if (el) {
17938
- root2.insertBefore(el, overflowContainer);
17939
- }
17940
- const obItem = overflowContainer.previousElementSibling;
17941
- if (obItem) {
17949
+ if (!entry.target.classList.contains(`${ns2.b()}-overflow-container`) && entry.target.style.visibility === "hidden") {
17950
+ ob.unobserve(entry.target);
17951
+ root2.insertBefore(entry.target, overflowContainerElement);
17952
+ entry.target.style.visibility = "";
17953
+ const obItem = overflowContainerElement.previousElementSibling;
17954
+ const canObAgin = obItem && entry.boundingClientRect.width % entry.target.getBoundingClientRect().width === 0;
17955
+ if (canObAgin) {
17942
17956
  ob.observe(obItem);
17943
17957
  }
17944
17958
  if (obItem == null ? void 0 : obItem.classList.contains("devui-submenu")) {
@@ -17953,9 +17967,12 @@ var Menu = defineComponent({
17953
17967
  useShowSubMenu("mouseleave", ev, wrapper);
17954
17968
  });
17955
17969
  }
17956
- v.target.style.visibility = "";
17957
- v.target.remove();
17958
17970
  overflowItemLength.value -= 1;
17971
+ ob.observe(entry.target);
17972
+ if (container.lastChild) {
17973
+ container.removeChild(container.lastChild);
17974
+ }
17975
+ resetOverflowContainerSelectState(container);
17959
17976
  }
17960
17977
  }
17961
17978
  });
@@ -17974,12 +17991,12 @@ var Menu = defineComponent({
17974
17991
  return createVNode("ul", {
17975
17992
  "ref": menuRoot,
17976
17993
  "class": rootClassName.value,
17977
- "style": [props["collapsed"] ? `width:${props["collapsedIndent"] * 2}px` : `width: ${props["width"]}`, "white-space: nowrap"]
17994
+ "style": [props["collapsed"] ? `width:${props["collapsedIndent"] * 2}px` : `width: ${props["width"]}`]
17978
17995
  }, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a), withDirectives(createVNode(SubMenu, {
17979
- "ref": overflow_container,
17996
+ "ref": overflowContainer,
17980
17997
  "key": "overflowContainer",
17981
17998
  "title": "...",
17982
- "class": `${ns2.b()}-overflow-container`
17999
+ "class": overflowContainerClassName
17983
18000
  }, null), [[vShow, overflowItemLength.value > 0 && mode.value === "horizontal"]])]);
17984
18001
  };
17985
18002
  }
@@ -18350,6 +18367,10 @@ const modalProps = {
18350
18367
  type: {
18351
18368
  type: String,
18352
18369
  default: ""
18370
+ },
18371
+ keepLast: {
18372
+ type: Boolean,
18373
+ default: false
18353
18374
  }
18354
18375
  };
18355
18376
  function useModal(props, emit) {
@@ -18404,6 +18425,7 @@ function addUnit(value, defaultUnit = "px") {
18404
18425
  return "";
18405
18426
  }
18406
18427
  }
18428
+ const modalPosition = ref("translate(-50%, -50%)");
18407
18429
  const useDraggable = (targetRef, dragRef, draggable) => {
18408
18430
  let transform = {
18409
18431
  offsetX: 0,
@@ -18431,7 +18453,7 @@ const useDraggable = (targetRef, dragRef, draggable) => {
18431
18453
  offsetX: moveX,
18432
18454
  offsetY: moveY
18433
18455
  };
18434
- targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
18456
+ modalPosition.value = `translate(calc(-50% + ${addUnit(moveX)}), calc(-50% + ${addUnit(moveY)}))`;
18435
18457
  };
18436
18458
  const onMouseup = () => {
18437
18459
  document.removeEventListener("mousemove", onMousemove);
@@ -18462,6 +18484,16 @@ const useDraggable = (targetRef, dragRef, draggable) => {
18462
18484
  onBeforeUnmount(() => {
18463
18485
  offDraggable();
18464
18486
  });
18487
+ const clearPosition = () => {
18488
+ transform = {
18489
+ offsetX: 0,
18490
+ offsetY: 0
18491
+ };
18492
+ modalPosition.value = "translate(-50%, -50%)";
18493
+ };
18494
+ return {
18495
+ clearPosition
18496
+ };
18465
18497
  };
18466
18498
  var Header = defineComponent({
18467
18499
  name: "DModalHeader",
@@ -18509,7 +18541,8 @@ var Modal = defineComponent({
18509
18541
  showClose,
18510
18542
  showOverlay,
18511
18543
  appendToBody,
18512
- closeOnClickOverlay
18544
+ closeOnClickOverlay,
18545
+ keepLast
18513
18546
  } = toRefs(props);
18514
18547
  const {
18515
18548
  execClose
@@ -18518,7 +18551,14 @@ var Modal = defineComponent({
18518
18551
  const dialogRef = ref();
18519
18552
  const headerRef = ref();
18520
18553
  const draggable = computed(() => props.draggable);
18521
- useDraggable(dialogRef, headerRef, draggable);
18554
+ const {
18555
+ clearPosition
18556
+ } = useDraggable(dialogRef, headerRef, draggable);
18557
+ watch(modelValue, (val) => {
18558
+ if (val && !keepLast.value) {
18559
+ clearPosition();
18560
+ }
18561
+ });
18522
18562
  const renderType = () => {
18523
18563
  const typeList = [{
18524
18564
  type: "success",
@@ -18538,7 +18578,12 @@ var Modal = defineComponent({
18538
18578
  icon: "info-o"
18539
18579
  }];
18540
18580
  const item = typeList.find((i) => i.type === props.type);
18541
- return createVNode(Header, null, {
18581
+ return createVNode("div", {
18582
+ "style": {
18583
+ cursor: props.draggable ? "move" : "default"
18584
+ },
18585
+ "ref": headerRef
18586
+ }, [createVNode(Header, null, {
18542
18587
  default: () => [createVNode("div", {
18543
18588
  "class": "type-content"
18544
18589
  }, [createVNode("div", {
@@ -18548,22 +18593,24 @@ var Modal = defineComponent({
18548
18593
  }, null)]), createVNode("div", {
18549
18594
  "class": "type-content-text"
18550
18595
  }, [item == null ? void 0 : item.text])])]
18551
- });
18596
+ })]);
18552
18597
  };
18553
18598
  return () => createVNode(Teleport, {
18554
18599
  "to": "body",
18555
18600
  "disabled": !appendToBody.value
18556
18601
  }, {
18557
- default: () => [showOverlay.value && createVNode(FixedOverlay, {
18558
- "modelValue": modelValue.value,
18559
- "onUpdate:modelValue": execClose,
18602
+ default: () => [showOverlay.value && createVNode(FixedOverlay, mergeProps({
18603
+ "modelValue": modelValue.value
18604
+ }, {
18605
+ "onUpdate:modelValue": execClose
18606
+ }, {
18560
18607
  "class": ns2.e("overlay"),
18561
18608
  "lock-scroll": false,
18562
18609
  "close-on-click-overlay": closeOnClickOverlay.value,
18563
18610
  "style": {
18564
18611
  zIndex: "calc(var(--devui-z-index-modal, 1050) - 1)"
18565
18612
  }
18566
- }, null), createVNode(Transition, {
18613
+ }), null), createVNode(Transition, {
18567
18614
  "name": props.showAnimation ? ns2.m("wipe") : ""
18568
18615
  }, {
18569
18616
  default: () => {
@@ -18572,7 +18619,10 @@ var Modal = defineComponent({
18572
18619
  "ref": dialogRef,
18573
18620
  "class": ns2.b()
18574
18621
  }, attrs, {
18575
- "onClick": (e) => e.stopPropagation()
18622
+ "onClick": (e) => e.stopPropagation(),
18623
+ "style": {
18624
+ transform: modalPosition.value
18625
+ }
18576
18626
  }), [showClose.value && createVNode("div", {
18577
18627
  "onClick": execClose,
18578
18628
  "class": "btn-close"
@@ -19555,7 +19605,7 @@ const tagProps = {
19555
19605
  },
19556
19606
  size: {
19557
19607
  type: String,
19558
- default: "xs"
19608
+ default: "md"
19559
19609
  }
19560
19610
  };
19561
19611
  function useClass(props) {
@@ -30095,7 +30145,7 @@ const installs = [
30095
30145
  UploadInstall
30096
30146
  ];
30097
30147
  var vueDevui = {
30098
- version: "1.0.1",
30148
+ version: "1.1.0",
30099
30149
  install(app) {
30100
30150
  installs.forEach((p) => app.use(p));
30101
30151
  }