@duxweb/dvha-pro 1.0.22 → 1.0.24

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 (157) hide show
  1. package/dist/cjs/component.cjs +1 -1
  2. package/dist/cjs/components/card/card.cjs +1 -1
  3. package/dist/cjs/components/card/store.cjs +1 -1
  4. package/dist/cjs/components/carousel/carousel.cjs +1 -1
  5. package/dist/cjs/components/crop/imageCrop.cjs +1 -1
  6. package/dist/cjs/components/crop/imageCropModal.cjs +1 -1
  7. package/dist/cjs/components/dashboard/hello.cjs +1 -1
  8. package/dist/cjs/components/dashboard/helloBig.cjs +1 -1
  9. package/dist/cjs/components/dashboard/quick.cjs +1 -1
  10. package/dist/cjs/components/data/dynamicData.cjs +1 -1
  11. package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
  12. package/dist/cjs/components/data/selectModal.cjs +1 -1
  13. package/dist/cjs/components/dialog/dialog.cjs +1 -1
  14. package/dist/cjs/components/drawer/drawer.cjs +1 -1
  15. package/dist/cjs/components/drawer/drawerPage.cjs +1 -1
  16. package/dist/cjs/components/editor/aiEditor.cjs +1 -1
  17. package/dist/cjs/components/form/drawerForm.cjs +1 -0
  18. package/dist/cjs/components/form/formItem.cjs +1 -1
  19. package/dist/cjs/components/form/formLayout.cjs +1 -1
  20. package/dist/cjs/components/form/modalForm.cjs +1 -1
  21. package/dist/cjs/components/form/pageForm.cjs +1 -1
  22. package/dist/cjs/components/form/settingForm.cjs +1 -1
  23. package/dist/cjs/components/icon/iconPicker.cjs +1 -1
  24. package/dist/cjs/components/layout/filter.cjs +1 -1
  25. package/dist/cjs/components/layout/filterLayout.cjs +1 -1
  26. package/dist/cjs/components/layout/list.cjs +1 -1
  27. package/dist/cjs/components/layout/table.cjs +1 -1
  28. package/dist/cjs/components/layout/tools.cjs +1 -1
  29. package/dist/cjs/components/list/card.cjs +1 -1
  30. package/dist/cjs/components/list/list.cjs +1 -1
  31. package/dist/cjs/components/media/media.cjs +1 -1
  32. package/dist/cjs/components/modal/modal.cjs +1 -1
  33. package/dist/cjs/components/modal/modalPage.cjs +1 -1
  34. package/dist/cjs/components/modal/modalTab.cjs +1 -1
  35. package/dist/cjs/components/panel/alert.cjs +1 -1
  36. package/dist/cjs/components/panel/collapse.cjs +1 -1
  37. package/dist/cjs/components/panel/setting.cjs +1 -1
  38. package/dist/cjs/components/select/cardSelect.cjs +1 -1
  39. package/dist/cjs/components/status/listEmpty.cjs +1 -1
  40. package/dist/cjs/components/table/tablePage.cjs +1 -1
  41. package/dist/cjs/components/tree/treeFilter.cjs +1 -1
  42. package/dist/cjs/components/upload/config.cjs +1 -1
  43. package/dist/cjs/components/upload/file.cjs +1 -1
  44. package/dist/cjs/components/upload/image.cjs +1 -1
  45. package/dist/cjs/components/upload/manage/item.cjs +1 -1
  46. package/dist/cjs/components/upload/manager.cjs +1 -1
  47. package/dist/cjs/components/widget/connect.cjs +1 -1
  48. package/dist/cjs/dvha-pro.css +1 -1
  49. package/dist/cjs/hooks/action.cjs +1 -1
  50. package/dist/cjs/hooks/download.cjs +1 -1
  51. package/dist/cjs/hooks/echart.cjs +1 -1
  52. package/dist/cjs/hooks/image.cjs +1 -1
  53. package/dist/cjs/hooks/level.cjs +1 -1
  54. package/dist/cjs/hooks/table/color.cjs +1 -0
  55. package/dist/cjs/hooks/table/column.cjs +1 -1
  56. package/dist/cjs/hooks/table/image.cjs +1 -1
  57. package/dist/cjs/hooks/table/input.cjs +1 -1
  58. package/dist/cjs/hooks/table/map.cjs +1 -1
  59. package/dist/cjs/hooks/table/status.cjs +1 -1
  60. package/dist/cjs/hooks/table/switch.cjs +1 -1
  61. package/dist/cjs/hooks/table.cjs +1 -1
  62. package/dist/cjs/index.cjs +1 -1
  63. package/dist/cjs/pages/layout/global.cjs +1 -1
  64. package/dist/cjs/pages/layout/tab.cjs +1 -1
  65. package/dist/cjs/pages/login.cjs +1 -1
  66. package/dist/cjs/pages/menu/avatar.cjs +1 -1
  67. package/dist/cjs/pages/menu/button.cjs +1 -1
  68. package/dist/cjs/pages/menu/cmd.cjs +1 -1
  69. package/dist/cjs/pages/page.cjs +1 -1
  70. package/dist/cjs/pages/pageStatus.cjs +1 -1
  71. package/dist/cjs/stores/ui.cjs +1 -1
  72. package/dist/cjs/theme/uno.css.cjs +2 -1
  73. package/dist/esm/component.js +3 -3
  74. package/dist/esm/components/card/card.js +24 -27
  75. package/dist/esm/components/card/store.js +33 -39
  76. package/dist/esm/components/carousel/carousel.js +16 -19
  77. package/dist/esm/components/crop/imageCrop.js +32 -35
  78. package/dist/esm/components/crop/imageCropModal.js +36 -37
  79. package/dist/esm/components/dashboard/hello.js +27 -30
  80. package/dist/esm/components/dashboard/helloBig.js +328 -331
  81. package/dist/esm/components/dashboard/quick.js +30 -33
  82. package/dist/esm/components/data/dynamicData.js +86 -98
  83. package/dist/esm/components/data/dynamicSelect.js +29 -31
  84. package/dist/esm/components/data/selectModal.js +45 -49
  85. package/dist/esm/components/dialog/dialog.js +54 -55
  86. package/dist/esm/components/drawer/drawer.js +23 -22
  87. package/dist/esm/components/drawer/drawerPage.js +39 -49
  88. package/dist/esm/components/editor/aiEditor.js +64 -70
  89. package/dist/esm/components/form/drawerForm.js +149 -0
  90. package/dist/esm/components/form/formItem.js +44 -50
  91. package/dist/esm/components/form/formLayout.js +7 -10
  92. package/dist/esm/components/form/modalForm.js +50 -50
  93. package/dist/esm/components/form/pageForm.js +47 -50
  94. package/dist/esm/components/form/settingForm.js +34 -37
  95. package/dist/esm/components/icon/iconPicker.js +54 -58
  96. package/dist/esm/components/layout/filter.js +13 -16
  97. package/dist/esm/components/layout/filterLayout.js +7 -10
  98. package/dist/esm/components/layout/list.js +299 -326
  99. package/dist/esm/components/layout/table.js +268 -283
  100. package/dist/esm/components/layout/tools.js +38 -41
  101. package/dist/esm/components/list/card.js +35 -38
  102. package/dist/esm/components/list/list.js +15 -18
  103. package/dist/esm/components/media/media.js +35 -36
  104. package/dist/esm/components/modal/modal.js +10 -10
  105. package/dist/esm/components/modal/modalPage.js +32 -36
  106. package/dist/esm/components/modal/modalTab.js +39 -45
  107. package/dist/esm/components/panel/alert.js +19 -22
  108. package/dist/esm/components/panel/collapse.js +33 -36
  109. package/dist/esm/components/panel/setting.js +25 -31
  110. package/dist/esm/components/select/cardSelect.js +27 -28
  111. package/dist/esm/components/status/listEmpty.js +13 -13
  112. package/dist/esm/components/table/tablePage.js +25 -25
  113. package/dist/esm/components/tree/treeFilter.js +137 -147
  114. package/dist/esm/components/upload/config.js +15 -27
  115. package/dist/esm/components/upload/file.js +90 -94
  116. package/dist/esm/components/upload/image.js +116 -123
  117. package/dist/esm/components/upload/manage/item.js +44 -47
  118. package/dist/esm/components/upload/manager.js +190 -207
  119. package/dist/esm/components/widget/connect.js +103 -106
  120. package/dist/esm/dvha-pro.css +1 -1
  121. package/dist/esm/hooks/action.js +141 -157
  122. package/dist/esm/hooks/download.js +55 -56
  123. package/dist/esm/hooks/echart.js +156 -179
  124. package/dist/esm/hooks/image.js +14 -15
  125. package/dist/esm/hooks/level.js +7 -7
  126. package/dist/esm/hooks/table/color.js +19 -0
  127. package/dist/esm/hooks/table/column.js +25 -23
  128. package/dist/esm/hooks/table/image.js +2 -2
  129. package/dist/esm/hooks/table/input.js +28 -28
  130. package/dist/esm/hooks/table/map.js +7 -7
  131. package/dist/esm/hooks/table/status.js +8 -9
  132. package/dist/esm/hooks/table/switch.js +19 -19
  133. package/dist/esm/hooks/table.js +27 -31
  134. package/dist/esm/index.js +162 -158
  135. package/dist/esm/pages/layout/global.js +12 -15
  136. package/dist/esm/pages/layout/tab.js +58 -71
  137. package/dist/esm/pages/login.js +81 -85
  138. package/dist/esm/pages/menu/avatar.js +136 -149
  139. package/dist/esm/pages/menu/button.js +16 -20
  140. package/dist/esm/pages/menu/cmd.js +68 -74
  141. package/dist/esm/pages/page.js +21 -25
  142. package/dist/esm/pages/pageStatus.js +21 -24
  143. package/dist/esm/stores/ui.js +15 -15
  144. package/dist/esm/theme/uno.css.js +2 -1
  145. package/dist/types/components/drawer/drawerPage.d.ts +1 -1
  146. package/dist/types/components/form/drawerForm.d.ts +104 -0
  147. package/dist/types/components/form/index.d.ts +1 -0
  148. package/dist/types/components/form/modalForm.d.ts +6 -0
  149. package/dist/types/components/form/pageForm.d.ts +6 -0
  150. package/dist/types/components/form/settingForm.d.ts +6 -0
  151. package/dist/types/components/layout/table.d.ts +9 -0
  152. package/dist/types/components/table/tablePage.d.ts +9 -0
  153. package/dist/types/hooks/table/color.d.ts +13 -0
  154. package/dist/types/hooks/table/column.d.ts +1 -0
  155. package/dist/types/hooks/table/index.d.ts +1 -0
  156. package/dist/types/hooks/table/types.d.ts +2 -2
  157. package/package.json +3 -3
