@dt-frames/ui 2.0.0 → 2.0.2

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 +93 -0
  41. package/es/components/container/index.js +288 -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 +18 -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 +3098 -0
  52. package/es/components/curd/src/components/Curd.d.ts +1451 -0
  53. package/es/components/curd/src/hooks/useCurd.d.ts +112 -0
  54. package/es/components/curd/src/props.d.ts +188 -0
  55. package/es/components/curd/src/types/curd.type.d.ts +19 -0
  56. package/es/components/drawer/index.d.ts +8041 -0
  57. package/es/components/drawer/index.js +837 -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 +13 -0
  61. package/es/components/drawer/src/hooks/useDrawer.d.ts +3 -0
  62. package/es/components/drawer/src/index.d.ts +8043 -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 +3367 -0
  66. package/es/components/form/index.js +1895 -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 +313 -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 +3113 -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 +3 -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 +1192 -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 +215 -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 +881 -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 +331 -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 +4414 -0
  113. package/es/components/table/index.less +183 -0
  114. package/es/components/table/src/components/TableAction.d.ts +70 -0
  115. package/es/components/table/src/components/TableHeader.d.ts +1243 -0
  116. package/es/components/table/src/components/TableRender.d.ts +13 -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 +1029 -0
  124. package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +995 -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 +1137 -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 +16 -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 +122 -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 +990 -0
  140. package/es/components/table/src/props.d.ts +244 -0
  141. package/es/components/table/src/types/actions.type.d.ts +22 -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 +92 -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 +3242 -0
  151. package/es/theme/index.d.ts +10 -0
  152. package/es/theme/index.js +3242 -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 +36 -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 +23 -0
  165. package/es/theme/src/components/header/components/setting-theme.d.ts +222 -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 +36 -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 +698 -0
  177. package/es/theme/src/components/header/multiple-header.d.ts +787 -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 +1644 -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 +1 -5
  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 +78 -0
