@duxweb/dvha-pro 1.0.18 → 1.0.20
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/component.cjs +1 -1
- package/dist/cjs/components/card/card.cjs +1 -1
- package/dist/cjs/components/chart/echart.cjs +1 -1
- package/dist/cjs/components/code/code.cjs +1 -0
- package/dist/cjs/components/crop/imageCrop.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/drawer/drawer.cjs +1 -1
- package/dist/cjs/components/drawer/drawerPage.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/icon.cjs +1 -1
- package/dist/cjs/components/layout/filter.cjs +1 -1
- package/dist/cjs/components/layout/filterLayout.cjs +1 -0
- package/dist/cjs/components/layout/list.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/level/level.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/panel/collapse.cjs +1 -0
- package/dist/cjs/components/panel/setting.cjs +1 -1
- package/dist/cjs/components/status/listEmpty.cjs +1 -0
- package/dist/cjs/components/table/table.cjs +1 -0
- 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 -0
- 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/dvha-pro.css +1 -1
- package/dist/cjs/hooks/action.cjs +1 -1
- package/dist/cjs/hooks/dialog.cjs +1 -1
- package/dist/cjs/hooks/drawer.cjs +1 -1
- package/dist/cjs/hooks/modal.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/media.cjs +1 -1
- package/dist/cjs/hooks/table.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/langs/en-US.json.cjs +1 -1
- package/dist/cjs/langs/zh-CN.json.cjs +1 -1
- package/dist/cjs/pages/authLayout.cjs +1 -1
- package/dist/cjs/pages/layout/page.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/menu/main.cjs +1 -1
- package/dist/cjs/pages/menu/mobile.cjs +1 -1
- package/dist/cjs/pages/page.cjs +1 -1
- package/dist/cjs/pages/page404.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/theme/naiveTheme.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +23 -7
- package/dist/esm/component.js +36 -34
- package/dist/esm/components/card/card.js +6 -6
- package/dist/esm/components/chart/echart.js +17 -6
- package/dist/esm/components/code/code.js +53 -0
- package/dist/esm/components/crop/imageCrop.js +37 -26
- package/dist/esm/components/data/dynamicSelect.js +29 -18
- package/dist/esm/components/data/selectModal.js +49 -38
- package/dist/esm/components/drawer/drawer.js +17 -28
- package/dist/esm/components/drawer/drawerPage.js +54 -17
- package/dist/esm/components/form/formItem.js +17 -17
- package/dist/esm/components/form/formLayout.js +8 -8
- package/dist/esm/components/form/modalForm.js +44 -35
- package/dist/esm/components/form/pageForm.js +81 -43
- package/dist/esm/components/form/settingForm.js +28 -17
- package/dist/esm/components/icon/icon.js +23 -12
- package/dist/esm/components/layout/filter.js +15 -11
- package/dist/esm/components/layout/filterLayout.js +34 -0
- package/dist/esm/components/layout/list.js +211 -161
- package/dist/esm/components/layout/table.js +217 -186
- package/dist/esm/components/level/level.js +28 -17
- package/dist/esm/components/modal/modal.js +9 -9
- package/dist/esm/components/modal/modalPage.js +2 -2
- package/dist/esm/components/panel/collapse.js +49 -0
- package/dist/esm/components/panel/setting.js +3 -3
- package/dist/esm/components/status/listEmpty.js +26 -0
- package/dist/esm/components/table/table.js +110 -0
- package/dist/esm/components/table/tablePage.js +24 -18
- package/dist/esm/components/tree/treeFilter.js +44 -39
- package/dist/esm/components/upload/config.js +32 -0
- package/dist/esm/components/upload/file.js +142 -116
- package/dist/esm/components/upload/image.js +95 -66
- package/dist/esm/components/upload/manage/item.js +17 -6
- package/dist/esm/components/upload/manager.js +202 -164
- package/dist/esm/dvha-pro.css +1 -1
- package/dist/esm/hooks/action.js +77 -75
- package/dist/esm/hooks/dialog.js +13 -2
- package/dist/esm/hooks/drawer.js +13 -2
- package/dist/esm/hooks/modal.js +13 -2
- package/dist/esm/hooks/table/image.js +21 -10
- package/dist/esm/hooks/table/media.js +20 -9
- package/dist/esm/hooks/table.js +16 -16
- package/dist/esm/index.js +174 -164
- package/dist/esm/langs/en-US.json.js +5 -3
- package/dist/esm/langs/zh-CN.json.js +5 -3
- package/dist/esm/pages/authLayout.js +19 -8
- package/dist/esm/pages/layout/page.js +17 -6
- package/dist/esm/pages/login.js +40 -29
- package/dist/esm/pages/menu/avatar.js +97 -86
- package/dist/esm/pages/menu/button.js +23 -12
- package/dist/esm/pages/menu/cmd.js +45 -34
- package/dist/esm/pages/menu/main.js +40 -27
- package/dist/esm/pages/menu/mobile.js +13 -2
- package/dist/esm/pages/page.js +1 -1
- package/dist/esm/pages/page404.js +20 -9
- package/dist/esm/pages/pageStatus.js +31 -15
- package/dist/esm/theme/naiveTheme.js +6 -6
- package/dist/esm/theme/uno.css.js +23 -7
- package/dist/types/components/code/code.d.ts +44 -0
- package/dist/types/components/code/index.d.ts +1 -0
- package/dist/types/components/drawer/drawer.d.ts +2 -0
- package/dist/types/components/drawer/drawerPage.d.ts +20 -1
- package/dist/types/components/form/formItem.d.ts +2 -2
- package/dist/types/components/form/formLayout.d.ts +3 -3
- package/dist/types/components/form/modalForm.d.ts +3 -3
- package/dist/types/components/form/pageForm.d.ts +12 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/layout/filterLayout.d.ts +32 -0
- package/dist/types/components/layout/index.d.ts +1 -0
- package/dist/types/components/layout/list.d.ts +7 -1
- package/dist/types/components/layout/table.d.ts +10 -1
- package/dist/types/components/list/card.d.ts +6 -0
- package/dist/types/components/list/list.d.ts +6 -0
- package/dist/types/components/panel/collapse.d.ts +14 -0
- package/dist/types/components/panel/index.d.ts +1 -0
- package/dist/types/components/select/cardSelect.d.ts +1 -1
- package/dist/types/components/status/index.d.ts +1 -0
- package/dist/types/components/status/listEmpty.d.ts +11 -0
- package/dist/types/components/table/index.d.ts +1 -0
- package/dist/types/components/table/table.d.ts +6552 -0
- package/dist/types/components/table/tablePage.d.ts +9 -0
- package/dist/types/components/tree/treeFilter.d.ts +13 -12
- package/dist/types/components/upload/config.d.ts +13 -0
- package/dist/types/components/upload/file.d.ts +4 -0
- package/dist/types/components/upload/image.d.ts +30 -2
- package/dist/types/components/upload/manager.d.ts +4 -0
- package/dist/types/hooks/drawer.d.ts +1 -0
- package/dist/types/hooks/table/types.d.ts +1 -0
- package/dist/types/main.d.ts +6 -0
- package/dist/types/pages/pageStatus.d.ts +11 -1
- package/package.json +7 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import
|
|
5
|
-
import { useMessage as
|
|
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
|
|
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
|
|
35
|
-
return typeof
|
|
46
|
+
function h(e) {
|
|
47
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !A(e);
|
|
36
48
|
}
|
|
37
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
89
|
-
emit:
|
|
109
|
+
setup(e, {
|
|
110
|
+
emit: v
|
|
90
111
|
}) {
|
|
91
|
-
const
|
|
112
|
+
const b = O(e, "value", v, {
|
|
92
113
|
passive: !0,
|
|
93
114
|
deep: !0,
|
|
94
|
-
defaultValue:
|
|
95
|
-
}),
|
|
96
|
-
t:
|
|
97
|
-
} =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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:
|
|
110
|
-
onError: (
|
|
134
|
+
accept: e.accept,
|
|
135
|
+
onError: (t) => y.error(t.message || a("components.upload.error")),
|
|
136
|
+
driver: C.value
|
|
111
137
|
}), {
|
|
112
|
-
isOverDropZone:
|
|
113
|
-
} =
|
|
114
|
-
onDrop: (
|
|
115
|
-
|
|
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
|
-
|
|
119
|
-
var
|
|
120
|
-
const
|
|
121
|
-
|
|
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 =
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
return
|
|
129
|
-
ext:
|
|
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
|
|
133
|
-
return
|
|
134
|
-
}).filter(Boolean).join(", ") : ""),
|
|
135
|
-
pending:
|
|
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
|
-
}, [
|
|
138
|
-
uploading:
|
|
163
|
+
}, [a("components.upload.status.pending")]),
|
|
164
|
+
uploading: o("div", {
|
|
139
165
|
class: "text-info"
|
|
140
|
-
}, [
|
|
141
|
-
success:
|
|
166
|
+
}, [a("components.upload.status.uploading")]),
|
|
167
|
+
success: o("div", {
|
|
142
168
|
class: "text-success"
|
|
143
|
-
}, [
|
|
144
|
-
error:
|
|
169
|
+
}, [a("components.upload.status.success")]),
|
|
170
|
+
error: o("div", {
|
|
145
171
|
class: "text-error"
|
|
146
|
-
}, [
|
|
147
|
-
})), N =
|
|
148
|
-
return () =>
|
|
149
|
-
class:
|
|
150
|
-
}, [
|
|
151
|
-
ref:
|
|
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: () =>
|
|
154
|
-
}, [
|
|
155
|
-
class:
|
|
156
|
-
}, [
|
|
157
|
-
class:
|
|
158
|
-
onClick: (
|
|
159
|
-
|
|
160
|
-
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:
|
|
165
|
-
multiple:
|
|
190
|
+
path: P.value,
|
|
191
|
+
multiple: e.multiple,
|
|
166
192
|
uploadParams: {
|
|
167
|
-
path:
|
|
168
|
-
accept:
|
|
169
|
-
maxNum:
|
|
193
|
+
path: p.value,
|
|
194
|
+
accept: e.accept,
|
|
195
|
+
maxNum: e.maxNum,
|
|
170
196
|
maxSize: c.value
|
|
171
197
|
}
|
|
172
198
|
}
|
|
173
|
-
}).then((
|
|
174
|
-
|
|
199
|
+
}).then((i) => {
|
|
200
|
+
r.addDataFiles(i);
|
|
175
201
|
}));
|
|
176
202
|
}
|
|
177
|
-
}, [
|
|
178
|
-
class:
|
|
179
|
-
}, null)]),
|
|
180
|
-
class:
|
|
181
|
-
}, [
|
|
182
|
-
class:
|
|
183
|
-
}, [
|
|
184
|
-
class:
|
|
185
|
-
}, [
|
|
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
|
-
}) :
|
|
213
|
+
}) : a("components.upload.allFormats"), w(","), " ", a("components.upload.maxSize", {
|
|
188
214
|
size: c.value
|
|
189
|
-
})])])])]),
|
|
215
|
+
})])])])]), o(L, {
|
|
190
216
|
bordered: !1,
|
|
191
217
|
class: V.value,
|
|
192
218
|
columns: [{
|
|
193
219
|
key: "filename",
|
|
194
|
-
title:
|
|
220
|
+
title: a("components.upload.file.name"),
|
|
195
221
|
minWidth: 200,
|
|
196
|
-
render: (
|
|
197
|
-
title:
|
|
198
|
-
desc:
|
|
222
|
+
render: (t) => o(I, {
|
|
223
|
+
title: t.filename,
|
|
224
|
+
desc: t.filetype
|
|
199
225
|
}, null)
|
|
200
226
|
}, {
|
|
201
227
|
key: "filesizeText",
|
|
202
|
-
title:
|
|
228
|
+
title: a("components.upload.file.size"),
|
|
203
229
|
width: 120
|
|
204
230
|
}, {
|
|
205
231
|
key: "status",
|
|
206
|
-
title:
|
|
232
|
+
title: a("components.upload.file.status"),
|
|
207
233
|
width: 120,
|
|
208
|
-
render: (
|
|
209
|
-
var
|
|
210
|
-
return
|
|
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: (
|
|
244
|
+
percentage: (i = t.progress) == null ? void 0 : i.percent,
|
|
219
245
|
showIndicator: !1,
|
|
220
246
|
height: 14
|
|
221
|
-
}, null) :
|
|
247
|
+
}, null) : S.value[t.status];
|
|
222
248
|
}
|
|
223
249
|
}, {
|
|
224
250
|
key: "actions",
|
|
225
|
-
title:
|
|
251
|
+
title: a("components.upload.actions"),
|
|
226
252
|
width: 120,
|
|
227
|
-
render: (
|
|
228
|
-
let
|
|
229
|
-
return
|
|
230
|
-
class:
|
|
231
|
-
}, [
|
|
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(
|
|
236
|
-
onClick: () =>
|
|
237
|
-
},
|
|
238
|
-
default: () => [
|
|
239
|
-
}),
|
|
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: () =>
|
|
244
|
-
},
|
|
245
|
-
default: () => [
|
|
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:
|
|
275
|
+
data: r.uploadFiles.value
|
|
250
276
|
}, {
|
|
251
|
-
empty: () =>
|
|
252
|
-
class:
|
|
253
|
-
}, [
|
|
277
|
+
empty: () => o("div", {
|
|
278
|
+
class: n.table.empty
|
|
279
|
+
}, [a("components.upload.empty")])
|
|
254
280
|
})]);
|
|
255
281
|
}
|
|
256
282
|
});
|
|
257
283
|
export {
|
|
258
|
-
|
|
284
|
+
Oe as DuxFileUpload
|
|
259
285
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import
|
|
5
|
-
import { useMessage as
|
|
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
|
|
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:
|
|
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(
|
|
54
|
-
emit:
|
|
77
|
+
setup(e, {
|
|
78
|
+
emit: c
|
|
55
79
|
}) {
|
|
56
|
-
const g =
|
|
80
|
+
const g = I(e, "value", c, {
|
|
57
81
|
passive: !0,
|
|
58
82
|
deep: !0,
|
|
59
|
-
defaultValue:
|
|
60
|
-
}),
|
|
61
|
-
t:
|
|
62
|
-
} =
|
|
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
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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:
|
|
79
|
-
maxFileCount:
|
|
80
|
-
maxFileSize:
|
|
106
|
+
multiple: e.multiple,
|
|
107
|
+
maxFileCount: e.maxNum,
|
|
108
|
+
maxFileSize: h.value * 1024 * 1024,
|
|
81
109
|
autoUpload: !0,
|
|
82
110
|
accept: "image/*",
|
|
83
|
-
onError: (
|
|
84
|
-
|
|
85
|
-
}
|
|
111
|
+
onError: (a) => {
|
|
112
|
+
p.error(a.message || m("components.upload.error"));
|
|
113
|
+
},
|
|
114
|
+
driver: b.value
|
|
86
115
|
});
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
const
|
|
90
|
-
g.value =
|
|
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(() =>
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
var
|
|
96
|
-
return (
|
|
97
|
-
}),
|
|
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:
|
|
100
|
-
"onUpdate:modelValue": (
|
|
101
|
-
class:
|
|
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
|
|
106
|
-
return [(
|
|
107
|
-
const u =
|
|
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:
|
|
110
|
-
class:
|
|
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:
|
|
120
|
-
}, [
|
|
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: () =>
|
|
128
|
-
}, null), t(
|
|
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
|
-
|
|
165
|
+
l.removeFiles([r.id]);
|
|
137
166
|
}
|
|
138
167
|
}, null)])]);
|
|
139
|
-
}), (
|
|
140
|
-
class:
|
|
168
|
+
}), (l.uploadFiles.value.length === 0 || !P.value) && t("div", {
|
|
169
|
+
class: i.uploadArea,
|
|
141
170
|
onClick: () => {
|
|
142
171
|
z();
|
|
143
172
|
}
|
|
144
|
-
}, [
|
|
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: (
|
|
147
|
-
|
|
148
|
-
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:
|
|
181
|
+
path: f.value,
|
|
153
182
|
type: "image",
|
|
154
|
-
multiple:
|
|
183
|
+
multiple: e.multiple,
|
|
155
184
|
uploadParams: {
|
|
156
185
|
path: d.value,
|
|
157
186
|
accept: "image/*",
|
|
158
|
-
maxNum:
|
|
159
|
-
maxSize:
|
|
187
|
+
maxNum: e.maxNum,
|
|
188
|
+
maxSize: e.maxSize
|
|
160
189
|
}
|
|
161
190
|
}
|
|
162
|
-
}).then((
|
|
163
|
-
|
|
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:
|
|
198
|
+
class: i.uploadContent
|
|
170
199
|
}, [y.value ? t("div", {
|
|
171
|
-
class:
|
|
200
|
+
class: i.progressContainer
|
|
172
201
|
}, [t("div", {
|
|
173
202
|
class: "i-tabler:photo size-6"
|
|
174
203
|
}, null), t("div", {
|
|
175
|
-
class:
|
|
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
|
-
|
|
218
|
+
Ie as DuxImageUpload
|
|
190
219
|
};
|