@duxweb/dvha-pro 1.0.23 → 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.
- package/dist/cjs/components/card/card.cjs +1 -1
- package/dist/cjs/components/card/store.cjs +1 -1
- package/dist/cjs/components/carousel/carousel.cjs +1 -1
- package/dist/cjs/components/crop/imageCrop.cjs +1 -1
- package/dist/cjs/components/crop/imageCropModal.cjs +1 -1
- package/dist/cjs/components/dashboard/hello.cjs +1 -1
- package/dist/cjs/components/dashboard/helloBig.cjs +1 -1
- package/dist/cjs/components/dashboard/quick.cjs +1 -1
- package/dist/cjs/components/data/dynamicData.cjs +1 -1
- package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
- package/dist/cjs/components/data/selectModal.cjs +1 -1
- package/dist/cjs/components/dialog/dialog.cjs +1 -1
- package/dist/cjs/components/drawer/drawer.cjs +1 -1
- package/dist/cjs/components/drawer/drawerPage.cjs +1 -1
- package/dist/cjs/components/editor/aiEditor.cjs +1 -1
- package/dist/cjs/components/form/drawerForm.cjs +1 -1
- package/dist/cjs/components/form/formItem.cjs +1 -1
- package/dist/cjs/components/form/formLayout.cjs +1 -1
- package/dist/cjs/components/form/modalForm.cjs +1 -1
- package/dist/cjs/components/form/pageForm.cjs +1 -1
- package/dist/cjs/components/form/settingForm.cjs +1 -1
- package/dist/cjs/components/icon/iconPicker.cjs +1 -1
- package/dist/cjs/components/layout/filter.cjs +1 -1
- package/dist/cjs/components/layout/filterLayout.cjs +1 -1
- package/dist/cjs/components/layout/list.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/layout/tools.cjs +1 -1
- package/dist/cjs/components/list/card.cjs +1 -1
- package/dist/cjs/components/list/list.cjs +1 -1
- package/dist/cjs/components/media/media.cjs +1 -1
- package/dist/cjs/components/modal/modal.cjs +1 -1
- package/dist/cjs/components/modal/modalPage.cjs +1 -1
- package/dist/cjs/components/modal/modalTab.cjs +1 -1
- package/dist/cjs/components/panel/alert.cjs +1 -1
- package/dist/cjs/components/panel/collapse.cjs +1 -1
- package/dist/cjs/components/panel/setting.cjs +1 -1
- package/dist/cjs/components/select/cardSelect.cjs +1 -1
- package/dist/cjs/components/status/listEmpty.cjs +1 -1
- package/dist/cjs/components/table/tablePage.cjs +1 -1
- package/dist/cjs/components/tree/treeFilter.cjs +1 -1
- package/dist/cjs/components/upload/config.cjs +1 -1
- package/dist/cjs/components/upload/file.cjs +1 -1
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/components/upload/manage/item.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/components/widget/connect.cjs +1 -1
- package/dist/cjs/dvha-pro.css +1 -1
- package/dist/cjs/hooks/action.cjs +1 -1
- package/dist/cjs/hooks/download.cjs +1 -1
- package/dist/cjs/hooks/echart.cjs +1 -1
- package/dist/cjs/hooks/image.cjs +1 -1
- package/dist/cjs/hooks/level.cjs +1 -1
- package/dist/cjs/hooks/table/color.cjs +1 -0
- package/dist/cjs/hooks/table/column.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/input.cjs +1 -1
- package/dist/cjs/hooks/table/map.cjs +1 -1
- package/dist/cjs/hooks/table/status.cjs +1 -1
- package/dist/cjs/hooks/table/switch.cjs +1 -1
- package/dist/cjs/hooks/table.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/pages/layout/global.cjs +1 -1
- package/dist/cjs/pages/layout/tab.cjs +1 -1
- package/dist/cjs/pages/login.cjs +1 -1
- package/dist/cjs/pages/menu/avatar.cjs +1 -1
- package/dist/cjs/pages/menu/button.cjs +1 -1
- package/dist/cjs/pages/menu/cmd.cjs +1 -1
- package/dist/cjs/pages/page.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/stores/ui.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +2 -1
- package/dist/esm/components/card/card.js +24 -27
- package/dist/esm/components/card/store.js +33 -39
- package/dist/esm/components/carousel/carousel.js +16 -19
- package/dist/esm/components/crop/imageCrop.js +32 -35
- package/dist/esm/components/crop/imageCropModal.js +36 -37
- package/dist/esm/components/dashboard/hello.js +27 -30
- package/dist/esm/components/dashboard/helloBig.js +328 -331
- package/dist/esm/components/dashboard/quick.js +30 -33
- package/dist/esm/components/data/dynamicData.js +86 -98
- package/dist/esm/components/data/dynamicSelect.js +29 -31
- package/dist/esm/components/data/selectModal.js +45 -49
- package/dist/esm/components/dialog/dialog.js +54 -55
- package/dist/esm/components/drawer/drawer.js +23 -23
- package/dist/esm/components/drawer/drawerPage.js +39 -49
- package/dist/esm/components/editor/aiEditor.js +64 -70
- package/dist/esm/components/form/drawerForm.js +48 -48
- package/dist/esm/components/form/formItem.js +45 -51
- package/dist/esm/components/form/formLayout.js +7 -10
- package/dist/esm/components/form/modalForm.js +50 -50
- package/dist/esm/components/form/pageForm.js +47 -50
- package/dist/esm/components/form/settingForm.js +34 -37
- package/dist/esm/components/icon/iconPicker.js +54 -58
- package/dist/esm/components/layout/filter.js +13 -16
- package/dist/esm/components/layout/filterLayout.js +7 -10
- package/dist/esm/components/layout/list.js +299 -326
- package/dist/esm/components/layout/table.js +268 -283
- package/dist/esm/components/layout/tools.js +38 -41
- package/dist/esm/components/list/card.js +35 -38
- package/dist/esm/components/list/list.js +15 -18
- package/dist/esm/components/media/media.js +35 -36
- package/dist/esm/components/modal/modal.js +10 -10
- package/dist/esm/components/modal/modalPage.js +32 -36
- package/dist/esm/components/modal/modalTab.js +39 -45
- package/dist/esm/components/panel/alert.js +19 -22
- package/dist/esm/components/panel/collapse.js +33 -36
- package/dist/esm/components/panel/setting.js +25 -31
- package/dist/esm/components/select/cardSelect.js +27 -28
- package/dist/esm/components/status/listEmpty.js +13 -13
- package/dist/esm/components/table/tablePage.js +25 -25
- package/dist/esm/components/tree/treeFilter.js +137 -147
- package/dist/esm/components/upload/config.js +15 -27
- package/dist/esm/components/upload/file.js +90 -94
- package/dist/esm/components/upload/image.js +116 -123
- package/dist/esm/components/upload/manage/item.js +44 -47
- package/dist/esm/components/upload/manager.js +190 -207
- package/dist/esm/components/widget/connect.js +103 -106
- package/dist/esm/dvha-pro.css +1 -1
- package/dist/esm/hooks/action.js +115 -131
- package/dist/esm/hooks/download.js +55 -56
- package/dist/esm/hooks/echart.js +156 -179
- package/dist/esm/hooks/image.js +14 -15
- package/dist/esm/hooks/level.js +7 -7
- package/dist/esm/hooks/table/color.js +19 -0
- package/dist/esm/hooks/table/column.js +25 -23
- package/dist/esm/hooks/table/image.js +2 -2
- package/dist/esm/hooks/table/input.js +28 -28
- package/dist/esm/hooks/table/map.js +7 -7
- package/dist/esm/hooks/table/status.js +8 -9
- package/dist/esm/hooks/table/switch.js +19 -19
- package/dist/esm/hooks/table.js +27 -31
- package/dist/esm/index.js +167 -165
- package/dist/esm/pages/layout/global.js +12 -15
- package/dist/esm/pages/layout/tab.js +58 -71
- package/dist/esm/pages/login.js +81 -85
- package/dist/esm/pages/menu/avatar.js +136 -149
- package/dist/esm/pages/menu/button.js +16 -20
- package/dist/esm/pages/menu/cmd.js +68 -74
- package/dist/esm/pages/page.js +21 -25
- package/dist/esm/pages/pageStatus.js +21 -24
- package/dist/esm/stores/ui.js +15 -15
- package/dist/esm/theme/uno.css.js +2 -1
- package/dist/types/components/form/drawerForm.d.ts +6 -0
- package/dist/types/components/form/modalForm.d.ts +6 -0
- package/dist/types/components/form/pageForm.d.ts +6 -0
- package/dist/types/components/form/settingForm.d.ts +6 -0
- package/dist/types/components/layout/table.d.ts +9 -0
- package/dist/types/components/table/tablePage.d.ts +9 -0
- package/dist/types/hooks/table/color.d.ts +13 -0
- package/dist/types/hooks/table/column.d.ts +1 -0
- package/dist/types/hooks/table/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import
|
|
5
|
-
import { useMessage as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
47
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
46
|
+
function v(e) {
|
|
47
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !w(e);
|
|
48
48
|
}
|
|
49
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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:
|
|
110
|
+
emit: x
|
|
111
111
|
}) {
|
|
112
|
-
const
|
|
112
|
+
const h = j(e, "value", x, {
|
|
113
113
|
passive: !0,
|
|
114
114
|
deep: !0,
|
|
115
115
|
defaultValue: e.defaultValue
|
|
116
|
-
}),
|
|
116
|
+
}), b = X(), {
|
|
117
117
|
t: a
|
|
118
|
-
} =
|
|
119
|
-
uploadPath:
|
|
120
|
-
managePath:
|
|
121
|
-
driver:
|
|
122
|
-
} =
|
|
123
|
-
driver: e
|
|
124
|
-
signPath: e
|
|
125
|
-
signCallback: e
|
|
126
|
-
uploadPath: e
|
|
127
|
-
managePath: e
|
|
128
|
-
}),
|
|
129
|
-
path:
|
|
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:
|
|
132
|
+
maxFileSize: p.value * 1024 * 1024,
|
|
133
133
|
autoUpload: !0,
|
|
134
134
|
accept: e.accept,
|
|
135
|
-
onError: (t) =>
|
|
136
|
-
driver:
|
|
135
|
+
onError: (t) => b.error(t.message || a("components.upload.error")),
|
|
136
|
+
driver: P.value
|
|
137
137
|
}), {
|
|
138
|
-
isOverDropZone:
|
|
139
|
-
} =
|
|
138
|
+
isOverDropZone: u
|
|
139
|
+
} = O(c, {
|
|
140
140
|
onDrop: (t) => {
|
|
141
|
-
t && t.length > 0 &&
|
|
141
|
+
t && t.length > 0 && n.addFiles(Array.from(t), "file");
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
148
|
+
const f = s(() => e.accept ? e.accept.split(",").map((t) => {
|
|
150
149
|
const i = t.trim();
|
|
151
|
-
if (
|
|
150
|
+
if (m[i]) return m[i];
|
|
152
151
|
if (i.includes("*")) {
|
|
153
|
-
const
|
|
154
|
-
return
|
|
155
|
-
ext:
|
|
152
|
+
const V = i.split("/")[0];
|
|
153
|
+
return m[i] || a("common.fileExtension", {
|
|
154
|
+
ext: V.toUpperCase()
|
|
156
155
|
});
|
|
157
156
|
}
|
|
158
|
-
const l =
|
|
157
|
+
const l = B.getExtension(i);
|
|
159
158
|
return l ? l.toUpperCase() : i;
|
|
160
|
-
}).filter(Boolean).join(", ") : ""),
|
|
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
|
-
})),
|
|
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:
|
|
174
|
+
class: r.container
|
|
176
175
|
}, [o("div", {
|
|
177
|
-
ref:
|
|
178
|
-
class:
|
|
179
|
-
onClick: () =>
|
|
176
|
+
ref: c,
|
|
177
|
+
class: S.value,
|
|
178
|
+
onClick: () => n.open()
|
|
180
179
|
}, [o("div", {
|
|
181
|
-
class:
|
|
180
|
+
class: r.content
|
|
182
181
|
}, [o("div", {
|
|
183
|
-
class:
|
|
182
|
+
class: r.icon.wrapper,
|
|
184
183
|
onClick: (t) => {
|
|
185
|
-
e.manager && (t.stopPropagation(),
|
|
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:
|
|
189
|
+
path: F.value,
|
|
191
190
|
multiple: e.multiple,
|
|
192
191
|
uploadParams: {
|
|
193
|
-
path:
|
|
192
|
+
path: d.value,
|
|
194
193
|
accept: e.accept,
|
|
195
194
|
maxNum: e.maxNum,
|
|
196
|
-
maxSize:
|
|
195
|
+
maxSize: p.value
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
}).then((i) => {
|
|
200
|
-
|
|
199
|
+
n.addDataFiles(i);
|
|
201
200
|
}));
|
|
202
201
|
}
|
|
203
202
|
}, [o("div", {
|
|
204
|
-
class:
|
|
203
|
+
class: r.icon.icon
|
|
205
204
|
}, null)]), o("div", {
|
|
206
|
-
class:
|
|
205
|
+
class: r.text.title
|
|
207
206
|
}, [a("components.upload.desc")]), o("div", {
|
|
208
|
-
class:
|
|
209
|
-
}, [
|
|
210
|
-
class:
|
|
211
|
-
}, [a("components.upload.dropHere")]) : o(
|
|
212
|
-
formats:
|
|
213
|
-
}) : a("components.upload.allFormats"),
|
|
214
|
-
size:
|
|
215
|
-
})])])])]), o(
|
|
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:
|
|
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(
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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:
|
|
257
|
-
}, [o(
|
|
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: () =>
|
|
263
|
-
},
|
|
258
|
+
onClick: () => n.cancelFiles([t.id])
|
|
259
|
+
}, v(i = a("components.upload.cancel")) ? i : {
|
|
264
260
|
default: () => [i]
|
|
265
|
-
}), o(
|
|
261
|
+
}), o(g, {
|
|
266
262
|
type: "error",
|
|
267
263
|
size: "small",
|
|
268
264
|
text: !0,
|
|
269
|
-
onClick: () =>
|
|
270
|
-
},
|
|
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:
|
|
271
|
+
data: n.uploadFiles.value
|
|
276
272
|
}, {
|
|
277
273
|
empty: () => o("div", {
|
|
278
|
-
class:
|
|
274
|
+
class: r.table.empty
|
|
279
275
|
}, [a("components.upload.empty")])
|
|
280
276
|
})]);
|
|
281
277
|
}
|
|
282
278
|
});
|
|
283
279
|
export {
|
|
284
|
-
|
|
280
|
+
je as DuxFileUpload
|
|
285
281
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import
|
|
5
|
-
import { useMessage as
|
|
6
|
-
import { VueDraggable as
|
|
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
|
|
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
|
|
41
|
+
import { useModal as A } from "../../hooks/modal.js";
|
|
42
42
|
import "dayjs";
|
|
43
|
-
import { useImagePreview as
|
|
43
|
+
import { useImagePreview as M } from "../../hooks/image.js";
|
|
44
44
|
import "@tanstack/vue-query";
|
|
45
45
|
import "pinia";
|
|
46
|
-
const
|
|
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:
|
|
78
|
+
emit: d
|
|
79
79
|
}) {
|
|
80
|
-
const
|
|
80
|
+
const c = k(e, "value", d, {
|
|
81
81
|
passive: !0,
|
|
82
82
|
deep: !0,
|
|
83
83
|
defaultValue: e.defaultValue
|
|
84
|
-
}), p =
|
|
85
|
-
t:
|
|
86
|
-
} =
|
|
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
|
-
},
|
|
95
|
-
uploadPath:
|
|
96
|
-
managePath:
|
|
97
|
-
driver:
|
|
98
|
-
} =
|
|
99
|
-
driver: e
|
|
100
|
-
signPath: e
|
|
101
|
-
signCallback: e
|
|
102
|
-
uploadPath: e
|
|
103
|
-
managePath: e
|
|
104
|
-
}),
|
|
105
|
-
path:
|
|
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:
|
|
108
|
+
maxFileSize: v.value * 1024 * 1024,
|
|
109
109
|
autoUpload: !0,
|
|
110
110
|
accept: "image/*",
|
|
111
111
|
onError: (a) => {
|
|
112
|
-
p.error(a.message ||
|
|
112
|
+
p.error(a.message || u("components.upload.error"));
|
|
113
113
|
},
|
|
114
|
-
driver:
|
|
114
|
+
driver: f.value
|
|
115
115
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
159
|
+
r.removeFiles([a.id]);
|
|
172
160
|
}
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
|
|
211
|
+
ke as DuxImageUpload
|
|
219
212
|
};
|