@dt-frames/ui 2.0.1 → 2.0.3

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 (220) hide show
  1. package/es/assets/data/icons/actions.d.ts +1 -0
  2. package/es/assets/data/icons/actions.ts +423 -0
  3. package/es/assets/data/icons/code.d.ts +1 -0
  4. package/es/assets/data/icons/code.ts +10 -0
  5. package/es/assets/data/icons/commuticate.d.ts +1 -0
  6. package/es/assets/data/icons/commuticate.ts +182 -0
  7. package/es/assets/data/icons/currency.d.ts +1 -0
  8. package/es/assets/data/icons/currency.ts +44 -0
  9. package/es/assets/data/icons/devices.d.ts +1 -0
  10. package/es/assets/data/icons/devices.ts +126 -0
  11. package/es/assets/data/icons/edit.d.ts +1 -0
  12. package/es/assets/data/icons/edit.ts +163 -0
  13. package/es/assets/data/icons/file.d.ts +1 -0
  14. package/es/assets/data/icons/file.ts +99 -0
  15. package/es/assets/data/icons/math.d.ts +1 -0
  16. package/es/assets/data/icons/math.ts +53 -0
  17. package/es/assets/data/icons/message.d.ts +1 -0
  18. package/es/assets/data/icons/message.ts +68 -0
  19. package/es/assets/data/icons/navigate.d.ts +1 -0
  20. package/es/assets/data/icons/navigate.ts +181 -0
  21. package/es/assets/data/icons/other.d.ts +1 -0
  22. package/es/assets/data/icons/other.ts +324 -0
  23. package/es/assets/data/index.d.ts +4 -0
  24. package/es/assets/data/index.ts +58 -0
  25. package/es/assets/icons/iconfont.css +7266 -0
  26. package/es/assets/icons/iconfont.eot +0 -0
  27. package/es/assets/icons/iconfont.svg +5445 -0
  28. package/es/assets/icons/iconfont.ttf +0 -0
  29. package/es/assets/icons/iconfont.woff +0 -0
  30. package/es/assets/icons/iconfont.woff2 +0 -0
  31. package/es/assets/imgs/header/avatar.png +0 -0
  32. package/es/assets/imgs/logo/logo.png +0 -0
  33. package/es/assets/imgs/table/empty.png +0 -0
  34. package/es/assets/locales/en.d.ts +101 -0
  35. package/es/assets/locales/en.ts +101 -0
  36. package/es/assets/locales/index.d.ts +2 -0
  37. package/es/assets/locales/index.ts +5 -0
  38. package/es/assets/locales/zh.d.ts +103 -0
  39. package/es/assets/locales/zh.ts +103 -0
  40. package/es/components/container/index.d.ts +94 -0
  41. package/es/components/container/index.js +290 -0
  42. package/es/components/container/index.less +64 -0
  43. package/es/components/container/src/components/bar.d.ts +14 -0
  44. package/es/components/container/src/components/scroll-bar.d.ts +70 -0
  45. package/es/components/container/src/hooks/scroll.d.ts +10 -0
  46. package/es/components/container/src/scroll-container.d.ts +76 -0
  47. package/es/components/container/src/slot-container.d.ts +20 -0
  48. package/es/components/container/src/types/scroll.type.d.ts +22 -0
  49. package/es/components/container/src/utils/scroll.d.ts +5 -0
  50. package/es/components/curd/index.d.ts +2 -0
  51. package/es/components/curd/index.js +3120 -0
  52. package/es/components/curd/src/components/Curd.d.ts +1246 -0
  53. package/es/components/curd/src/hooks/useCurd.d.ts +112 -0
  54. package/es/components/curd/src/props.d.ts +187 -0
  55. package/es/components/curd/src/types/curd.type.d.ts +19 -0
  56. package/es/components/drawer/index.d.ts +8039 -0
  57. package/es/components/drawer/index.js +838 -0
  58. package/es/components/drawer/index.less +10 -0
  59. package/es/components/drawer/src/components/DrawerFooter.d.ts +139 -0
  60. package/es/components/drawer/src/components/DrawerHeader.d.ts +11 -0
  61. package/es/components/drawer/src/hooks/useDrawer.d.ts +3 -0
  62. package/es/components/drawer/src/index.d.ts +8041 -0
  63. package/es/components/drawer/src/props.d.ts +64 -0
  64. package/es/components/drawer/src/types/index.type.d.ts +48 -0
  65. package/es/components/form/index.d.ts +3219 -0
  66. package/es/components/form/index.js +1896 -0
  67. package/es/components/form/index.less +141 -0
  68. package/es/components/form/src/components/FormButtons.d.ts +88 -0
  69. package/es/components/form/src/components/FormItem.d.ts +165 -0
  70. package/es/components/form/src/components/componentMap.d.ts +4 -0
  71. package/es/components/form/src/components/formIcon.d.ts +1231 -0
  72. package/es/components/form/src/components/formInputUseDialog.d.ts +911 -0
  73. package/es/components/form/src/components/index.d.ts +4 -0
  74. package/es/components/form/src/components/radioButton.d.ts +34 -0
  75. package/es/components/form/src/enums/index.d.ts +7 -0
  76. package/es/components/form/src/hooks/helper.d.ts +14 -0
  77. package/es/components/form/src/hooks/useForm.d.ts +6 -0
  78. package/es/components/form/src/hooks/useFormActions.d.ts +12 -0
  79. package/es/components/form/src/hooks/useFormEvent.d.ts +25 -0
  80. package/es/components/form/src/hooks/useFormValue.d.ts +3 -0
  81. package/es/components/form/src/hooks/useFormValues.d.ts +11 -0
  82. package/es/components/form/src/hooks/useLabelWidth.d.ts +22 -0
  83. package/es/components/form/src/index.d.ts +2965 -0
  84. package/es/components/form/src/props.d.ts +133 -0
  85. package/es/components/form/src/types/actions.type.d.ts +15 -0
  86. package/es/components/form/src/types/form.type.d.ts +70 -0
  87. package/es/components/icons/index.d.ts +497 -0
  88. package/es/components/icons/index.js +1969 -0
  89. package/es/components/icons/index.less +42 -0
  90. package/es/components/icons/src/pick-icon.d.ts +455 -0
  91. package/es/components/icons/src/svg-icon.d.ts +44 -0
  92. package/es/components/modal/index.d.ts +3 -0
  93. package/es/components/modal/index.js +1193 -0
  94. package/es/components/modal/index.less +54 -0
  95. package/es/components/modal/src/components/CloseIcon.d.ts +40 -0
  96. package/es/components/modal/src/components/Modal.d.ts +108 -0
  97. package/es/components/modal/src/components/ModalFooter.d.ts +139 -0
  98. package/es/components/modal/src/components/ModalWrap.d.ts +153 -0
  99. package/es/components/modal/src/hooks/useDrag.d.ts +7 -0
  100. package/es/components/modal/src/hooks/useFullScreen.d.ts +6 -0
  101. package/es/components/modal/src/hooks/useModal.d.ts +5 -0
  102. package/es/components/modal/src/index.d.ts +774 -0
  103. package/es/components/modal/src/props.d.ts +100 -0
  104. package/es/components/modal/src/types/modal.type.d.ts +17 -0
  105. package/es/components/source/hooks/useDownload.d.ts +8 -0
  106. package/es/components/source/hooks/useSource.d.ts +40 -0
  107. package/es/components/source/index.d.ts +2 -0
  108. package/es/components/source/index.js +332 -0
  109. package/es/components/source/types/source.type.d.ts +37 -0
  110. package/es/components/source/utils/index.d.ts +8 -0
  111. package/es/components/table/index.d.ts +3 -0
  112. package/es/components/table/index.js +3983 -0
  113. package/es/components/table/index.less +192 -0
  114. package/es/components/table/src/components/TableAction.d.ts +70 -0
  115. package/es/components/table/src/components/TableHeader.d.ts +1136 -0
  116. package/es/components/table/src/components/TableRender.d.ts +17 -0
  117. package/es/components/table/src/components/editTable/CellComponent.d.ts +22 -0
  118. package/es/components/table/src/components/editTable/EditTableCell.d.ts +93 -0
  119. package/es/components/table/src/components/editTable/componentMap.d.ts +4 -0
  120. package/es/components/table/src/components/editTable/index.d.ts +9 -0
  121. package/es/components/table/src/components/editTable/props.d.ts +27 -0
  122. package/es/components/table/src/components/tableSetting/Column.d.ts +69 -0
  123. package/es/components/table/src/components/tableSetting/Download.d.ts +922 -0
  124. package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +888 -0
  125. package/es/components/table/src/components/tableSetting/Fullscreen.d.ts +22 -0
  126. package/es/components/table/src/components/tableSetting/index.d.ts +1030 -0
  127. package/es/components/table/src/hooks/useColumns.d.ts +14 -0
  128. package/es/components/table/src/hooks/useCustomRow.d.ts +20 -0
  129. package/es/components/table/src/hooks/useDataSource.d.ts +15 -0
  130. package/es/components/table/src/hooks/useHeader.d.ts +8 -0
  131. package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -0
  132. package/es/components/table/src/hooks/useLoading.d.ts +6 -0
  133. package/es/components/table/src/hooks/usePagination.d.ts +7 -0
  134. package/es/components/table/src/hooks/useRow.d.ts +5 -0
  135. package/es/components/table/src/hooks/useRowSelection.d.ts +12 -0
  136. package/es/components/table/src/hooks/useTable.d.ts +9 -0
  137. package/es/components/table/src/hooks/useTableInstance.d.ts +16 -0
  138. package/es/components/table/src/hooks/useTableScroll.d.ts +13 -0
  139. package/es/components/table/src/index.d.ts +644 -0
  140. package/es/components/table/src/props.d.ts +185 -0
  141. package/es/components/table/src/types/actions.type.d.ts +21 -0
  142. package/es/components/table/src/types/header.type.d.ts +23 -0
  143. package/es/components/table/src/types/table.type.d.ts +98 -0
  144. package/es/directives/icon.d.ts +2 -0
  145. package/es/directives/index.d.ts +7 -0
  146. package/es/directives/index.js +2015 -0
  147. package/es/directives/permission.d.ts +2 -0
  148. package/es/global.d.ts +7 -0
  149. package/es/index.d.ts +1 -0
  150. package/es/index.js +4 -0
  151. package/es/theme/index.d.ts +10 -0
  152. package/es/theme/index.js +3255 -0
  153. package/es/theme/index.less +603 -0
  154. package/es/theme/src/components/content/index.d.ts +27 -0
  155. package/es/theme/src/components/feature/back-top.d.ts +5 -0
  156. package/es/theme/src/components/feature/index.d.ts +7 -0
  157. package/es/theme/src/components/footer/index.d.ts +31 -0
  158. package/es/theme/src/components/header/components/bread-crumb.d.ts +6 -0
  159. package/es/theme/src/components/header/components/fullscreen.d.ts +5 -0
  160. package/es/theme/src/components/header/components/index.d.ts +11 -0
  161. package/es/theme/src/components/header/components/lang-picker.d.ts +23 -0
  162. package/es/theme/src/components/header/components/logo.d.ts +35 -0
  163. package/es/theme/src/components/header/components/menu-filter.d.ts +22 -0
  164. package/es/theme/src/components/header/components/notify.d.ts +24 -0
  165. package/es/theme/src/components/header/components/setting-theme.d.ts +223 -0
  166. package/es/theme/src/components/header/components/size.d.ts +282 -0
  167. package/es/theme/src/components/header/components/theme-drawer/feature.d.ts +138 -0
  168. package/es/theme/src/components/header/components/theme-drawer/index.d.ts +3 -0
  169. package/es/theme/src/components/header/components/theme-drawer/menu-type.d.ts +16 -0
  170. package/es/theme/src/components/header/components/theme-drawer/select.d.ts +58 -0
  171. package/es/theme/src/components/header/components/theme-drawer/switch.d.ts +49 -0
  172. package/es/theme/src/components/header/components/trigger.d.ts +10 -0
  173. package/es/theme/src/components/header/components/user-info.d.ts +37 -0
  174. package/es/theme/src/components/header/helper/change-theme.d.ts +13 -0
  175. package/es/theme/src/components/header/helper/menu-tree.d.ts +3 -0
  176. package/es/theme/src/components/header/index.d.ts +699 -0
  177. package/es/theme/src/components/header/multiple-header.d.ts +785 -0
  178. package/es/theme/src/components/sider/components/basic-menu/basic-menu-item.d.ts +62 -0
  179. package/es/theme/src/components/sider/components/basic-menu/basic-menu.d.ts +207 -0
  180. package/es/theme/src/components/sider/components/basic-menu/basic-sub-menu-item.d.ts +127 -0
  181. package/es/theme/src/components/sider/components/basic-menu/menu-item-content.d.ts +26 -0
  182. package/es/theme/src/components/sider/components/drag-bar.d.ts +14 -0
  183. package/es/theme/src/components/sider/components/layout-menu.d.ts +22 -0
  184. package/es/theme/src/components/sider/components/props.d.ts +69 -0
  185. package/es/theme/src/components/sider/components/sider-trigger.d.ts +18 -0
  186. package/es/theme/src/components/sider/helper/sider.d.ts +12 -0
  187. package/es/theme/src/components/sider/helper/split-menu.d.ts +10 -0
  188. package/es/theme/src/components/sider/index.d.ts +70 -0
  189. package/es/theme/src/components/tabs/components/TabContent.d.ts +6 -0
  190. package/es/theme/src/components/tabs/components/TabRedo.d.ts +21 -0
  191. package/es/theme/src/components/tabs/components/index.d.ts +3 -0
  192. package/es/theme/src/components/tabs/hooks/useMultifyTabs.d.ts +7 -0
  193. package/es/theme/src/components/tabs/hooks/useTabDropdown.d.ts +6 -0
  194. package/es/theme/src/components/tabs/index.d.ts +63 -0
  195. package/es/theme/src/components/tabs/types/tabs.type.d.ts +7 -0
  196. package/es/theme/src/enums/index.d.ts +1 -0
  197. package/es/theme/src/enums/theme.enum.d.ts +33 -0
  198. package/es/theme/src/hooks/index.d.ts +6 -0
  199. package/es/theme/src/hooks/useDragLine.d.ts +2 -0
  200. package/es/theme/src/hooks/useHeader.d.ts +25 -0
  201. package/es/theme/src/hooks/useMenu.d.ts +27 -0
  202. package/es/theme/src/hooks/useMultifyTab.d.ts +7 -0
  203. package/es/theme/src/hooks/useOpenKeys.d.ts +7 -0
  204. package/es/theme/src/hooks/useTheme.d.ts +9 -0
  205. package/es/theme/src/index.d.ts +1643 -0
  206. package/es/theme/src/setting/theme.setting.d.ts +2 -0
  207. package/es/theme/src/stores/index.d.ts +3 -0
  208. package/es/theme/src/stores/routeReuse.store.d.ts +23 -0
  209. package/es/theme/src/stores/theme.store.d.ts +15 -0
  210. package/es/theme/src/types/index.d.ts +3 -0
  211. package/es/theme/src/types/menu.type.d.ts +15 -0
  212. package/es/theme/src/types/theme.type.d.ts +60 -0
  213. package/es/utils/withInstall.d.ts +4 -0
  214. package/index.d.ts +10 -0
  215. package/index.js +34 -0
  216. package/package.json +3 -6
  217. package/tailwind.config.cjs +11 -0
  218. package/tsconfig.json +41 -0
  219. package/tsconfig.node.json +9 -0
  220. package/vite.config.ts +51 -0