@@ -0,0 +1,1192 @@
1
+ import { useApp, isFunction, isObject, error, useTimeoutFn, useSlots, useI18n, off, on, windowResizeFn, dispatchResize, isArray, deepMerge } from "@dt-frames/core";
2
+ import { Tooltip, Button, FormItem, Col, Spin } from "ant-design-vue/es";
3
+ import { createVNode, isVNode, defineComponent as defineComponent$1, openBlock, createElementBlock, normalizeClass, unref as unref$1, Fragment, createBlock, withCtx, createElementVNode, createCommentVNode, getCurrentInstance as getCurrentInstance$1, ref as ref$1, inject, computed as computed$1, onUnmounted as onUnmounted$1, h as h$1, normalizeStyle, resolveDynamicComponent, renderSlot, mergeProps, resolveDirective, normalizeProps, renderList, withDirectives, createTextVNode, toDisplayString, createSlots, guardReactiveProps } from "vue";
4
+ import { omit } from "lodash-es";
5
+ import { Modal as Modal$1 } from "ant-design-vue";
6
+ import "ant-design-vue/es/form/style";
7
+ import "ant-design-vue/es/button/style";
8
+ const orgDialogProp = reactive({});
9
+ const cbTransfer = reactive({});
10
+ const dataTransfer = reactive({});
11
+ function useModalOut() {
12
+ const modal = ref(null);
13
+ const loaded = ref(true);
14
+ const uid = ref(null);
15
+ const { isProd } = useApp();
16
+ function register(modalMethod, uuid) {
17
+ if (!getCurrentInstance()) {
18
+ throw new Error("useModal\u53EA\u80FD\u5728setup()\u6216\u8005\u51FD\u6570\u4E2D\u4F7F\u7528");
19
+ }
20
+ uid.value = uuid;
21
+ onUnmounted(() => {
22
+ if (unref(isProd)) {
23
+ modal.value = null;
24
+ loaded.value = false;
25
+ dataTransfer[unref(uid)] = null;
26
+ orgDialogProp[unref(uid)] = null;
27
+ cbTransfer[unref(uid)] = (res) => {
28
+ };
29
+ }
30
+ });
31
+ if (unref(loaded) && modalMethod === unref(modal))
32
+ return;
33
+ modal.value = modalMethod;
34
+ loaded.value = true;
35
+ }
36
+ const getInstance = () => {
37
+ const instance = unref(modal);
38
+ if (!instance) {
39
+ error("useModalOut \u5B9E\u4F8B\u672A\u5B9A\u4E49");
40
+ }
41
+ return instance;
42
+ };
43
+ const methods = {
44
+ setModalProps: (props) => {
45
+ getInstance()?.setModalProps(props);
46
+ },
47
+ redoModalHeight: () => {
48
+ getInstance()?.redoModalHeight?.();
49
+ },
50
+ openModal: (params, afterClose) => {
51
+ const id = unref(uid);
52
+ dataTransfer[id] = isObject(params) ? { ...toRaw(params) } : params;
53
+ getInstance()?.setModalProps({
54
+ footer: [],
55
+ defaultFullscreen: false,
56
+ ...orgDialogProp[id],
57
+ visible: true
58
+ });
59
+ cbTransfer[id] = (res) => {
60
+ if (afterClose && isFunction(afterClose)) {
61
+ afterClose(res);
62
+ }
63
+ };
64
+ },
65
+ closeModal: () => {
66
+ getInstance()?.setModalProps({ visible: false });
67
+ }
68
+ };
69
+ return [register, methods];
70
+ }
71
+ function useModal(props, setModalData) {
72
+ const modalInstanceRef = ref(null);
73
+ const currentInstance = getCurrentInstance();
74
+ const uidRef = ref(null);
75
+ const { isProd } = useApp();
76
+ const getInstance = () => {
77
+ const instance = unref(modalInstanceRef);
78
+ if (!instance) {
79
+ error("useModal \u5B9E\u4F8B\u672A\u5B9A\u4E49");
80
+ }
81
+ return instance;
82
+ };
83
+ const register = (modalInstance, uuid) => {
84
+ if (unref(isProd)) {
85
+ modalInstanceRef.value = null;
86
+ }
87
+ uidRef.value = uuid;
88
+ modalInstanceRef.value = modalInstance;
89
+ currentInstance?.emit("register", modalInstance, uuid);
90
+ orgDialogProp[uuid] = toRaw(props);
91
+ modalInstance.setModalProps(props);
92
+ };
93
+ watchEffect(() => {
94
+ const data = dataTransfer[unref(uidRef)];
95
+ if (!data)
96
+ return;
97
+ if (!setModalData || !isFunction(setModalData))
98
+ return;
99
+ nextTick(() => {
100
+ setModalData(data);
101
+ });
102
+ });
103
+ const methods = {
104
+ setLoading: (loading = true) => {
105
+ getInstance()?.setModalProps({ loading });
106
+ },
107
+ closeModal: (rsp) => {
108
+ if (cbTransfer[unref(uidRef)])
109
+ cbTransfer[unref(uidRef)](rsp);
110
+ getInstance()?.setModalProps({ visible: false });
111
+ },
112
+ setModalProps: (props2) => {
113
+ getInstance()?.setModalProps(props2);
114
+ },
115
+ redoModalHeight: () => {
116
+ const callRedo = getInstance()?.redoModalHeight;
117
+ callRedo && callRedo();
118
+ }
119
+ };
120
+ return [register, methods];
121
+ }
122
+ const _default = "";
123
+ const index$2 = "";
124
+ const basicProps = {
125
+ t: {
126
+ type: String
127
+ },
128
+ visible: {
129
+ type: Boolean
130
+ },
131
+ closable: {
132
+ type: Boolean,
133
+ default: true
134
+ },
135
+ destroyOnClose: {
136
+ type: Boolean
137
+ },
138
+ scrollTop: {
139
+ type: Boolean,
140
+ default: true
141
+ },
142
+ height: { type: Number },
143
+ minHeight: { type: Number },
144
+ width: { type: [String, Number] },
145
+ draggable: {
146
+ type: Boolean,
147
+ default: true
148
+ },
149
+ defaultFullscreen: {
150
+ type: Boolean
151
+ },
152
+ canFullscreen: {
153
+ type: Boolean,
154
+ default: true
155
+ },
156
+ title: {
157
+ type: String
158
+ },
159
+ loading: { type: Boolean, default: false },
160
+ loadingTip: { type: String, default: "\u52A0\u8F7D\u4E2D..." },
161
+ useWrapper: {
162
+ type: Boolean,
163
+ default: true
164
+ },
165
+ wrapClassName: { type: String },
166
+ zIndex: { type: Number },
167
+ centered: { type: Boolean },
168
+ showOkBtn: {
169
+ type: Boolean,
170
+ default: true
171
+ },
172
+ showCancelBtn: {
173
+ type: Boolean,
174
+ default: true
175
+ },
176
+ okText: {
177
+ type: String
178
+ },
179
+ cancelText: {
180
+ type: String
181
+ },
182
+ mask: { type: Boolean, default: true },
183
+ maskClosable: { type: Boolean, default: true },
184
+ keyboard: { type: Boolean, default: true },
185
+ maskStyle: Object,
186
+ footer: {
187
+ type: Object
188
+ },
189
+ bodyStyle: Object,
190
+ wrapperProps: Object,
191
+ getContainer: Function,
192
+ closeFunc: Function,
193
+ afterClose: Function
194
+ };
195
+ function useDragMove(context) {
196
+ const getStyle = (dom, attr) => {
197
+ return getComputedStyle(dom)[attr];
198
+ };
199
+ const drag = (wrap) => {
200
+ if (!wrap)
201
+ return;
202
+ wrap.setAttribute("data-drag", unref(context.draggable));
203
+ const dialogHeaderEl = wrap.querySelector(".ant-modal-header");
204
+ const dragDom = wrap.querySelector(".ant-modal");
205
+ if (!dialogHeaderEl || !dragDom || !unref(context.draggable))
206
+ return;
207
+ dialogHeaderEl.style.cursor = "move";
208
+ dialogHeaderEl.onmousedown = (e) => {
209
+ if (!e)
210
+ return;
211
+ const disX = e.clientX;
212
+ const disY = e.clientY;
213
+ const screenWidth = document.body.clientWidth;
214
+ const screenHeight = document.documentElement.clientHeight;
215
+ const dragDomWidth = dragDom.offsetWidth;
216
+ const dragDomheight = dragDom.offsetHeight;
217
+ console.log(dragDomWidth, dragDomheight, screenHeight, screenWidth);
218
+ const minDragDomLeft = dragDom.offsetLeft;
219
+ const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
220
+ const minDragDomTop = dragDom.offsetTop;
221
+ const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
222
+ const domLeft = getStyle(dragDom, "left");
223
+ const domTop = getStyle(dragDom, "top");
224
+ let styL = +domLeft;
225
+ let styT = +domTop;
226
+ if (domLeft.includes("%")) {
227
+ styL = +document.body.clientWidth * (+domLeft.replace(/%/g, "") / 100);
228
+ styT = +document.body.clientHeight * (+domTop.replace(/%/g, "") / 100);
229
+ } else {
230
+ styL = +domLeft.replace(/px/g, "");
231
+ styT = +domTop.replace(/px/g, "");
232
+ }
233
+ document.onmousemove = function(e2) {
234
+ let left = e2.clientX - disX;
235
+ let top = e2.clientY - disY;
236
+ if (-left > minDragDomLeft) {
237
+ left = -minDragDomLeft;
238
+ } else if (left > maxDragDomLeft) {
239
+ left = maxDragDomLeft;
240
+ }
241
+ if (-top > minDragDomTop) {
242
+ top = -minDragDomTop;
243
+ } else if (top > maxDragDomTop) {
244
+ top = maxDragDomTop;
245
+ }
246
+ dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
247
+ };
248
+ document.onmouseup = () => {
249
+ document.onmousemove = null;
250
+ document.onmouseup = null;
251
+ };
252
+ };
253
+ };
254
+ const handleDrag = () => {
255
+ const dragWraps = document.querySelectorAll(".ant-modal-wrap");
256
+ for (const wrap of Array.from(dragWraps)) {
257
+ if (!wrap)
258
+ continue;
259
+ const display = getStyle(wrap, "display");
260
+ const draggable = wrap.getAttribute("data-drag");
261
+ if (display !== "none") {
262
+ if (draggable === null || unref(context.destroyOnClose)) {
263
+ drag(wrap);
264
+ }
265
+ }
266
+ }
267
+ };
268
+ watchEffect(() => {
269
+ if (!unref(context.visible) || !unref(context.draggable)) {
270
+ return;
271
+ }
272
+ useTimeoutFn(() => {
273
+ handleDrag();
274
+ }, 30);
275
+ });
276
+ }
277
+ function _isSlot(s) {
278
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
279
+ }
280
+ const Modal = defineComponent({
281
+ name: "Modal",
282
+ inheritAttrs: false,
283
+ props: basicProps,
284
+ emits: ["cancel"],
285
+ setup(props, {
286
+ slots,
287
+ emit
288
+ }) {
289
+ const {
290
+ visible,
291
+ draggable,
292
+ destroyOnClose
293
+ } = toRefs(props);
294
+ const attrs = useAttrs();
295
+ useDragMove({
296
+ visible,
297
+ destroyOnClose,
298
+ draggable
299
+ });
300
+ const {
301
+ extendSlots
302
+ } = useSlots();
303
+ const onCancel = (e) => emit("cancel", e);
304
+ return () => {
305
+ let _slot;
306
+ const propsData = {
307
+ ...unref(attrs),
308
+ ...props,
309
+ destroyOnClose: true,
310
+ onCancel
311
+ };
312
+ if (!propsData?.visible)
313
+ return null;
314
+ return createVNode(Modal$1, propsData, _isSlot(_slot = extendSlots(slots)) ? _slot : {
315
+ default: () => [_slot]
316
+ });
317
+ };
318
+ }
319
+ });
320
+ const index$1 = "";
321
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent$1({
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$1(getClass)])
352
+ }, [
353
+ __props.canFullscreen ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
354
+ __props.fullScreen ? (openBlock(), createBlock(_component_ATooltip, {
355
+ key: 0,
356
+ title: unref$1(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$1(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$1({
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$1(() => {
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$1(() => {
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$1({
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("0");
552
+ const sizeHeight = ref("0");
553
+ const moveX = ref(0);
554
+ const moveY = ref(0);
555
+ const wrap = ref();
556
+ const resize = ref();
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(() => {
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$1(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$1(Bar), {
617
+ move: unref$1(moveX),
618
+ size: unref$1(sizeWidth)
619
+ }, null, 8, ["move", "size"]),
620
+ createVNode(unref$1(Bar), {
621
+ vertical: "",
622
+ move: unref$1(moveY),
623
+ size: unref$1(sizeHeight)
624
+ }, null, 8, ["move", "size"])
625
+ ]);
626
+ };
627
+ }
628
+ });
629
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent$1({
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 = defineComponent({
647
+ name: "slot-container",
648
+ props: {
649
+ template: {
650
+ type: Function
651
+ },
652
+ data: {
653
+ type: Object
654
+ }
655
+ },
656
+ setup(props) {
657
+ return () => {
658
+ return h("div", [props.template(props.data)]);
659
+ };
660
+ }
661
+ });
662
+ const withInstall = (comp) => {
663
+ comp.install = (app) => {
664
+ app.component(comp.name, comp);
665
+ };
666
+ return comp;
667
+ };
668
+ const DtScrollContainer = withInstall(_sfc_main$5);
669
+ withInstall(_sfc_main$4);
670
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent$1({
671
+ __name: "ModalWrap",
672
+ props: {
673
+ useWrapper: { type: Boolean, default: true },
674
+ modalHeaderHeight: { type: Number, default: 55 },
675
+ modalFooterHeight: { type: Number, default: 58 },
676
+ minHeight: { type: Number, default: 200 },
677
+ height: { type: Number },
678
+ visible: { type: Boolean },
679
+ fullScreen: { type: Boolean }
680
+ },
681
+ emits: ["ext-height", "height-change"],
682
+ setup(__props, { emit: emits }) {
683
+ const props = __props;
684
+ const wrapperRef = ref(null);
685
+ const wrapRef = ref(null);
686
+ const realHeightRef = ref(0);
687
+ const minRealHeightRef = ref(0);
688
+ let realHeight = 0;
689
+ const wrapStyle = computed(() => {
690
+ return {
691
+ minHeight: `${props.minHeight}px`,
692
+ [props.fullScreen ? "height" : "maxHeight"]: `${unref(realHeightRef)}px`
693
+ };
694
+ });
695
+ onMounted(() => {
696
+ const { modalHeaderHeight, modalFooterHeight } = props;
697
+ emits("ext-height", modalHeaderHeight + modalFooterHeight);
698
+ });
699
+ async function getModalDom() {
700
+ const wrapperRefDom = unref(wrapperRef);
701
+ if (!wrapperRefDom)
702
+ return;
703
+ const bodyDom = wrapperRefDom.$el.parentElement;
704
+ if (!bodyDom)
705
+ return;
706
+ bodyDom.style.padding = "0";
707
+ await nextTick();
708
+ const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
709
+ return modalDom;
710
+ }
711
+ async function setModalHeight() {
712
+ if (!props.visible)
713
+ return;
714
+ try {
715
+ const modalDom = await getModalDom();
716
+ if (!modalDom)
717
+ return;
718
+ const modalRect = getComputedStyle(modalDom).top;
719
+ const modalTop = Number.parseInt(modalRect);
720
+ let maxHeight = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight - 100;
721
+ if (modalTop < 40) {
722
+ maxHeight -= 26;
723
+ }
724
+ await nextTick();
725
+ const warpEl = unref(wrapRef);
726
+ if (!warpEl)
727
+ return;
728
+ await nextTick();
729
+ realHeight = warpEl.scrollHeight;
730
+ if (props.fullScreen) {
731
+ realHeightRef.value = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight;
732
+ } else {
733
+ realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight;
734
+ }
735
+ emits("height-change", unref(realHeightRef));
736
+ const _modalDom = await getModalDom();
737
+ _modalDom.style.top = (window.innerHeight - _modalDom.offsetHeight) / 2 + "px";
738
+ } catch (error2) {
739
+ console.log(error2);
740
+ }
741
+ }
742
+ windowResizeFn(setModalHeight.bind(null, false));
743
+ watchEffect(() => {
744
+ props.useWrapper && setModalHeight();
745
+ });
746
+ watch(
747
+ () => props.fullScreen,
748
+ (v) => {
749
+ setModalHeight();
750
+ if (!v) {
751
+ realHeightRef.value = minRealHeightRef.value;
752
+ } else {
753
+ minRealHeightRef.value = realHeightRef.value;
754
+ }
755
+ }
756
+ );
757
+ return (_ctx, _cache) => {
758
+ return openBlock(), createBlock(unref$1(DtScrollContainer), {
759
+ ref_key: "wrapperRef",
760
+ ref: wrapperRef
761
+ }, {
762
+ default: withCtx(() => [
763
+ createElementVNode("div", {
764
+ ref_key: "wrapRef",
765
+ ref: wrapRef,
766
+ style: normalizeStyle(unref$1(wrapStyle))
767
+ }, [
768
+ renderSlot(_ctx.$slots, "default")
769
+ ], 4)
770
+ ]),
771
+ _: 3
772
+ }, 512);
773
+ };
774
+ }
775
+ });
776
+ const index = "";
777
+ const _hoisted_1 = {
778
+ key: 0,
779
+ className: "preIcon pr-1"
780
+ };
781
+ const _hoisted_2 = {
782
+ key: 0,
783
+ className: "preIcon pl-1"
784
+ };
785
+ const _hoisted_3 = { class: "text" };
786
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i ic:baseline-arrow-drop-down" }, null, -1);
787
+ const _hoisted_5 = [
788
+ _hoisted_4
789
+ ];
790
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent$1({
791
+ __name: "FormButtons",
792
+ props: {
793
+ mode: {
794
+ type: String,
795
+ default: "search"
796
+ },
797
+ show: {
798
+ type: Boolean,
799
+ default: true
800
+ },
801
+ showAdvancedButton: {
802
+ type: Boolean,
803
+ default: true
804
+ },
805
+ minShowColumn: {
806
+ type: Number,
807
+ default: 2
808
+ },
809
+ buttonList: {
810
+ type: [Array],
811
+ default: []
812
+ },
813
+ isAdvanced: {
814
+ type: Boolean,
815
+ default: true
816
+ }
817
+ },
818
+ emits: ["handle-method"],
819
+ setup(__props, { emit: emits }) {
820
+ const props = __props;
821
+ const { t } = useI18n();
822
+ const advancedRef = ref(props.isAdvanced);
823
+ let key = 0;
824
+ const showAdvanceRef = computed(() => {
825
+ return props.mode === "search" ? props.showAdvancedButton : false;
826
+ });
827
+ const colOpt = computed(() => {
828
+ let style = {
829
+ textAlign: "right"
830
+ };
831
+ if (props.mode === "dialog") {
832
+ Object.assign(style, {
833
+ display: "inline-block"
834
+ });
835
+ }
836
+ return { style };
837
+ });
838
+ const getAdvanceClass = computed(() => {
839
+ return [
840
+ "basic-arrow",
841
+ { "basic-arrow--active": !advancedRef.value }
842
+ ];
843
+ });
844
+ const toggleAdvanced = () => {
845
+ advancedRef.value = !advancedRef.value;
846
+ dispatchResize();
847
+ emits("handle-method", advancedRef.value);
848
+ };
849
+ function handleBtnClick(button) {
850
+ if (button.onClick && isFunction(button.onClick)) {
851
+ button.onClick();
852
+ } else {
853
+ emits("handle-method", button);
854
+ }
855
+ }
856
+ watch(() => props.isAdvanced, (v) => {
857
+ if (v) {
858
+ nextTick(() => toggleAdvanced());
859
+ }
860
+ }, {
861
+ immediate: true
862
+ });
863
+ watch(
864
+ () => props.buttonList,
865
+ (v) => key = new Date().getTime(),
866
+ {
867
+ immediate: true,
868
+ deep: true
869
+ }
870
+ );
871
+ return (_ctx, _cache) => {
872
+ const _component_AButton = Button;
873
+ const _component_AFormItem = FormItem;
874
+ const _component_ACol = Col;
875
+ const _directive_icon = resolveDirective("icon");
876
+ const _directive_auth = resolveDirective("auth");
877
+ return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref$1(colOpt))), {
878
+ default: withCtx(() => [
879
+ createVNode(_component_AFormItem, {
880
+ class: "dt-form-btns",
881
+ style: normalizeStyle({
882
+ "margin-bottom": __props.mode === "search" ? "16px" : "0px"
883
+ })
884
+ }, {
885
+ default: withCtx(() => [
886
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (button) => {
887
+ return openBlock(), createElementBlock(Fragment, null, [
888
+ (button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
889
+ type: button.type,
890
+ class: normalizeClass(button.class),
891
+ loading: button.loading,
892
+ disabled: button.disabled,
893
+ key: unref$1(key),
894
+ onClick: ($event) => handleBtnClick(button)
895
+ }, {
896
+ icon: withCtx(() => [
897
+ button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
898
+ [_directive_icon, button.preIcon]
899
+ ]) : createCommentVNode("", true)
900
+ ]),
901
+ default: withCtx(() => [
902
+ createTextVNode(" " + toDisplayString(unref$1(t)(button.name)) + " ", 1),
903
+ button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
904
+ [_directive_icon, button.postIcon]
905
+ ]) : createCommentVNode("", true)
906
+ ]),
907
+ _: 2
908
+ }, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
909
+ [_directive_auth, button.auth]
910
+ ]) : createCommentVNode("", true)
911
+ ], 64);
912
+ }), 256)),
913
+ unref$1(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
914
+ key: 0,
915
+ type: "link",
916
+ class: "advanced",
917
+ onClick: toggleAdvanced
918
+ }, {
919
+ default: withCtx(() => [
920
+ createElementVNode("span", _hoisted_3, toDisplayString(unref$1(advancedRef) ? unref$1(t)("UI.ADVANCED") : unref$1(t)("UI.EXPAND")), 1),
921
+ createElementVNode("span", {
922
+ class: normalizeClass(unref$1(getAdvanceClass))
923
+ }, _hoisted_5, 2)
924
+ ]),
925
+ _: 1
926
+ })) : createCommentVNode("", true)
927
+ ]),
928
+ _: 1
929
+ }, 8, ["style"])
930
+ ]),
931
+ _: 1
932
+ }, 16)) : createCommentVNode("", true);
933
+ };
934
+ }
935
+ });
936
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
937
+ __name: "ModalFooter",
938
+ props: {
939
+ buttons: Object,
940
+ showSave: { type: Boolean, default: true },
941
+ showCancel: { type: Boolean, default: true },
942
+ okText: { type: String },
943
+ cancelText: { type: String }
944
+ },
945
+ emits: [
946
+ "handleSave",
947
+ "handleCancel"
948
+ ],
949
+ setup(__props, { emit: emits }) {
950
+ const props = __props;
951
+ const { t } = useI18n("UI");
952
+ const buttonList = computed$1(() => {
953
+ if (props.buttons && props.buttons.length)
954
+ return props.buttons;
955
+ let buttonActions = [
956
+ { t: "\u4FDD\u5B58", name: props.okText || t("SAVE"), preIcon: "mdi:content-save", type: "primary", flag: "OK" },
957
+ { t: "\u5173\u95ED", name: props.cancelText || t("CLOSE"), preIcon: "mdi:close", flag: "CANCEL" }
958
+ ];
959
+ if (!props.showSave)
960
+ buttonActions = buttonActions.filter((btn) => btn.flag !== "OK");
961
+ if (!props.showCancel)
962
+ buttonActions = buttonActions.filter((btn) => btn.flag !== "CANCEL");
963
+ return buttonActions;
964
+ });
965
+ function handleMethod(item) {
966
+ switch (item.flag) {
967
+ case "OK":
968
+ emits("handleSave");
969
+ break;
970
+ case "CANCEL":
971
+ emits("handleCancel");
972
+ break;
973
+ }
974
+ }
975
+ return (_ctx, _cache) => {
976
+ return openBlock(), createElementBlock(Fragment, null, [
977
+ renderSlot(_ctx.$slots, "appendFooter"),
978
+ createVNode(_sfc_main$2, {
979
+ mode: "dialog",
980
+ buttonList: unref$1(buttonList),
981
+ onHandleMethod: _cache[0] || (_cache[0] = ($event) => handleMethod($event))
982
+ }, null, 8, ["buttonList"])
983
+ ], 64);
984
+ };
985
+ }
986
+ });
987
+ function useFullScreen(wrapClassName) {
988
+ const fullScreenRef = ref(false);
989
+ const getWrapClassName = computed(() => {
990
+ const clsName = unref(wrapClassName) || "";
991
+ const cls = unref(fullScreenRef) ? `fullscreen-modal ${clsName} ` : unref(clsName);
992
+ return `dt-modal ${cls}`;
993
+ });
994
+ function toggleFullScreen(e) {
995
+ e && e.stopPropagation();
996
+ fullScreenRef.value = !unref(fullScreenRef);
997
+ dispatchResize();
998
+ }
999
+ return {
1000
+ fullScreenRef,
1001
+ getWrapClassName,
1002
+ toggleFullScreen
1003
+ };
1004
+ }
1005
+ const _sfc_main = /* @__PURE__ */ defineComponent$1({
1006
+ __name: "index",
1007
+ props: basicProps,
1008
+ emits: ["visible-change", "height-change", "cancel", "save", "register", "update:visible"],
1009
+ setup(__props, { emit: emits }) {
1010
+ const props = __props;
1011
+ const visibleRef = ref(false);
1012
+ const propsRef = ref();
1013
+ const modalWrapperRef = ref(null);
1014
+ const { getWrapClassName, toggleFullScreen, fullScreenRef } = useFullScreen(computed(() => unref(propsRef)?.wrapClassName));
1015
+ const getMergeProps = computed(() => {
1016
+ return {
1017
+ ...props,
1018
+ ...unref(propsRef)
1019
+ };
1020
+ });
1021
+ const getBindValue = computed(() => {
1022
+ const bindValue = {
1023
+ ...unref(getMergeProps),
1024
+ ...unref(propsRef),
1025
+ visible: unref(visibleRef),
1026
+ wrapClassName: unref(getWrapClassName)
1027
+ };
1028
+ let omitArr = unref(fullScreenRef) ? ["height", "title"] : ["title"];
1029
+ if (isArray(unref(propsRef)?.footer)) {
1030
+ omitArr.push("footer");
1031
+ }
1032
+ return omit(bindValue, omitArr);
1033
+ });
1034
+ const getWrapperHeight = computed(() => {
1035
+ if (unref(fullScreenRef))
1036
+ return void 0;
1037
+ return unref(getBindValue).height;
1038
+ });
1039
+ const modalFooterHeight = computed(() => {
1040
+ if (isArray(props.footer)) {
1041
+ return (unref(propsRef)?.footer).length ? 0 : void 0;
1042
+ }
1043
+ return props?.footer !== void 0 && !props.footer ? 0 : void 0;
1044
+ });
1045
+ const modalMethods = {
1046
+ setModalProps,
1047
+ redoModalHeight: () => {
1048
+ nextTick(() => {
1049
+ if (unref(modalWrapperRef)) {
1050
+ unref(modalWrapperRef).setModalHeight();
1051
+ }
1052
+ });
1053
+ }
1054
+ };
1055
+ const instance = getCurrentInstance();
1056
+ if (instance) {
1057
+ emits("register", modalMethods, instance.uid);
1058
+ }
1059
+ function handleHeightChange(height) {
1060
+ emits("height-change", height);
1061
+ }
1062
+ function setModalProps(props2) {
1063
+ propsRef.value = deepMerge(unref(propsRef) || {}, props2);
1064
+ if (Reflect.has(props2, "visible")) {
1065
+ visibleRef.value = !!props2.visible;
1066
+ }
1067
+ if (Reflect.has(props2, "defaultFullscreen")) {
1068
+ fullScreenRef.value = !!props2.defaultFullscreen;
1069
+ }
1070
+ }
1071
+ function handleSave() {
1072
+ emits("save");
1073
+ }
1074
+ async function handleCancel(e = null) {
1075
+ if (e) {
1076
+ e?.stopPropagation();
1077
+ if (e.target?.classList?.contains("dt-basic-modal-close--custom"))
1078
+ return;
1079
+ if (props.closeFunc && isFunction(props.closeFunc)) {
1080
+ const isClose = await props.closeFunc();
1081
+ visibleRef.value = !isClose;
1082
+ return;
1083
+ }
1084
+ }
1085
+ const { afterClose } = unref(getBindValue);
1086
+ if (afterClose && isFunction(afterClose)) {
1087
+ afterClose();
1088
+ }
1089
+ visibleRef.value = false;
1090
+ emits("cancel", e);
1091
+ }
1092
+ watch(() => unref(visibleRef), (v) => {
1093
+ emits("visible-change", v);
1094
+ emits("update:visible", v);
1095
+ nextTick(() => {
1096
+ if (props.scrollTop && v && unref(modalWrapperRef)) {
1097
+ unref(modalWrapperRef).$el.scrollTop = 0;
1098
+ }
1099
+ });
1100
+ }, {
1101
+ immediate: false
1102
+ });
1103
+ return (_ctx, _cache) => {
1104
+ const _component_ASpin = Spin;
1105
+ return openBlock(), createBlock(unref$1(Modal), mergeProps(unref$1(getBindValue), { onCancel: handleCancel }), createSlots({
1106
+ default: withCtx(() => [
1107
+ createVNode(_component_ASpin, {
1108
+ spinning: unref$1(getBindValue).loading,
1109
+ tip: unref$1(getBindValue).loadingTip
1110
+ }, {
1111
+ default: withCtx(() => [
1112
+ createVNode(_sfc_main$3, mergeProps({
1113
+ useWrapper: unref$1(getBindValue).useWrapper,
1114
+ fullScreen: unref$1(fullScreenRef),
1115
+ ref_key: "modalWrapperRef",
1116
+ ref: modalWrapperRef,
1117
+ minHeight: unref$1(getBindValue).minHeight,
1118
+ height: unref$1(getWrapperHeight),
1119
+ visible: unref$1(visibleRef),
1120
+ modalFooterHeight: unref$1(modalFooterHeight)
1121
+ }, unref$1(omit)(unref$1(getBindValue).wrapperProps, "visible", "height", "modalFooterHeight"), { onHeightChange: handleHeightChange }), {
1122
+ default: withCtx(() => [
1123
+ renderSlot(_ctx.$slots, "default")
1124
+ ]),
1125
+ _: 3
1126
+ }, 16, ["useWrapper", "fullScreen", "minHeight", "height", "visible", "modalFooterHeight"])
1127
+ ]),
1128
+ _: 3
1129
+ }, 8, ["spinning", "tip"])
1130
+ ]),
1131
+ _: 2
1132
+ }, [
1133
+ !_ctx.$slots.closeIcon ? {
1134
+ name: "closeIcon",
1135
+ fn: withCtx(() => [
1136
+ createVNode(_sfc_main$7, {
1137
+ canFullscreen: unref$1(getBindValue).canFullscreen,
1138
+ fullScreen: unref$1(fullScreenRef),
1139
+ onCancel: handleCancel,
1140
+ onFullscreen: unref$1(toggleFullScreen)
1141
+ }, null, 8, ["canFullscreen", "fullScreen", "onFullscreen"])
1142
+ ]),
1143
+ key: "0"
1144
+ } : void 0,
1145
+ !_ctx.$slots.title ? {
1146
+ name: "title",
1147
+ fn: withCtx(() => [
1148
+ createTextVNode(toDisplayString(unref$1(getMergeProps).title), 1)
1149
+ ]),
1150
+ key: "1"
1151
+ } : void 0,
1152
+ !_ctx.$slots.footer ? {
1153
+ name: "footer",
1154
+ fn: withCtx(() => [
1155
+ createVNode(_sfc_main$1, {
1156
+ buttons: unref$1(propsRef)?.footer,
1157
+ showSave: unref$1(getBindValue).showOkBtn,
1158
+ showCancel: unref$1(getBindValue).showCancelBtn,
1159
+ okText: unref$1(getBindValue).okText,
1160
+ cancelText: unref$1(getBindValue).cancelText,
1161
+ onHandleSave: handleSave,
1162
+ onHandleCancel: handleCancel
1163
+ }, createSlots({ _: 2 }, [
1164
+ renderList(Object.keys(_ctx.$slots), (item) => {
1165
+ return {
1166
+ name: item,
1167
+ fn: withCtx((data) => [
1168
+ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
1169
+ ])
1170
+ };
1171
+ })
1172
+ ]), 1032, ["buttons", "showSave", "showCancel", "okText", "cancelText"])
1173
+ ]),
1174
+ key: "2"
1175
+ } : void 0,
1176
+ renderList(Object.keys(unref$1(omit)(_ctx.$slots, "default")), (item) => {
1177
+ return {
1178
+ name: item,
1179
+ fn: withCtx((data) => [
1180
+ renderSlot(_ctx.$slots, item, normalizeProps(guardReactiveProps(data || {})))
1181
+ ])
1182
+ };
1183
+ })
1184
+ ]), 1040);
1185
+ };
1186
+ }
1187
+ });
1188
+ export {
1189
+ _sfc_main as DtModal,
1190
+ useModal,
1191
+ useModalOut
1192
+ };