@duxweb/dvha-pro 1.0.17 → 1.0.19

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