@duxweb/dvha-pro 1.1.5 → 1.1.6
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/editor/aiEditor.cjs +1 -1
- package/dist/cjs/components/tree/treeFilter.cjs +1 -1
- package/dist/cjs/components/upload/file.cjs +1 -1
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/hooks/table/input.cjs +1 -1
- package/dist/cjs/hooks/table/switch.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/theme/uno.css.cjs +4 -1
- package/dist/esm/components/editor/aiEditor.js +62 -61
- package/dist/esm/components/tree/treeFilter.js +50 -49
- package/dist/esm/components/upload/file.js +25 -26
- package/dist/esm/components/upload/image.js +60 -64
- package/dist/esm/hooks/table/input.js +74 -40
- package/dist/esm/hooks/table/switch.js +15 -15
- package/dist/esm/langs/en-US.json.js +1 -1
- package/dist/esm/langs/zh-CN.json.js +1 -1
- package/dist/esm/theme/uno.css.js +4 -1
- package/dist/types/hooks/table/input.d.ts +3 -0
- package/dist/types/hooks/table/switch.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
1
|
+
import { defineComponent as Y, toRef as w, ref as u, watch as C, computed as K, createVNode as n, mergeProps as q, Fragment as G } from "vue";
|
|
2
|
+
import { useI18n as H, useTree as Q, useCustomMutation as W } from "@duxweb/dvha-core";
|
|
3
3
|
import { useVModel as Z } from "@vueuse/core";
|
|
4
4
|
import $ from "clsx";
|
|
5
|
-
import { NTree as
|
|
5
|
+
import { NTree as N, NInput as ee, NButton as le, NScrollbar as te, NSpin as ne, NDropdown as ae } from "naive-ui";
|
|
6
6
|
import { DuxCard as ie } from "../card/card.js";
|
|
7
|
-
const fe = /* @__PURE__ */
|
|
7
|
+
const fe = /* @__PURE__ */ Y({
|
|
8
8
|
name: "DuxTreeFilter",
|
|
9
9
|
props: {
|
|
10
10
|
title: String,
|
|
@@ -24,32 +24,32 @@ const fe = /* @__PURE__ */ q({
|
|
|
24
24
|
default: !1
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
extends:
|
|
27
|
+
extends: N,
|
|
28
28
|
setup(t, {
|
|
29
29
|
emit: T,
|
|
30
30
|
slots: b
|
|
31
31
|
}) {
|
|
32
|
-
const
|
|
32
|
+
const F = Z(t, "value", T, {
|
|
33
33
|
passive: !1,
|
|
34
34
|
defaultValue: t.defaultValue
|
|
35
|
-
}), U =
|
|
36
|
-
t:
|
|
37
|
-
} =
|
|
38
|
-
options:
|
|
39
|
-
loading:
|
|
40
|
-
expanded:
|
|
35
|
+
}), U = w(t, "params", {}), A = w(t, "path", ""), I = w(t, "sortPath", ""), k = u(), P = u(0), O = u(0), o = u([]), y = u(), {
|
|
36
|
+
t: E
|
|
37
|
+
} = H(), {
|
|
38
|
+
options: B,
|
|
39
|
+
loading: j,
|
|
40
|
+
expanded: L
|
|
41
41
|
} = Q({
|
|
42
42
|
path: A.value,
|
|
43
43
|
params: U.value,
|
|
44
44
|
...t.treeOptions
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
C(B, (e) => {
|
|
47
|
+
o.value = e;
|
|
48
48
|
}, {
|
|
49
49
|
immediate: !0,
|
|
50
50
|
deep: !0
|
|
51
51
|
});
|
|
52
|
-
const p = u(!1),
|
|
52
|
+
const p = u(!1), g = K(() => t.menus?.map((e) => ({
|
|
53
53
|
label: e.label,
|
|
54
54
|
key: e.value,
|
|
55
55
|
icon: e?.icon ? () => n("div", {
|
|
@@ -58,34 +58,34 @@ const fe = /* @__PURE__ */ q({
|
|
|
58
58
|
onSelect: e.onSelect
|
|
59
59
|
})) || []), M = (e) => {
|
|
60
60
|
const l = t.menus?.find((a) => a.value === e);
|
|
61
|
-
l && l.onSelect(
|
|
61
|
+
l && l.onSelect(k.value), p.value = !1;
|
|
62
62
|
}, _ = W({
|
|
63
63
|
path: I.value,
|
|
64
64
|
method: "POST"
|
|
65
|
-
}),
|
|
65
|
+
}), S = (e, l) => {
|
|
66
66
|
for (const a of e)
|
|
67
67
|
if (a.children) {
|
|
68
68
|
for (const i of a.children)
|
|
69
69
|
if (i.id === l)
|
|
70
70
|
return a;
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
71
|
+
const r = S(a.children, l);
|
|
72
|
+
if (r)
|
|
73
|
+
return r;
|
|
74
74
|
}
|
|
75
75
|
}, z = ({
|
|
76
76
|
node: e,
|
|
77
77
|
dragNode: l,
|
|
78
78
|
dropPosition: a
|
|
79
79
|
}) => {
|
|
80
|
-
const
|
|
80
|
+
const r = S(o.value, l.id), i = !r, m = [...o.value];
|
|
81
81
|
if (i) {
|
|
82
|
-
const d =
|
|
82
|
+
const d = o.value.findIndex((V) => V.id === l.id);
|
|
83
83
|
d >= 0 && m.splice(d, 1);
|
|
84
84
|
} else {
|
|
85
|
-
const d =
|
|
86
|
-
|
|
85
|
+
const d = r?.children?.indexOf(l) || 0;
|
|
86
|
+
r?.children?.splice(d, 1);
|
|
87
87
|
}
|
|
88
|
-
let h =
|
|
88
|
+
let h = S(m, e.id), x, s = h?.children || m, c = 0;
|
|
89
89
|
switch (a) {
|
|
90
90
|
case "before":
|
|
91
91
|
c = s.findIndex((d) => d.id === e.id), c > 0 && (x = s[c - 1].id);
|
|
@@ -97,7 +97,7 @@ const fe = /* @__PURE__ */ q({
|
|
|
97
97
|
c = s.findIndex((d) => d.id === e.id) + 1, x = e.id;
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
|
-
s.splice(c, 0, l),
|
|
100
|
+
s.splice(c, 0, l), o.value = m, _.mutate({
|
|
101
101
|
payload: {
|
|
102
102
|
parent_id: h?.id,
|
|
103
103
|
before_id: x,
|
|
@@ -105,26 +105,26 @@ const fe = /* @__PURE__ */ q({
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
}, f = u([]), v = u(!1);
|
|
108
|
-
|
|
108
|
+
C(L, (e) => {
|
|
109
109
|
f?.value?.length > 0 || (v.value = e.length > 0, f.value = e);
|
|
110
110
|
}, {
|
|
111
111
|
immediate: !0
|
|
112
112
|
});
|
|
113
113
|
const D = (e) => {
|
|
114
|
-
const l = [], a = (
|
|
115
|
-
|
|
114
|
+
const l = [], a = (r) => {
|
|
115
|
+
r.forEach((i) => {
|
|
116
116
|
i.children && i.children.length > 0 && (l.push(i.key || i.id), a(i.children));
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
119
|
return a(e), l;
|
|
120
|
-
},
|
|
121
|
-
v.value ? (f.value = [], v.value = !1) : (f.value = D(
|
|
122
|
-
},
|
|
120
|
+
}, J = () => {
|
|
121
|
+
v.value ? (f.value = [], v.value = !1) : (f.value = D(o.value), v.value = !0);
|
|
122
|
+
}, R = K(() => {
|
|
123
123
|
const {
|
|
124
124
|
title: e,
|
|
125
125
|
path: l,
|
|
126
126
|
sortPath: a,
|
|
127
|
-
params:
|
|
127
|
+
params: r,
|
|
128
128
|
menus: i,
|
|
129
129
|
numField: m,
|
|
130
130
|
iconField: h,
|
|
@@ -132,10 +132,10 @@ const fe = /* @__PURE__ */ q({
|
|
|
132
132
|
value: s,
|
|
133
133
|
defaultValue: c,
|
|
134
134
|
onUpdateValue: d,
|
|
135
|
-
bordered:
|
|
136
|
-
...
|
|
135
|
+
bordered: V,
|
|
136
|
+
...X
|
|
137
137
|
} = t;
|
|
138
|
-
return
|
|
138
|
+
return X;
|
|
139
139
|
});
|
|
140
140
|
return () => n(ie, {
|
|
141
141
|
class: "h-full",
|
|
@@ -151,11 +151,11 @@ const fe = /* @__PURE__ */ q({
|
|
|
151
151
|
}, [b.header ? b.header() : n(ee, {
|
|
152
152
|
value: y.value,
|
|
153
153
|
"onUpdate:value": (e) => y.value = e,
|
|
154
|
-
placeholder:
|
|
154
|
+
placeholder: E("common.keyword")
|
|
155
155
|
}, {
|
|
156
156
|
prefix: () => n(le, {
|
|
157
157
|
text: !0,
|
|
158
|
-
onClick:
|
|
158
|
+
onClick: J,
|
|
159
159
|
class: "mr-1!"
|
|
160
160
|
}, {
|
|
161
161
|
icon: () => n("div", {
|
|
@@ -169,27 +169,28 @@ const fe = /* @__PURE__ */ q({
|
|
|
169
169
|
default: () => [n("div", {
|
|
170
170
|
class: "p-2"
|
|
171
171
|
}, [n(ne, {
|
|
172
|
-
show:
|
|
172
|
+
show: j.value,
|
|
173
173
|
class: "h-full"
|
|
174
174
|
}, {
|
|
175
|
-
default: () => [n(
|
|
176
|
-
|
|
175
|
+
default: () => [n(N, q(R.value, {
|
|
176
|
+
key: JSON.stringify(o.value),
|
|
177
|
+
data: o.value || [],
|
|
177
178
|
expandedKeys: f.value,
|
|
178
179
|
onUpdateExpandedKeys: (e) => {
|
|
179
180
|
f.value = e;
|
|
180
|
-
const l = D(
|
|
181
|
+
const l = D(o.value);
|
|
181
182
|
v.value = l.length > 0 && l.every((a) => e.includes(a));
|
|
182
183
|
},
|
|
183
184
|
blockLine: !0,
|
|
184
|
-
selectedKeys:
|
|
185
|
+
selectedKeys: F.value,
|
|
185
186
|
onUpdateSelectedKeys: (e) => {
|
|
186
|
-
|
|
187
|
+
F.value = e, t?.onUpdateValue?.(e);
|
|
187
188
|
},
|
|
188
189
|
onDrop: z,
|
|
189
190
|
pattern: y.value,
|
|
190
191
|
renderPrefix: t?.numField || t?.iconField ? ({
|
|
191
192
|
option: e
|
|
192
|
-
}) => n(
|
|
193
|
+
}) => n(G, null, [t.iconField && e[t.iconField] && n("div", {
|
|
193
194
|
class: $(e[t.iconField] || "", "size-4")
|
|
194
195
|
}, null), t.numField && n("div", {
|
|
195
196
|
class: "rounded-full bg-primary px-2 text-xs text-white"
|
|
@@ -198,18 +199,18 @@ const fe = /* @__PURE__ */ q({
|
|
|
198
199
|
option: e
|
|
199
200
|
}) => ({
|
|
200
201
|
onContextmenu: (l) => {
|
|
201
|
-
|
|
202
|
+
g.value?.length && (k.value = e, p.value = !0, P.value = l.clientX, O.value = l.clientY, l.preventDefault());
|
|
202
203
|
}
|
|
203
204
|
})
|
|
204
205
|
}), null)]
|
|
205
206
|
})])]
|
|
206
|
-
}), n(ae, {
|
|
207
|
+
}), g.value?.length > 0 && n(ae, {
|
|
207
208
|
trigger: "manual",
|
|
208
209
|
placement: "bottom-start",
|
|
209
210
|
show: p.value,
|
|
210
|
-
options:
|
|
211
|
+
options: g.value,
|
|
211
212
|
x: P.value,
|
|
212
|
-
y:
|
|
213
|
+
y: O.value,
|
|
213
214
|
width: 100,
|
|
214
215
|
onSelect: M,
|
|
215
216
|
onClickoutside: () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as U, ref as c, computed as s, watch as b, nextTick as w, createVNode as o, Fragment as Z, createTextVNode as j, isVNode as O } from "vue";
|
|
2
2
|
import { useI18n as B, useUpload as T } from "@duxweb/dvha-core";
|
|
3
|
-
import { useVModel as X, useDropZone as
|
|
4
|
-
import
|
|
3
|
+
import { useVModel as X, useDropZone as L } from "@vueuse/core";
|
|
4
|
+
import E from "mime";
|
|
5
5
|
import { useMessage as I, NDataTable as W, NProgress as G, NButton as F } from "naive-ui";
|
|
6
6
|
import "vue-router";
|
|
7
7
|
import "@overlastic/vue";
|
|
@@ -130,6 +130,7 @@ const d = {
|
|
|
130
130
|
setup(t, {
|
|
131
131
|
emit: S
|
|
132
132
|
}) {
|
|
133
|
+
console.log("props", t);
|
|
133
134
|
const u = X(t, "value", S, {
|
|
134
135
|
passive: !0,
|
|
135
136
|
deep: !0,
|
|
@@ -148,7 +149,7 @@ const d = {
|
|
|
148
149
|
uploadPath: t?.path,
|
|
149
150
|
managePath: t?.managePath,
|
|
150
151
|
method: t?.method
|
|
151
|
-
}),
|
|
152
|
+
}), l = T({
|
|
152
153
|
path: g.value,
|
|
153
154
|
multiple: t.multiple,
|
|
154
155
|
maxFileCount: t.maxNum,
|
|
@@ -159,29 +160,27 @@ const d = {
|
|
|
159
160
|
driver: k.value,
|
|
160
161
|
method: v.value
|
|
161
162
|
}), {
|
|
162
|
-
isOverDropZone:
|
|
163
|
-
} =
|
|
163
|
+
isOverDropZone: h
|
|
164
|
+
} = L(f, {
|
|
164
165
|
onDrop: (e) => {
|
|
165
|
-
e && e.length > 0 &&
|
|
166
|
+
e && e.length > 0 && l.addFiles(Array.from(e), "file");
|
|
166
167
|
}
|
|
167
168
|
}), p = c(!1);
|
|
168
|
-
b(
|
|
169
|
+
b(l.dataFiles, (e) => {
|
|
169
170
|
const i = t.multiple ? e : e[0];
|
|
170
171
|
p.value = !0, u.value = i, t.onUpdateValue?.(i), w(() => {
|
|
171
172
|
p.value = !1;
|
|
172
173
|
});
|
|
173
174
|
});
|
|
174
|
-
const
|
|
175
|
+
const x = s(() => t.accept ? t.accept.split(",").map((e) => {
|
|
175
176
|
const i = e.trim();
|
|
176
177
|
if (d[i]) return d[i];
|
|
177
178
|
if (i.includes("*")) {
|
|
178
179
|
const A = i.split("/")[0];
|
|
179
|
-
return d[i] ||
|
|
180
|
-
ext: A.toUpperCase()
|
|
181
|
-
});
|
|
180
|
+
return d[i] || A.toUpperCase();
|
|
182
181
|
}
|
|
183
|
-
const
|
|
184
|
-
return
|
|
182
|
+
const n = E.getExtension(i);
|
|
183
|
+
return n ? n.toUpperCase() : i;
|
|
185
184
|
}).filter(Boolean).join(", ") : ""), z = s(() => ({
|
|
186
185
|
pending: o("div", {
|
|
187
186
|
class: "text-info"
|
|
@@ -195,13 +194,13 @@ const d = {
|
|
|
195
194
|
error: o("div", {
|
|
196
195
|
class: "text-error"
|
|
197
196
|
}, [a("components.upload.status.error")])
|
|
198
|
-
})), D = s(() => [r.dropZone.base,
|
|
197
|
+
})), D = s(() => [r.dropZone.base, h.value ? r.dropZone.active : r.dropZone.hover]), M = s(() => [l.uploadFiles.value.length === 0 && "border-b border-muted"]), y = c(!1);
|
|
199
198
|
return b(u, (e) => {
|
|
200
199
|
if (p.value || !e || !e?.length || y.value)
|
|
201
200
|
return;
|
|
202
201
|
y.value = !0;
|
|
203
202
|
const i = Array.isArray(e) ? e : [e];
|
|
204
|
-
|
|
203
|
+
l.addDataFiles(i);
|
|
205
204
|
}, {
|
|
206
205
|
immediate: !0
|
|
207
206
|
}), () => o("div", {
|
|
@@ -209,7 +208,7 @@ const d = {
|
|
|
209
208
|
}, [o("div", {
|
|
210
209
|
ref: f,
|
|
211
210
|
class: D.value,
|
|
212
|
-
onClick: () =>
|
|
211
|
+
onClick: () => l.open()
|
|
213
212
|
}, [o("div", {
|
|
214
213
|
class: r.content
|
|
215
214
|
}, [o("div", {
|
|
@@ -231,7 +230,7 @@ const d = {
|
|
|
231
230
|
}
|
|
232
231
|
}
|
|
233
232
|
}).then((i) => {
|
|
234
|
-
|
|
233
|
+
l.addDataFiles(i);
|
|
235
234
|
}));
|
|
236
235
|
}
|
|
237
236
|
}, [o("div", {
|
|
@@ -240,10 +239,10 @@ const d = {
|
|
|
240
239
|
class: r.text.title
|
|
241
240
|
}, [a("components.upload.desc")]), o("div", {
|
|
242
241
|
class: r.text.desc
|
|
243
|
-
}, [
|
|
242
|
+
}, [h.value ? o("span", {
|
|
244
243
|
class: r.text.highlight
|
|
245
|
-
}, [a("components.upload.dropHere")]) : o(Z, null, [
|
|
246
|
-
formats:
|
|
244
|
+
}, [a("components.upload.dropHere")]) : o(Z, null, [x.value ? a("components.upload.supportFormats", {
|
|
245
|
+
formats: x.value
|
|
247
246
|
}) : a("components.upload.allFormats"), j(","), " ", a("components.upload.maxSize", {
|
|
248
247
|
size: m.value
|
|
249
248
|
})])])])]), o(W, {
|
|
@@ -284,7 +283,7 @@ const d = {
|
|
|
284
283
|
title: a("components.upload.actions"),
|
|
285
284
|
width: 120,
|
|
286
285
|
render: (e) => {
|
|
287
|
-
let i,
|
|
286
|
+
let i, n;
|
|
288
287
|
return o("div", {
|
|
289
288
|
class: r.table.actions
|
|
290
289
|
}, [o(F, {
|
|
@@ -292,20 +291,20 @@ const d = {
|
|
|
292
291
|
size: "small",
|
|
293
292
|
text: !0,
|
|
294
293
|
disabled: ["success", "error", "cancelled"].includes(e.status),
|
|
295
|
-
onClick: () =>
|
|
294
|
+
onClick: () => l.cancelFiles([e.id])
|
|
296
295
|
}, P(i = a("components.upload.cancel")) ? i : {
|
|
297
296
|
default: () => [i]
|
|
298
297
|
}), o(F, {
|
|
299
298
|
type: "error",
|
|
300
299
|
size: "small",
|
|
301
300
|
text: !0,
|
|
302
|
-
onClick: () =>
|
|
303
|
-
}, P(
|
|
304
|
-
default: () => [
|
|
301
|
+
onClick: () => l.removeFiles([e.id])
|
|
302
|
+
}, P(n = a("components.upload.delete")) ? n : {
|
|
303
|
+
default: () => [n]
|
|
305
304
|
})]);
|
|
306
305
|
}
|
|
307
306
|
}],
|
|
308
|
-
data:
|
|
307
|
+
data: l.uploadFiles.value
|
|
309
308
|
}, {
|
|
310
309
|
empty: () => o("div", {
|
|
311
310
|
class: r.table.empty
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as k, computed as n, watch as g, createVNode as r } from "vue";
|
|
2
2
|
import { useI18n as w, useUpload as I } from "@duxweb/dvha-core";
|
|
3
3
|
import { useVModel as V } from "@vueuse/core";
|
|
4
|
-
import
|
|
5
|
-
import { useMessage as
|
|
4
|
+
import A from "clsx";
|
|
5
|
+
import { useMessage as j, NImage as B, NButton as v, NProgress as D } from "naive-ui";
|
|
6
6
|
import { VueDraggable as M } from "vue-draggable-plus";
|
|
7
7
|
import "vue-router";
|
|
8
8
|
import "@overlastic/vue";
|
|
@@ -63,7 +63,7 @@ import "dayjs";
|
|
|
63
63
|
import { useImagePreview as q } from "../../hooks/image.js";
|
|
64
64
|
import "@tanstack/vue-query";
|
|
65
65
|
import "pinia";
|
|
66
|
-
const Ze = /* @__PURE__ */
|
|
66
|
+
const Ze = /* @__PURE__ */ k({
|
|
67
67
|
name: "DuxImageUpload",
|
|
68
68
|
props: {
|
|
69
69
|
path: {
|
|
@@ -95,14 +95,14 @@ const Ze = /* @__PURE__ */ U({
|
|
|
95
95
|
method: String
|
|
96
96
|
},
|
|
97
97
|
setup(t, {
|
|
98
|
-
emit:
|
|
98
|
+
emit: h
|
|
99
99
|
}) {
|
|
100
|
-
const
|
|
100
|
+
const u = V(t, "value", h, {
|
|
101
101
|
passive: !0,
|
|
102
102
|
deep: !0,
|
|
103
103
|
defaultValue: t.defaultValue
|
|
104
|
-
}),
|
|
105
|
-
t:
|
|
104
|
+
}), f = j(), b = q(), {
|
|
105
|
+
t: s
|
|
106
106
|
} = w(), i = {
|
|
107
107
|
container: "flex gap-2",
|
|
108
108
|
imageItem: "size-80px rounded border border-muted relative group draggable flex items-center",
|
|
@@ -111,11 +111,11 @@ const Ze = /* @__PURE__ */ U({
|
|
|
111
111
|
uploadContent: "flex-1 flex flex-col justify-center items-center gap-1 relative",
|
|
112
112
|
progressContainer: "size-80px flex items-center justify-center rounded",
|
|
113
113
|
progressBar: "absolute left-2 right-2 bottom-2"
|
|
114
|
-
},
|
|
115
|
-
uploadPath:
|
|
116
|
-
managePath:
|
|
117
|
-
driver:
|
|
118
|
-
method:
|
|
114
|
+
}, x = n(() => t.maxSize), {
|
|
115
|
+
uploadPath: d,
|
|
116
|
+
managePath: y,
|
|
117
|
+
driver: z,
|
|
118
|
+
method: p
|
|
119
119
|
} = O({
|
|
120
120
|
driver: t?.driver,
|
|
121
121
|
signPath: t?.signPath,
|
|
@@ -123,119 +123,115 @@ const Ze = /* @__PURE__ */ U({
|
|
|
123
123
|
uploadPath: t?.path,
|
|
124
124
|
managePath: t?.managePath,
|
|
125
125
|
method: t?.method
|
|
126
|
-
}),
|
|
127
|
-
path:
|
|
126
|
+
}), a = I({
|
|
127
|
+
path: d.value,
|
|
128
128
|
multiple: t.multiple,
|
|
129
129
|
maxFileCount: t.maxNum,
|
|
130
|
-
maxFileSize:
|
|
130
|
+
maxFileSize: x.value * 1024 * 1024,
|
|
131
131
|
autoUpload: !0,
|
|
132
132
|
accept: "image/*",
|
|
133
|
-
method:
|
|
133
|
+
method: p.value,
|
|
134
134
|
onError: (e) => {
|
|
135
|
-
|
|
135
|
+
f.error(e.message || s("components.upload.error"));
|
|
136
136
|
},
|
|
137
|
-
driver:
|
|
137
|
+
driver: z.value
|
|
138
138
|
});
|
|
139
|
-
|
|
139
|
+
g(a.dataFiles, (e) => {
|
|
140
140
|
const o = t.multiple ? e?.map((l) => l.url) : e?.[0]?.url;
|
|
141
|
-
|
|
141
|
+
u.value = o, t.onUpdateValue?.(o);
|
|
142
142
|
});
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
return
|
|
147
|
-
if (!e || !e
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
r.addDataFiles(o.map((l) => ({
|
|
152
|
-
url: l
|
|
143
|
+
const F = n(() => a.progress.value.totalPercent), P = n(() => a.isUploading.value), C = async () => {
|
|
144
|
+
a.open();
|
|
145
|
+
}, S = n(() => t.multiple ? t.maxNum && a.uploadFiles.value.length >= t.maxNum : !0), N = n(() => a.dataFiles.value?.map((e) => e.url)), U = L();
|
|
146
|
+
return g(u, (e) => {
|
|
147
|
+
if (!e || !(Array.isArray(e) ? e.length : String(e).length)) return;
|
|
148
|
+
const o = typeof e == "string" ? [e] : Array.isArray(e) ? e : [], l = (a.dataFiles.value || []).map((m) => m.url).filter(Boolean), c = o.filter((m) => !l.includes(m));
|
|
149
|
+
c.length && a.addDataFiles(c.map((m) => ({
|
|
150
|
+
url: m
|
|
153
151
|
})));
|
|
154
|
-
}, {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
modelValue: r.uploadFiles.value,
|
|
158
|
-
"onUpdate:modelValue": (e) => r.uploadFiles.value = e,
|
|
152
|
+
}), () => r("div", null, [r(M, {
|
|
153
|
+
modelValue: a.uploadFiles.value,
|
|
154
|
+
"onUpdate:modelValue": (e) => a.uploadFiles.value = e,
|
|
159
155
|
class: i.container,
|
|
160
156
|
draggable: ".draggable"
|
|
161
157
|
}, {
|
|
162
|
-
default: () => [
|
|
158
|
+
default: () => [a.uploadFiles.value?.map((e, o) => {
|
|
163
159
|
const l = e.url || URL.createObjectURL(e.file);
|
|
164
|
-
return
|
|
160
|
+
return r("div", {
|
|
165
161
|
key: o,
|
|
166
|
-
class:
|
|
167
|
-
}, [
|
|
162
|
+
class: A(i.imageItem)
|
|
163
|
+
}, [r(B, {
|
|
168
164
|
class: "z-0 rounded",
|
|
169
165
|
objectFit: "scale-down",
|
|
170
166
|
width: 78,
|
|
171
167
|
height: 78,
|
|
172
168
|
previewDisabled: !0,
|
|
173
169
|
src: l
|
|
174
|
-
}, null),
|
|
170
|
+
}, null), r("div", {
|
|
175
171
|
class: i.imageOverlay
|
|
176
|
-
}, [e.status === "success" &&
|
|
172
|
+
}, [e.status === "success" && r(v, {
|
|
177
173
|
quaternary: !0,
|
|
178
174
|
circle: !0,
|
|
179
175
|
size: "small",
|
|
180
|
-
renderIcon: () =>
|
|
176
|
+
renderIcon: () => r("div", {
|
|
181
177
|
class: "n-icon i-tabler:eye"
|
|
182
178
|
}, null),
|
|
183
|
-
onClick: () =>
|
|
184
|
-
}, null),
|
|
179
|
+
onClick: () => b.show(N.value, o)
|
|
180
|
+
}, null), r(v, {
|
|
185
181
|
quaternary: !0,
|
|
186
182
|
circle: !0,
|
|
187
183
|
size: "small",
|
|
188
|
-
renderIcon: () =>
|
|
184
|
+
renderIcon: () => r("div", {
|
|
189
185
|
class: "n-icon i-tabler:trash"
|
|
190
186
|
}, null),
|
|
191
187
|
onClick: () => {
|
|
192
|
-
|
|
188
|
+
a.removeFiles([e.id]);
|
|
193
189
|
}
|
|
194
190
|
}, null)])]);
|
|
195
|
-
}), (
|
|
191
|
+
}), (a.uploadFiles.value.length === 0 || !S.value) && r("div", {
|
|
196
192
|
class: i.uploadArea,
|
|
197
193
|
onClick: () => {
|
|
198
|
-
|
|
194
|
+
C();
|
|
199
195
|
}
|
|
200
|
-
}, [t.manager &&
|
|
196
|
+
}, [t.manager && r("div", {
|
|
201
197
|
class: " py-1 text-xs bg-muted border-b border-dashed border-accented flex items-center justify-center",
|
|
202
198
|
onClick: (e) => {
|
|
203
|
-
e.stopPropagation(),
|
|
204
|
-
title:
|
|
199
|
+
e.stopPropagation(), U.show({
|
|
200
|
+
title: s("components.upload.title"),
|
|
205
201
|
width: "800px",
|
|
206
202
|
component: () => import("./manager.js"),
|
|
207
203
|
componentProps: {
|
|
208
|
-
path:
|
|
204
|
+
path: y.value,
|
|
209
205
|
type: "image",
|
|
210
206
|
multiple: t.multiple,
|
|
211
207
|
uploadParams: {
|
|
212
|
-
path:
|
|
208
|
+
path: d.value,
|
|
213
209
|
accept: "image/*",
|
|
214
210
|
maxNum: t.maxNum,
|
|
215
211
|
maxSize: t.maxSize,
|
|
216
|
-
method:
|
|
212
|
+
method: p.value
|
|
217
213
|
}
|
|
218
214
|
}
|
|
219
215
|
}).then((o) => {
|
|
220
|
-
|
|
216
|
+
a.addDataFiles(o);
|
|
221
217
|
});
|
|
222
218
|
}
|
|
223
|
-
}, [
|
|
219
|
+
}, [r("div", {
|
|
224
220
|
class: "i-tabler:folder size-4"
|
|
225
|
-
}, null)]),
|
|
221
|
+
}, null)]), r("div", {
|
|
226
222
|
class: i.uploadContent
|
|
227
|
-
}, [
|
|
223
|
+
}, [P.value ? r("div", {
|
|
228
224
|
class: i.progressContainer
|
|
229
|
-
}, [
|
|
225
|
+
}, [r("div", {
|
|
230
226
|
class: "i-tabler:photo size-6"
|
|
231
|
-
}, null),
|
|
227
|
+
}, null), r("div", {
|
|
232
228
|
class: i.progressBar
|
|
233
|
-
}, [
|
|
229
|
+
}, [r(D, {
|
|
234
230
|
type: "line",
|
|
235
|
-
percentage:
|
|
231
|
+
percentage: F.value,
|
|
236
232
|
showIndicator: !1,
|
|
237
233
|
height: 4
|
|
238
|
-
}, null)])]) :
|
|
234
|
+
}, null)])]) : r("div", {
|
|
239
235
|
class: "i-tabler:plus size-4"
|
|
240
236
|
}, null)])])]
|
|
241
237
|
})]);
|