vue-devui 1.0.0-beta.16 → 1.0.0-beta.19

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 (190) hide show
  1. package/README.md +29 -21
  2. package/accordion/index.es.js +229 -14
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +28 -30
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/auto-complete/index.es.js +133 -271
  9. package/auto-complete/index.umd.js +1 -1
  10. package/auto-complete/style.css +1 -1
  11. package/back-top/index.es.js +5 -3
  12. package/back-top/index.umd.js +1 -1
  13. package/badge/index.es.js +13 -19
  14. package/badge/index.umd.js +1 -1
  15. package/badge/style.css +1 -1
  16. package/breadcrumb/index.es.js +2 -1
  17. package/button/index.es.js +95 -122
  18. package/button/index.umd.js +1 -1
  19. package/button/style.css +1 -1
  20. package/carousel/index.es.js +38 -53
  21. package/carousel/index.umd.js +1 -1
  22. package/cascader/index.es.js +5412 -784
  23. package/cascader/index.umd.js +27 -1
  24. package/cascader/style.css +1 -1
  25. package/checkbox/style.css +1 -1
  26. package/color-picker/index.es.js +5517 -281
  27. package/color-picker/index.umd.js +27 -1
  28. package/color-picker/style.css +1 -1
  29. package/countdown/index.es.js +9 -8
  30. package/date-picker/index.es.js +44 -62
  31. package/date-picker/index.umd.js +1 -1
  32. package/date-picker/style.css +1 -1
  33. package/drawer/index.es.js +159 -324
  34. package/drawer/index.umd.js +1 -1
  35. package/drawer/style.css +1 -1
  36. package/dropdown/index.es.js +459 -301
  37. package/dropdown/index.umd.js +1 -1
  38. package/dropdown/style.css +1 -1
  39. package/editable-select/index.es.js +293 -5724
  40. package/editable-select/index.umd.js +1 -27
  41. package/editable-select/style.css +1 -1
  42. package/form/index.es.js +6125 -535
  43. package/form/index.umd.js +27 -1
  44. package/form/style.css +1 -1
  45. package/fullscreen/index.es.js +112 -133
  46. package/fullscreen/index.umd.js +1 -1
  47. package/fullscreen/style.css +1 -1
  48. package/gantt/index.es.js +3 -15
  49. package/gantt/index.umd.js +1 -1
  50. package/gantt/style.css +1 -1
  51. package/grid/index.es.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +39 -57
  54. package/icon/index.umd.js +1 -1
  55. package/image-preview/index.es.js +2 -1
  56. package/input/index.es.js +4 -5
  57. package/input/index.umd.js +1 -1
  58. package/input/style.css +1 -1
  59. package/input-icon/index.es.js +42 -42
  60. package/input-icon/index.umd.js +1 -1
  61. package/input-icon/style.css +1 -1
  62. package/input-number/index.es.js +46 -57
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/{time-axis → list}/index.d.ts +0 -0
  66. package/list/index.es.js +39 -0
  67. package/list/index.umd.js +1 -0
  68. package/{toast → list}/package.json +1 -1
  69. package/list/style.css +1 -0
  70. package/loading/index.es.js +2 -2
  71. package/modal/index.es.js +300 -960
  72. package/modal/index.umd.js +1 -1
  73. package/modal/style.css +1 -1
  74. package/nav-sprite/index.es.js +1 -675
  75. package/nav-sprite/index.umd.js +1 -1
  76. package/{toast → notification}/index.d.ts +0 -0
  77. package/notification/index.es.js +284 -0
  78. package/notification/index.umd.js +1 -0
  79. package/notification/package.json +7 -0
  80. package/notification/style.css +1 -0
  81. package/nuxt/components/DropdownMenu.js +3 -0
  82. package/nuxt/components/IFileOptions.js +3 -0
  83. package/nuxt/components/IUploadOptions.js +3 -0
  84. package/nuxt/components/List.js +3 -0
  85. package/nuxt/components/ListItem.js +3 -0
  86. package/nuxt/components/Notification.js +3 -0
  87. package/nuxt/components/NotificationService.js +3 -0
  88. package/nuxt/components/PanelBody.js +3 -0
  89. package/nuxt/components/PanelFooter.js +3 -0
  90. package/nuxt/components/PanelHeader.js +3 -0
  91. package/nuxt/components/Timeline.js +3 -0
  92. package/nuxt/components/TimelineItem.js +3 -0
  93. package/nuxt/components/UploadStatus.js +3 -0
  94. package/nuxt/components/alertProps.js +3 -0
  95. package/nuxt/components/badgeProps.js +3 -0
  96. package/nuxt/components/dropdownMenuProps.js +3 -0
  97. package/nuxt/components/fixedOverlayProps.js +3 -0
  98. package/nuxt/components/flexibleOverlayProps.js +3 -0
  99. package/nuxt/components/fullscreenProps.js +3 -0
  100. package/nuxt/components/iconProps.js +2 -0
  101. package/nuxt/components/notificationProps.js +3 -0
  102. package/nuxt/components/overlayEmits.js +3 -0
  103. package/nuxt/components/overlayProps.js +3 -0
  104. package/nuxt/components/paginationProps.js +3 -0
  105. package/nuxt/components/panelProps.js +3 -0
  106. package/nuxt/components/popoverProps.js +3 -0
  107. package/nuxt/components/searchProps.js +3 -0
  108. package/nuxt/components/tooltipProps.js +3 -0
  109. package/nuxt/components/uploadProps.js +3 -0
  110. package/overlay/index.es.js +152 -198
  111. package/overlay/index.umd.js +1 -1
  112. package/overlay/style.css +1 -1
  113. package/package.json +12 -60
  114. package/pagination/index.es.js +11 -13
  115. package/pagination/index.umd.js +1 -1
  116. package/pagination/style.css +1 -1
  117. package/panel/index.es.js +48 -35
  118. package/panel/index.umd.js +1 -1
  119. package/popover/index.es.js +5954 -201
  120. package/popover/index.umd.js +27 -1
  121. package/popover/style.css +1 -1
  122. package/quadrant-diagram/index.es.js +5405 -166
  123. package/quadrant-diagram/index.umd.js +27 -1
  124. package/radio/style.css +1 -1
  125. package/read-tip/index.es.js +6 -3
  126. package/read-tip/style.css +1 -1
  127. package/result/index.es.js +38 -53
  128. package/result/index.umd.js +1 -1
  129. package/ripple/index.es.js +10 -6
  130. package/search/index.es.js +5428 -200
  131. package/search/index.umd.js +27 -1
  132. package/search/style.css +1 -1
  133. package/select/index.es.js +43 -43
  134. package/select/index.umd.js +1 -1
  135. package/select/style.css +1 -1
  136. package/skeleton/index.es.js +17 -17
  137. package/skeleton/index.umd.js +1 -1
  138. package/slider/index.es.js +2 -1
  139. package/splitter/index.es.js +5815 -99
  140. package/splitter/index.umd.js +27 -1
  141. package/splitter/style.css +1 -1
  142. package/status/index.es.js +1 -4
  143. package/status/index.umd.js +1 -1
  144. package/status/style.css +1 -1
  145. package/steps-guide/index.es.js +6 -3
  146. package/sticky/index.umd.js +1 -1
  147. package/style.css +1 -1
  148. package/table/index.es.js +548 -360
  149. package/table/index.umd.js +1 -1
  150. package/table/style.css +1 -1
  151. package/tabs/index.es.js +3 -4
  152. package/tabs/index.umd.js +1 -1
  153. package/tabs/style.css +1 -1
  154. package/tag/index.es.js +2 -1
  155. package/tag-input/index.es.js +4 -2
  156. package/textarea/style.css +1 -1
  157. package/{theme → theme/theme.scss} +0 -0
  158. package/time-picker/index.es.js +98 -123
  159. package/time-picker/index.umd.js +1 -1
  160. package/time-picker/style.css +1 -1
  161. package/timeline/index.d.ts +7 -0
  162. package/{time-axis → timeline}/index.es.js +65 -78
  163. package/timeline/index.umd.js +1 -0
  164. package/{time-axis → timeline}/package.json +1 -1
  165. package/timeline/style.css +1 -0
  166. package/tooltip/index.es.js +5804 -94
  167. package/tooltip/index.umd.js +27 -1
  168. package/tooltip/style.css +1 -1
  169. package/transfer/index.es.js +5896 -404
  170. package/transfer/index.umd.js +27 -1
  171. package/transfer/style.css +1 -1
  172. package/tree/index.es.js +5439 -814
  173. package/tree/index.umd.js +27 -1
  174. package/tree/style.css +1 -1
  175. package/tree-select/index.es.js +11 -7
  176. package/tree-select/style.css +1 -1
  177. package/upload/index.es.js +335 -2213
  178. package/upload/index.umd.js +1 -1
  179. package/upload/style.css +1 -1
  180. package/vue-devui.es.js +9709 -12248
  181. package/vue-devui.umd.js +20 -20
  182. package/nuxt/components/TimeAxis.js +0 -3
  183. package/nuxt/components/TimeAxisItem.js +0 -3
  184. package/nuxt/components/Toast.js +0 -3
  185. package/nuxt/components/ToastService.js +0 -3
  186. package/time-axis/index.umd.js +0 -1
  187. package/time-axis/style.css +0 -1
  188. package/toast/index.es.js +0 -2063
  189. package/toast/index.umd.js +0 -1
  190. package/toast/style.css +0 -1
