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