@@ -1,11 +1,11 @@
1
- import { defineComponent as k, ref as D, computed as m, watch as M, createVNode as o, Fragment as U, createTextVNode as w, isVNode as A } from "vue";
2
- import { useI18n as Z, useUpload as j } from "@duxweb/dvha-core";
3
- import { useVModel as O, useDropZone as B } from "@vueuse/core";
4
- import X from "mime";
5
- import { useMessage as E, NDataTable as L, NProgress as T, NButton as x } from "naive-ui";
1
+ import { defineComponent as z, ref as k, computed as s, watch as D, createVNode as o, Fragment as M, createTextVNode as U, isVNode as w } from "vue";
2
+ import { useI18n as A, useUpload as Z } from "@duxweb/dvha-core";
3
+ import { useVModel as j, useDropZone as O } from "@vueuse/core";
4
+ import B from "mime";
5
+ import { useMessage as X, NDataTable as E, NProgress as L, NButton as g } from "naive-ui";
6
6
  import "vue-router";
7
7
  import "@overlastic/vue";
8
- import { DuxMedia as I } from "../media/media.js";
8
+ import { DuxMedia as T } from "../media/media.js";
9
9
  import "vue-echarts";
10
10
  import "vue-cropper";
11
11
  import "clsx";
@@ -27,7 +27,7 @@ import "vue-command-palette";
27
27
  import "@duxweb/dvha-naiveui";