@@ -0,0 +1,1193 @@
1
+ import { useApp, isFunction, isObject, error, useTimeoutFn, useSlots, useI18n, off, on, windowResizeFn, dispatchResize, isArray, deepMerge } from "@dt-frames/core";
2
+ import { reactive, ref as ref$1, watchEffect, unref, nextTick, onUnmounted, toRefs, useAttrs, createVNode, isVNode, defineComponent, computed, openBlock, createElementBlock, normalizeClass, Fragment, createBlock, withCtx, createElementVNode, createCommentVNode, getCurrentInstance as getCurrentInstance$1, inject, h as h$1, provide, onMounted as onMounted$1, normalizeStyle, resolveDynamicComponent, renderSlot, mergeProps, watch, resolveDirective, normalizeProps, renderList, withDirectives, createTextVNode, toDisplayString, createSlots, guardReactiveProps } from "vue";
3
+ import { Tooltip, Button, FormItem, Col, Spin } from "ant-design-vue/es";
4
+ import "ant-design-vue/es/spin/style";
5
+ import { omit } from "lodash-es";
6
+ import { Modal } from "ant-design-vue";
7
+ import "ant-design-vue/es/tooltip/style";
8
+ import "ant-design-vue/es/col/style";
9
+ import "ant-design-vue/es/form/style";
10
+ import "ant-design-vue/es/button/style";
11
+ const orgDialogProp = reactive({});
12
+ const cbTransfer = reactive({});
13
+ const dataTransfer = reactive({});
14
+ function useModalOut() {
15
+ const modal = ref$1(null);
16
+ const loaded = ref$1(true);
17
+ const uid = ref$1(null);
18
+ const { isProd } = useApp();
19
+ function register(modalMethod, uuid) {
20
+ if (!getCurrentInstance()) {
21
+ throw new Error("useModal\u53EA\u80FD\u5728setup()\u6216\u8005\u51FD\u6570\u4E2D\u4F7F\u7528");
22
+ }
23
+ uid.value = uuid;
24
+ onUnmounted(() => {
25
+ if (unref(isProd)) {
26
+ modal.value = null;
27
+ loaded.value = false;
28
+ dataTransfer[unref(uid)] = null;
29
+ orgDialogProp[unref(uid)] = null;
30
+ cbTransfer[unref(uid)] = (res) => {
31
+ };
32
+ }
33
+ });
34
+ if (unref(loaded) && modalMethod === unref(modal))
35
+ return;
36
+ modal.value = modalMethod;
37
+ loaded.value = true;
38
+ }
39
+ const getInstance = () => {
40
+ const instance = unref(modal);
41
+ if (!instance) {
42
+ error("useModalOut \u5B9E\u4F8B\u672A\u5B9A\u4E49");
43
+ }
44
+ return instance;
45
+ };
46
+ const methods = {
47
+ setModalProps: (props) => {
48
+ getInstance()?.setModalProps(props);
49
+ },
50
+ redoModalHeight: () => {
51
+ getInstance()?.redoModalHeight?.();
52
+ },
53
+ openModal: (params, afterClose) => {
54
+ const id = unref(uid);
55
+ dataTransfer[id] = isObject(params) ? { ...toRaw(params) } : params;
56
+ getInstance()?.setModalProps({
57
+ footer: [],
58
+ defaultFullscreen: false,
59
+ ...orgDialogProp[id],
60
+ visible: true
61
+ });
62
+ cbTransfer[id] = (res) => {
63
+ if (afterClose && isFunction(afterClose)) {
64
+ afterClose(res);
65
+ }
66
+ };
67
+ },
68
+ closeModal: () => {
69
+ getInstance()?.setModalProps({ visible: false });
70
+ }
71
+ };
72
+ return [register, methods];
73
+ }
74
+ function useModal(props, setModalData) {
75
+ const modalInstanceRef = ref$1(null);
76
+ const currentInstance = getCurrentInstance();
77
+ const uidRef = ref$1(null);
78
+ const { isProd } = useApp();
79
+ const getInstance = () => {
80
+ const instance = unref(modalInstanceRef);
81
+ if (!instance) {
82
+ error("useModal \u5B9E\u4F8B\u672A\u5B9A\u4E49");
83
+ }
84
+ return instance;
85
+ };
86
+ const register = (modalInstance, uuid) => {
87
+ if (unref(isProd)) {
88
+ modalInstanceRef.value = null;
89
+ }
90
+ uidRef.value = uuid;
91
+ modalInstanceRef.value = modalInstance;
92
+ currentInstance?.emit("register", modalInstance, uuid);
93
+ orgDialogProp[uuid] = toRaw(props);
94
+ modalInstance.setModalProps(props);
95
+ };
96
+ watchEffect(() => {
97
+ const data = dataTransfer[unref(uidRef)];
98
+ if (!data)
99
+ return;
100
+ if (!setModalData || !isFunction(setModalData))
101
+ return;
102
+ nextTick(() => {
103
+ setModalData(data);
104
+ });
105
+ });
106
+ const methods = {
107
+ setLoading: (loading = true) => {
108
+ getInstance()?.setModalProps({ loading });
109
+ },
110
+ closeModal: (rsp) => {
111
+ if (cbTransfer[unref(uidRef)])
112
+ cbTransfer[unref(uidRef)](rsp);
113
+ getInstance()?.setModalProps({ visible: false });
114
+ },
115
+ setModalProps: (props2) => {
116
+ getInstance()?.setModalProps(props2);
117
+ },
118
+ redoModalHeight: () => {
119
+ const callRedo = getInstance()?.redoModalHeight;
120
+ callRedo && callRedo();
121
+ }
122
+ };
123
+ return [register, methods];
124
+ }
125
+ const basicProps = {
126
+ t: {
127
+ type: String
128
+ },
129
+ visible: {
130
+ type: Boolean
131
+ },
132
+ closable: {
133
+ type: Boolean,
134
+ default: true
135
+ },
136
+ destroyOnClose: {
137
+ type: Boolean
138
+ },
139
+ scrollTop: {
140
+ type: Boolean,
141
+ default: true
142
+ },
143
+ height: { type: Number },
144
+ minHeight: { type: Number },
145
+ width: { type: [String, Number] },
146
+ draggable: {
147
+ type: Boolean,
148
+ default: true
149
+ },
150
+ defaultFullscreen: {
151
+ type: Boolean
152
+ },
153
+ canFullscreen: {
154
+ type: Boolean,
155
+ default: true
156
+ },
157
+ title: {
158
+ type: String
159
+ },
160
+ loading: { type: Boolean, default: false },
161
+ loadingTip: { type: String, default: "\u52A0\u8F7D\u4E2D..." },
162
+ useWrapper: {
163
+ type: Boolean,
164
+ default: true
165
+ },
166
+ wrapClassName: { type: String },
167
+ zIndex: { type: Number },
168
+ centered: { type: Boolean },
169
+ showOkBtn: {
170
+ type: Boolean,
171
+ default: true
172
+ },
173
+ showCancelBtn: {
174
+ type: Boolean,
175
+ default: true
176
+ },
177
+ okText: {
178
+ type: String
179
+ },
180
+ cancelText: {
181
+ type: String
182
+ },
183
+ mask: { type: Boolean, default: true },
184
+ maskClosable: { type: Boolean, default: true },
185
+ keyboard: { type: Boolean, default: true },
186
+ maskStyle: Object,
187
+ footer: {
188
+ type: Object
189
+ },
190
+ bodyStyle: Object,
191
+ wrapperProps: Object,
192
+ getContainer: Function,
193
+ closeFunc: Function,
194
+ afterClose: Function
195
+ };
196
+ function useDragMove(context) {
197
+ const getStyle = (dom, attr) => {
198
+ return getComputedStyle(dom)[attr];
199
+ };
200
+ const drag = (wrap) => {
201
+ if (!wrap)
202
+ return;
203
+ wrap.setAttribute("data-drag", unref(context.draggable));
204
+ const dialogHeaderEl = wrap.querySelector(".ant-modal-header");
205
+ const dragDom = wrap.querySelector(".ant-modal");
206
+ if (!dialogHeaderEl || !dragDom || !unref(context.draggable))
207
+ return;
208
+ dialogHeaderEl.style.cursor = "move";
209
+ dialogHeaderEl.onmousedown = (e) => {
210
+ if (!e)
211
+ return;
212
+ const disX = e.clientX;
213
+ const disY = e.clientY;
214
+ const screenWidth = document.body.clientWidth;
215
+ const screenHeight = document.documentElement.clientHeight;
216
+ const dragDomWidth = dragDom.offsetWidth;
217
+ const dragDomheight = dragDom.offsetHeight;
218
+ console.log(dragDomWidth, dragDomheight, screenHeight, screenWidth);
219
+ const minDragDomLeft = dragDom.offsetLeft;
220
+ const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
221
+ const minDragDomTop = dragDom.offsetTop;
222
+ const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
223
+ const domLeft = getStyle(dragDom, "left");
224
+ const domTop = getStyle(dragDom, "top");
225
+ let styL = +domLeft;
226
+ let styT = +domTop;
227
+ if (domLeft.includes("%")) {
228
+ styL = +document.body.clientWidth * (+domLeft.replace(/%/g, "") / 100);
229
+ styT = +document.body.clientHeight * (+domTop.replace(/%/g, "") / 100);
230
+ } else {
231
+ styL = +domLeft.replace(/px/g, "");
232
+ styT = +domTop.replace(/px/g, "");
233
+ }
234
+ document.onmousemove = function(e2) {
235
+ let left = e2.clientX - disX;
236
+ let top = e2.clientY - disY;
237
+ if (-left > minDragDomLeft) {
238
+ left = -minDragDomLeft;
239
+ } else if (left > maxDragDomLeft) {
240
+ left = maxDragDomLeft;
241
+ }
242
+ if (-top > minDragDomTop) {
243
+ top = -minDragDomTop;
244
+ } else if (top > maxDragDomTop) {
245
+ top = maxDragDomTop;
246
+ }
247
+ dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
248
+ };
249
+ document.onmouseup = () => {
250
+ document.onmousemove = null;
251
+ document.onmouseup = null;
252
+ };
253
+ };
254
+ };
255
+ const handleDrag = () => {
256
+ const dragWraps = document.querySelectorAll(".ant-modal-wrap");
257
+ for (const wrap of Array.from(dragWraps)) {
258
+ if (!wrap)
259
+ continue;
260
+ const display = getStyle(wrap, "display");
261
+ const draggable = wrap.getAttribute("data-drag");
262
+ if (display !== "none") {
263
+ if (draggable === null || unref(context.destroyOnClose)) {
264
+ drag(wrap);
265
+ }
266
+ }
267
+ }
268
+ };
269
+ watchEffect(() => {
270
+ if (!unref(context.visible) || !unref(context.draggable)) {
271
+ return;
272
+ }
273
+ useTimeoutFn(() => {
274
+ handleDrag();
275
+ }, 30);
276
+ });
277
+ }
278
+ function _isSlot(s) {
279
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
280
+ }
281
+ const _sfc_main$8 = {
282
+ name: "Modal",
283
+ inheritAttrs: false,
284
+ props: basicProps,
285
+ emits: ["cancel"],
286
+ setup(props, {
287
+ slots,
288
+ emit
289
+ }) {
290
+ const {
291
+ visible,
292
+ draggable,
293
+ destroyOnClose
294
+ } = toRefs(props);
295
+ const attrs = useAttrs();
296
+ useDragMove({
297
+ visible,
298
+ destroyOnClose,
299
+ draggable
300
+ });
301
+ const {
302
+ extendSlots
303
+ } = useSlots();
304
+ const onCancel = (e) => emit("cancel", e);
305
+ return () => {
306
+ let _slot;
307
+ const propsData = {
308
+ ...unref(attrs),
309
+ ...props,
310
+ destroyOnClose: true,
311
+ onCancel
312
+ };
313
+ if (!propsData?.visible)
314
+ return null;
315
+ return createVNode(Modal, propsData, _isSlot(_slot = extendSlots(slots)) ? _slot : {
316
+ default: () => [_slot]
317
+ });
318
+ };
319
+ }
320
+ };
321
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
322
+ __name: "CloseIcon",
323
+ props: {
324
+ canFullscreen: { type: Boolean, default: true },
325
+ fullScreen: { type: Boolean }
326
+ },
327
+ emits: ["cancel", "fullscreen"],
328
+ setup(__props, { emit }) {
329
+ const props = __props;
330
+ const { t } = useI18n("UI");
331
+ const getClass = computed(() => {
332
+ return [
333
+ "dt-basic-modal-close",
334
+ `dt-basic-modal-close--custom`,
335
+ {
336
+ [`dt-basic-modal-close--can-full`]: props.canFullscreen
337
+ }
338
+ ];
339
+ });
340
+ function handleCancel(e) {
341
+ emit("cancel", e);
342
+ }
343
+ function handleFullScreen(e) {
344
+ e?.stopPropagation();
345
+ e?.preventDefault();
346
+ emit("fullscreen");
347
+ }
348
+ return (_ctx, _cache) => {
349
+ const _component_ATooltip = Tooltip;
350
+ return openBlock(), createElementBlock("div", {
351
+ class: normalizeClass(["flex h-14 items-center justify-center", unref(getClass)])
352
+ }, [
353
+ __props.canFullscreen ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
354
+ __props.fullScreen ? (openBlock(), createBlock(_component_ATooltip, {
355
+ key: 0,
356
+ title: unref(t)("EXIT_FULLSCREEN"),
357
+ placement: "bottom"
358
+ }, {
359
+ default: withCtx(() => [
360
+ createElementVNode("i", {
361
+ class: "i ic:baseline-fullscreen-exit hover:font-bold inline-block w-10 h-14 pr-4",
362
+ onClick: handleFullScreen
363
+ })
364
+ ]),
365
+ _: 1
366
+ }, 8, ["title"])) : (openBlock(), createBlock(_component_ATooltip, {
367
+ key: 1,
368
+ title: unref(t)("FULLSCREEN"),
369
+ placement: "bottom"
370
+ }, {
371
+ default: withCtx(() => [
372
+ createElementVNode("i", {
373
+ class: "i ic:baseline-fullscreen hover:font-bold inline-block h-14 w-10 pr-4",
374
+ onClick: handleFullScreen
375
+ })
376
+ ]),
377
+ _: 1
378
+ }, 8, ["title"]))
379
+ ], 64)) : createCommentVNode("", true),
380
+ createElementVNode("i", {
381
+ class: "i mdi:close h-14 w-10 pr-4",
382
+ onClick: handleCancel
383
+ })
384
+ ], 2);
385
+ };
386
+ }
387
+ });
388
+ const isServer = typeof window === "undefined";
389
+ const BAR_MAP = {
390
+ vertical: {
391
+ offset: "offsetHeight",
392
+ scroll: "scrollTop",
393
+ scrollSize: "scrollHeight",
394
+ size: "height",
395
+ key: "vertical",
396
+ axis: "Y",
397
+ client: "clientY",
398
+ direction: "top"
399
+ },
400
+ horizontal: {
401
+ offset: "offsetWidth",
402
+ scroll: "scrollLeft",
403
+ scrollSize: "scrollWidth",
404
+ size: "width",
405
+ key: "horizontal",
406
+ axis: "X",
407
+ client: "clientX",
408
+ direction: "left"
409
+ }
410
+ };
411
+ function renderThumbStyle({ move, size, bar }) {
412
+ const style = {};
413
+ const translate = `translate${bar.axis}(${move}%)`;
414
+ style[bar.size] = size;
415
+ style.transform = translate;
416
+ style.msTransform = translate;
417
+ style.webkitTransform = translate;
418
+ return style;
419
+ }
420
+ function resizeHandler(entries) {
421
+ for (const entry of entries) {
422
+ const listeners = entry.target.__resizeListeners__ || [];
423
+ if (listeners.length) {
424
+ listeners.forEach((fn) => {
425
+ fn();
426
+ });
427
+ }
428
+ }
429
+ }
430
+ function addResizeListener(element, fn) {
431
+ if (isServer)
432
+ return;
433
+ if (!element.__resizeListeners__) {
434
+ element.__resizeListeners__ = [];
435
+ element.__ro__ = new ResizeObserver(resizeHandler);
436
+ element.__ro__.observe(element);
437
+ }
438
+ element.__resizeListeners__.push(fn);
439
+ }
440
+ function removeResizeListener(element, fn) {
441
+ if (!element || !element.__resizeListeners__)
442
+ return;
443
+ element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
444
+ if (!element.__resizeListeners__.length) {
445
+ element.__ro__.disconnect();
446
+ }
447
+ }
448
+ const Bar = defineComponent({
449
+ name: "Bar",
450
+ props: {
451
+ vertical: Boolean,
452
+ size: String,
453
+ move: Number
454
+ },
455
+ setup(props) {
456
+ const instance = getCurrentInstance$1();
457
+ const thumb = ref$1();
458
+ const wrap = inject("scroll-bar-wrap", {});
459
+ const bar = computed(() => {
460
+ return BAR_MAP[props.vertical ? "vertical" : "horizontal"];
461
+ });
462
+ const barStore = ref$1({});
463
+ const cursorDown = ref$1();
464
+ const clickThumbHandler = (e) => {
465
+ if (e.ctrlKey || e.button === 2) {
466
+ return;
467
+ }
468
+ window.getSelection()?.removeAllRanges();
469
+ startDrag(e);
470
+ barStore.value[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
471
+ };
472
+ const clickTrackHandler = (e) => {
473
+ const offset = Math.abs(
474
+ e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]
475
+ );
476
+ const thumbHalf = thumb.value[bar.value.offset] / 2;
477
+ const thumbPositionPercentage = (offset - thumbHalf) * 100 / instance?.vnode.el?.[bar.value.offset];
478
+ wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
479
+ };
480
+ const startDrag = (e) => {
481
+ e.stopImmediatePropagation();
482
+ cursorDown.value = true;
483
+ on(document, "mousemove", mouseMoveDocumentHandler);
484
+ on(document, "mouseup", mouseUpDocumentHandler);
485
+ document.onselectstart = () => false;
486
+ };
487
+ const mouseMoveDocumentHandler = (e) => {
488
+ if (cursorDown.value === false)
489
+ return;
490
+ const prevPage = barStore.value[bar.value.axis];
491
+ if (!prevPage)
492
+ return;
493
+ const offset = (instance?.vnode.el?.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
494
+ const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
495
+ const thumbPositionPercentage = (offset - thumbClickPosition) * 100 / instance?.vnode.el?.[bar.value.offset];
496
+ wrap.value[bar.value.scroll] = thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100;
497
+ };
498
+ function mouseUpDocumentHandler() {
499
+ cursorDown.value = false;
500
+ barStore.value[bar.value.axis] = 0;
501
+ off(document, "mousemove", mouseMoveDocumentHandler);
502
+ document.onselectstart = null;
503
+ }
504
+ onUnmounted(() => {
505
+ off(document, "mouseup", mouseUpDocumentHandler);
506
+ });
507
+ return () => h$1(
508
+ "div",
509
+ {
510
+ class: ["scrollbar__bar", "is-" + bar.value.key],
511
+ onMousedown: clickTrackHandler
512
+ },
513
+ h$1("div", {
514
+ ref: thumb,
515
+ class: "scrollbar__thumb",
516
+ onMousedown: clickThumbHandler,
517
+ style: renderThumbStyle({
518
+ size: props.size,
519
+ move: props.move,
520
+ bar: bar.value
521
+ })
522
+ })
523
+ );
524
+ }
525
+ });
526
+ const _hoisted_1$1 = { class: "scrollbar relative h-full overflow-hidden" };
527
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
528
+ __name: "scroll-bar",
529
+ props: {
530
+ wrapClass: {
531
+ type: [String, Array],
532
+ default: ""
533
+ },
534
+ wrapStyle: Array,
535
+ viewClass: {
536
+ type: [String, Array],
537
+ default: ""
538
+ },
539
+ viewStyle: {
540
+ type: [String, Array],
541
+ default: ""
542
+ },
543
+ noresize: Boolean,
544
+ tag: {
545
+ type: String,
546
+ default: "div"
547
+ }
548
+ },
549
+ setup(__props) {
550
+ const props = __props;
551
+ const sizeWidth = ref$1("0");
552
+ const sizeHeight = ref$1("0");
553
+ const moveX = ref$1(0);
554
+ const moveY = ref$1(0);
555
+ const wrap = ref$1();
556
+ const resize = ref$1();
557
+ provide("scroll-bar-wrap", wrap);
558
+ const style = computed(() => {
559
+ let rsStyle = {};
560
+ if (Array.isArray(props.wrapStyle)) {
561
+ props.wrapStyle.forEach((it) => {
562
+ if (it)
563
+ rsStyle = Object.assign({}, rsStyle, it);
564
+ });
565
+ }
566
+ return rsStyle;
567
+ });
568
+ const handleScroll = () => {
569
+ moveY.value = unref(wrap).scrollTop * 100 / unref(wrap).clientHeight;
570
+ moveX.value = unref(wrap).scrollLeft * 100 / unref(wrap).clientWidth;
571
+ };
572
+ const update = () => {
573
+ if (!unref(wrap))
574
+ return;
575
+ const heightPercentage = unref(wrap).clientHeight * 100 / unref(wrap).scrollHeight;
576
+ const widthPercentage = unref(wrap).clientWidth * 100 / unref(wrap).scrollWidth;
577
+ sizeHeight.value = heightPercentage < 100 ? heightPercentage + "%" : "";
578
+ sizeWidth.value = widthPercentage < 100 ? widthPercentage + "%" : "";
579
+ };
580
+ onMounted$1(() => {
581
+ nextTick(update);
582
+ if (!props.noresize) {
583
+ addResizeListener(unref(resize), update);
584
+ addResizeListener(unref(wrap), update);
585
+ addEventListener("resize", update);
586
+ }
587
+ });
588
+ onBeforeUnmount(() => {
589
+ if (!props.noresize) {
590
+ removeResizeListener(unref(resize), update);
591
+ removeResizeListener(unref(wrap), update);
592
+ removeEventListener("resize", update);
593
+ }
594
+ });
595
+ return (_ctx, _cache) => {
596
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
597
+ createElementVNode("div", {
598
+ ref_key: "wrap",
599
+ ref: wrap,
600
+ class: normalizeClass([[__props.wrapClass, "scrollbar__wrap--hidden-default"], "h-full overflow-auto"]),
601
+ style: normalizeStyle(unref(style)),
602
+ onScroll: handleScroll
603
+ }, [
604
+ (openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
605
+ class: normalizeClass(["box-border", __props.viewClass]),
606
+ ref_key: "resize",
607
+ ref: resize,
608
+ style: normalizeStyle(__props.viewStyle)
609
+ }, {
610
+ default: withCtx(() => [
611
+ renderSlot(_ctx.$slots, "default")
612
+ ]),
613
+ _: 3
614
+ }, 8, ["class", "style"]))
615
+ ], 38),
616
+ createVNode(unref(Bar), {
617
+ move: moveX.value,
618
+ size: sizeWidth.value
619
+ }, null, 8, ["move", "size"]),
620
+ createVNode(unref(Bar), {
621
+ vertical: "",
622
+ move: moveY.value,
623
+ size: sizeHeight.value
624
+ }, null, 8, ["move", "size"])
625
+ ]);
626
+ };
627
+ }
628
+ });
629
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
630
+ __name: "scroll-container",
631
+ setup(__props) {
632
+ const scrollbarRef = ref(null);
633
+ return (_ctx, _cache) => {
634
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
635
+ ref_key: "scrollbarRef",
636
+ ref: scrollbarRef
637
+ }, _ctx.$attrs, { class: "w-full h-full" }), {
638
+ default: withCtx(() => [
639
+ renderSlot(_ctx.$slots, "default")
640
+ ]),
641
+ _: 3
642
+ }, 16);
643
+ };
644
+ }
645
+ });
646
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
647
+ __name: "slot-container",
648
+ props: {
649
+ template: {
650
+ type: Function
651
+ },
652
+ data: {
653
+ type: Object
654
+ }
655
+ },
656
+ setup(__props) {
657
+ const props = __props;
658
+ const Container = h("div", [props.template(props.data)]);
659
+ return (_ctx, _cache) => {
660
+ return openBlock(), createBlock(unref(Container));
661
+ };
662
+ }
663
+ });
664
+ const withInstall = (comp) => {
665
+ comp.install = (app) => {
666
+ app.component(comp.name, comp);
667
+ };
668
+ return comp;
669
+ };
670
+ const DtScrollContainer = withInstall(_sfc_main$5);
671
+ withInstall(_sfc_main$4);
672
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
673
+ __name: "ModalWrap",
674
+ props: {
675
+ useWrapper: { type: Boolean, default: true },
676
+ modalHeaderHeight: { type: Number, default: 55 },
677
+ modalFooterHeight: { type: Number, default: 58 },
678
+ minHeight: { type: Number, default: 200 },
679
+ height: { type: Number },
680
+ visible: { type: Boolean },
681
+ fullScreen: { type: Boolean }
682
+ },
683
+ emits: ["ext-height", "height-change"],
684
+ setup(__props, { emit: emits }) {
685
+ const props = __props;
686
+ const wrapperRef = ref$1(null);
687
+ const wrapRef = ref$1(null);
688
+ const realHeightRef = ref$1(0);
689
+ const minRealHeightRef = ref$1(0);
690
+ let realHeight = 0;
691
+ const wrapStyle = computed(() => {
692
+ return {
693
+ minHeight: `${props.minHeight}px`,
694
+ [props.fullScreen ? "height" : "maxHeight"]: `${unref(realHeightRef)}px`
695
+ };
696
+ });
697
+ onMounted(() => {
698
+ const { modalHeaderHeight, modalFooterHeight } = props;
699
+ emits("ext-height", modalHeaderHeight + modalFooterHeight);
700
+ });
701
+ async function getModalDom() {
702
+ const wrapperRefDom = unref(wrapperRef);
703
+ if (!wrapperRefDom)
704
+ return;
705
+ const bodyDom = wrapperRefDom.$el.parentElement;
706
+ if (!bodyDom)
707
+ return;
708
+ bodyDom.style.padding = "0";
709
+ await nextTick();
710
+ const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
711
+ return modalDom;
712
+ }
713
+ async function setModalHeight() {
714
+ if (!props.visible)
715
+ return;
716
+ try {
717
+ const modalDom = await getModalDom();
718
+ if (!modalDom)
719
+ return;
720
+ const modalRect = getComputedStyle(modalDom).top;
721
+ const modalTop = Number.parseInt(modalRect);
722
+ let maxHeight = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight - 100;
723
+ if (modalTop < 40) {
724
+ maxHeight -= 26;
725
+ }
726
+ await nextTick();
727
+ const warpEl = unref(wrapRef);
728
+ if (!warpEl)
729
+ return;
730
+ await nextTick();
731
+ realHeight = warpEl.scrollHeight;
732
+ if (props.fullScreen) {
733
+ realHeightRef.value = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight;
734
+ } else {
735
+ realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight;
736
+ }
737
+ emits("height-change", unref(realHeightRef));
738
+ const _modalDom = await getModalDom();
739
+ _modalDom.style.top = (window.innerHeight - _modalDom.offsetHeight) / 2 + "px";
740
+ } catch (error2) {
741
+ console.log(error2);
742
+ }
743
+ }
744
+ windowResizeFn(setModalHeight.bind(null, false));
745
+ watchEffect(() => {
746
+ props.useWrapper && setModalHeight();
747
+ });
748
+ watch(
749
+ () => props.fullScreen,
750
+ (v) => {
751
+ setModalHeight();
752
+ if (!v) {
753
+ realHeightRef.value = minRealHeightRef.value;
754
+ } else {
755
+ minRealHeightRef.value = realHeightRef.value;
756
+ }
757
+ }
758
+ );
759
+ return (_ctx, _cache) => {
760
+ return openBlock(), createBlock(unref(DtScrollContainer), {
761
+ ref_key: "wrapperRef",
762
+ ref: wrapperRef
763
+ }, {
764
+ default: withCtx(() => [
765
+ createElementVNode("div", {
766
+ ref_key: "wrapRef",
767
+ ref: wrapRef,
768
+ style: normalizeStyle(unref(wrapStyle))
769
+ }, [
770
+ renderSlot(_ctx.$slots, "default")
771
+ ], 4)
772
+ ]),
773
+ _: 3
774
+ }, 512);
775
+ };
776
+ }
777
+ });
778
+ const _hoisted_1 = {
779
+ key: 0,
780
+ className: "preIcon pr-1"
781
+ };
782
+ const _hoisted_2 = {
783
+ key: 0,
784
+ className: "preIcon pl-1"
785
+ };
786
+ const _hoisted_3 = { class: "text" };
787
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i ic:baseline-arrow-drop-down" }, null, -1);
788
+ const _hoisted_5 = [
789
+ _hoisted_4
790
+ ];
791
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
792
+ __name: "FormButtons",
793
+ props: {
794
+ mode: {
795
+ type: String,
796
+ default: "search"
797
+ },
798
+ show: {
799
+ type: Boolean,
800
+ default: true
801
+ },
802
+ showAdvancedButton: {
803
+ type: Boolean,
804
+ default: true
805
+ },
806
+ minShowColumn: {
807
+ type: Number,
808
+ default: 2
809
+ },
810
+ buttonList: {
811
+ type: [Array],
812
+ default: []
813
+ },
814
+ isAdvanced: {
815
+ type: Boolean,
816
+ default: true
817
+ }
818
+ },
819
+ emits: ["handle-method"],
820
+ setup(__props, { emit: emits }) {
821
+ const props = __props;
822
+ const { t } = useI18n();
823
+ const advancedRef = ref$1(props.isAdvanced);
824
+ let key = 0;
825
+ const showAdvanceRef = computed(() => {
826
+ return props.mode === "search" ? props.showAdvancedButton : false;
827
+ });
828
+ const colOpt = computed(() => {
829
+ let style = {
830
+ textAlign: "right"
831
+ };
832
+ if (props.mode === "dialog") {
833
+ Object.assign(style, {
834
+ display: "inline-block"
835
+ });
836
+ }
837
+ return { style };
838
+ });
839
+ const getAdvanceClass = computed(() => {
840
+ return [
841
+ "basic-arrow",
842
+ { "basic-arrow--active": !advancedRef.value }
843
+ ];
844
+ });
845
+ const toggleAdvanced = () => {
846
+ advancedRef.value = !advancedRef.value;
847
+ dispatchResize();
848
+ emits("handle-method", advancedRef.value);
849
+ };
850
+ function handleBtnClick(button) {
851
+ if (button.onClick && isFunction(button.onClick)) {
852
+ button.onClick();
853
+ } else {
854
+ emits("handle-method", button);
855
+ }
856
+ }
857
+ watch(() => props.isAdvanced, (v) => {
858
+ if (v) {
859
+ nextTick(() => toggleAdvanced());
860
+ }
861
+ }, {
862
+ immediate: true
863
+ });
864
+ watch(
865
+ () => props.buttonList,
866
+ (v) => key = new Date().getTime(),
867
+ {
868
+ immediate: true,
869
+ deep: true
870
+ }
871
+ );
872
+ return (_ctx, _cache) => {
873
+ const _component_AButton = Button;
874
+ const _component_AFormItem = FormItem;
875
+ const _component_ACol = Col;
876
+ const _directive_icon = resolveDirective("icon");
877
+ const _directive_auth = resolveDirective("auth");
878
+ return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref(colOpt))), {
879
+ default: withCtx(() => [
880
+ createVNode(_component_AFormItem, {
881
+ class: "dt-form-btns",
882
+ style: normalizeStyle({
883
+ "margin-bottom": __props.mode === "search" ? "16px" : "0px"
884
+ })
885
+ }, {
886
+ default: withCtx(() => [
887
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (button) => {
888
+ return openBlock(), createElementBlock(Fragment, null, [
889
+ (button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
890
+ type: button.type,
891
+ class: normalizeClass(button.class),
892
+ loading: button.loading?.value,
893
+ disabled: button.disabled,
894
+ key: unref(key),
895
+ onClick: ($event) => handleBtnClick(button)
896
+ }, {
897
+ icon: withCtx(() => [
898
+ button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
899
+ [_directive_icon, button.preIcon]
900
+ ]) : createCommentVNode("", true)
901
+ ]),
902
+ default: withCtx(() => [
903
+ createTextVNode(" " + toDisplayString(unref(t)(button.name)) + " ", 1),
904
+ button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
905
+ [_directive_icon, button.postIcon]
906
+ ]) : createCommentVNode("", true)
907
+ ]),
908
+ _: 2
909
+ }, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
910
+ [_directive_auth, button.auth]
911
+ ]) : createCommentVNode("", true)
912
+ ], 64);
913
+ }), 256)),
914
+ unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
915
+ key: 0,
916
+ type: "link",
917
+ class: "advanced",
918
+ onClick: toggleAdvanced
919
+ }, {
920
+ default: withCtx(() => [
921
+ createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
922
+ createElementVNode("span", {
923
+ class: normalizeClass(unref(getAdvanceClass))
924
+ }, _hoisted_5, 2)
925
+ ]),
926
+ _: 1
927
+ })) : createCommentVNode("", true)
928
+ ]),
929
+ _: 1
930
+ }, 8, ["style"])
931
+ ]),
932
+ _: 1
933
+ }, 16)) : createCommentVNode("", true);
934
+ };
935
+ }
936
+ });
937
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
938
+ __name: "ModalFooter",
939
+ props: {
940
+ buttons: Object,
941
+ showSave: { type: Boolean, default: true },
942
+ showCancel: { type: Boolean, default: true },
943
+ okText: { type: String },
944
+ cancelText: { type: String }
945
+ },
946
+ emits: [
947
+ "handleSave",
948
+ "handleCancel"
949
+ ],
950
+ setup(__props, { emit: emits }) {
951
+ const props = __props;
952
+ const { t } = useI18n("UI");
953
+ const buttonList = computed(() => {
954
+ if (props.buttons && props.buttons.length)
955
+ return props.buttons;
956
+ let buttonActions = [
957
+ { t: "\u4FDD\u5B58", name: props.okText || t("SAVE"), preIcon: "mdi:content-save", type: "primary", flag: "OK" },
958
+ { t: "\u5173\u95ED", name: props.cancelText || t("CLOSE"), preIcon: "mdi:close", flag: "CANCEL" }
959
+ ];
960
+ if (!props.showSave)
961
+ buttonActions = buttonActions.filter((btn) => btn.flag !== "OK");
962
+ if (!props.showCancel)
963
+ buttonActions = buttonActions.filter((btn) => btn.flag !== "CANCEL");
964
+ return buttonActions;
965
+ });
966
+ function handleMethod(item) {
967
+ switch (item.flag) {
968
+ case "OK":
969
+ emits("handleSave");
970
+ break;
971
+ case "CANCEL":
972
+ emits("handleCancel");
973
+ break;
974
+ }
975
+ }
976
+ return (_ctx, _cache) => {
977
+ return openBlock(), createElementBlock(Fragment, null, [
978
+ renderSlot(_ctx.$slots, "appendFooter"),
979
+ createVNode(_sfc_main$2, {
980
+ mode: "dialog",
981
+ buttonList: unref(buttonList),
982
+ onHandleMethod: _cache[0] || (_cache[0] = ($event) => handleMethod($event))
983
+ }, null, 8, ["buttonList"])
984
+ ], 64);
985
+ };
986
+ }
987
+ });
988
+ function useFullScreen(wrapClassName) {
989
+ const fullScreenRef = ref$1(false);
990
+ const getWrapClassName = computed(() => {
991
+ const clsName = unref(wrapClassName) || "";
992
+ const cls = unref(fullScreenRef) ? `fullscreen-modal ${clsName} ` : unref(clsName);
993
+ return `dt-modal ${cls}`;
994
+ });
995
+ function toggleFullScreen(e) {
996
+ e && e.stopPropagation();
997
+ fullScreenRef.value = !unref(fullScreenRef);
998
+ dispatchResize();
999
+ }
1000
+ return {
1001
+ fullScreenRef,
1002
+ getWrapClassName,
1003
+ toggleFullScreen
1004
+ };
1005
+ }
1006
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1007
+ __name: "index",
1008
+ props: basicProps,
1009
+ emits: ["visible-change", "height-change", "cancel", "save", "register", "update:visible"],
1010
+ setup(__props, { emit: emits }) {
1011
+ const props = __props;
1012
+ const visibleRef = ref$1(false);
1013
+ const propsRef = ref$1();
1014
+ const modalWrapperRef = ref$1(null);
1015
+ const { getWrapClassName, toggleFullScreen, fullScreenRef } = useFullScreen(computed(() => unref(propsRef)?.wrapClassName));
1016
+ const getMergeProps = computed(() => {
1017
+ return {
1018
+ ...props,
1019
+ ...unref(propsRef)
1020
+ };
1021
+ });
1022
+ const getBindValue = computed(() => {
1023
+ const bindValue = {
1024
+ ...unref(getMergeProps),
1025
+ ...unref(propsRef),
1026
+ visible: unref(visibleRef),
1027
+ wrapClassName: unref(getWrapClassName)
1028
+ };
1029
+ let omitArr = unref(fullScreenRef) ? ["height", "title"] : ["title"];
1030
+ if (isArray(unref(propsRef)?.footer)) {
1031
+ omitArr.push("footer");
1032
+ }
1033
+ return omit(bindValue, omitArr);
1034
+ });
1035
+ const getWrapperHeight = computed(() => {
1036
+ if (unref(fullScreenRef))
1037
+ return void 0;
1038
+ return unref(getBindValue).height;
1039
+ });
1040
+ const modalFooterHeight = computed(() => {
1041
+ if (isArray(props.footer)) {
1042
+ return (unref(propsRef)?.footer).length ? 0 : void 0;
1043
+ }
1044
+ return props?.footer !== void 0 && !props.footer ? 0 : void 0;
1045
+ });
1046
+ const modalMethods = {
1047
+ setModalProps,
1048
+ redoModalHeight: () => {
1049
+ nextTick(() => {
1050
+ if (unref(modalWrapperRef)) {
1051
+ unref(modalWrapperRef).setModalHeight();
1052
+ }
1053
+ });
1054
+ }
1055
+ };
1056
+ const instance = getCurrentInstance();
1057
+ if (instance) {
1058
+ emits("register", modalMethods, instance.uid);
1059
+ }
1060
+ function handleHeightChange(height) {
1061
+ emits("height-change", height);
1062
+ }
1063
+ function setModalProps(props2) {
1064
+ propsRef.value = deepMerge(unref(propsRef) || {}, props2);
1065
+ if (Reflect.has(props2, "visible")) {
1066
+ visibleRef.value = !!props2.visible;
1067
+ }
1068
+ if (Reflect.has(props2, "defaultFullscreen")) {
1069
+ fullScreenRef.value = !!props2.defaultFullscreen;
1070
+ }
1071
+ }
1072
+ function handleSave() {
1073
+ emits("save");
1074
+ }
1075
+ async function handleCancel(e = null) {
1076
+ if (e) {
1077
+ e?.stopPropagation();
1078
+ if (e.target?.classList?.contains("dt-basic-modal-close--custom"))
1079
+ return;
1080
+ if (props.closeFunc && isFunction(props.closeFunc)) {
1081
+ const isClose = await props.closeFunc();
1082
+ visibleRef.value = !isClose;
1083
+ return;
1084
+ }
1085
+ }
1086
+ const { afterClose } = unref(getBindValue);
1087
+ if (afterClose && isFunction(afterClose)) {
1088
+ afterClose();
1089
+ }
1090
+ visibleRef.value = false;
1091
+ emits("cancel", e);
1092
+ }
1093
+ watch(() => unref(visibleRef), (v) => {
1094
+ emits("visible-change", v);
1095
+ emits("update:visible", v);
1096
+ nextTick(() => {
1097
+ if (props.scrollTop && v && unref(modalWrapperRef)) {
1098
+ unref(modalWrapperRef).$el.scrollTop = 0;
1099
+ }
1100
+ });
1101
+ }, {
1102
+ immediate: false
1103
+ });
1104
+ return (_ctx, _cache) => {
1105
+ const _component_ASpin = Spin;
1106
+ return openBlock(), createBlock(_sfc_main$8, mergeProps(unref(getBindValue), { onCancel: handleCancel }), createSlots({
1107
+ default: withCtx(() => [
1108
+ createVNode(_component_ASpin, {
1109
+ spinning: unref(getBindValue).loading,
1110
+ tip: unref(getBindValue).loadingTip
1111
+ }, {
1112
+ default: withCtx(() => [
1113
+ createVNode(_sfc_main$3, mergeProps({
1114
+ useWrapper: unref(getBindValue).useWrapper,
1115
+ fullScreen: unref(fullScreenRef),
1116
+ ref_key: "modalWrapperRef",
1117
+ ref: modalWrapperRef,
1118
+ minHeight: unref(getBindValue).minHeight,
1119
+ height: unref(getWrapperHeight),
1120
+ visible: visibleRef.value,
1121
+ modalFooterHeight: unref(modalFooterHeight)
1122
+ }, unref(omit)(unref(getBindValue).wrapperProps, "visible", "height", "modalFooterHeight"), { onHeightChange: handleHeightChange }), {
1123
+ default: withCtx(() => [
1124
+ renderSlot(_ctx.$slots, "default")
1125
+ ]),
1126
+ _: 3
1127
+ }, 16, ["useWrapper", "fullScreen", "minHeight", "height", "visible", "modalFooterHeight"])
1128
+ ]),
1129
+ _: 3
1130
+ }, 8, ["spinning", "tip"])
1131
+ ]),
1132
+ _: 2
1133
+ }, [
1134
+ !_ctx.$slots.closeIcon ? {
1135
+ name: "closeIcon",
1136
+ fn: withCtx(() => [
1137
+ createVNode(_sfc_main$7, {
1138
+ canFullscreen: unref(getBindValue).canFullscreen,
1139
+ fullScreen: unref(fullScreenRef),
1140
+ onCancel: handleCancel,
1141
+ onFullscreen: unref(toggleFullScreen)
1142
+ }, null, 8, ["canFullscreen", "fullScreen", "onFullscreen"])
1143
+ ]),
1144
+ key: "0"
1145
+ } : void 0,
1146
+ !_ctx.$slots.title ? {
1147
+ name: "title",
1148
+ fn: withCtx(() => [
1149
+ createTextVNode(toDisplayString(unref(getMergeProps).title), 1)
1150
+ ]),
1151
+ key: "1"
1152
+ } : void 0,
1153
+ !_ctx.$slots.footer ? {
1154
+ name: "footer",
1155
+ fn: withCtx(() => [
1156
+ createVNode(_sfc_main$1, {
1157
+ buttons: propsRef.value?.footer,
1158
+ showSave: unref(getBindValue).showOkBtn,
1159
+ showCancel: unref(getBindValue).showCancelBtn,
1160
+ okText: unref(getBindValue).okText,
1161
+ cancelText: unref(getBindValue).cancelText,
1162
+ onHandleSave: handleSave,
1163
+ onHandleCancel: handleCancel
1164
+ }, createSlots({ _: 2 }, [
1165
+ renderList(Object.keys(_ctx.$slots), (item) => {
1166
+ return {
1167
+ name: item,
1168
+ fn: withCtx((data) => [
1169
+ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
1170
+ ])
1171
+ };
1172
+ })
1173
+ ]), 1032, ["buttons", "showSave", "showCancel", "okText", "cancelText"])
1174
+ ]),
1175
+ key: "2"
1176
+ } : void 0,
1177
+ renderList(Object.keys(unref(omit)(_ctx.$slots, "default")), (item) => {
1178
+ return {
1179
+ name: item,
1180
+ fn: withCtx((data) => [
1181
+ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
1182
+ ])
1183
+ };
1184
+ })
1185
+ ]), 1040);
1186
+ };
1187
+ }
1188
+ });
1189
+ export {
1190
+ _sfc_main as DtModal,
1191
+ useModal,
1192
+ useModalOut
1193
+ };