handy-uploader 2.0.3 → 3.0.0
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/README.md +186 -300
- package/dist/components/handyUploader.vue.d.ts +3 -3
- package/dist/composables/deprecation.d.ts +2 -0
- package/dist/composables/useErrorHandler.d.ts +4 -0
- package/dist/composables/useFileUpload.d.ts +5 -0
- package/dist/core/attachments.d.ts +91 -0
- package/dist/core/fileUtils.d.ts +56 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/videoThumbnail.d.ts +32 -0
- package/dist/handy-uploader.cjs +1 -0
- package/dist/handy-uploader.css +1 -1
- package/dist/handy-uploader.mjs +1110 -0
- package/dist/language-CYpPw-mk.mjs +551 -0
- package/dist/language-fvWXvWRx.js +1 -0
- package/dist/lib/index.d.ts +8 -19
- package/dist/lib/language.d.ts +3 -0
- package/dist/lib/shared.d.ts +5 -0
- package/dist/lib/vuetify.d.ts +15 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/utils/fileUtils.d.ts +1 -56
- package/dist/vue/components/HandyDialog.vue.d.ts +31 -0
- package/dist/vue/components/HandyDropzone.vue.d.ts +38 -0
- package/dist/vue/components/HandyFileIcon.vue.d.ts +9 -0
- package/dist/vue/components/HandyFileList.vue.d.ts +65 -0
- package/dist/vue/components/HandyIcon.vue.d.ts +10 -0
- package/dist/vue/components/HandyUploader.vue.d.ts +137 -0
- package/dist/vue/index.d.ts +9 -0
- package/dist/vue/types.d.ts +5 -0
- package/dist/vue/useUploader.d.ts +46 -0
- package/dist/vuetify.cjs +1 -0
- package/dist/vuetify.mjs +1870 -0
- package/package.json +31 -7
- package/dist/handy-uploader.es.js +0 -2308
- package/dist/handy-uploader.umd.js +0 -1
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
import { ref as H, computed as A, unref as P, defineComponent as J, openBlock as t, createElementBlock as l, createElementVNode as a, watch as Y, onMounted as ke, withModifiers as ee, normalizeClass as G, toDisplayString as f, createVNode as T, renderSlot as U, createCommentVNode as h, useSlots as Ce, normalizeStyle as te, Fragment as W, renderList as q, createBlock as ae, createTextVNode as ie, isReadonly as _e, reactive as ze, createSlots as Te, withCtx as O, normalizeProps as ce, guardReactiveProps as re, withDirectives as Z, vModelText as se, vModelCheckbox as fe } from "vue";
|
|
2
|
+
import { f as we, p as xe, r as De, a as Ae, g as he, s as He, c as Se, b as Le, d as de, l as me, j as oe } from "./language-CYpPw-mk.mjs";
|
|
3
|
+
import { C as bl, e as pl, h as gl, i as yl, k as $l, m as Fl, n as kl, o as Cl, q as _l, t as zl, u as Tl, v as wl, w as xl, x as Dl, y as Al } from "./language-CYpPw-mk.mjs";
|
|
4
|
+
const Me = {
|
|
5
|
+
maxFileSize: 5 * 1024 * 1024,
|
|
6
|
+
maxFileCount: 10,
|
|
7
|
+
accept: "",
|
|
8
|
+
imageCompressor: !1,
|
|
9
|
+
imageCompressLevel: 0.8
|
|
10
|
+
};
|
|
11
|
+
function Be(e, z = {}) {
|
|
12
|
+
const b = () => ({
|
|
13
|
+
...Me,
|
|
14
|
+
...typeof z == "function" ? z() : P(z)
|
|
15
|
+
}), o = H(!1), g = H([]), F = A(() => e.value.length), p = A(() => F.value < b().maxFileCount);
|
|
16
|
+
let w = Promise.resolve();
|
|
17
|
+
function m(v) {
|
|
18
|
+
const r = w.then(async () => {
|
|
19
|
+
o.value = !0;
|
|
20
|
+
try {
|
|
21
|
+
return await v();
|
|
22
|
+
} finally {
|
|
23
|
+
o.value = !1;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return w = r.catch(() => {
|
|
27
|
+
}), r;
|
|
28
|
+
}
|
|
29
|
+
const _ = (v) => typeof v == "function" ? v() : v;
|
|
30
|
+
async function B(v, r) {
|
|
31
|
+
const y = b(), D = we(v, y.accept), d = xe(D.accepted, {
|
|
32
|
+
currentCount: e.value.length + _(r),
|
|
33
|
+
maxFileCount: y.maxFileCount,
|
|
34
|
+
maxFileSize: y.maxFileSize
|
|
35
|
+
});
|
|
36
|
+
return { staged: await De(d.accepted), errors: [...D.errors, ...d.errors] };
|
|
37
|
+
}
|
|
38
|
+
async function c(v) {
|
|
39
|
+
const r = b(), y = await Ae(v, {
|
|
40
|
+
currentCount: e.value.length,
|
|
41
|
+
maxFileCount: r.maxFileCount,
|
|
42
|
+
maxFileSize: r.maxFileSize,
|
|
43
|
+
imageCompressor: r.imageCompressor,
|
|
44
|
+
imageCompressLevel: r.imageCompressLevel
|
|
45
|
+
});
|
|
46
|
+
return y.accepted.length > 0 && (e.value = [...e.value, ...y.accepted]), y;
|
|
47
|
+
}
|
|
48
|
+
function I(v, r = 0) {
|
|
49
|
+
const y = Array.from(v);
|
|
50
|
+
return m(async () => {
|
|
51
|
+
const D = await B(y, r);
|
|
52
|
+
return g.value = D.errors, D.staged;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function S(v) {
|
|
56
|
+
return m(async () => {
|
|
57
|
+
const r = await c(v);
|
|
58
|
+
return g.value = r.errors, r.accepted;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function k(v) {
|
|
62
|
+
const r = Array.from(v);
|
|
63
|
+
return m(async () => {
|
|
64
|
+
const y = await B(r, 0), D = await c(y.staged);
|
|
65
|
+
return g.value = [...y.errors, ...D.errors], D.accepted;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function x(v) {
|
|
69
|
+
e.value = e.value.filter((r, y) => y !== v);
|
|
70
|
+
}
|
|
71
|
+
function X(v, r) {
|
|
72
|
+
e.value = e.value.map(
|
|
73
|
+
(y, D) => D === v ? { file: { ...y.file, ...r } } : y
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function K() {
|
|
77
|
+
e.value = [];
|
|
78
|
+
}
|
|
79
|
+
function V() {
|
|
80
|
+
g.value = [];
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
isProcessing: o,
|
|
84
|
+
errors: g,
|
|
85
|
+
count: F,
|
|
86
|
+
canAddMore: p,
|
|
87
|
+
options: A(b),
|
|
88
|
+
add: k,
|
|
89
|
+
stage: I,
|
|
90
|
+
commit: S,
|
|
91
|
+
remove: x,
|
|
92
|
+
update: X,
|
|
93
|
+
clear: K,
|
|
94
|
+
dismissErrors: V
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const Ee = ["width", "height"], Ne = ["d"], N = /* @__PURE__ */ J({
|
|
98
|
+
__name: "HandyIcon",
|
|
99
|
+
props: {
|
|
100
|
+
name: {},
|
|
101
|
+
size: { default: 20 }
|
|
102
|
+
},
|
|
103
|
+
setup(e) {
|
|
104
|
+
const z = {
|
|
105
|
+
trash: "M9 3h6l1 1h4v2H4V4h4l1-1zM6 7h12l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7zm4 3v9h1.5v-9H10zm3.5 0v9H15v-9h-1.5z",
|
|
106
|
+
pencil: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z",
|
|
107
|
+
chevron: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",
|
|
108
|
+
close: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",
|
|
109
|
+
play: "M8 5v14l11-7L8 5z",
|
|
110
|
+
upload: "M5 20h14v-2H5v2zM12 4 6.5 9.5l1.42 1.42L11 7.83V16h2V7.83l3.08 3.09L17.5 9.5 12 4z",
|
|
111
|
+
disk: "M6 2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm6 4a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 3a2 2 0 1 1 0 4 2 2 0 0 1 0-4zM7 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"
|
|
112
|
+
};
|
|
113
|
+
return (b, o) => (t(), l("svg", {
|
|
114
|
+
class: "hu-icon",
|
|
115
|
+
viewBox: "0 0 24 24",
|
|
116
|
+
width: e.size,
|
|
117
|
+
height: e.size,
|
|
118
|
+
fill: "currentColor",
|
|
119
|
+
"aria-hidden": "true",
|
|
120
|
+
focusable: "false"
|
|
121
|
+
}, [
|
|
122
|
+
a("path", {
|
|
123
|
+
d: z[e.name]
|
|
124
|
+
}, null, 8, Ne)
|
|
125
|
+
], 8, Ee));
|
|
126
|
+
}
|
|
127
|
+
}), Ue = { class: "hu-dialog__panel" }, Ie = { class: "hu-dialog__header" }, Ve = ["aria-label"], Oe = { class: "hu-dialog__body" }, Pe = {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: "hu-dialog__actions"
|
|
130
|
+
}, ue = /* @__PURE__ */ J({
|
|
131
|
+
__name: "HandyDialog",
|
|
132
|
+
props: {
|
|
133
|
+
open: { type: Boolean },
|
|
134
|
+
title: { default: "" },
|
|
135
|
+
closeLabel: { default: "Close" },
|
|
136
|
+
size: { default: "medium" }
|
|
137
|
+
},
|
|
138
|
+
emits: ["update:open"],
|
|
139
|
+
setup(e, { emit: z }) {
|
|
140
|
+
const b = e, o = z, g = `hu-dialog-title-${Math.random().toString(36).slice(2, 10)}`, F = H(null);
|
|
141
|
+
function p(m) {
|
|
142
|
+
const _ = F.value;
|
|
143
|
+
_ && (m && !_.open ? typeof _.showModal == "function" ? _.showModal() : _.setAttribute("open", "") : !m && _.open && (typeof _.close == "function" ? _.close() : _.removeAttribute("open")));
|
|
144
|
+
}
|
|
145
|
+
function w() {
|
|
146
|
+
o("update:open", !1);
|
|
147
|
+
}
|
|
148
|
+
return Y(() => b.open, p), ke(() => p(b.open)), (m, _) => (t(), l("dialog", {
|
|
149
|
+
ref_key: "el",
|
|
150
|
+
ref: F,
|
|
151
|
+
class: G(["hu-dialog", `hu-dialog--${e.size}`]),
|
|
152
|
+
"aria-labelledby": g,
|
|
153
|
+
onCancel: ee(w, ["prevent"])
|
|
154
|
+
}, [
|
|
155
|
+
a("div", Ue, [
|
|
156
|
+
a("header", Ie, [
|
|
157
|
+
a("h2", {
|
|
158
|
+
id: g,
|
|
159
|
+
class: "hu-dialog__title"
|
|
160
|
+
}, f(e.title), 1),
|
|
161
|
+
a("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
class: "hu-icon-button",
|
|
164
|
+
"aria-label": e.closeLabel,
|
|
165
|
+
onClick: w
|
|
166
|
+
}, [
|
|
167
|
+
T(N, { name: "close" })
|
|
168
|
+
], 8, Ve)
|
|
169
|
+
]),
|
|
170
|
+
a("div", Oe, [
|
|
171
|
+
U(m.$slots, "default")
|
|
172
|
+
]),
|
|
173
|
+
m.$slots.actions ? (t(), l("footer", Pe, [
|
|
174
|
+
U(m.$slots, "actions")
|
|
175
|
+
])) : h("", !0)
|
|
176
|
+
])
|
|
177
|
+
], 34));
|
|
178
|
+
}
|
|
179
|
+
}), Re = ["accept", "multiple", "disabled"], je = { class: "hu-dropzone__label" }, We = {
|
|
180
|
+
key: 0,
|
|
181
|
+
class: "hu-dropzone__hint"
|
|
182
|
+
}, ve = /* @__PURE__ */ J({
|
|
183
|
+
__name: "HandyDropzone",
|
|
184
|
+
props: {
|
|
185
|
+
accept: { default: "" },
|
|
186
|
+
multiple: { type: Boolean, default: !0 },
|
|
187
|
+
disabled: { type: Boolean, default: !1 },
|
|
188
|
+
label: { default: "Choose files" },
|
|
189
|
+
hint: { default: "" }
|
|
190
|
+
},
|
|
191
|
+
emits: ["files"],
|
|
192
|
+
setup(e, { expose: z, emit: b }) {
|
|
193
|
+
const o = e, g = b, F = H(null), p = H(!1);
|
|
194
|
+
let w = 0;
|
|
195
|
+
function m() {
|
|
196
|
+
o.disabled || (w++, p.value = !0);
|
|
197
|
+
}
|
|
198
|
+
function _() {
|
|
199
|
+
w = Math.max(0, w - 1), w === 0 && (p.value = !1);
|
|
200
|
+
}
|
|
201
|
+
function B(S) {
|
|
202
|
+
var x;
|
|
203
|
+
if (w = 0, p.value = !1, o.disabled) return;
|
|
204
|
+
const k = Array.from(((x = S.dataTransfer) == null ? void 0 : x.files) ?? []);
|
|
205
|
+
k.length > 0 && g("files", o.multiple ? k : k.slice(0, 1));
|
|
206
|
+
}
|
|
207
|
+
function c(S) {
|
|
208
|
+
const k = S.target, x = Array.from(k.files ?? []);
|
|
209
|
+
k.value = "", x.length > 0 && g("files", x);
|
|
210
|
+
}
|
|
211
|
+
function I() {
|
|
212
|
+
var S;
|
|
213
|
+
(S = F.value) == null || S.click();
|
|
214
|
+
}
|
|
215
|
+
return z({ open: I }), (S, k) => (t(), l("label", {
|
|
216
|
+
class: G(["hu-dropzone", { "hu-dropzone--active": p.value, "hu-dropzone--disabled": e.disabled }]),
|
|
217
|
+
onDragenter: ee(m, ["prevent"]),
|
|
218
|
+
onDragover: k[0] || (k[0] = ee(() => {
|
|
219
|
+
}, ["prevent"])),
|
|
220
|
+
onDragleave: ee(_, ["prevent"]),
|
|
221
|
+
onDrop: ee(B, ["prevent"])
|
|
222
|
+
}, [
|
|
223
|
+
a("input", {
|
|
224
|
+
ref_key: "input",
|
|
225
|
+
ref: F,
|
|
226
|
+
class: "hu-visually-hidden",
|
|
227
|
+
type: "file",
|
|
228
|
+
accept: e.accept || void 0,
|
|
229
|
+
multiple: e.multiple,
|
|
230
|
+
disabled: e.disabled,
|
|
231
|
+
onChange: c
|
|
232
|
+
}, null, 40, Re),
|
|
233
|
+
U(S.$slots, "default", { isDragging: p.value }, () => [
|
|
234
|
+
a("span", je, f(e.label), 1),
|
|
235
|
+
e.hint ? (t(), l("span", We, f(e.hint), 1)) : h("", !0)
|
|
236
|
+
])
|
|
237
|
+
], 34));
|
|
238
|
+
}
|
|
239
|
+
}), qe = ["data-hu-type", "width", "height", "aria-label"], Xe = ["font-size"], le = /* @__PURE__ */ J({
|
|
240
|
+
__name: "HandyFileIcon",
|
|
241
|
+
props: {
|
|
242
|
+
fileName: {},
|
|
243
|
+
size: { default: 48 }
|
|
244
|
+
},
|
|
245
|
+
setup(e) {
|
|
246
|
+
const z = e, b = A(() => he(z.fileName)), o = A(() => He(z.fileName).format.slice(0, 4).toUpperCase());
|
|
247
|
+
return (g, F) => (t(), l("svg", {
|
|
248
|
+
class: "hu-file-icon",
|
|
249
|
+
"data-hu-type": b.value,
|
|
250
|
+
viewBox: "0 0 40 48",
|
|
251
|
+
width: e.size * 40 / 48,
|
|
252
|
+
height: e.size,
|
|
253
|
+
role: "img",
|
|
254
|
+
"aria-label": o.value || "file"
|
|
255
|
+
}, [
|
|
256
|
+
F[0] || (F[0] = a("path", {
|
|
257
|
+
d: "M4 0h22l14 14v30a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",
|
|
258
|
+
fill: "currentColor"
|
|
259
|
+
}, null, -1)),
|
|
260
|
+
F[1] || (F[1] = a("path", {
|
|
261
|
+
d: "M26 0v10a4 4 0 0 0 4 4h10z",
|
|
262
|
+
fill: "#fff",
|
|
263
|
+
"fill-opacity": "0.45"
|
|
264
|
+
}, null, -1)),
|
|
265
|
+
a("text", {
|
|
266
|
+
x: "20",
|
|
267
|
+
y: "37",
|
|
268
|
+
"text-anchor": "middle",
|
|
269
|
+
"font-family": "system-ui, sans-serif",
|
|
270
|
+
"font-weight": "700",
|
|
271
|
+
"font-size": o.value.length > 3 ? 8.5 : 10,
|
|
272
|
+
fill: "#fff"
|
|
273
|
+
}, f(o.value), 9, Xe)
|
|
274
|
+
], 8, qe));
|
|
275
|
+
}
|
|
276
|
+
}), Ye = { key: 0 }, Ge = { class: "hu-table" }, Je = {
|
|
277
|
+
key: 0,
|
|
278
|
+
class: "hu-table__thumb",
|
|
279
|
+
scope: "col"
|
|
280
|
+
}, Ke = { scope: "col" }, Qe = {
|
|
281
|
+
scope: "col",
|
|
282
|
+
class: "hu-table__size"
|
|
283
|
+
}, Ze = {
|
|
284
|
+
key: 1,
|
|
285
|
+
scope: "col",
|
|
286
|
+
class: "hu-table__actions"
|
|
287
|
+
}, et = {
|
|
288
|
+
key: 0,
|
|
289
|
+
class: "hu-table__thumb"
|
|
290
|
+
}, tt = { class: "hu-thumb hu-thumb--small" }, lt = ["src", "onError"], at = ["title"], it = { class: "hu-table__size" }, nt = ["data-hu-size"], st = { key: 1 }, ot = { class: "hu-actions" }, ut = ["aria-label", "title", "onClick"], dt = ["aria-label", "title", "onClick"], ct = {
|
|
291
|
+
key: 0,
|
|
292
|
+
class: "hu-card__media"
|
|
293
|
+
}, rt = ["src", "onError"], ft = {
|
|
294
|
+
key: 2,
|
|
295
|
+
class: "hu-play",
|
|
296
|
+
"aria-hidden": "true"
|
|
297
|
+
}, mt = { class: "hu-card__content" }, ht = { class: "hu-card__info" }, vt = ["title"], bt = { class: "hu-chip" }, pt = {
|
|
298
|
+
key: 0,
|
|
299
|
+
class: "hu-thumb"
|
|
300
|
+
}, gt = ["src", "onError"], yt = {
|
|
301
|
+
key: 1,
|
|
302
|
+
class: "hu-card__actions"
|
|
303
|
+
}, $t = ["aria-label", "title", "onClick"], Ft = ["aria-label", "title", "onClick"], kt = ["aria-expanded", "aria-label", "onClick"], Ct = {
|
|
304
|
+
key: 2,
|
|
305
|
+
class: "hu-card__details"
|
|
306
|
+
}, _t = ["aria-label"], zt = {
|
|
307
|
+
key: 1,
|
|
308
|
+
class: "hu-description"
|
|
309
|
+
}, be = /* @__PURE__ */ J({
|
|
310
|
+
__name: "HandyFileList",
|
|
311
|
+
props: {
|
|
312
|
+
files: {},
|
|
313
|
+
t: {},
|
|
314
|
+
view: { default: "thumbnail" },
|
|
315
|
+
thumb: { type: Boolean, default: !0 },
|
|
316
|
+
cols: { default: 3 },
|
|
317
|
+
cardType: { default: "default" },
|
|
318
|
+
editable: { type: Boolean, default: !0 },
|
|
319
|
+
removable: { type: Boolean, default: !0 },
|
|
320
|
+
tableThumbColumn: { type: Boolean, default: !0 },
|
|
321
|
+
tableFixedHeader: { type: Boolean, default: !0 },
|
|
322
|
+
tableHeight: { default: 400 }
|
|
323
|
+
},
|
|
324
|
+
emits: ["remove", "edit"],
|
|
325
|
+
setup(e, { emit: z }) {
|
|
326
|
+
const b = e, o = z, g = Ce(), F = A(() => b.removable || b.editable || !!g.actions), p = A(() => Math.max(1, Math.round(12 / Math.min(12, Math.max(1, b.cols))))), w = H(0), m = Se(() => w.value++), _ = /* @__PURE__ */ new WeakMap(), B = (d) => he(d.file.name), c = H(/* @__PURE__ */ new WeakSet());
|
|
327
|
+
function I(d) {
|
|
328
|
+
if (B(d) === "video") {
|
|
329
|
+
m.invalidate(d.file);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const $ = new WeakSet([d.file]);
|
|
333
|
+
for (const n of b.files) c.value.has(n.file) && $.add(n.file);
|
|
334
|
+
c.value = $;
|
|
335
|
+
}
|
|
336
|
+
function S(d) {
|
|
337
|
+
if (!b.thumb || !d.file.base64 || c.value.has(d.file)) return;
|
|
338
|
+
const $ = B(d);
|
|
339
|
+
if ($ === "image") {
|
|
340
|
+
let n = _.get(d.file);
|
|
341
|
+
return n || (n = Le(d.file.base64, d.file.format), _.set(d.file, n)), n;
|
|
342
|
+
}
|
|
343
|
+
if ($ === "video") return m.get(d.file);
|
|
344
|
+
}
|
|
345
|
+
const k = A(() => (w.value, b.files.map(S)));
|
|
346
|
+
Y(
|
|
347
|
+
() => b.files,
|
|
348
|
+
(d) => m.retain(d.map(($) => $.file))
|
|
349
|
+
);
|
|
350
|
+
const x = H(/* @__PURE__ */ new WeakSet()), X = (d) => x.value.has(d.file);
|
|
351
|
+
function K(d) {
|
|
352
|
+
const $ = /* @__PURE__ */ new WeakSet();
|
|
353
|
+
for (const n of b.files)
|
|
354
|
+
n.file !== d.file && x.value.has(n.file) && $.add(n.file);
|
|
355
|
+
x.value.has(d.file) || $.add(d.file), x.value = $;
|
|
356
|
+
}
|
|
357
|
+
const V = (d) => {
|
|
358
|
+
var $;
|
|
359
|
+
return ((($ = d.file.tags) == null ? void 0 : $.length) ?? 0) > 0 || !!d.file.description;
|
|
360
|
+
}, v = (d) => Number(d.file.size) || 0, r = (d) => de(v(d), b.t.size);
|
|
361
|
+
function y(d) {
|
|
362
|
+
const $ = v(d) / 1048576;
|
|
363
|
+
return $ < 1 ? "small" : $ < 5 ? "medium" : "large";
|
|
364
|
+
}
|
|
365
|
+
const D = (d, $) => `${$}-${d.file.name}-${d.file.size}`;
|
|
366
|
+
return (d, $) => e.files.length === 0 ? (t(), l("div", Ye, [
|
|
367
|
+
U(d.$slots, "empty")
|
|
368
|
+
])) : e.view === "table" ? (t(), l("div", {
|
|
369
|
+
key: 1,
|
|
370
|
+
class: G(["hu-table-wrap", { "hu-table-wrap--fixed": e.tableFixedHeader }]),
|
|
371
|
+
style: te(e.tableFixedHeader ? { maxHeight: `${e.tableHeight}px` } : void 0)
|
|
372
|
+
}, [
|
|
373
|
+
a("table", Ge, [
|
|
374
|
+
a("thead", null, [
|
|
375
|
+
a("tr", null, [
|
|
376
|
+
e.tableThumbColumn ? (t(), l("th", Je, f(e.t.table.thumb), 1)) : h("", !0),
|
|
377
|
+
a("th", Ke, f(e.t.table.name), 1),
|
|
378
|
+
a("th", Qe, f(e.t.table.size), 1),
|
|
379
|
+
F.value ? (t(), l("th", Ze, f(e.t.table.action.action), 1)) : h("", !0)
|
|
380
|
+
])
|
|
381
|
+
]),
|
|
382
|
+
a("tbody", null, [
|
|
383
|
+
(t(!0), l(W, null, q(e.files, (n, C) => (t(), l("tr", {
|
|
384
|
+
key: D(n, C)
|
|
385
|
+
}, [
|
|
386
|
+
e.tableThumbColumn ? (t(), l("td", et, [
|
|
387
|
+
a("span", tt, [
|
|
388
|
+
k.value[C] ? (t(), l("img", {
|
|
389
|
+
key: 0,
|
|
390
|
+
src: k.value[C],
|
|
391
|
+
alt: "",
|
|
392
|
+
onError: (E) => I(n)
|
|
393
|
+
}, null, 40, lt)) : (t(), ae(le, {
|
|
394
|
+
key: 1,
|
|
395
|
+
"file-name": n.file.name,
|
|
396
|
+
size: 36
|
|
397
|
+
}, null, 8, ["file-name"]))
|
|
398
|
+
])
|
|
399
|
+
])) : h("", !0),
|
|
400
|
+
a("td", {
|
|
401
|
+
class: "hu-file__name",
|
|
402
|
+
title: n.file.name
|
|
403
|
+
}, f(n.file.name), 9, at),
|
|
404
|
+
a("td", it, [
|
|
405
|
+
a("span", {
|
|
406
|
+
class: "hu-chip",
|
|
407
|
+
"data-hu-size": y(n)
|
|
408
|
+
}, f(r(n)), 9, nt)
|
|
409
|
+
]),
|
|
410
|
+
F.value ? (t(), l("td", st, [
|
|
411
|
+
a("div", ot, [
|
|
412
|
+
U(d.$slots, "actions", {
|
|
413
|
+
attachment: n,
|
|
414
|
+
index: C
|
|
415
|
+
}),
|
|
416
|
+
e.editable ? (t(), l("button", {
|
|
417
|
+
key: 0,
|
|
418
|
+
type: "button",
|
|
419
|
+
class: "hu-icon-button hu-icon-button--edit",
|
|
420
|
+
"aria-label": `${e.t.edit} ${n.file.name}`,
|
|
421
|
+
title: e.t.edit,
|
|
422
|
+
onClick: (E) => o("edit", C)
|
|
423
|
+
}, [
|
|
424
|
+
T(N, {
|
|
425
|
+
name: "pencil",
|
|
426
|
+
size: 18
|
|
427
|
+
})
|
|
428
|
+
], 8, ut)) : h("", !0),
|
|
429
|
+
e.removable ? (t(), l("button", {
|
|
430
|
+
key: 1,
|
|
431
|
+
type: "button",
|
|
432
|
+
class: "hu-icon-button hu-icon-button--danger",
|
|
433
|
+
"aria-label": `${e.t.delete} ${n.file.name}`,
|
|
434
|
+
title: e.t.table.action.deleteTooltip,
|
|
435
|
+
onClick: (E) => o("remove", C)
|
|
436
|
+
}, [
|
|
437
|
+
T(N, {
|
|
438
|
+
name: "trash",
|
|
439
|
+
size: 18
|
|
440
|
+
})
|
|
441
|
+
], 8, dt)) : h("", !0)
|
|
442
|
+
])
|
|
443
|
+
])) : h("", !0)
|
|
444
|
+
]))), 128))
|
|
445
|
+
])
|
|
446
|
+
])
|
|
447
|
+
], 6)) : (t(), l("ul", {
|
|
448
|
+
key: 2,
|
|
449
|
+
class: G(["hu-files", `hu-files--${e.view}`]),
|
|
450
|
+
style: te(e.view === "thumbnail" ? { "--hu-columns": p.value } : void 0)
|
|
451
|
+
}, [
|
|
452
|
+
(t(!0), l(W, null, q(e.files, (n, C) => (t(), l("li", {
|
|
453
|
+
key: D(n, C),
|
|
454
|
+
class: G(["hu-card", [`hu-card--${e.cardType}`, `hu-card--${e.view}`]])
|
|
455
|
+
}, [
|
|
456
|
+
U(d.$slots, "item", {
|
|
457
|
+
attachment: n,
|
|
458
|
+
index: C,
|
|
459
|
+
remove: () => o("remove", C)
|
|
460
|
+
}, () => {
|
|
461
|
+
var E;
|
|
462
|
+
return [
|
|
463
|
+
e.view === "thumbnail" ? (t(), l("div", ct, [
|
|
464
|
+
k.value[C] ? (t(), l("img", {
|
|
465
|
+
key: 0,
|
|
466
|
+
src: k.value[C],
|
|
467
|
+
alt: "",
|
|
468
|
+
class: G(B(n) === "video" ? "hu-media--cover" : "hu-media--contain"),
|
|
469
|
+
onError: (L) => I(n)
|
|
470
|
+
}, null, 42, rt)) : (t(), ae(le, {
|
|
471
|
+
key: 1,
|
|
472
|
+
"file-name": n.file.name,
|
|
473
|
+
size: 96
|
|
474
|
+
}, null, 8, ["file-name"])),
|
|
475
|
+
B(n) === "video" ? (t(), l("span", ft, [
|
|
476
|
+
T(N, {
|
|
477
|
+
name: "play",
|
|
478
|
+
size: 28
|
|
479
|
+
})
|
|
480
|
+
])) : h("", !0)
|
|
481
|
+
])) : h("", !0),
|
|
482
|
+
a("div", mt, [
|
|
483
|
+
a("div", ht, [
|
|
484
|
+
a("span", {
|
|
485
|
+
class: "hu-file__name",
|
|
486
|
+
title: n.file.name
|
|
487
|
+
}, f(n.file.name), 9, vt),
|
|
488
|
+
a("span", bt, [
|
|
489
|
+
e.view === "simple" ? (t(), ae(N, {
|
|
490
|
+
key: 0,
|
|
491
|
+
name: "disk",
|
|
492
|
+
size: 14
|
|
493
|
+
})) : h("", !0),
|
|
494
|
+
ie(" " + f(r(n)), 1)
|
|
495
|
+
])
|
|
496
|
+
]),
|
|
497
|
+
e.view === "simple" ? (t(), l("span", pt, [
|
|
498
|
+
k.value[C] ? (t(), l("img", {
|
|
499
|
+
key: 0,
|
|
500
|
+
src: k.value[C],
|
|
501
|
+
alt: "",
|
|
502
|
+
onError: (L) => I(n)
|
|
503
|
+
}, null, 40, gt)) : (t(), ae(le, {
|
|
504
|
+
key: 1,
|
|
505
|
+
"file-name": n.file.name,
|
|
506
|
+
size: 60
|
|
507
|
+
}, null, 8, ["file-name"]))
|
|
508
|
+
])) : h("", !0)
|
|
509
|
+
]),
|
|
510
|
+
F.value || V(n) ? (t(), l("div", yt, [
|
|
511
|
+
U(d.$slots, "actions", {
|
|
512
|
+
attachment: n,
|
|
513
|
+
index: C
|
|
514
|
+
}),
|
|
515
|
+
e.removable ? (t(), l("button", {
|
|
516
|
+
key: 0,
|
|
517
|
+
type: "button",
|
|
518
|
+
class: "hu-icon-button hu-icon-button--danger",
|
|
519
|
+
"aria-label": `${e.t.delete} ${n.file.name}`,
|
|
520
|
+
title: e.t.delete,
|
|
521
|
+
onClick: (L) => o("remove", C)
|
|
522
|
+
}, [
|
|
523
|
+
T(N, { name: "trash" })
|
|
524
|
+
], 8, $t)) : h("", !0),
|
|
525
|
+
e.editable ? (t(), l("button", {
|
|
526
|
+
key: 1,
|
|
527
|
+
type: "button",
|
|
528
|
+
class: "hu-icon-button hu-icon-button--edit",
|
|
529
|
+
"aria-label": `${e.t.edit} ${n.file.name}`,
|
|
530
|
+
title: e.t.edit,
|
|
531
|
+
onClick: (L) => o("edit", C)
|
|
532
|
+
}, [
|
|
533
|
+
T(N, { name: "pencil" })
|
|
534
|
+
], 8, Ft)) : h("", !0),
|
|
535
|
+
V(n) ? (t(), l("button", {
|
|
536
|
+
key: 2,
|
|
537
|
+
type: "button",
|
|
538
|
+
class: "hu-icon-button hu-details-toggle",
|
|
539
|
+
"aria-expanded": X(n),
|
|
540
|
+
"aria-label": `${e.t.fileDescription} / ${e.t.fileTags}`,
|
|
541
|
+
onClick: (L) => K(n)
|
|
542
|
+
}, [
|
|
543
|
+
T(N, { name: "chevron" })
|
|
544
|
+
], 8, kt)) : h("", !0)
|
|
545
|
+
])) : h("", !0),
|
|
546
|
+
X(n) ? (t(), l("div", Ct, [
|
|
547
|
+
(E = n.file.tags) != null && E.length ? (t(), l("ul", {
|
|
548
|
+
key: 0,
|
|
549
|
+
class: "hu-tags",
|
|
550
|
+
"aria-label": e.t.fileTags
|
|
551
|
+
}, [
|
|
552
|
+
(t(!0), l(W, null, q(n.file.tags ?? [], (L) => (t(), l("li", {
|
|
553
|
+
key: L,
|
|
554
|
+
class: "hu-tag"
|
|
555
|
+
}, f(L), 1))), 128))
|
|
556
|
+
], 8, _t)) : h("", !0),
|
|
557
|
+
n.file.description ? (t(), l("p", zt, f(n.file.description), 1)) : h("", !0)
|
|
558
|
+
])) : h("", !0)
|
|
559
|
+
];
|
|
560
|
+
})
|
|
561
|
+
], 2))), 128))
|
|
562
|
+
], 6));
|
|
563
|
+
}
|
|
564
|
+
}), Tt = ["dir"], wt = {
|
|
565
|
+
key: 0,
|
|
566
|
+
class: "hu-toolbar"
|
|
567
|
+
}, xt = { class: "hu-badge-wrap" }, Dt = ["disabled"], At = ["data-hu-full", "aria-label"], Ht = {
|
|
568
|
+
key: 1,
|
|
569
|
+
class: "hu-alert",
|
|
570
|
+
role: "alert"
|
|
571
|
+
}, St = ["aria-label"], Lt = {
|
|
572
|
+
key: 0,
|
|
573
|
+
class: "hu-status",
|
|
574
|
+
role: "status"
|
|
575
|
+
}, Mt = {
|
|
576
|
+
key: 1,
|
|
577
|
+
class: "hu-alert hu-alert--inline",
|
|
578
|
+
role: "alert"
|
|
579
|
+
}, Bt = {
|
|
580
|
+
key: 2,
|
|
581
|
+
class: "hu-staged"
|
|
582
|
+
}, Et = { class: "hu-staged__fields" }, Nt = {
|
|
583
|
+
key: 0,
|
|
584
|
+
class: "hu-field"
|
|
585
|
+
}, Ut = { class: "hu-field__label" }, It = { class: "hu-field__row" }, Vt = ["onUpdate:modelValue"], Ot = {
|
|
586
|
+
key: 0,
|
|
587
|
+
class: "hu-field__suffix"
|
|
588
|
+
}, Pt = {
|
|
589
|
+
key: 1,
|
|
590
|
+
class: "hu-file__name"
|
|
591
|
+
}, Rt = {
|
|
592
|
+
key: 2,
|
|
593
|
+
class: "hu-field"
|
|
594
|
+
}, jt = { class: "hu-field__label" }, Wt = ["value", "onInput"], qt = {
|
|
595
|
+
key: 3,
|
|
596
|
+
class: "hu-field"
|
|
597
|
+
}, Xt = { class: "hu-field__label" }, Yt = { class: "hu-tag-picker" }, Gt = ["onUpdate:modelValue", "value"], Jt = ["aria-label", "onClick"], Kt = ["disabled"], Qt = {
|
|
598
|
+
key: 0,
|
|
599
|
+
class: "hu-edit"
|
|
600
|
+
}, Zt = { class: "hu-staged__fields" }, el = {
|
|
601
|
+
key: 0,
|
|
602
|
+
class: "hu-field"
|
|
603
|
+
}, tl = { class: "hu-field__label" }, ll = {
|
|
604
|
+
key: 1,
|
|
605
|
+
class: "hu-field"
|
|
606
|
+
}, al = { class: "hu-field__label" }, il = {
|
|
607
|
+
key: 2,
|
|
608
|
+
class: "hu-field"
|
|
609
|
+
}, nl = { class: "hu-field__label" }, sl = { class: "hu-tag-picker" }, ol = ["value"], ul = { class: "hu-dialog__message" }, dl = /* @__PURE__ */ J({
|
|
610
|
+
__name: "HandyUploader",
|
|
611
|
+
props: {
|
|
612
|
+
documentAttachment: { default: () => [] },
|
|
613
|
+
lang: { default: "en" },
|
|
614
|
+
maxFileSize: { default: 5242880 },
|
|
615
|
+
fileUploaderType: { default: "thumbnail" },
|
|
616
|
+
maxFileCount: { default: 10 },
|
|
617
|
+
badgeCounter: { type: Boolean, default: !0 },
|
|
618
|
+
btnColor: { default: "info" },
|
|
619
|
+
imageCompressor: { type: Boolean, default: !1 },
|
|
620
|
+
imageCompressLevel: { default: 0.8 },
|
|
621
|
+
fileAccept: { default: "" },
|
|
622
|
+
thumb: { type: Boolean, default: !0 },
|
|
623
|
+
tableThumbColumn: { type: Boolean, default: !0 },
|
|
624
|
+
tableFixedHeader: { type: Boolean, default: !0 },
|
|
625
|
+
tableHeight: { default: 400 },
|
|
626
|
+
rtlSupport: { type: Boolean, default: !1 },
|
|
627
|
+
changeFileName: { type: Boolean, default: !1 },
|
|
628
|
+
addFileDescription: { type: Boolean, default: !1 },
|
|
629
|
+
addFileTag: { type: Boolean, default: !1 },
|
|
630
|
+
tags: { default: () => [] },
|
|
631
|
+
customLang: { default: null },
|
|
632
|
+
insertPermission: { type: Boolean, default: !0 },
|
|
633
|
+
cols: { default: 3 },
|
|
634
|
+
editPermission: { type: Boolean, default: !0 },
|
|
635
|
+
deletePermission: { type: Boolean, default: !0 },
|
|
636
|
+
cardType: { default: "default" }
|
|
637
|
+
},
|
|
638
|
+
emits: [
|
|
639
|
+
"updateDocumentAttachment",
|
|
640
|
+
"update:documentAttachment",
|
|
641
|
+
"add",
|
|
642
|
+
"remove",
|
|
643
|
+
"error",
|
|
644
|
+
"updateCardType",
|
|
645
|
+
"updateBadgeCounter",
|
|
646
|
+
"updateMaxFileCount",
|
|
647
|
+
"updateMaxFileSize",
|
|
648
|
+
"updateImageCompressor",
|
|
649
|
+
"updateImageCompressLevel",
|
|
650
|
+
"updateFileAccept",
|
|
651
|
+
"updateThumb",
|
|
652
|
+
"updateChangeFileName",
|
|
653
|
+
"updateAddFileDescription",
|
|
654
|
+
"updateAddFileTag",
|
|
655
|
+
"updateTableThumbColumn",
|
|
656
|
+
"updateTableFixedHeader",
|
|
657
|
+
"updateTableHeight",
|
|
658
|
+
"updateLang"
|
|
659
|
+
],
|
|
660
|
+
setup(e, { expose: z, emit: b }) {
|
|
661
|
+
const o = e, g = b, F = H(0), p = A(() => (F.value, [...o.documentAttachment]));
|
|
662
|
+
Y(
|
|
663
|
+
() => o.documentAttachment,
|
|
664
|
+
() => F.value++,
|
|
665
|
+
{ deep: !1 }
|
|
666
|
+
);
|
|
667
|
+
const w = A({
|
|
668
|
+
// A fresh copy on every change, so counts stay right even for non-reactive arrays.
|
|
669
|
+
get: () => p.value,
|
|
670
|
+
set: (u) => {
|
|
671
|
+
const i = o.documentAttachment;
|
|
672
|
+
if (Object.isFrozen(i) || _e(i)) {
|
|
673
|
+
g("updateDocumentAttachment", u), g("update:documentAttachment", u);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
i.splice(0, i.length, ...u), F.value++, g("updateDocumentAttachment", i), g("update:documentAttachment", i);
|
|
677
|
+
}
|
|
678
|
+
}), m = Be(w, () => ({
|
|
679
|
+
maxFileSize: o.maxFileSize,
|
|
680
|
+
maxFileCount: o.maxFileCount,
|
|
681
|
+
accept: o.fileAccept,
|
|
682
|
+
imageCompressor: o.imageCompressor,
|
|
683
|
+
imageCompressLevel: o.imageCompressLevel
|
|
684
|
+
})), _ = {
|
|
685
|
+
cardType: "updateCardType",
|
|
686
|
+
badgeCounter: "updateBadgeCounter",
|
|
687
|
+
maxFileCount: "updateMaxFileCount",
|
|
688
|
+
maxFileSize: "updateMaxFileSize",
|
|
689
|
+
imageCompressor: "updateImageCompressor",
|
|
690
|
+
imageCompressLevel: "updateImageCompressLevel",
|
|
691
|
+
fileAccept: "updateFileAccept",
|
|
692
|
+
thumb: "updateThumb",
|
|
693
|
+
changeFileName: "updateChangeFileName",
|
|
694
|
+
addFileDescription: "updateAddFileDescription",
|
|
695
|
+
addFileTag: "updateAddFileTag",
|
|
696
|
+
tableThumbColumn: "updateTableThumbColumn",
|
|
697
|
+
tableFixedHeader: "updateTableFixedHeader",
|
|
698
|
+
tableHeight: "updateTableHeight",
|
|
699
|
+
lang: "updateLang"
|
|
700
|
+
};
|
|
701
|
+
for (const [u, i] of Object.entries(_))
|
|
702
|
+
Y(
|
|
703
|
+
() => o[u],
|
|
704
|
+
(s) => g(i, s)
|
|
705
|
+
);
|
|
706
|
+
const B = {
|
|
707
|
+
fileTypeAlert: "File type is not allowed",
|
|
708
|
+
invalidFileAlert: "File could not be processed",
|
|
709
|
+
dropHint: "or drag and drop here"
|
|
710
|
+
}, c = A(() => {
|
|
711
|
+
const u = o.customLang ?? me;
|
|
712
|
+
return { ...B, ...me.en, ...u[o.lang] };
|
|
713
|
+
}), I = A(() => o.rtlSupport || o.lang === "fa" || o.lang === "ar"), S = A(() => {
|
|
714
|
+
const u = `${p.value.length + r.value.length}/${o.maxFileCount}`, i = de(o.maxFileSize, c.value.size);
|
|
715
|
+
return `${c.value.dropHint} · ${u} · ≤ ${i}`;
|
|
716
|
+
}), k = {
|
|
717
|
+
primary: "#1976d2",
|
|
718
|
+
secondary: "#424242",
|
|
719
|
+
accent: "#82b1ff",
|
|
720
|
+
error: "#ff5252",
|
|
721
|
+
info: "#2196f3",
|
|
722
|
+
success: "#4caf50",
|
|
723
|
+
warning: "#fb8c00"
|
|
724
|
+
}, x = A(() => {
|
|
725
|
+
const u = k[o.btnColor] ?? o.btnColor;
|
|
726
|
+
return u ? { "--hu-button-bg": u } : void 0;
|
|
727
|
+
}), X = A(
|
|
728
|
+
() => o.changeFileName || o.addFileDescription || o.addFileTag && o.tags.length > 0
|
|
729
|
+
);
|
|
730
|
+
function K(u) {
|
|
731
|
+
const i = u.fileName ? `${u.fileName}: ` : "";
|
|
732
|
+
switch (u.code) {
|
|
733
|
+
case "maxFileCount":
|
|
734
|
+
return `${c.value.maxFileCountAlert} ${u.limit}`;
|
|
735
|
+
case "maxFileSize":
|
|
736
|
+
return `${i}${c.value.maxFileSizeAlert} ${de(u.limit ?? 0, c.value.size)}`;
|
|
737
|
+
case "fileType":
|
|
738
|
+
return `${i}${c.value.fileTypeAlert}`;
|
|
739
|
+
default:
|
|
740
|
+
return `${i}${c.value.invalidFileAlert}`;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
const V = A(() => m.errors.value.map(K));
|
|
744
|
+
Y(m.errors, (u) => {
|
|
745
|
+
u.length > 0 && g("error", u);
|
|
746
|
+
});
|
|
747
|
+
const v = H(!1), r = H([]);
|
|
748
|
+
let y = 0;
|
|
749
|
+
function D() {
|
|
750
|
+
y++, r.value = [], m.dismissErrors(), v.value = !0;
|
|
751
|
+
}
|
|
752
|
+
async function d(u) {
|
|
753
|
+
const i = y, s = await m.stage(u, () => r.value.length);
|
|
754
|
+
i === y && v.value && r.value.push(...s);
|
|
755
|
+
}
|
|
756
|
+
async function $() {
|
|
757
|
+
const u = await m.commit(r.value);
|
|
758
|
+
u.length > 0 && g("add", u), r.value = [], v.value = !1;
|
|
759
|
+
}
|
|
760
|
+
async function n(u) {
|
|
761
|
+
const i = await m.add(u);
|
|
762
|
+
return i.length > 0 && g("add", i), i;
|
|
763
|
+
}
|
|
764
|
+
function C(u) {
|
|
765
|
+
const i = p.value[u];
|
|
766
|
+
i && (m.remove(u), g("remove", i, u));
|
|
767
|
+
}
|
|
768
|
+
Y(v, (u) => {
|
|
769
|
+
u || (y++, r.value = []);
|
|
770
|
+
});
|
|
771
|
+
const E = H(!1), L = H(null), M = ze({ name: "", description: "", tags: [] });
|
|
772
|
+
function pe(u) {
|
|
773
|
+
var s;
|
|
774
|
+
const i = (s = p.value[u]) == null ? void 0 : s.file;
|
|
775
|
+
i && (L.value = u, M.name = i.name, M.description = i.description ?? "", M.tags = [...i.tags ?? []], E.value = !0);
|
|
776
|
+
}
|
|
777
|
+
function ge() {
|
|
778
|
+
L.value !== null && m.update(L.value, {
|
|
779
|
+
...o.changeFileName ? { name: M.name } : {},
|
|
780
|
+
...o.addFileDescription ? { description: M.description } : {},
|
|
781
|
+
...o.addFileTag ? { tags: [...M.tags] } : {}
|
|
782
|
+
}), E.value = !1;
|
|
783
|
+
}
|
|
784
|
+
const Q = H(!1), ne = H(null);
|
|
785
|
+
function ye(u) {
|
|
786
|
+
ne.value = u, Q.value = !0;
|
|
787
|
+
}
|
|
788
|
+
function $e() {
|
|
789
|
+
ne.value !== null && C(ne.value), Q.value = !1;
|
|
790
|
+
}
|
|
791
|
+
return z({
|
|
792
|
+
add: n,
|
|
793
|
+
remove: C,
|
|
794
|
+
update: m.update,
|
|
795
|
+
clear: m.clear,
|
|
796
|
+
openInsert: D
|
|
797
|
+
}), (u, i) => (t(), l("div", {
|
|
798
|
+
class: "hu-uploader",
|
|
799
|
+
dir: I.value ? "rtl" : void 0
|
|
800
|
+
}, [
|
|
801
|
+
e.insertPermission ? (t(), l("div", wt, [
|
|
802
|
+
a("span", xt, [
|
|
803
|
+
a("button", {
|
|
804
|
+
type: "button",
|
|
805
|
+
class: "hu-button hu-button--primary",
|
|
806
|
+
style: te(x.value),
|
|
807
|
+
disabled: !P(m).canAddMore.value,
|
|
808
|
+
onClick: D
|
|
809
|
+
}, [
|
|
810
|
+
T(N, {
|
|
811
|
+
name: "upload",
|
|
812
|
+
size: 18
|
|
813
|
+
}),
|
|
814
|
+
ie(" " + f(c.value.insertFile), 1)
|
|
815
|
+
], 12, Dt),
|
|
816
|
+
e.badgeCounter && p.value.length > 0 ? (t(), l("span", {
|
|
817
|
+
key: 0,
|
|
818
|
+
class: "hu-count",
|
|
819
|
+
"data-hu-full": p.value.length >= e.maxFileCount,
|
|
820
|
+
"aria-label": `${p.value.length} / ${e.maxFileCount}`
|
|
821
|
+
}, f(p.value.length), 9, At)) : h("", !0)
|
|
822
|
+
])
|
|
823
|
+
])) : h("", !0),
|
|
824
|
+
V.value.length > 0 && !v.value ? (t(), l("div", Ht, [
|
|
825
|
+
a("ul", null, [
|
|
826
|
+
(t(!0), l(W, null, q(V.value, (s, R) => (t(), l("li", { key: R }, f(s), 1))), 128))
|
|
827
|
+
]),
|
|
828
|
+
a("button", {
|
|
829
|
+
type: "button",
|
|
830
|
+
class: "hu-icon-button",
|
|
831
|
+
"aria-label": c.value.deleteDialog.cancel,
|
|
832
|
+
onClick: i[0] || (i[0] = //@ts-ignore
|
|
833
|
+
(...s) => P(m).dismissErrors && P(m).dismissErrors(...s))
|
|
834
|
+
}, [
|
|
835
|
+
T(N, {
|
|
836
|
+
name: "close",
|
|
837
|
+
size: 16
|
|
838
|
+
})
|
|
839
|
+
], 8, St)
|
|
840
|
+
])) : h("", !0),
|
|
841
|
+
T(be, {
|
|
842
|
+
files: p.value,
|
|
843
|
+
t: c.value,
|
|
844
|
+
view: e.fileUploaderType,
|
|
845
|
+
thumb: e.thumb,
|
|
846
|
+
cols: e.cols,
|
|
847
|
+
"card-type": e.cardType,
|
|
848
|
+
editable: e.editPermission && X.value,
|
|
849
|
+
removable: e.deletePermission,
|
|
850
|
+
"table-thumb-column": e.tableThumbColumn,
|
|
851
|
+
"table-fixed-header": e.tableFixedHeader,
|
|
852
|
+
"table-height": e.tableHeight,
|
|
853
|
+
onRemove: ye,
|
|
854
|
+
onEdit: pe
|
|
855
|
+
}, Te({
|
|
856
|
+
empty: O(() => [
|
|
857
|
+
U(u.$slots, "empty")
|
|
858
|
+
]),
|
|
859
|
+
_: 2
|
|
860
|
+
}, [
|
|
861
|
+
u.$slots.item ? {
|
|
862
|
+
name: "item",
|
|
863
|
+
fn: O((s) => [
|
|
864
|
+
U(u.$slots, "item", ce(re(s)))
|
|
865
|
+
]),
|
|
866
|
+
key: "0"
|
|
867
|
+
} : void 0,
|
|
868
|
+
u.$slots.actions ? {
|
|
869
|
+
name: "actions",
|
|
870
|
+
fn: O((s) => [
|
|
871
|
+
U(u.$slots, "actions", ce(re(s)))
|
|
872
|
+
]),
|
|
873
|
+
key: "1"
|
|
874
|
+
} : void 0
|
|
875
|
+
]), 1032, ["files", "t", "view", "thumb", "cols", "card-type", "editable", "removable", "table-thumb-column", "table-fixed-header", "table-height"]),
|
|
876
|
+
T(ue, {
|
|
877
|
+
open: v.value,
|
|
878
|
+
"onUpdate:open": i[2] || (i[2] = (s) => v.value = s),
|
|
879
|
+
title: c.value.insertNewFile,
|
|
880
|
+
"close-label": c.value.deleteDialog.cancel
|
|
881
|
+
}, {
|
|
882
|
+
actions: O(() => [
|
|
883
|
+
a("button", {
|
|
884
|
+
type: "button",
|
|
885
|
+
class: "hu-button",
|
|
886
|
+
onClick: i[1] || (i[1] = (s) => v.value = !1)
|
|
887
|
+
}, f(c.value.deleteDialog.cancel), 1),
|
|
888
|
+
a("button", {
|
|
889
|
+
type: "button",
|
|
890
|
+
class: "hu-button hu-button--primary",
|
|
891
|
+
style: te(x.value),
|
|
892
|
+
disabled: r.value.length === 0 || P(m).isProcessing.value,
|
|
893
|
+
onClick: $
|
|
894
|
+
}, f(c.value.add), 13, Kt)
|
|
895
|
+
]),
|
|
896
|
+
default: O(() => [
|
|
897
|
+
T(ve, {
|
|
898
|
+
accept: e.fileAccept,
|
|
899
|
+
disabled: r.value.length + p.value.length >= e.maxFileCount,
|
|
900
|
+
label: c.value.insertFile,
|
|
901
|
+
hint: S.value,
|
|
902
|
+
onFiles: d
|
|
903
|
+
}, null, 8, ["accept", "disabled", "label", "hint"]),
|
|
904
|
+
P(m).isProcessing.value ? (t(), l("p", Lt, "…")) : h("", !0),
|
|
905
|
+
V.value.length > 0 ? (t(), l("ul", Mt, [
|
|
906
|
+
(t(!0), l(W, null, q(V.value, (s, R) => (t(), l("li", { key: R }, f(s), 1))), 128))
|
|
907
|
+
])) : h("", !0),
|
|
908
|
+
r.value.length > 0 ? (t(), l("ul", Bt, [
|
|
909
|
+
(t(!0), l(W, null, q(r.value, (s, R) => (t(), l("li", {
|
|
910
|
+
key: R,
|
|
911
|
+
class: "hu-staged__item"
|
|
912
|
+
}, [
|
|
913
|
+
T(le, {
|
|
914
|
+
"file-name": P(oe)(s.file.name, s.file.format),
|
|
915
|
+
size: 40
|
|
916
|
+
}, null, 8, ["file-name"]),
|
|
917
|
+
a("div", Et, [
|
|
918
|
+
e.changeFileName ? (t(), l("label", Nt, [
|
|
919
|
+
a("span", Ut, f(c.value.fileName), 1),
|
|
920
|
+
a("span", It, [
|
|
921
|
+
Z(a("input", {
|
|
922
|
+
"onUpdate:modelValue": (j) => s.file.name = j,
|
|
923
|
+
class: "hu-input",
|
|
924
|
+
type: "text"
|
|
925
|
+
}, null, 8, Vt), [
|
|
926
|
+
[se, s.file.name]
|
|
927
|
+
]),
|
|
928
|
+
s.file.format ? (t(), l("span", Ot, "." + f(s.file.format), 1)) : h("", !0)
|
|
929
|
+
])
|
|
930
|
+
])) : (t(), l("span", Pt, f(P(oe)(s.file.name, s.file.format)), 1)),
|
|
931
|
+
e.addFileDescription ? (t(), l("label", Rt, [
|
|
932
|
+
a("span", jt, f(c.value.fileDescription), 1),
|
|
933
|
+
a("textarea", {
|
|
934
|
+
class: "hu-input",
|
|
935
|
+
rows: "2",
|
|
936
|
+
value: s.file.description ?? "",
|
|
937
|
+
onInput: (j) => s.file.description = j.target.value
|
|
938
|
+
}, null, 40, Wt)
|
|
939
|
+
])) : h("", !0),
|
|
940
|
+
e.addFileTag && e.tags.length ? (t(), l("fieldset", qt, [
|
|
941
|
+
a("legend", Xt, f(c.value.fileTags), 1),
|
|
942
|
+
a("span", Yt, [
|
|
943
|
+
(t(!0), l(W, null, q(e.tags, (j) => (t(), l("label", {
|
|
944
|
+
key: j,
|
|
945
|
+
class: "hu-tag hu-tag--selectable"
|
|
946
|
+
}, [
|
|
947
|
+
Z(a("input", {
|
|
948
|
+
"onUpdate:modelValue": (Fe) => s.file.tags = Fe,
|
|
949
|
+
type: "checkbox",
|
|
950
|
+
value: j
|
|
951
|
+
}, null, 8, Gt), [
|
|
952
|
+
[fe, s.file.tags]
|
|
953
|
+
]),
|
|
954
|
+
ie(" " + f(j), 1)
|
|
955
|
+
]))), 128))
|
|
956
|
+
])
|
|
957
|
+
])) : h("", !0)
|
|
958
|
+
]),
|
|
959
|
+
a("button", {
|
|
960
|
+
type: "button",
|
|
961
|
+
class: "hu-icon-button",
|
|
962
|
+
"aria-label": `${c.value.delete} ${P(oe)(s.file.name, s.file.format)}`,
|
|
963
|
+
onClick: (j) => r.value.splice(R, 1)
|
|
964
|
+
}, [
|
|
965
|
+
T(N, {
|
|
966
|
+
name: "close",
|
|
967
|
+
size: 18
|
|
968
|
+
})
|
|
969
|
+
], 8, Jt)
|
|
970
|
+
]))), 128))
|
|
971
|
+
])) : h("", !0)
|
|
972
|
+
]),
|
|
973
|
+
_: 1
|
|
974
|
+
}, 8, ["open", "title", "close-label"]),
|
|
975
|
+
T(ue, {
|
|
976
|
+
open: E.value,
|
|
977
|
+
"onUpdate:open": i[7] || (i[7] = (s) => E.value = s),
|
|
978
|
+
title: c.value.edit,
|
|
979
|
+
"close-label": c.value.deleteDialog.cancel
|
|
980
|
+
}, {
|
|
981
|
+
actions: O(() => [
|
|
982
|
+
a("button", {
|
|
983
|
+
type: "button",
|
|
984
|
+
class: "hu-button",
|
|
985
|
+
onClick: i[6] || (i[6] = (s) => E.value = !1)
|
|
986
|
+
}, f(c.value.deleteDialog.cancel), 1),
|
|
987
|
+
a("button", {
|
|
988
|
+
type: "button",
|
|
989
|
+
class: "hu-button hu-button--primary",
|
|
990
|
+
style: te(x.value),
|
|
991
|
+
onClick: ge
|
|
992
|
+
}, f(c.value.edit), 5)
|
|
993
|
+
]),
|
|
994
|
+
default: O(() => [
|
|
995
|
+
L.value !== null && p.value[L.value] ? (t(), l("div", Qt, [
|
|
996
|
+
a("div", Zt, [
|
|
997
|
+
e.changeFileName ? (t(), l("label", el, [
|
|
998
|
+
a("span", tl, f(c.value.fileName), 1),
|
|
999
|
+
Z(a("input", {
|
|
1000
|
+
"onUpdate:modelValue": i[3] || (i[3] = (s) => M.name = s),
|
|
1001
|
+
class: "hu-input",
|
|
1002
|
+
type: "text"
|
|
1003
|
+
}, null, 512), [
|
|
1004
|
+
[se, M.name]
|
|
1005
|
+
])
|
|
1006
|
+
])) : h("", !0),
|
|
1007
|
+
e.addFileDescription ? (t(), l("label", ll, [
|
|
1008
|
+
a("span", al, f(c.value.fileDescription), 1),
|
|
1009
|
+
Z(a("textarea", {
|
|
1010
|
+
"onUpdate:modelValue": i[4] || (i[4] = (s) => M.description = s),
|
|
1011
|
+
class: "hu-input",
|
|
1012
|
+
rows: "3"
|
|
1013
|
+
}, null, 512), [
|
|
1014
|
+
[se, M.description]
|
|
1015
|
+
])
|
|
1016
|
+
])) : h("", !0),
|
|
1017
|
+
e.addFileTag && e.tags.length ? (t(), l("fieldset", il, [
|
|
1018
|
+
a("legend", nl, f(c.value.fileTags), 1),
|
|
1019
|
+
a("span", sl, [
|
|
1020
|
+
(t(!0), l(W, null, q(e.tags, (s) => (t(), l("label", {
|
|
1021
|
+
key: s,
|
|
1022
|
+
class: "hu-tag hu-tag--selectable"
|
|
1023
|
+
}, [
|
|
1024
|
+
Z(a("input", {
|
|
1025
|
+
"onUpdate:modelValue": i[5] || (i[5] = (R) => M.tags = R),
|
|
1026
|
+
type: "checkbox",
|
|
1027
|
+
value: s
|
|
1028
|
+
}, null, 8, ol), [
|
|
1029
|
+
[fe, M.tags]
|
|
1030
|
+
]),
|
|
1031
|
+
ie(" " + f(s), 1)
|
|
1032
|
+
]))), 128))
|
|
1033
|
+
])
|
|
1034
|
+
])) : h("", !0)
|
|
1035
|
+
]),
|
|
1036
|
+
T(le, {
|
|
1037
|
+
"file-name": p.value[L.value].file.name,
|
|
1038
|
+
size: 60
|
|
1039
|
+
}, null, 8, ["file-name"])
|
|
1040
|
+
])) : h("", !0)
|
|
1041
|
+
]),
|
|
1042
|
+
_: 1
|
|
1043
|
+
}, 8, ["open", "title", "close-label"]),
|
|
1044
|
+
T(ue, {
|
|
1045
|
+
open: Q.value,
|
|
1046
|
+
"onUpdate:open": i[9] || (i[9] = (s) => Q.value = s),
|
|
1047
|
+
title: c.value.delete,
|
|
1048
|
+
"close-label": c.value.deleteDialog.cancel,
|
|
1049
|
+
size: "small"
|
|
1050
|
+
}, {
|
|
1051
|
+
actions: O(() => [
|
|
1052
|
+
a("button", {
|
|
1053
|
+
type: "button",
|
|
1054
|
+
class: "hu-button",
|
|
1055
|
+
onClick: i[8] || (i[8] = (s) => Q.value = !1)
|
|
1056
|
+
}, f(c.value.deleteDialog.cancel), 1),
|
|
1057
|
+
a("button", {
|
|
1058
|
+
type: "button",
|
|
1059
|
+
class: "hu-button hu-button--danger-solid",
|
|
1060
|
+
onClick: $e
|
|
1061
|
+
}, f(c.value.delete), 1)
|
|
1062
|
+
]),
|
|
1063
|
+
default: O(() => [
|
|
1064
|
+
a("p", ul, f(c.value.deleteDialog.message), 1)
|
|
1065
|
+
]),
|
|
1066
|
+
_: 1
|
|
1067
|
+
}, 8, ["open", "title", "close-label"])
|
|
1068
|
+
], 8, Tt));
|
|
1069
|
+
}
|
|
1070
|
+
}), cl = { HandyUploader: dl, HandyDropzone: ve, HandyFileList: be };
|
|
1071
|
+
function ml(e) {
|
|
1072
|
+
for (const [z, b] of Object.entries(cl)) e.component(z, b);
|
|
1073
|
+
}
|
|
1074
|
+
export {
|
|
1075
|
+
bl as COMPRESSIBLE_EXTENSIONS,
|
|
1076
|
+
Me as DEFAULT_UPLOADER_OPTIONS,
|
|
1077
|
+
ue as HandyDialog,
|
|
1078
|
+
ve as HandyDropzone,
|
|
1079
|
+
le as HandyFileIcon,
|
|
1080
|
+
be as HandyFileList,
|
|
1081
|
+
dl as HandyUploader,
|
|
1082
|
+
pl as base64ByteLength,
|
|
1083
|
+
gl as compressDataUrl,
|
|
1084
|
+
yl as compressImage,
|
|
1085
|
+
Le as constructImageDataUrl,
|
|
1086
|
+
Se as createVideoThumbnailCache,
|
|
1087
|
+
cl as default,
|
|
1088
|
+
$l as fileToBase64,
|
|
1089
|
+
we as filterByAccept,
|
|
1090
|
+
de as formatBytes,
|
|
1091
|
+
Fl as formatFileSize,
|
|
1092
|
+
kl as generateVideoThumbnail,
|
|
1093
|
+
Cl as getFileIcon,
|
|
1094
|
+
he as getFileType,
|
|
1095
|
+
_l as getMimeTypeFromExtension,
|
|
1096
|
+
zl as getVideoDataUrl,
|
|
1097
|
+
ml as install,
|
|
1098
|
+
Tl as isImageFile,
|
|
1099
|
+
oe as joinFileName,
|
|
1100
|
+
me as languageData,
|
|
1101
|
+
wl as matchesAccept,
|
|
1102
|
+
xe as precheckFiles,
|
|
1103
|
+
Ae as prepareAttachments,
|
|
1104
|
+
xl as readFileAsDataUrl,
|
|
1105
|
+
De as readFiles,
|
|
1106
|
+
He as splitFileName,
|
|
1107
|
+
Be as useUploader,
|
|
1108
|
+
Dl as validateFileCount,
|
|
1109
|
+
Al as validateFileSize
|
|
1110
|
+
};
|