28
28
  import "../../pages/page404.js";
29
29
  import "@iconify-json/tabler/icons.json";
30
- import { useUploadConfig as W } from "./config.js";
30
+ import { useUploadConfig as I } from "./config.js";
31
31
  import "vue3-ace-editor";
32
32
  import "ace-builds/src-noconflict/mode-vue";
33
33
  import "ace-builds/src-noconflict/mode-javascript";
@@ -39,14 +39,14 @@ import "ace-builds/src-noconflict/theme-tomorrow";
39
39
  import "ace-builds/src-noconflict/ext-searchbox";
40
40
  import "ace-builds/src-noconflict/ext-language_tools";
41
41
  import "ace-builds/src-noconflict/mode-snippets";
42
- import { useModal as G } from "../../hooks/modal.js";
42
+ import { useModal as W } from "../../hooks/modal.js";
43
43
  import "dayjs";
44
44
  import "@tanstack/vue-query";
45
45
  import "pinia";
46
- function h(e) {
47
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !A(e);
46
+ function v(e) {
47
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !w(e);
48
48
  }
49
- const d = {
49
+ const m = {
50
50
  "image/*": "JPG, PNG, GIF, BMP, WEBP",
51
51
  "video/*": "MP4, AVI, MOV, WMV, FLV",
52
52
  "audio/*": "MP3, WAV, AAC, FLAC",
@@ -56,7 +56,7 @@ const d = {
56
56
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "DOCX",
57
57
  "application/vnd.ms-excel": "XLS",
58
58
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "XLSX"
59
- }, n = {
59
+ }, r = {
60
60
  container: "flex flex-col gap-2",
61
61
  dropZone: {
62
62
  base: "flex items-center justify-center p-6 rounded bg-muted border border-dashed transition-all cursor-pointer group",
@@ -77,7 +77,7 @@ const d = {
77
77
  empty: "flex items-center justify-center h-full text-muted",
78
78
  actions: "flex gap-2"
79
79
  }
80
- }, Oe = /* @__PURE__ */ k({
80
+ }, je = /* @__PURE__ */ z({
81
81
  name: "DuxFileUpload",
82
82
  props: {
83
83
  path: {
@@ -107,57 +107,56 @@ const d = {
107
107
  onUpdateValue: Function
108
108
  },
109
109
  setup(e, {
110
- emit: v
110
+ emit: x
111
111
  }) {
112
- const b = O(e, "value", v, {
112
+ const h = j(e, "value", x, {
113
113
  passive: !0,
114
114
  deep: !0,
115
115
  defaultValue: e.defaultValue
116
- }), y = E(), {
116
+ }), b = X(), {
117
117
  t: a
118
- } = Z(), u = D(), c = m(() => e.maxSize || 5), F = G(), {
119
- uploadPath: p,
120
- managePath: P,
121
- driver: C
122
- } = W({
123
- driver: e == null ? void 0 : e.driver,
124
- signPath: e == null ? void 0 : e.signPath,
125
- signCallback: e == null ? void 0 : e.signCallback,
126
- uploadPath: e == null ? void 0 : e.path,
127
- managePath: e == null ? void 0 : e.managePath
128
- }), r = j({
129
- path: p.value,
118
+ } = A(), c = k(), p = s(() => e.maxSize || 5), y = W(), {
119
+ uploadPath: d,
120
+ managePath: F,
121
+ driver: P
122
+ } = I({
123
+ driver: e?.driver,
124
+ signPath: e?.signPath,
125
+ signCallback: e?.signCallback,
126
+ uploadPath: e?.path,
127
+ managePath: e?.managePath
128
+ }), n = Z({
129
+ path: d.value,
130
130
  multiple: e.multiple,
131
131
  maxFileCount: e.maxNum,
132
- maxFileSize: c.value * 1024 * 1024,
132
+ maxFileSize: p.value * 1024 * 1024,
133
133
  autoUpload: !0,
134
134
  accept: e.accept,
135
- onError: (t) => y.error(t.message || a("components.upload.error")),
136
- driver: C.value
135
+ onError: (t) => b.error(t.message || a("components.upload.error")),
136
+ driver: P.value
137
137
  }), {
138
- isOverDropZone: f
139
- } = B(u, {
138
+ isOverDropZone: u
139
+ } = O(c, {
140
140
  onDrop: (t) => {
141
- t && t.length > 0 && r.addFiles(Array.from(t), "file");
141
+ t && t.length > 0 && n.addFiles(Array.from(t), "file");
142
142
  }
143
143
  });
144
- M(r.dataFiles, (t) => {
145
- var l, s;
146
- const i = e.multiple ? t == null ? void 0 : t.map((z) => z.url) : (l = t == null ? void 0 : t[0]) == null ? void 0 : l.url;
147
- b.value = i, (s = e.onUpdateValue) == null || s.call(e, i);
144
+ D(n.dataFiles, (t) => {
145
+ const i = e.multiple ? t?.map((l) => l.url) : t?.[0]?.url;
146
+ h.value = i, e.onUpdateValue?.(i);
148
147
  });
149
- const g = m(() => e.accept ? e.accept.split(",").map((t) => {
148
+ const f = s(() => e.accept ? e.accept.split(",").map((t) => {
150
149
  const i = t.trim();
151
- if (d[i]) return d[i];
150
+ if (m[i]) return m[i];
152
151
  if (i.includes("*")) {
153
- const s = i.split("/")[0];
154
- return d[i] || a("common.fileExtension", {
155
- ext: s.toUpperCase()
152
+ const V = i.split("/")[0];
153
+ return m[i] || a("common.fileExtension", {
154
+ ext: V.toUpperCase()
156
155
  });
157
156
  }
158
- const l = X.getExtension(i);
157
+ const l = B.getExtension(i);
159
158
  return l ? l.toUpperCase() : i;
160
- }).filter(Boolean).join(", ") : ""), S = m(() => ({
159
+ }).filter(Boolean).join(", ") : ""), C = s(() => ({
161
160
  pending: o("div", {
162
161
  class: "text-info"
163
162
  }, [a("components.upload.status.pending")]),
@@ -170,56 +169,56 @@ const d = {
170
169
  error: o("div", {
171
170
  class: "text-error"
172
171
  }, [a("components.upload.status.error")])
173
- })), N = m(() => [n.dropZone.base, f.value ? n.dropZone.active : n.dropZone.hover]), V = m(() => [r.uploadFiles.value.length === 0 && "border-b border-muted"]);
172
+ })), S = s(() => [r.dropZone.base, u.value ? r.dropZone.active : r.dropZone.hover]), N = s(() => [n.uploadFiles.value.length === 0 && "border-b border-muted"]);
174
173
  return () => o("div", {
175
- class: n.container
174
+ class: r.container
176
175
  }, [o("div", {
177
- ref: u,
178
- class: N.value,
179
- onClick: () => r.open()
176
+ ref: c,
177
+ class: S.value,
178
+ onClick: () => n.open()
180
179
  }, [o("div", {
181
- class: n.content
180
+ class: r.content
182
181
  }, [o("div", {
183
- class: n.icon.wrapper,
182
+ class: r.icon.wrapper,
184
183
  onClick: (t) => {
185
- e.manager && (t.stopPropagation(), F.show({
184
+ e.manager && (t.stopPropagation(), y.show({
186
185
  title: a("components.upload.title"),
187
186
  width: 800,
188
187
  component: () => import("./manager.js"),
189
188
  componentProps: {
190
- path: P.value,
189
+ path: F.value,
191
190
  multiple: e.multiple,
192
191
  uploadParams: {
193
- path: p.value,
192
+ path: d.value,
194
193
  accept: e.accept,
195
194
  maxNum: e.maxNum,
196
- maxSize: c.value
195
+ maxSize: p.value
197
196
  }
198
197
  }
199
198
  }).then((i) => {
200
- r.addDataFiles(i);
199
+ n.addDataFiles(i);
201
200
  }));
202
201
  }
203
202
  }, [o("div", {
204
- class: n.icon.icon
203
+ class: r.icon.icon
205
204
  }, null)]), o("div", {
206
- class: n.text.title
205
+ class: r.text.title
207
206
  }, [a("components.upload.desc")]), o("div", {
208
- class: n.text.desc
209
- }, [f.value ? o("span", {
210
- class: n.text.highlight
211
- }, [a("components.upload.dropHere")]) : o(U, null, [g.value ? a("components.upload.supportFormats", {
212
- formats: g.value
213
- }) : a("components.upload.allFormats"), w(","), " ", a("components.upload.maxSize", {
214
- size: c.value
215
- })])])])]), o(L, {
207
+ class: r.text.desc
208
+ }, [u.value ? o("span", {
209
+ class: r.text.highlight
210
+ }, [a("components.upload.dropHere")]) : o(M, null, [f.value ? a("components.upload.supportFormats", {
211
+ formats: f.value
212
+ }) : a("components.upload.allFormats"), U(","), " ", a("components.upload.maxSize", {
213
+ size: p.value
214
+ })])])])]), o(E, {
216
215
  bordered: !1,
217
- class: V.value,
216
+ class: N.value,
218
217
  columns: [{
219
218
  key: "filename",
220
219
  title: a("components.upload.file.name"),
221
220
  minWidth: 200,
222
- render: (t) => o(I, {
221
+ render: (t) => o(T, {
223
222
  title: t.filename,
224
223
  desc: t.filetype
225
224
  }, null)
@@ -231,21 +230,18 @@ const d = {
231
230
  key: "status",
232
231
  title: a("components.upload.file.status"),
233
232
  width: 120,
234
- render: (t) => {
235
- var i;
236
- return t.status === "uploading" ? o(T, {
237
- type: "line",
238
- style: {
239
- width: "24px",
240
- height: "24px"
241
- },
242
- color: "rgb(var(--ui-color-primary))",
243
- "indicator-placement": "inside",
244
- percentage: (i = t.progress) == null ? void 0 : i.percent,
245
- showIndicator: !1,
246
- height: 14
247
- }, null) : S.value[t.status];
248
- }
233
+ render: (t) => t.status === "uploading" ? o(L, {
234
+ type: "line",
235
+ style: {
236
+ width: "24px",
237
+ height: "24px"
238
+ },
239
+ color: "rgb(var(--ui-color-primary))",
240
+ "indicator-placement": "inside",
241
+ percentage: t.progress?.percent,
242
+ showIndicator: !1,
243
+ height: 14
244
+ }, null) : C.value[t.status]
249
245
  }, {
250
246
  key: "actions",
251
247
  title: a("components.upload.actions"),
@@ -253,33 +249,33 @@ const d = {
253
249
  render: (t) => {
254
250
  let i, l;
255
251
  return o("div", {
256
- class: n.table.actions
257
- }, [o(x, {
252
+ class: r.table.actions
253
+ }, [o(g, {
258
254
  type: "warning",
259
255
  size: "small",
260
256
  text: !0,
261
257
  disabled: ["success", "error", "cancelled"].includes(t.status),
262
- onClick: () => r.cancelFiles([t.id])
263
- }, h(i = a("components.upload.cancel")) ? i : {
258
+ onClick: () => n.cancelFiles([t.id])
259
+ }, v(i = a("components.upload.cancel")) ? i : {
264
260
  default: () => [i]
265
- }), o(x, {
261
+ }), o(g, {
266
262
  type: "error",
267
263
  size: "small",
268
264
  text: !0,
269
- onClick: () => r.removeFiles([t.id])
270
- }, h(l = a("components.upload.delete")) ? l : {
265
+ onClick: () => n.removeFiles([t.id])
266
+ }, v(l = a("components.upload.delete")) ? l : {
271
267
  default: () => [l]
272
268
  })]);
273
269
  }
274
270
  }],
275
- data: r.uploadFiles.value
271
+ data: n.uploadFiles.value
276
272
  }, {
277
273
  empty: () => o("div", {
278
- class: n.table.empty
274
+ class: r.table.empty
279
275
  }, [a("components.upload.empty")])
280
276
  })]);
281
277
  }
282
278
  });
283
279
  export {
284
- Oe as DuxFileUpload
280
+ je as DuxFileUpload
285
281
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as S, computed as n, watch as U, createVNode as t } from "vue";
2
- import { useI18n as k, useUpload as w } from "@duxweb/dvha-core";
3
- import { useVModel as I } from "@vueuse/core";
4
- import V from "clsx";
5
- import { useMessage as j, NImage as B, NButton as s, NProgress as D } from "naive-ui";
6
- import { VueDraggable as A } from "vue-draggable-plus";
1
+ import { defineComponent as F, computed as i, watch as N, createVNode as t } from "vue";
2
+ import { useI18n as S, useUpload as U } from "@duxweb/dvha-core";
3
+ import { useVModel as k } from "@vueuse/core";
4
+ import w from "clsx";
5
+ import { useMessage as I, NImage as V, NButton as s, NProgress as j } from "naive-ui";
6
+ import { VueDraggable as B } from "vue-draggable-plus";
7
7
  import "vue-router";
8
8
  import "@overlastic/vue";
9
9
  import "vue-echarts";
@@ -26,7 +26,7 @@ import "@duxweb/dvha-naiveui";
26
26
  import "../../pages/page404.js";
27
27
  import "@iconify-json/tabler/icons.json";
28
28
  import "mime";
29
- import { useUploadConfig as M } from "./config.js";
29
+ import { useUploadConfig as D } from "./config.js";
30
30
  import "vue3-ace-editor";
31
31
  import "ace-builds/src-noconflict/mode-vue";
32
32
  import "ace-builds/src-noconflict/mode-javascript";
@@ -38,12 +38,12 @@ import "ace-builds/src-noconflict/theme-tomorrow";
38
38
  import "ace-builds/src-noconflict/ext-searchbox";
39
39
  import "ace-builds/src-noconflict/ext-language_tools";
40
40
  import "ace-builds/src-noconflict/mode-snippets";
41
- import { useModal as L } from "../../hooks/modal.js";
41
+ import { useModal as A } from "../../hooks/modal.js";
42
42
  import "dayjs";
43
- import { useImagePreview as O } from "../../hooks/image.js";
43
+ import { useImagePreview as M } from "../../hooks/image.js";
44
44
  import "@tanstack/vue-query";
45
45
  import "pinia";
46
- const Ie = /* @__PURE__ */ S({
46
+ const ke = /* @__PURE__ */ F({
47
47
  name: "DuxImageUpload",
48
48
  props: {
49
49
  path: {
@@ -75,15 +75,15 @@ const Ie = /* @__PURE__ */ S({
75
75
  onUpdateValue: Function
76
76
  },
77
77
  setup(e, {
78
- emit: c
78
+ emit: d
79
79
  }) {
80
- const g = I(e, "value", c, {
80
+ const c = k(e, "value", d, {
81
81
  passive: !0,
82
82
  deep: !0,
83
83
  defaultValue: e.defaultValue
84
- }), p = j(), v = O(), {
85
- t: m
86
- } = k(), i = {
84
+ }), p = I(), g = M(), {
85
+ t: u
86
+ } = S(), l = {
87
87
  container: "flex gap-2",
88
88
  imageItem: "size-80px rounded border border-muted relative group draggable flex items-center",
89
89
  imageOverlay: "z-1 size-full inset-0 absolute flex items-center justify-center bg-default/80 transition-all opacity-0 group-hover:opacity-100 rounded",
@@ -91,129 +91,122 @@ const Ie = /* @__PURE__ */ S({
91
91
  uploadContent: "flex-1 flex flex-col justify-center items-center gap-1 relative",
92
92
  progressContainer: "size-80px flex items-center justify-center rounded",
93
93
  progressBar: "absolute left-2 right-2 bottom-2"
94
- }, h = n(() => e.maxSize), {
95
- uploadPath: d,
96
- managePath: f,
97
- driver: b
98
- } = M({
99
- driver: e == null ? void 0 : e.driver,
100
- signPath: e == null ? void 0 : e.signPath,
101
- signCallback: e == null ? void 0 : e.signCallback,
102
- uploadPath: e == null ? void 0 : e.path,
103
- managePath: e == null ? void 0 : e.managePath
104
- }), l = w({
105
- path: d.value,
94
+ }, v = i(() => e.maxSize), {
95
+ uploadPath: m,
96
+ managePath: h,
97
+ driver: f
98
+ } = D({
99
+ driver: e?.driver,
100
+ signPath: e?.signPath,
101
+ signCallback: e?.signCallback,
102
+ uploadPath: e?.path,
103
+ managePath: e?.managePath
104
+ }), r = U({
105
+ path: m.value,
106
106
  multiple: e.multiple,
107
107
  maxFileCount: e.maxNum,
108
- maxFileSize: h.value * 1024 * 1024,
108
+ maxFileSize: v.value * 1024 * 1024,
109
109
  autoUpload: !0,
110
110
  accept: "image/*",
111
111
  onError: (a) => {
112
- p.error(a.message || m("components.upload.error"));
112
+ p.error(a.message || u("components.upload.error"));
113
113
  },
114
- driver: b.value
114
+ driver: f.value
115
115
  });
116
- U(l.dataFiles, (a) => {
117
- var o, u;
118
- const r = e.multiple ? a == null ? void 0 : a.map((N) => N.url) : (o = a == null ? void 0 : a[0]) == null ? void 0 : o.url;
119
- g.value = r, (u = e.onUpdateValue) == null || u.call(e, r);
116
+ N(r.dataFiles, (a) => {
117
+ const o = e.multiple ? a?.map((n) => n.url) : a?.[0]?.url;
118
+ c.value = o, e.onUpdateValue?.(o);
120
119
  });
121
- const x = n(() => l.progress.value.totalPercent), y = n(() => l.isUploading.value), z = async () => {
122
- l.open();
123
- }, P = n(() => e.multiple ? e.maxNum && l.uploadFiles.value.length >= e.maxNum : !0), C = n(() => {
124
- var a;
125
- return (a = l.dataFiles.value) == null ? void 0 : a.map((r) => r.url);
126
- }), F = L();
127
- return () => t("div", null, [t(A, {
128
- modelValue: l.uploadFiles.value,
129
- "onUpdate:modelValue": (a) => l.uploadFiles.value = a,
130
- class: i.container,
120
+ const b = i(() => r.progress.value.totalPercent), x = i(() => r.isUploading.value), y = async () => {
121
+ r.open();
122
+ }, z = i(() => e.multiple ? e.maxNum && r.uploadFiles.value.length >= e.maxNum : !0), P = i(() => r.dataFiles.value?.map((a) => a.url)), C = A();
123
+ return () => t("div", null, [t(B, {
124
+ modelValue: r.uploadFiles.value,
125
+ "onUpdate:modelValue": (a) => r.uploadFiles.value = a,
126
+ class: l.container,
131
127
  draggable: ".draggable"
132
128
  }, {
133
- default: () => {
134
- var a;
135
- return [(a = l.uploadFiles.value) == null ? void 0 : a.map((r, o) => {
136
- const u = r.url || URL.createObjectURL(r.file);
137
- return t("div", {
138
- key: o,
139
- class: V(i.imageItem)
140
- }, [t(B, {
141
- class: "z-0 rounded",
142
- objectFit: "scale-down",
143
- width: 78,
144
- height: 78,
145
- previewDisabled: !0,
146
- src: u
147
- }, null), t("div", {
148
- class: i.imageOverlay
149
- }, [r.status === "success" && t(s, {
150
- quaternary: !0,
151
- circle: !0,
152
- size: "small",
153
- renderIcon: () => t("div", {
154
- class: "n-icon i-tabler:eye"
155
- }, null),
156
- onClick: () => v.show(C.value, o)
157
- }, null), t(s, {
158
- quaternary: !0,
159
- circle: !0,
160
- size: "small",
161
- renderIcon: () => t("div", {
162
- class: "n-icon i-tabler:trash"
163
- }, null),
164
- onClick: () => {
165
- l.removeFiles([r.id]);
166
- }
167
- }, null)])]);
168
- }), (l.uploadFiles.value.length === 0 || !P.value) && t("div", {
169
- class: i.uploadArea,
129
+ default: () => [r.uploadFiles.value?.map((a, o) => {
130
+ const n = a.url || URL.createObjectURL(a.file);
131
+ return t("div", {
132
+ key: o,
133
+ class: w(l.imageItem)
134
+ }, [t(V, {
135
+ class: "z-0 rounded",
136
+ objectFit: "scale-down",
137
+ width: 78,
138
+ height: 78,
139
+ previewDisabled: !0,
140
+ src: n
141
+ }, null), t("div", {
142
+ class: l.imageOverlay
143
+ }, [a.status === "success" && t(s, {
144
+ quaternary: !0,
145
+ circle: !0,
146
+ size: "small",
147
+ renderIcon: () => t("div", {
148
+ class: "n-icon i-tabler:eye"
149
+ }, null),
150
+ onClick: () => g.show(P.value, o)
151
+ }, null), t(s, {
152
+ quaternary: !0,
153
+ circle: !0,
154
+ size: "small",
155
+ renderIcon: () => t("div", {
156
+ class: "n-icon i-tabler:trash"
157
+ }, null),
170
158
  onClick: () => {
171
- z();
159
+ r.removeFiles([a.id]);
172
160
  }
173
- }, [e.manager && t("div", {
174
- class: " py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",
175
- onClick: (r) => {
176
- r.stopPropagation(), F.show({
177
- title: m("components.upload.title"),
178
- width: "800px",
179
- component: () => import("./manager.js"),
180
- componentProps: {
181
- path: f.value,
182
- type: "image",
183
- multiple: e.multiple,
184
- uploadParams: {
185
- path: d.value,
186
- accept: "image/*",
187
- maxNum: e.maxNum,
188
- maxSize: e.maxSize
189
- }
161
+ }, null)])]);
162
+ }), (r.uploadFiles.value.length === 0 || !z.value) && t("div", {
163
+ class: l.uploadArea,
164
+ onClick: () => {
165
+ y();
166
+ }
167
+ }, [e.manager && t("div", {
168
+ class: " py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",
169
+ onClick: (a) => {
170
+ a.stopPropagation(), C.show({
171
+ title: u("components.upload.title"),
172
+ width: "800px",
173
+ component: () => import("./manager.js"),
174
+ componentProps: {
175
+ path: h.value,
176
+ type: "image",
177
+ multiple: e.multiple,
178
+ uploadParams: {
179
+ path: m.value,
180
+ accept: "image/*",
181
+ maxNum: e.maxNum,
182
+ maxSize: e.maxSize
190
183
  }
191
- }).then((o) => {
192
- l.addDataFiles(o);
193
- });
194
- }
195
- }, [t("div", {
196
- class: "i-tabler:folder size-4"
197
- }, null)]), t("div", {
198
- class: i.uploadContent
199
- }, [y.value ? t("div", {
200
- class: i.progressContainer
201
- }, [t("div", {
202
- class: "i-tabler:photo size-6"
203
- }, null), t("div", {
204
- class: i.progressBar
205
- }, [t(D, {
206
- type: "line",
207
- percentage: x.value,
208
- showIndicator: !1,
209
- height: 4
210
- }, null)])]) : t("div", {
211
- class: "i-tabler:plus size-4"
212
- }, null)])])];
213
- }
184
+ }
185
+ }).then((o) => {
186
+ r.addDataFiles(o);
187
+ });
188
+ }
189
+ }, [t("div", {
190
+ class: "i-tabler:folder size-4"
191
+ }, null)]), t("div", {
192
+ class: l.uploadContent
193
+ }, [x.value ? t("div", {
194
+ class: l.progressContainer
195
+ }, [t("div", {
196
+ class: "i-tabler:photo size-6"
197
+ }, null), t("div", {
198
+ class: l.progressBar
199
+ }, [t(j, {
200
+ type: "line",
201
+ percentage: b.value,
202
+ showIndicator: !1,
203
+ height: 4
204
+ }, null)])]) : t("div", {
205
+ class: "i-tabler:plus size-4"
206
+ }, null)])])]
214
207
  })]);
215
208
  }
216
209
  });
217
210
  export {
218
- Ie as DuxImageUpload
211
+ ke as DuxImageUpload
219
212
  };