package/table/index.es.js CHANGED
@@ -21,7 +21,9 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { computed, ref, watch, defineComponent, inject, createVNode, mergeProps, toRef, provide, Teleport, Transition, renderSlot, isVNode, onMounted, onUnmounted, withDirectives, vShow, reactive, isRef, toRefs, Fragment, shallowRef, getCurrentInstance, createTextVNode, resolveDirective, onBeforeMount, h, onBeforeUnmount, render } from "vue";
24
+ import { computed, ref, watch, defineComponent, inject, createVNode, mergeProps, toRef, provide, toRefs, onMounted, onUnmounted, Teleport, Transition, renderSlot, isVNode, unref, nextTick, Fragment, withDirectives, vShow, shallowRef, getCurrentInstance, createTextVNode, resolveDirective, reactive, onBeforeMount, h, onBeforeUnmount, render } from "vue";
25
+ import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
26
+ import { onClickOutside } from "@vueuse/core";
25
27
  const TableProps = {
26
28
  data: {
27
29
  type: Array,
@@ -155,7 +157,7 @@ const createColumnGenerator = () => {
155
157
  const _columns = ref([]);
156
158
  const insertColumn = (column) => {
157
159
  _columns.value.push(column);
158
- _columns.value.sort((a, b) => a.order > b.order ? 1 : -1);
160
+ _columns.value.sort((a, b) => a.order - b.order);
159
161
  };
160
162
  const sortColumn = () => {
161
163
  _columns.value.sort((a, b) => a.order > b.order ? 1 : -1);
@@ -209,7 +211,7 @@ const createSelection = (dataSource, _data) => {
209
211
  };
210
212
  };
211
213
  const createSorter = (dataSource, _data) => {
212
- const sortData = (field, direction, compareFn = (field2, a, b) => a[field2] > b[field2]) => {
214
+ const sortData = (field, direction, compareFn = (fieldKey, a, b) => a[fieldKey] > b[fieldKey]) => {
213
215
  if (direction === "ASC") {
214
216
  _data.value = _data.value.sort((a, b) => compareFn(field, a, b) ? 1 : -1);
215
217
  } else if (direction === "DESC") {
@@ -221,13 +223,13 @@ const createSorter = (dataSource, _data) => {
221
223
  return { sortData };
222
224
  };
223
225
  const createFilter = (dataSource, _data) => {
224
- const fieldSet = new Set();
226
+ const fieldSet = /* @__PURE__ */ new Set();
225
227
  const filterData = (field, results) => {
226
228
  fieldSet.add(field);
227
229
  const fields = [...fieldSet];
228
230
  _data.value = dataSource.value.filter((item) => {
229
- return fields.reduce((prev, field2) => {
230
- return prev && results.indexOf(item[field2]) !== -1;
231
+ return fields.reduce((prev, fieldKey) => {
232
+ return prev && results.indexOf(item[fieldKey]) !== -1;
231
233
  }, true);
232
234
  });
233
235
  };
@@ -686,14 +688,7 @@ const Sort = defineComponent({
686
688
  }
687
689
  });
688
690
  const dropdownProps = {
689
- origin: {
690
- type: Object
691
- },
692
- isOpen: {
693
- type: Boolean,
694
- default: false
695
- },
696
- disabled: {
691
+ visible: {
697
692
  type: Boolean,
698
693
  default: false
699
694
  },
@@ -705,6 +700,18 @@ const dropdownProps = {
705
700
  type: String,
706
701
  default: "all"
707
702
  },
703
+ position: {
704
+ type: Array,
705
+ default: ["bottom"]
706
+ },
707
+ align: {
708
+ type: String,
709
+ default: null
710
+ },
711
+ offset: {
712
+ type: [Number, Object],
713
+ default: 4
714
+ },
708
715
  closeOnMouseLeaveMenu: {
709
716
  type: Boolean,
710
717
  default: false
@@ -713,14 +720,15 @@ const dropdownProps = {
713
720
  type: Boolean,
714
721
  default: true
715
722
  },
716
- width: {
717
- type: [Number, String],
718
- default: "102px"
723
+ overlayClass: {
724
+ type: String,
725
+ default: ""
726
+ },
727
+ destroyOnHide: {
728
+ type: Boolean,
729
+ default: true
719
730
  }
720
731
  };
721
- function isComponent(target) {
722
- return !!(target == null ? void 0 : target.$el);
723
- }
724
732
  function getElement(element) {
725
733
  if (element instanceof Element) {
726
734
  return element;
@@ -730,85 +738,158 @@ function getElement(element) {
730
738
  }
731
739
  return null;
732
740
  }
741
+ const dropdownMap = /* @__PURE__ */ new Map();
733
742
  function subscribeEvent(dom, type, callback) {
734
743
  dom == null ? void 0 : dom.addEventListener(type, callback);
735
744
  return () => {
736
745
  dom == null ? void 0 : dom.removeEventListener(type, callback);
737
746
  };
738
747
  }
739
- const useDropdown = ({
740
- visible,
741
- trigger,
742
- origin,
743
- closeScope,
744
- closeOnMouseLeaveMenu
745
- }) => {
746
- const dropdownElRef = ref();
747
- const closeByScope = () => {
748
- if (closeScope.value === "none") {
749
- return;
750
- }
751
- visible.value = false;
748
+ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
749
+ let overlayEnter = false;
750
+ let originEnter = false;
751
+ const { trigger, closeScope, closeOnMouseLeaveMenu } = toRefs(props);
752
+ const toggle = (status) => {
753
+ isOpen.value = status;
754
+ emit("toggle", isOpen.value);
752
755
  };
753
- watch([trigger, origin, dropdownElRef], ([trigger2, origin2, dropdownEl], ov, onInvalidate) => {
754
- const originEl = getElement(origin2);
755
- if (!originEl || !dropdownEl) {
756
+ const handleLeave = async (elementType, closeAll) => {
757
+ await new Promise((resolve) => setTimeout(resolve, 50));
758
+ if (elementType === "origin" && overlayEnter || elementType === "dropdown" && originEnter) {
756
759
  return;
757
760
  }
758
- const subscriptions = [
759
- subscribeEvent(dropdownEl, "click", () => {
760
- if (closeScope.value === "all") {
761
- visible.value = false;
762
- }
763
- })
764
- ];
765
- if (trigger2 === "click") {
766
- subscriptions.push(subscribeEvent(originEl, "click", () => visible.value = !visible.value), subscribeEvent(document, "click", (e) => {
767
- if (!visible.value) {
768
- return;
769
- }
770
- const target = e.target;
771
- const isContain = originEl.contains(target) || dropdownEl.contains(target);
772
- if (isContain) {
761
+ if (closeAll) {
762
+ [...dropdownMap.values()].reverse().forEach((item) => {
763
+ setTimeout(() => {
764
+ var _a;
765
+ (_a = item.toggle) == null ? void 0 : _a.call(item);
766
+ }, 0);
767
+ });
768
+ }
769
+ toggle(false);
770
+ };
771
+ watch([trigger, origin, dropdownRef], ([triggerVal, originVal, dropdownEl], ov, onInvalidate) => {
772
+ const originEl = getElement(originVal);
773
+ const subscriptions = [];
774
+ setTimeout(() => {
775
+ subscriptions.push(subscribeEvent(document, "click", (e) => {
776
+ const dropdownValues = [...dropdownMap.values()];
777
+ if (!isOpen.value || closeScope.value === "none" || dropdownEl.contains(e.target) && closeScope.value === "blank" || dropdownValues.some((item) => {
778
+ var _a;
779
+ return (_a = item.toggleEl) == null ? void 0 : _a.contains(e.target);
780
+ }) && dropdownValues.some((item) => {
781
+ var _a;
782
+ return (_a = item.menuEl) == null ? void 0 : _a.contains(e.target);
783
+ })) {
773
784
  return;
774
785
  }
775
- closeByScope();
776
- }), subscribeEvent(dropdownEl, "mouseleave", () => {
777
- if (closeOnMouseLeaveMenu.value) {
778
- visible.value = false;
779
- }
786
+ [...dropdownMap.values()].reverse().forEach((item) => {
787
+ setTimeout(() => {
788
+ var _a, _b;
789
+ if (!((_a = item.toggleEl) == null ? void 0 : _a.contains(e.target))) {
790
+ (_b = item.toggle) == null ? void 0 : _b.call(item);
791
+ }
792
+ }, 0);
793
+ });
794
+ overlayEnter = false;
780
795
  }));
781
- } else if (trigger2 === "hover") {
782
- let overlayEnter = false;
783
- let originEnter = false;
784
- const handleLeave = async (elementType) => {
785
- await new Promise((resolve) => setTimeout(resolve, 50));
786
- if (elementType === "origin" && overlayEnter || elementType === "dropdown" && originEnter) {
787
- return;
796
+ }, 0);
797
+ if (triggerVal === "click") {
798
+ subscriptions.push(subscribeEvent(originEl, "click", () => toggle(!isOpen.value)), subscribeEvent(dropdownEl, "mouseleave", (e) => {
799
+ var _a;
800
+ if (closeOnMouseLeaveMenu.value && !((_a = dropdownMap.get(id).child) == null ? void 0 : _a.contains(e.relatedTarget))) {
801
+ handleLeave("dropdown", true);
788
802
  }
789
- closeByScope();
790
- };
803
+ }));
804
+ } else if (triggerVal === "hover") {
791
805
  subscriptions.push(subscribeEvent(originEl, "mouseenter", () => {
792
806
  originEnter = true;
793
- visible.value = true;
807
+ toggle(true);
794
808
  }), subscribeEvent(originEl, "mouseleave", () => {
795
809
  originEnter = false;
796
- if (!closeOnMouseLeaveMenu.value) {
797
- handleLeave("origin");
798
- }
810
+ handleLeave("origin");
799
811
  }), subscribeEvent(dropdownEl, "mouseenter", () => {
800
812
  overlayEnter = true;
801
- visible.value = true;
802
- }), subscribeEvent(dropdownEl, "mouseleave", () => {
813
+ isOpen.value = true;
814
+ }), subscribeEvent(dropdownEl, "mouseleave", (e) => {
815
+ var _a;
803
816
  overlayEnter = false;
804
- handleLeave("dropdown");
817
+ if (e.relatedTarget && ((originEl == null ? void 0 : originEl.contains(e.relatedTarget)) || ((_a = dropdownMap.get(id).child) == null ? void 0 : _a.contains(e.relatedTarget)))) {
818
+ return;
819
+ }
820
+ handleLeave("dropdown", true);
805
821
  }));
806
822
  }
807
823
  onInvalidate(() => subscriptions.forEach((v) => v()));
808
824
  });
809
- return { dropdownEl: dropdownElRef };
810
825
  };
811
- var overlay = "";
826
+ function useDropdown(id, visible, isOpen, origin, dropdownRef, popDirection, emit) {
827
+ const calcPopDirection = (dropdownEl) => {
828
+ const elementHeight = dropdownEl.offsetHeight;
829
+ const bottomDistance = window.innerHeight - origin.value.getBoundingClientRect().bottom;
830
+ const isBottomEnough = bottomDistance >= elementHeight;
831
+ if (!isBottomEnough) {
832
+ popDirection.value = "top";
833
+ } else {
834
+ popDirection.value = "bottom";
835
+ }
836
+ };
837
+ watch(visible, (newVal, oldVal) => {
838
+ if (oldVal === void 0) {
839
+ return;
840
+ }
841
+ isOpen.value = newVal;
842
+ emit("toggle", isOpen.value);
843
+ }, { immediate: true });
844
+ watch([isOpen, dropdownRef], ([isOpenVal, dropdownEl]) => {
845
+ var _a;
846
+ if (isOpenVal) {
847
+ dropdownMap.set(id, __spreadProps(__spreadValues({}, dropdownMap.get(id)), {
848
+ menuEl: dropdownEl,
849
+ toggle: () => {
850
+ isOpen.value = false;
851
+ emit("toggle", isOpen.value);
852
+ }
853
+ }));
854
+ for (const value of dropdownMap.values()) {
855
+ if ((_a = value.menuEl) == null ? void 0 : _a.contains(origin.value)) {
856
+ value.child = dropdownEl;
857
+ }
858
+ }
859
+ }
860
+ if (dropdownEl) {
861
+ calcPopDirection(dropdownEl);
862
+ }
863
+ });
864
+ onMounted(() => {
865
+ dropdownMap.set(id, { toggleEl: origin.value });
866
+ });
867
+ onUnmounted(() => {
868
+ dropdownMap.delete(id);
869
+ });
870
+ }
871
+ function useOverlayProps(props, currentPosition, isOpen) {
872
+ const { showAnimation, overlayClass, destroyOnHide } = toRefs(props);
873
+ const overlayModelValue = ref(false);
874
+ const overlayShowValue = ref(false);
875
+ const styles = computed(() => ({
876
+ transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%"
877
+ }));
878
+ const classes = computed(() => ({
879
+ "fade-in-bottom": showAnimation.value && isOpen.value && currentPosition.value === "bottom",
880
+ "fade-in-top": showAnimation.value && isOpen.value && currentPosition.value === "top",
881
+ [`${overlayClass.value}`]: true
882
+ }));
883
+ const handlePositionChange = (pos) => {
884
+ currentPosition.value = pos.includes("top") || pos.includes("end") ? "top" : "bottom";
885
+ };
886
+ watch(isOpen, (isOpenVal) => {
887
+ overlayModelValue.value = destroyOnHide.value ? isOpenVal : true;
888
+ overlayShowValue.value = isOpenVal;
889
+ });
890
+ return { overlayModelValue, overlayShowValue, styles, classes, handlePositionChange };
891
+ }
892
+ var baseOverlay = "";
812
893
  function _isSlot(s) {
813
894
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
814
895
  }
@@ -855,28 +936,13 @@ const overlayProps = {
855
936
  default: true
856
937
  }
857
938
  };
858
- const overlayEmits = ["update:visible", "backdropClick"];
859
939
  const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
860
940
  overlayStyle: {
861
941
  type: [String, Object],
862
942
  default: void 0
863
943
  }
864
944
  });
865
- const flexibleOverlayProps = __spreadValues({
866
- origin: {
867
- type: Object,
868
- require: true
869
- },
870
- position: {
871
- type: Object,
872
- default: () => ({
873
- originX: "left",
874
- originY: "top",
875
- overlayX: "left",
876
- overlayY: "top"
877
- })
878
- }
879
- }, overlayProps);
945
+ const overlayEmits = ["update:visible", "backdropClick"];
880
946
  function useOverlayLogic(props, ctx) {
881
947
  const backgroundClass = computed(() => {
882
948
  return [
@@ -927,7 +993,8 @@ function useOverlayLogic(props, ctx) {
927
993
  handleOverlayBubbleCancel
928
994
  };
929
995
  }
930
- const FixedOverlay = defineComponent({
996
+ var fixedOverlay = "";
997
+ defineComponent({
931
998
  name: "DFixedOverlay",
932
999
  props: fixedOverlayProps,
933
1000
  emits: overlayEmits,
@@ -939,7 +1006,7 @@ const FixedOverlay = defineComponent({
939
1006
  handleOverlayBubbleCancel
940
1007
  } = useOverlayLogic(props, ctx);
941
1008
  return () => createVNode(CommonOverlay, null, {
942
- default: () => [withDirectives(createVNode("div", {
1009
+ default: () => [props.visible && createVNode("div", {
943
1010
  "class": backgroundClass.value,
944
1011
  "style": props.backgroundStyle,
945
1012
  "onClick": handleBackdropClick
@@ -947,250 +1014,340 @@ const FixedOverlay = defineComponent({
947
1014
  "class": overlayClass.value,
948
1015
  "style": props.overlayStyle,
949
1016
  "onClick": handleOverlayBubbleCancel
950
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
1017
+ }, [renderSlot(ctx.slots, "default")])])]
951
1018
  });
952
1019
  }
953
1020
  });
954
- const FlexibleOverlay = defineComponent({
955
- name: "DFlexibleOverlay",
956
- props: flexibleOverlayProps,
957
- emits: overlayEmits,
958
- setup(props, ctx) {
959
- const overlayRef = ref(null);
960
- const positionedStyle = reactive({
961
- position: "absolute"
962
- });
963
- onMounted(async () => {
964
- const handleRectChange = (position, rect, origin) => {
965
- const point = calculatePosition(position, rect, origin);
966
- positionedStyle.left = `${point.x}px`;
967
- positionedStyle.top = `${point.y}px`;
968
- };
969
- const locationElements = computed(() => {
970
- const overlay2 = overlayRef.value;
971
- const origin = getOrigin(props.origin);
972
- if (!overlay2 || !origin) {
973
- return;
974
- }
975
- return {
976
- origin,
977
- overlay: overlay2
978
- };
979
- });
980
- const visibleRef = toRef(props, "visible");
981
- const positionRef = toRef(props, "position");
982
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
983
- if (!visible || !locationElements2) {
984
- return;
985
- }
986
- const {
987
- origin,
988
- overlay: overlay2
989
- } = locationElements2;
990
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
991
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
992
- onInvalidate(() => {
993
- unsubscriptions.forEach((fn) => fn());
994
- });
995
- });
996
- });
997
- const {
998
- backgroundClass,
999
- overlayClass,
1000
- handleBackdropClick,
1001
- handleOverlayBubbleCancel
1002
- } = useOverlayLogic(props, ctx);
1003
- return () => createVNode(CommonOverlay, null, {
1004
- default: () => [withDirectives(createVNode("div", {
1005
- "style": props.backgroundStyle,
1006
- "class": backgroundClass.value,
1007
- "onClick": handleBackdropClick
1008
- }, [createVNode("div", {
1009
- "ref": overlayRef,
1010
- "class": overlayClass.value,
1011
- "style": positionedStyle,
1012
- "onClick": handleOverlayBubbleCancel
1013
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
1014
- });
1015
- }
1016
- });
1017
- function getOrigin(origin) {
1018
- if (origin instanceof Element) {
1019
- return origin;
1020
- }
1021
- if (isRef(origin)) {
1022
- return getElement(origin.value);
1023
- }
1024
- if (isComponent(origin)) {
1025
- return getElement(origin);
1021
+ const flexibleOverlayProps = {
1022
+ modelValue: {
1023
+ type: Boolean,
1024
+ default: false
1025
+ },
1026
+ origin: {
1027
+ type: Object,
1028
+ require: true
1029
+ },
1030
+ position: {
1031
+ type: Array,
1032
+ default: ["bottom"]
1033
+ },
1034
+ offset: {
1035
+ type: [Number, Object],
1036
+ default: 8
1037
+ },
1038
+ align: {
1039
+ type: String,
1040
+ default: null
1041
+ },
1042
+ showArrow: {
1043
+ type: Boolean,
1044
+ default: false
1045
+ },
1046
+ isArrowCenter: {
1047
+ type: Boolean,
1048
+ default: true
1026
1049
  }
1027
- return origin;
1028
- }
1029
- function calculatePosition(position, rect, origin) {
1030
- const originRect = getOriginRect(origin);
1031
- const originPoint = getOriginRelativePoint(originRect, position);
1032
- return getOverlayPoint(originPoint, rect, position);
1033
- }
1034
- function getOriginRect(origin) {
1035
- if (origin instanceof Element) {
1036
- return origin.getBoundingClientRect();
1050
+ };
1051
+ function getScrollParent(element) {
1052
+ const overflowRegex = /(auto|scroll|hidden)/;
1053
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
1054
+ const style = window.getComputedStyle(parent);
1055
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
1056
+ return parent;
1057
+ }
1037
1058
  }
1038
- const width = origin.width || 0;
1039
- const height = origin.height || 0;
1040
- return {
1041
- top: origin.y,
1042
- bottom: origin.y + height,
1043
- left: origin.x,
1044
- right: origin.x + width,
1045
- height,
1046
- width
1047
- };
1059
+ return window;
1048
1060
  }
1049
- function getOverlayPoint(originPoint, rect, position) {
1050
- let x;
1051
- const {
1052
- width,
1053
- height
1054
- } = rect;
1055
- if (position.overlayX == "center") {
1056
- x = originPoint.x - width / 2;
1057
- } else {
1058
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
1059
- }
1060
- let y;
1061
- if (position.overlayY == "center") {
1062
- y = originPoint.y - height / 2;
1063
- } else {
1064
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
1061
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
1062
+ let { x, y } = point;
1063
+ if (!isArrowCenter) {
1064
+ const { width, height } = originRect;
1065
+ if (x && placement.includes("start")) {
1066
+ x = 12;
1067
+ }
1068
+ if (x && placement.includes("end")) {
1069
+ x = Math.round(width - 24);
1070
+ }
1071
+ if (y && placement.includes("start")) {
1072
+ y = 10;
1073
+ }
1074
+ if (y && placement.includes("end")) {
1075
+ y = height - 14;
1076
+ }
1065
1077
  }
1066
- return {
1067
- x,
1068
- y
1069
- };
1078
+ return { x, y };
1070
1079
  }
1071
- function getOriginRelativePoint(originRect, position) {
1072
- let x;
1073
- if (position.originX == "center") {
1074
- x = originRect.left + originRect.width / 2;
1075
- } else {
1076
- const startX = originRect.left;
1077
- const endX = originRect.right;
1078
- x = position.originX == "left" ? startX : endX;
1079
- }
1080
- let y;
1081
- if (position.originY == "center") {
1082
- y = originRect.top + originRect.height / 2;
1083
- } else {
1084
- y = position.originY == "top" ? originRect.top : originRect.bottom;
1085
- }
1086
- return {
1087
- x,
1088
- y
1089
- };
1090
- }
1091
- function subscribeLayoutEvent(event) {
1092
- window.addEventListener("scroll", event, true);
1093
- window.addEventListener("resize", event);
1094
- window.addEventListener("orientationchange", event);
1095
- return () => {
1096
- window.removeEventListener("scroll", event, true);
1097
- window.removeEventListener("resize", event);
1098
- window.removeEventListener("orientationchange", event);
1080
+ function useOverlay(props, emit) {
1081
+ const overlayRef = ref();
1082
+ const arrowRef = ref();
1083
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
1084
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
1085
+ const staticSide = {
1086
+ top: "bottom",
1087
+ right: "left",
1088
+ bottom: "top",
1089
+ left: "right"
1090
+ }[placement.split("-")[0]];
1091
+ Object.assign(arrowEl.style, {
1092
+ left: x ? `${x}px` : "",
1093
+ top: y ? `${y}px` : "",
1094
+ right: "",
1095
+ bottom: "",
1096
+ [staticSide]: "-4px"
1097
+ });
1099
1098
  };
1100
- }
1101
- function subscribeOverlayResize(overlay2, callback) {
1102
- if (overlay2 instanceof Element) {
1103
- const resizeObserver = new ResizeObserver(callback);
1104
- resizeObserver.observe(overlay2);
1105
- return () => resizeObserver.disconnect();
1106
- }
1107
- return () => {
1099
+ const updatePosition = async () => {
1100
+ const hostEl = props.origin;
1101
+ const overlayEl = unref(overlayRef.value);
1102
+ const arrowEl = unref(arrowRef.value);
1103
+ const middleware = [
1104
+ shift(),
1105
+ offset(props.offset),
1106
+ autoPlacement({
1107
+ alignment: props.align,
1108
+ allowedPlacements: props.position
1109
+ })
1110
+ ];
1111
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
1112
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
1113
+ strategy: "fixed",
1114
+ middleware
1115
+ });
1116
+ emit("positionChange", placement);
1117
+ Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
1118
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
1108
1119
  };
1120
+ watch(() => props.modelValue, () => {
1121
+ const originParent = getScrollParent(props.origin);
1122
+ if (props.modelValue && props.origin) {
1123
+ nextTick(updatePosition);
1124
+ originParent.addEventListener("scroll", updatePosition);
1125
+ originParent !== window && window.addEventListener("scroll", updatePosition);
1126
+ window.addEventListener("resize", updatePosition);
1127
+ } else {
1128
+ originParent.removeEventListener("scroll", updatePosition);
1129
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
1130
+ window.removeEventListener("resize", updatePosition);
1131
+ }
1132
+ });
1133
+ onUnmounted(() => {
1134
+ const originParent = getScrollParent(props.origin);
1135
+ originParent.removeEventListener("scroll", updatePosition);
1136
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
1137
+ window.removeEventListener("resize", updatePosition);
1138
+ });
1139
+ return { arrowRef, overlayRef, updatePosition };
1109
1140
  }
1110
- function subscribeOriginResize(origin, callback) {
1111
- if (origin instanceof Element) {
1112
- const observer = new MutationObserver(callback);
1113
- observer.observe(origin, {
1114
- attributeFilter: ["style"]
1141
+ var flexibleOverlay = "";
1142
+ const FlexibleOverlay = defineComponent({
1143
+ name: "DFlexibleOverlay",
1144
+ inheritAttrs: false,
1145
+ props: flexibleOverlayProps,
1146
+ emits: ["update:modelValue", "positionChange"],
1147
+ setup(props, {
1148
+ slots,
1149
+ attrs,
1150
+ emit,
1151
+ expose
1152
+ }) {
1153
+ const {
1154
+ arrowRef,
1155
+ overlayRef,
1156
+ updatePosition
1157
+ } = useOverlay(props, emit);
1158
+ expose({
1159
+ updatePosition
1115
1160
  });
1116
- return () => observer.disconnect();
1161
+ return () => {
1162
+ var _a;
1163
+ return props.modelValue && createVNode("div", mergeProps({
1164
+ "ref": overlayRef,
1165
+ "class": "devui-flexible-overlay"
1166
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
1167
+ "ref": arrowRef,
1168
+ "class": "devui-flexible-overlay-arrow"
1169
+ }, null)]);
1170
+ };
1117
1171
  }
1118
- return () => {
1119
- };
1120
- }
1121
- FlexibleOverlay.install = function(app) {
1122
- app.component(FlexibleOverlay.name, FlexibleOverlay);
1123
- };
1124
- FixedOverlay.install = function(app) {
1125
- app.component(FixedOverlay.name, FixedOverlay);
1126
- };
1172
+ });
1127
1173
  var dropdown = "";
1174
+ let dropdownId = 1;
1128
1175
  var Dropdown = defineComponent({
1129
1176
  name: "DDropdown",
1177
+ inheritAttrs: false,
1130
1178
  props: dropdownProps,
1131
- emits: [],
1132
- setup(props, ctx) {
1179
+ emits: ["toggle"],
1180
+ setup(props, {
1181
+ slots,
1182
+ attrs,
1183
+ emit,
1184
+ expose
1185
+ }) {
1133
1186
  const {
1187
+ visible,
1188
+ position,
1189
+ align,
1190
+ offset: offset2,
1191
+ showAnimation
1192
+ } = toRefs(props);
1193
+ const origin = ref();
1194
+ const dropdownRef = ref();
1195
+ const overlayRef = ref();
1196
+ const id = `dropdown_${dropdownId++}`;
1197
+ const isOpen = ref(false);
1198
+ const currentPosition = ref("bottom");
1199
+ useDropdownEvent({
1200
+ id,
1134
1201
  isOpen,
1135
1202
  origin,
1136
- trigger,
1137
- closeScope,
1138
- closeOnMouseLeaveMenu
1139
- } = toRefs(props);
1140
- const visible = ref(false);
1141
- watch(isOpen, (value) => {
1142
- visible.value = value;
1143
- }, {
1144
- immediate: true
1203
+ dropdownRef,
1204
+ props,
1205
+ emit
1206
+ });
1207
+ useDropdown(id, visible, isOpen, origin, dropdownRef, currentPosition, emit);
1208
+ const {
1209
+ overlayModelValue,
1210
+ overlayShowValue,
1211
+ styles,
1212
+ classes,
1213
+ handlePositionChange
1214
+ } = useOverlayProps(props, currentPosition, isOpen);
1215
+ expose({
1216
+ updatePosition: () => overlayRef.value.updatePosition()
1145
1217
  });
1146
- const position = {
1147
- originX: "center",
1148
- originY: "bottom",
1149
- overlayX: "center",
1150
- overlayY: "top"
1218
+ return () => {
1219
+ var _a;
1220
+ return createVNode(Fragment, null, [createVNode("div", {
1221
+ "ref": origin,
1222
+ "class": "devui-dropdown-toggle"
1223
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
1224
+ "to": "body"
1225
+ }, {
1226
+ default: () => [createVNode(Transition, {
1227
+ "name": showAnimation.value ? `devui-dropdown-fade-${currentPosition.value}` : ""
1228
+ }, {
1229
+ default: () => [withDirectives(createVNode(FlexibleOverlay, {
1230
+ "modelValue": overlayModelValue.value,
1231
+ "onUpdate:modelValue": ($event) => overlayModelValue.value = $event,
1232
+ "ref": overlayRef,
1233
+ "origin": origin.value,
1234
+ "position": position.value,
1235
+ "align": align.value,
1236
+ "offset": offset2.value,
1237
+ "onPositionChange": handlePositionChange,
1238
+ "class": classes.value,
1239
+ "style": styles.value
1240
+ }, {
1241
+ default: () => {
1242
+ var _a2;
1243
+ return [createVNode("div", mergeProps({
1244
+ "ref": dropdownRef,
1245
+ "class": "devui-dropdown-menu-wrap"
1246
+ }, attrs), [(_a2 = slots.menu) == null ? void 0 : _a2.call(slots)])];
1247
+ }
1248
+ }), [[vShow, overlayShowValue.value]])]
1249
+ })]
1250
+ })]);
1151
1251
  };
1252
+ }
1253
+ });
1254
+ const dropdownMenuProps = {
1255
+ modelValue: {
1256
+ type: Boolean,
1257
+ default: false
1258
+ },
1259
+ origin: {
1260
+ type: Object,
1261
+ require: true
1262
+ },
1263
+ position: {
1264
+ type: Array,
1265
+ default: ["bottom"]
1266
+ },
1267
+ align: {
1268
+ type: String,
1269
+ default: null
1270
+ },
1271
+ offset: {
1272
+ type: [Number, Object],
1273
+ default: 4
1274
+ },
1275
+ clickOutside: {
1276
+ type: Function,
1277
+ default: () => true
1278
+ },
1279
+ showAnimation: {
1280
+ type: Boolean,
1281
+ default: true
1282
+ },
1283
+ overlayClass: {
1284
+ type: String,
1285
+ default: ""
1286
+ }
1287
+ };
1288
+ defineComponent({
1289
+ name: "DDropdownMenu",
1290
+ inheritAttrs: false,
1291
+ props: dropdownMenuProps,
1292
+ emits: ["update:modelValue"],
1293
+ setup(props, {
1294
+ slots,
1295
+ attrs,
1296
+ emit
1297
+ }) {
1152
1298
  const {
1153
- dropdownEl
1154
- } = useDropdown({
1155
- visible,
1299
+ modelValue,
1156
1300
  origin,
1157
- trigger,
1158
- closeScope,
1159
- closeOnMouseLeaveMenu
1160
- });
1161
- const animatedVisible = computed(() => {
1162
- return props.showAnimation ? visible.value : true;
1163
- });
1164
- const wrapStyle = computed(() => typeof props.width === "string" ? {
1165
- width: props.width
1166
- } : {
1167
- width: `${props.width}px`
1301
+ position,
1302
+ align,
1303
+ offset: offset2,
1304
+ clickOutside,
1305
+ showAnimation,
1306
+ overlayClass
1307
+ } = toRefs(props);
1308
+ const dropdownMenuRef = ref(null);
1309
+ onClickOutside(dropdownMenuRef, (value) => {
1310
+ var _a, _b;
1311
+ if (((_a = clickOutside.value) == null ? void 0 : _a.call(clickOutside)) && !((_b = origin == null ? void 0 : origin.value) == null ? void 0 : _b.contains(value.target))) {
1312
+ emit("update:modelValue", false);
1313
+ }
1168
1314
  });
1169
- return () => createVNode(FlexibleOverlay, {
1170
- "origin": props.origin,
1171
- "visible": visible.value,
1172
- "onUpdate:visible": ($event) => visible.value = $event,
1173
- "position": position,
1174
- "hasBackdrop": false
1315
+ const currentPosition = ref("bottom");
1316
+ const handlePositionChange = (pos) => {
1317
+ currentPosition.value = pos.split("-")[0] === "top" ? "top" : "bottom";
1318
+ };
1319
+ const styles = computed(() => ({
1320
+ transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%"
1321
+ }));
1322
+ return () => createVNode(Teleport, {
1323
+ "to": "body"
1175
1324
  }, {
1176
1325
  default: () => [createVNode(Transition, {
1177
- "name": "devui-dropdown-fade"
1326
+ "name": showAnimation.value ? `devui-dropdown-fade-${currentPosition.value}` : ""
1178
1327
  }, {
1179
- default: () => {
1180
- var _a, _b;
1181
- return [withDirectives(createVNode("div", {
1182
- "ref": dropdownEl,
1183
- "class": "devui-dropdown-menu-wrap",
1184
- "style": wrapStyle.value
1185
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, animatedVisible.value]])];
1186
- }
1328
+ default: () => [createVNode(FlexibleOverlay, {
1329
+ "modelValue": modelValue.value,
1330
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
1331
+ "origin": origin == null ? void 0 : origin.value,
1332
+ "position": position.value,
1333
+ "align": align.value,
1334
+ "offset": offset2.value,
1335
+ "onPositionChange": handlePositionChange,
1336
+ "class": overlayClass.value,
1337
+ "style": styles.value
1338
+ }, {
1339
+ default: () => {
1340
+ var _a;
1341
+ return [createVNode("div", mergeProps({
1342
+ "ref": dropdownMenuRef,
1343
+ "class": "devui-dropdown-menu-wrap"
1344
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)])];
1345
+ }
1346
+ })]
1187
1347
  })]
1188
1348
  });
1189
1349
  }
1190
1350
  });
1191
- Dropdown.install = function(app) {
1192
- app.component(Dropdown.name, Dropdown);
1193
- };
1194
1351
  var filter = "";
1195
1352
  const Filter = defineComponent({
1196
1353
  props: {
@@ -1424,48 +1581,74 @@ const TD = defineComponent({
1424
1581
  }, [column.value.renderCell(props.row, props.index)]);
1425
1582
  }
1426
1583
  });
1427
- var table = "";
1428
- var Table = defineComponent({
1429
- name: "DTable",
1430
- props: TableProps,
1431
- setup(props, ctx) {
1432
- const table2 = getCurrentInstance();
1433
- const store = createStore(toRef(props, "data"));
1434
- table2.store = store;
1435
- provide(TABLE_TOKEN, table2);
1436
- const {
1437
- classes,
1438
- style
1439
- } = useTable(props);
1440
- const isEmpty2 = computed(() => props.data.length === 0);
1441
- const fixHeaderCompo = computed(() => {
1584
+ var FixHeader = defineComponent({
1585
+ props: {
1586
+ classes: {
1587
+ type: Object,
1588
+ default: () => ({})
1589
+ },
1590
+ isEmpty: {
1591
+ type: Boolean
1592
+ }
1593
+ },
1594
+ setup(props) {
1595
+ return () => {
1442
1596
  return createVNode("div", {
1443
1597
  "class": "devui-table-view"
1444
1598
  }, [createVNode("div", {
1445
- "style": "overflow: hidden scroll;"
1599
+ "style": "overflow:hidden scroll;"
1446
1600
  }, [createVNode("table", {
1447
- "class": classes.value,
1601
+ "class": props.classes,
1448
1602
  "cellpadding": "0",
1449
1603
  "cellspacing": "0"
1450
1604
  }, [createVNode(ColGroup, null, null), createVNode(TableHeader, null, null)])]), createVNode("div", {
1451
1605
  "class": "scroll-view"
1452
1606
  }, [createVNode("table", {
1453
- "class": classes.value,
1607
+ "class": props.classes,
1454
1608
  "cellpadding": "0",
1455
1609
  "cellspacing": "0"
1456
- }, [createVNode(ColGroup, null, null), !isEmpty2.value && createVNode(TableBody, {
1610
+ }, [createVNode(ColGroup, null, null), !props.isEmpty && createVNode(TableBody, {
1457
1611
  "style": "flex: 1"
1458
1612
  }, null)])])]);
1459
- });
1460
- const normalHeaderCompo = computed(() => {
1613
+ };
1614
+ }
1615
+ });
1616
+ var NormalHeader = defineComponent({
1617
+ props: {
1618
+ classes: {
1619
+ type: Object,
1620
+ default: () => ({})
1621
+ },
1622
+ isEmpty: {
1623
+ type: Boolean
1624
+ }
1625
+ },
1626
+ setup(props) {
1627
+ return () => {
1461
1628
  return createVNode("table", {
1462
- "class": classes.value,
1629
+ "class": props.classes,
1463
1630
  "cellpadding": "0",
1464
1631
  "cellspacing": "0"
1465
1632
  }, [createVNode(ColGroup, null, null), createVNode(TableHeader, {
1466
- "style": "position: relative"
1467
- }, null), !isEmpty2.value && createVNode(TableBody, null, null)]);
1468
- });
1633
+ "style": "position:relative"
1634
+ }, null), !props.isEmpty && createVNode(TableBody, null, null)]);
1635
+ };
1636
+ }
1637
+ });
1638
+ var table = "";
1639
+ var Table = defineComponent({
1640
+ name: "DTable",
1641
+ props: TableProps,
1642
+ setup(props, ctx) {
1643
+ const table2 = getCurrentInstance();
1644
+ const store = createStore(toRef(props, "data"));
1645
+ table2.store = store;
1646
+ provide(TABLE_TOKEN, table2);
1647
+ const {
1648
+ classes,
1649
+ style
1650
+ } = useTable(props);
1651
+ const isEmpty2 = computed(() => props.data.length === 0);
1469
1652
  ctx.expose({
1470
1653
  getCheckedRows() {
1471
1654
  return store.getCheckedRows();
@@ -1474,7 +1657,13 @@ var Table = defineComponent({
1474
1657
  return () => withDirectives(createVNode("div", {
1475
1658
  "class": "devui-table-wrapper",
1476
1659
  "style": style.value
1477
- }, [ctx.slots.default(), props.fixHeader ? fixHeaderCompo.value : normalHeaderCompo.value, isEmpty2.value && createVNode("div", {
1660
+ }, [ctx.slots.default(), props.fixHeader ? createVNode(FixHeader, {
1661
+ "classes": classes.value,
1662
+ "is-empty": isEmpty2.value
1663
+ }, null) : createVNode(NormalHeader, {
1664
+ "classes": classes.value,
1665
+ "is-empty": isEmpty2.value
1666
+ }, null), isEmpty2.value && createVNode("div", {
1478
1667
  "class": "devui-table-empty"
1479
1668
  }, [createTextVNode("No Data")])]), [[resolveDirective("dLoading"), props.showLoading]]);
1480
1669
  }
@@ -1539,6 +1728,9 @@ function formatWidth(width) {
1539
1728
  function formatMinWidth(minWidth) {
1540
1729
  return formatWidth(minWidth) || 80;
1541
1730
  }
1731
+ function defaultRenderHeader() {
1732
+ return h("span", { class: "title" }, this.header);
1733
+ }
1542
1734
  function createColumn(props, templates) {
1543
1735
  const {
1544
1736
  field,
@@ -1556,31 +1748,38 @@ function createColumn(props, templates) {
1556
1748
  fixedRight
1557
1749
  } = props;
1558
1750
  const column = reactive({});
1559
- watch([field, header2, order], ([field2, header22, order2]) => {
1560
- column.field = field2;
1561
- column.header = header22;
1562
- column.order = order2;
1751
+ function defaultRenderCell(rowData, index2) {
1752
+ var _a, _b;
1753
+ const value = rowData[this.field];
1754
+ if (templates.default) {
1755
+ return templates.default(rowData);
1756
+ }
1757
+ if (this.formatter) {
1758
+ return this.formatter(rowData, value, index2);
1759
+ }
1760
+ return (_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : "";
1761
+ }
1762
+ watch([field, header2, order], ([fieldVal, headerVal, orderVal]) => {
1763
+ column.field = fieldVal;
1764
+ column.header = headerVal;
1765
+ column.order = orderVal;
1563
1766
  }, { immediate: true });
1564
- watch([sortable, compareFn], ([sortable2, compareFn2]) => {
1565
- column.sortable = sortable2;
1566
- column.compareFn = compareFn2;
1767
+ watch([sortable, compareFn], ([sortableVal, compareFnVal]) => {
1768
+ column.sortable = sortableVal;
1769
+ column.compareFn = compareFnVal;
1567
1770
  });
1568
- watch([
1569
- filterable,
1570
- filterList,
1571
- filterMultiple
1572
- ], ([filterable2, filterList2, filterMultiple2]) => {
1573
- column.filterable = filterable2;
1574
- column.filterMultiple = filterMultiple2;
1575
- column.filterList = filterList2;
1771
+ watch([filterable, filterList, filterMultiple], ([filterableVal, filterListVal, filterMultipleVal]) => {
1772
+ column.filterable = filterableVal;
1773
+ column.filterMultiple = filterMultipleVal;
1774
+ column.filterList = filterListVal;
1576
1775
  }, { immediate: true });
1577
1776
  watch([fixedLeft, fixedRight], ([left, right]) => {
1578
1777
  column.fixedLeft = left;
1579
1778
  column.fixedRight = right;
1580
1779
  }, { immediate: true });
1581
- watch([width, minWidth], ([width2, minWidth2]) => {
1582
- column.width = formatWidth(width2);
1583
- column.minWidth = formatMinWidth(minWidth2);
1780
+ watch([width, minWidth], ([widthVal, minWidthVal]) => {
1781
+ column.width = formatWidth(widthVal);
1782
+ column.minWidth = formatMinWidth(minWidthVal);
1584
1783
  column.realWidth = column.width || column.minWidth;
1585
1784
  });
1586
1785
  onBeforeMount(() => {
@@ -1592,17 +1791,6 @@ function createColumn(props, templates) {
1592
1791
  });
1593
1792
  return column;
1594
1793
  }
1595
- function defaultRenderHeader() {
1596
- return h("span", { class: "title" }, this.header);
1597
- }
1598
- function defaultRenderCell(rowData, index2) {
1599
- var _a, _b;
1600
- const value = rowData[this.field];
1601
- if (this.formatter) {
1602
- return this.formatter(rowData, value, index2);
1603
- }
1604
- return (_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : "";
1605
- }
1606
1794
  var Column = defineComponent({
1607
1795
  name: "DColumn",
1608
1796
  props: TableColumnProps,
@@ -1727,7 +1915,7 @@ function unmountComponent(ComponnetInstance) {
1727
1915
  render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1728
1916
  }
1729
1917
  const loadingConstructor = defineComponent(Loading);
1730
- const cacheInstance = new WeakSet();
1918
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
1731
1919
  const isEmpty = (val) => {
1732
1920
  if (!val)
1733
1921
  return true;