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.
@@ -1,2308 +0,0 @@
1
- import { defineComponent as ee, computed as le, resolveComponent as g, createElementBlock as V, openBlock as m, createVNode as r, withCtx as a, createTextVNode as w, toDisplayString as x, reactive as _e, watch as E, onMounted as ze, Fragment as O, renderList as X, createBlock as b, createElementVNode as A, unref as Z, createCommentVNode as B, mergeProps as Y, withDirectives as xe, vShow as we, nextTick as Te, ref as ae, onBeforeMount as $e, onDeactivated as Le } from "vue";
2
- function ce(o) {
3
- const i = o / 1024, e = i / 1024;
4
- return e >= 1 ? {
5
- text: `${e.toFixed(2)} MB`,
6
- color: e > 10 ? "red" : e > 5 ? "orange" : "green"
7
- } : {
8
- text: `${i.toFixed(2)} KB`,
9
- color: i > 1e3 ? "orange" : "green"
10
- };
11
- }
12
- function re(o, i) {
13
- var t;
14
- const e = ((t = o.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
15
- return ["jpg", "jpeg", "png", "gif", "bmp", "svg", "webp", "tiff"].includes(e) || i != null && i.startsWith("image/") ? "image" : ["pdf", "doc", "docx", "txt", "rtf", "odt"].includes(e) ? "document" : ["xls", "xlsx", "csv", "ods"].includes(e) ? "spreadsheet" : ["ppt", "pptx", "odp"].includes(e) ? "presentation" : ["zip", "rar", "7z", "tar", "gz"].includes(e) ? "archive" : ["mp4", "avi", "mov", "wmv", "flv", "webm"].includes(e) ? "video" : ["mp3", "wav", "flac", "aac", "ogg"].includes(e) ? "audio" : "unknown";
16
- }
17
- const de = {
18
- // PDF
19
- pdf: { icon: "mdi-file-pdf-box", color: "red darken-1" },
20
- // Word Documents
21
- doc: { icon: "mdi-file-word-outline", color: "blue darken-1" },
22
- docx: { icon: "mdi-file-word-outline", color: "blue darken-1" },
23
- odt: { icon: "mdi-file-word-outline", color: "blue darken-1" },
24
- // Images
25
- jpg: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
26
- jpeg: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
27
- png: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
28
- gif: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
29
- bmp: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
30
- tif: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
31
- tiff: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
32
- svg: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
33
- webp: { icon: "mdi-file-image-outline", color: "deep-purple darken-1" },
34
- // Excel/Spreadsheets
35
- xls: { icon: "mdi-file-excel-outline", color: "teal darken-1" },
36
- xlsx: { icon: "mdi-file-excel-outline", color: "teal darken-1" },
37
- csv: { icon: "mdi-file-excel-outline", color: "teal darken-1" },
38
- ods: { icon: "mdi-file-excel-outline", color: "teal darken-1" },
39
- // PowerPoint/Presentations
40
- ppt: { icon: "mdi-file-powerpoint-outline", color: "orange darken-3" },
41
- pptx: { icon: "mdi-file-powerpoint-outline", color: "orange darken-3" },
42
- pptm: { icon: "mdi-file-powerpoint-outline", color: "orange darken-3" },
43
- odp: { icon: "mdi-file-powerpoint-outline", color: "orange darken-3" },
44
- // Videos
45
- mp4: { icon: "mdi-file-video-outline", color: "red lighten-1" },
46
- mov: { icon: "mdi-file-video-outline", color: "red lighten-1" },
47
- flv: { icon: "mdi-file-video-outline", color: "red lighten-1" },
48
- wmv: { icon: "mdi-file-video-outline", color: "red lighten-1" },
49
- avi: { icon: "mdi-file-video-outline", color: "red lighten-1" },
50
- webm: { icon: "mdi-file-video-outline", color: "red lighten-1" },
51
- // Audio
52
- mp3: { icon: "mdi-file-music-outline", color: "purple darken-1" },
53
- wav: { icon: "mdi-file-music-outline", color: "purple darken-1" },
54
- flac: { icon: "mdi-file-music-outline", color: "purple darken-1" },
55
- aac: { icon: "mdi-file-music-outline", color: "purple darken-1" },
56
- ogg: { icon: "mdi-file-music-outline", color: "purple darken-1" },
57
- // CAD
58
- dwg: { icon: "mdi-file-cad", color: "indigo lighten-2" },
59
- // Archives
60
- zip: { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
61
- rar: { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
62
- "7z": { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
63
- "7-zip": { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
64
- tar: { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
65
- gz: { icon: "mdi-folder-zip-outline", color: "lime lighten-1" },
66
- // Text files
67
- txt: { icon: "mdi-script-text-outline", color: "light-green darken-3" },
68
- rtf: { icon: "mdi-script-text-outline", color: "light-green darken-3" },
69
- // Unknown/Default file type
70
- unknown: { icon: "mdi-file-question-outline", color: "grey darken-1" }
71
- };
72
- function kt(o, i) {
73
- const e = re(o, i), t = {
74
- image: { icon: "mdi-file-image", color: "blue" },
75
- document: { icon: "mdi-file-document", color: "red" },
76
- spreadsheet: { icon: "mdi-file-excel", color: "green" },
77
- presentation: { icon: "mdi-file-powerpoint", color: "orange" },
78
- archive: { icon: "mdi-folder-zip", color: "purple" },
79
- video: { icon: "mdi-file-video", color: "pink" },
80
- audio: { icon: "mdi-file-music", color: "teal" },
81
- file: { icon: "mdi-file", color: "grey" },
82
- unknown: { icon: "mdi-file-question-outline", color: "grey darken-1" }
83
- };
84
- return t[e] || t.unknown;
85
- }
86
- function ue(o) {
87
- var e;
88
- const i = (e = o.split(".").pop()) == null ? void 0 : e.toLowerCase();
89
- return i && de[i] || de.unknown;
90
- }
91
- function me(o) {
92
- return ue(o).icon;
93
- }
94
- function fe(o) {
95
- return ue(o).color;
96
- }
97
- function pe(o, i) {
98
- return re(o, i) === "image";
99
- }
100
- function Ve(o, i) {
101
- return o <= i;
102
- }
103
- function Be(o, i) {
104
- return o < i;
105
- }
106
- function Fe(o) {
107
- var t;
108
- const i = ((t = o.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
109
- return {
110
- // Image types
111
- jpg: "image/jpeg",
112
- jpeg: "image/jpeg",
113
- png: "image/png",
114
- gif: "image/gif",
115
- bmp: "image/bmp",
116
- tiff: "image/tiff",
117
- svg: "image/svg+xml",
118
- webp: "image/webp",
119
- // Video types
120
- mp4: "video/mp4",
121
- avi: "video/x-msvideo",
122
- mov: "video/quicktime",
123
- wmv: "video/x-ms-wmv",
124
- flv: "video/x-flv",
125
- webm: "video/webm",
126
- // Document types
127
- pdf: "application/pdf",
128
- doc: "application/msword",
129
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
130
- txt: "text/plain",
131
- csv: "text/csv",
132
- // Archive types
133
- zip: "application/zip",
134
- rar: "application/x-rar-compressed"
135
- }[i] || "application/octet-stream";
136
- }
137
- function Se(o, i) {
138
- if (!o || !i)
139
- return console.warn("constructImageDataUrl: missing base64 or format", { hasBase64: !!o, format: i }), "";
140
- const e = o.replace(/^data:[^;]+;base64,/, "");
141
- return `data:${i.startsWith("image/") ? i : `image/${i}`};base64,${e}`;
142
- }
143
- function Ie(o, i = 0.8, e = 1920, t = 1080) {
144
- return new Promise((c, T) => {
145
- const L = document.createElement("canvas"), k = L.getContext("2d"), C = new Image();
146
- C.onload = () => {
147
- let { width: h, height: D } = C;
148
- if (h > e || D > t) {
149
- const U = Math.min(e / h, t / D);
150
- h *= U, D *= U;
151
- }
152
- L.width = h, L.height = D, k == null || k.drawImage(C, 0, 0, h, D);
153
- const $ = L.toDataURL("image/jpeg", i);
154
- c($);
155
- }, C.onerror = () => T(new Error("Failed to load image for compression"));
156
- const _ = new FileReader();
157
- _.onload = (h) => {
158
- var D;
159
- C.src = (D = h.target) == null ? void 0 : D.result;
160
- }, _.onerror = () => T(new Error("Failed to read file")), _.readAsDataURL(o);
161
- });
162
- }
163
- function ye(o) {
164
- return new Promise((i, e) => {
165
- const t = new FileReader();
166
- t.onload = () => {
167
- const c = t.result, T = c.split(",")[1] || c;
168
- i(T);
169
- }, t.onerror = () => e(new Error("Failed to read file")), t.readAsDataURL(o);
170
- });
171
- }
172
- const ie = /* @__PURE__ */ ee({
173
- __name: "SelectFileIconType",
174
- props: {
175
- fileFormat: {},
176
- size: { default: 30 }
177
- },
178
- setup(o) {
179
- const i = o, e = le(() => {
180
- const t = `file.${i.fileFormat}`;
181
- return ue(t);
182
- });
183
- return (t, c) => {
184
- const T = g("v-icon");
185
- return m(), V("div", null, [
186
- r(T, {
187
- size: i.size,
188
- color: e.value.color
189
- }, {
190
- default: a(() => [
191
- w(x(e.value.icon), 1)
192
- ]),
193
- _: 1
194
- }, 8, ["size", "color"])
195
- ]);
196
- };
197
- }
198
- }), Ue = {
199
- key: 0,
200
- style: { height: "200px", display: "flex", "align-items": "center", "justify-content": "center", "background-color": "#f5f5f5", overflow: "hidden" }
201
- }, Ee = ["src", "onError"], Pe = {
202
- key: 1,
203
- style: { height: "200px", "background-color": "#f5f5f5", position: "relative", overflow: "hidden", display: "flex", "align-items": "center", "justify-content": "center" }
204
- }, Me = ["src", "onError"], je = {
205
- key: 1,
206
- style: { width: "100%", height: "100%", background: "#e0e0e0", display: "flex", "align-items": "center", "justify-content": "center" }
207
- }, He = {
208
- class: "d-flex justify-center align-center",
209
- style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)", background: "rgba(0,0,0,0.7)", "border-radius": "50%", width: "60px", height: "60px", cursor: "pointer" }
210
- }, Ne = {
211
- key: 2,
212
- class: "d-flex justify-center align-center",
213
- style: { height: "200px", "background-color": "#f5f5f5" }
214
- }, Re = { class: "BYekan" }, Oe = { class: "BYekan" }, We = { key: 0 }, ge = /* @__PURE__ */ ee({
215
- __name: "ThumbnailUploader",
216
- props: {
217
- lang: { default: "en" },
218
- documentAttachment: {},
219
- thumb: { type: Boolean, default: !0 },
220
- cols: { default: 4 },
221
- editPermission: { type: Boolean, default: !0 },
222
- deletePermission: { type: Boolean, default: !0 },
223
- selectedLang: {},
224
- cardType: {},
225
- outlined: { type: Boolean, default: !1 },
226
- raised: { type: Boolean, default: !1 },
227
- shaped: { type: Boolean, default: !1 },
228
- tile: { type: Boolean, default: !1 }
229
- },
230
- emits: ["openDeleteDialog", "openEditDocumentDialog"],
231
- setup(o, { emit: i }) {
232
- const e = (n) => {
233
- const l = pe(n);
234
- return console.log("🔍 isImageFile check:", n, "→", l), l;
235
- }, t = o, c = i, T = (n) => {
236
- const l = re(n) === "video";
237
- return console.log("🎥 Checking if video file:", n, "result:", l, "fileType:", re(n)), l;
238
- }, L = (n) => {
239
- var p;
240
- if (!n.base64 || !n.format)
241
- return console.error("❌ Missing base64 or format for:", n.name, { base64: !!n.base64, format: n.format }), "";
242
- const l = Se(n.base64, n.format);
243
- return console.log("🖼️ Image source for:", n.name, {
244
- format: n.format,
245
- base64Length: ((p = n.base64) == null ? void 0 : p.length) || 0,
246
- srcLength: l.length,
247
- srcPreview: l.substring(0, 100) + "..."
248
- }), l;
249
- }, k = (n) => {
250
- var l;
251
- console.error("Image failed to load:", {
252
- name: n.name,
253
- format: n.format,
254
- base64Length: ((l = n.base64) == null ? void 0 : l.length) || 0
255
- });
256
- }, C = _e(/* @__PURE__ */ new Map()), _ = (n) => (console.log("🎬 Starting video thumbnail generation for:", n.name), new Promise((l, p) => {
257
- var W;
258
- const s = document.createElement("video"), F = document.createElement("canvas"), y = F.getContext("2d");
259
- if (!y) {
260
- console.error("❌ Canvas context not available"), p(new Error("Canvas context not available"));
261
- return;
262
- }
263
- s.crossOrigin = "anonymous", s.preload = "metadata", s.muted = !0, s.onloadedmetadata = () => {
264
- if (console.log("📹 Video metadata loaded:", {
265
- duration: s.duration,
266
- width: s.videoWidth,
267
- height: s.videoHeight,
268
- readyState: s.readyState,
269
- networkState: s.networkState
270
- }), s.duration === 0 || isNaN(s.duration)) {
271
- console.error("❌ Invalid video duration:", s.duration);
272
- const K = h(n);
273
- D.delete(K), p(new Error("Invalid video duration"));
274
- return;
275
- }
276
- if (s.videoWidth === 0 || s.videoHeight === 0) {
277
- console.error("❌ Invalid video dimensions:", s.videoWidth, "x", s.videoHeight);
278
- const K = h(n);
279
- D.delete(K), p(new Error("Invalid video dimensions"));
280
- return;
281
- }
282
- F.width = s.videoWidth, F.height = s.videoHeight;
283
- const N = Math.min(1, s.duration * 0.1);
284
- console.log("⏰ Seeking to time:", N, "of total duration:", s.duration), s.currentTime = N;
285
- }, s.onseeked = () => {
286
- console.log("🎯 Video seeked successfully to:", s.currentTime);
287
- try {
288
- console.log("🖼️ Canvas setup:", {
289
- width: F.width,
290
- height: F.height,
291
- videoCurrentTime: s.currentTime,
292
- videoReadyState: s.readyState
293
- }), y.drawImage(s, 0, 0, F.width, F.height);
294
- const K = y.getImageData(0, 0, F.width, F.height).data.some((te) => te !== 0);
295
- console.log("🎨 Canvas content check:", K ? "Has content" : "Empty/transparent");
296
- const G = F.toDataURL("image/jpeg", 0.8);
297
- console.log("✅ Generated thumbnail:", {
298
- dataUrlLength: G.length,
299
- startsWithData: G.startsWith("data:image/jpeg"),
300
- preview: G.substring(0, 50) + "..."
301
- }), l(G);
302
- } catch (N) {
303
- console.error("❌ Error during thumbnail generation:", N), p(N);
304
- }
305
- }, s.onabort = () => {
306
- console.warn("⚠️ Video loading aborted"), p(new Error("Video loading aborted"));
307
- }, s.onstalled = () => {
308
- console.warn("⚠️ Video loading stalled");
309
- }, s.onerror = (N) => {
310
- console.error("❌ Video failed to load for thumbnail generation:", N), p(new Error("Video failed to load for thumbnail generation"));
311
- }, s.onloadstart = () => {
312
- console.log("🔄 Video load started");
313
- }, s.oncanplay = () => {
314
- console.log("▶️ Video can play");
315
- };
316
- const S = ((W = n.base64) == null ? void 0 : W.replace(/^data:[^;]+;base64,/, "")) || "";
317
- let I;
318
- n.format.startsWith("video/") ? I = n.format : (I = Fe(n.name), I.startsWith("video/") || (I = `video/${n.format}`));
319
- const J = `data:${I};base64,${S}`;
320
- console.log("🔗 Setting video source:", {
321
- fileName: n.name,
322
- format: n.format,
323
- mimeType: I,
324
- base64Length: S.length,
325
- videoSrcLength: J.length
326
- }), s.src = J;
327
- })), h = (n) => {
328
- var l;
329
- return `${n.name}_${(l = n.base64) == null ? void 0 : l.substring(0, 50)}`;
330
- };
331
- le(() => (console.log("🔄 Video thumbnails computed updated:", Array.from(C.keys())), C));
332
- const D = /* @__PURE__ */ new Set(), $ = (n) => {
333
- const l = h(n);
334
- if (console.log("🔍 Getting video thumbnail for:", n.name, "cache key:", l), C.has(l))
335
- return console.log("💾 Returning cached thumbnail for:", n.name), C.get(l);
336
- if (D.has(l)) {
337
- console.log("⏳ Thumbnail already being generated for:", n.name);
338
- return;
339
- }
340
- console.log("🚀 No cached thumbnail, generating new one for:", n.name), D.add(l), _(n).then((p) => {
341
- console.log("✅ Thumbnail generated and cached for:", n.name), C.set(l, p), D.delete(l), Te(() => {
342
- console.log("🔄 UI update triggered for:", n.name);
343
- });
344
- }).catch((p) => {
345
- console.error("❌ Failed to generate video thumbnail for:", n.name, p), D.delete(l);
346
- });
347
- }, U = (n) => {
348
- console.error("Video thumbnail failed to load:", {
349
- name: n.name,
350
- format: n.format
351
- });
352
- const l = h(n);
353
- C.delete(l);
354
- }, j = (n) => ({
355
- icon: me(n),
356
- color: fe(n)
357
- }), P = (n) => n.tags.length > 0 || !!n.description, H = (n) => {
358
- n.showDetailState = !n.showDetailState;
359
- }, u = (n, l) => {
360
- c("openDeleteDialog", n, l);
361
- }, f = (n, l) => {
362
- c("openEditDocumentDialog", n, l);
363
- }, d = () => {
364
- console.log("🎯 Generating thumbnails for videos, total attachments:", t.documentAttachment.length);
365
- const n = t.documentAttachment.filter((l) => T(l.file.name));
366
- console.log("📹 Found video attachments:", n.length, n.map((l) => l.file.name)), n.forEach((l) => {
367
- console.log("🎬 Processing video:", l.file.name), $(l.file);
368
- });
369
- };
370
- return E(() => t.documentAttachment, d, { immediate: !0 }), ze(d), (n, l) => {
371
- const p = g("v-icon"), s = g("v-card-subtitle"), F = g("v-chip"), y = g("v-divider"), S = g("v-btn"), I = g("v-tooltip"), J = g("v-spacer"), W = g("v-card-actions"), N = g("v-chip-group"), K = g("v-card-text"), G = g("v-expand-transition"), te = g("v-card"), se = g("v-col"), oe = g("v-row");
372
- return m(), V("div", null, [
373
- r(oe, null, {
374
- default: a(() => [
375
- (m(!0), V(O, null, X(o.documentAttachment, (z, Q) => (m(), b(se, {
376
- key: `attachment-${Q}`,
377
- cols: "12",
378
- md: o.cols,
379
- xs: "12"
380
- }, {
381
- default: a(() => [
382
- r(te, {
383
- shaped: o.shaped,
384
- outlined: o.outlined,
385
- raised: o.raised,
386
- tile: o.tile,
387
- class: "mx-auto",
388
- "max-width": "344"
389
- }, {
390
- default: a(() => [
391
- e(z.file.name) ? (m(), V("div", Ue, [
392
- A("img", {
393
- src: L(z.file),
394
- style: { "max-width": "100%", "max-height": "100%", "object-fit": "contain" },
395
- onError: (R) => k(z.file)
396
- }, null, 40, Ee)
397
- ])) : T(z.file.name) ? (m(), V("div", Pe, [
398
- $(z.file) ? (m(), V("img", {
399
- key: 0,
400
- src: $(z.file),
401
- style: { width: "100%", height: "100%", "object-fit": "cover" },
402
- onError: (R) => U(z.file)
403
- }, null, 40, Me)) : (m(), V("div", je, [
404
- r(p, {
405
- size: "60",
406
- color: "grey"
407
- }, {
408
- default: a(() => [...l[0] || (l[0] = [
409
- w("mdi-video", -1)
410
- ])]),
411
- _: 1
412
- })
413
- ])),
414
- A("div", He, [
415
- r(p, {
416
- color: "white",
417
- size: "30"
418
- }, {
419
- default: a(() => [...l[1] || (l[1] = [
420
- w("mdi-play", -1)
421
- ])]),
422
- _: 1
423
- })
424
- ])
425
- ])) : (m(), V("div", Ne, [
426
- r(p, {
427
- size: "120",
428
- color: j(z.file.name).color
429
- }, {
430
- default: a(() => [
431
- w(x(j(z.file.name).icon), 1)
432
- ]),
433
- _: 2
434
- }, 1032, ["color"])
435
- ])),
436
- r(s, { class: "text-truncate py-2" }, {
437
- default: a(() => [
438
- w(x(z.file.name), 1)
439
- ]),
440
- _: 2
441
- }, 1024),
442
- r(s, { class: "pt-2 pb-3" }, {
443
- default: a(() => [
444
- r(F, {
445
- color: Z(ce)(z.file.size).color,
446
- label: "",
447
- "text-color": "white"
448
- }, {
449
- default: a(() => [
450
- w(x(Z(ce)(z.file.size).text) + " ", 1),
451
- r(p, { right: "" }, {
452
- default: a(() => [...l[2] || (l[2] = [
453
- w("mdi-harddisk", -1)
454
- ])]),
455
- _: 1
456
- })
457
- ]),
458
- _: 2
459
- }, 1032, ["color"])
460
- ]),
461
- _: 2
462
- }, 1024),
463
- r(y, { class: "mx-4" }),
464
- r(W, { style: { padding: "0" } }, {
465
- default: a(() => [
466
- r(I, { right: "" }, {
467
- activator: a(({ props: R }) => [
468
- o.deletePermission ? (m(), b(S, Y({
469
- key: 0,
470
- text: "",
471
- fab: ""
472
- }, { ref_for: !0 }, R, {
473
- onClick: (ne) => u(Q, "")
474
- }), {
475
- default: a(() => [
476
- r(p, { color: "red" }, {
477
- default: a(() => [...l[3] || (l[3] = [
478
- w("mdi-trash-can-outline", -1)
479
- ])]),
480
- _: 1
481
- })
482
- ]),
483
- _: 1
484
- }, 16, ["onClick"])) : B("", !0)
485
- ]),
486
- default: a(() => [
487
- A("span", Re, x(o.selectedLang[o.lang].delete), 1)
488
- ]),
489
- _: 2
490
- }, 1024),
491
- r(I, { right: "" }, {
492
- activator: a(({ props: R }) => [
493
- o.editPermission ? (m(), b(S, Y({
494
- key: 0,
495
- text: "",
496
- fab: ""
497
- }, { ref_for: !0 }, R, {
498
- onClick: (ne) => f(z, Q)
499
- }), {
500
- default: a(() => [
501
- r(p, { color: "green" }, {
502
- default: a(() => [...l[4] || (l[4] = [
503
- w("mdi-pencil-outline", -1)
504
- ])]),
505
- _: 1
506
- })
507
- ]),
508
- _: 1
509
- }, 16, ["onClick"])) : B("", !0)
510
- ]),
511
- default: a(() => [
512
- A("span", Oe, x(o.selectedLang[o.lang].edit), 1)
513
- ]),
514
- _: 2
515
- }, 1024),
516
- r(J),
517
- P(z.file) ? (m(), b(S, {
518
- key: 0,
519
- icon: "",
520
- onClick: (R) => H(z.file)
521
- }, {
522
- default: a(() => [
523
- r(p, null, {
524
- default: a(() => [
525
- w(x(z.file.showDetailState ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
526
- ]),
527
- _: 2
528
- }, 1024)
529
- ]),
530
- _: 2
531
- }, 1032, ["onClick"])) : B("", !0)
532
- ]),
533
- _: 2
534
- }, 1024),
535
- r(G, null, {
536
- default: a(() => [
537
- P(z.file) ? xe((m(), V("div", We, [
538
- r(y),
539
- z.file.tags.length ? (m(), b(N, {
540
- key: 0,
541
- multiple: "",
542
- "active-class": "primary--text",
543
- class: "pa-2"
544
- }, {
545
- default: a(() => [
546
- (m(!0), V(O, null, X(z.file.tags, (R, ne) => (m(), b(F, {
547
- key: `tag-${ne}`,
548
- class: "ma-1"
549
- }, {
550
- default: a(() => [
551
- w(x(R), 1)
552
- ]),
553
- _: 2
554
- }, 1024))), 128))
555
- ]),
556
- _: 2
557
- }, 1024)) : B("", !0),
558
- z.file.description ? (m(), b(K, {
559
- key: 1,
560
- class: "text-justify"
561
- }, {
562
- default: a(() => [
563
- w(x(z.file.description), 1)
564
- ]),
565
- _: 2
566
- }, 1024)) : B("", !0)
567
- ], 512)), [
568
- [we, z.file.showDetailState]
569
- ]) : B("", !0)
570
- ]),
571
- _: 2
572
- }, 1024)
573
- ]),
574
- _: 2
575
- }, 1032, ["shaped", "outlined", "raised", "tile"])
576
- ]),
577
- _: 2
578
- }, 1032, ["md"]))), 128))
579
- ]),
580
- _: 1
581
- })
582
- ]);
583
- };
584
- }
585
- }), Ke = {
586
- class: "text-left",
587
- style: { width: "80px" }
588
- }, qe = { class: "text-center" }, Ge = {
589
- class: "text-left",
590
- style: { width: "120px" }
591
- }, Ye = {
592
- class: "text-left",
593
- style: { width: "120px" }
594
- }, Xe = { class: "text-center pa-3" }, Je = { class: "text-left pa-3" }, Qe = { class: "text-left pa-3" }, Ze = { class: "text-center pa-2" }, et = { class: "d-flex justify-center ga-1" }, tt = /* @__PURE__ */ ee({
595
- __name: "TableUploader",
596
- props: {
597
- documentAttachment: {},
598
- thumb: { type: Boolean, default: !0 },
599
- lang: { default: "en" },
600
- cols: { default: 4 },
601
- editPermission: { type: Boolean, default: !0 },
602
- deletePermission: { type: Boolean, default: !0 },
603
- tableThumbColumn: { type: Boolean },
604
- tableFixedHeader: { type: Boolean, default: !0 },
605
- tableHeight: { default: 400 },
606
- selectedLang: {}
607
- },
608
- emits: ["openDeleteDialog", "openEditDocumentDialog"],
609
- setup(o, { emit: i }) {
610
- const e = o, t = i, c = (_) => _ ? pe(_) : !1, T = (_) => {
611
- const h = _ / 1e3, D = h / 1024;
612
- return D >= 1 ? `${D.toFixed(1)} MB` : `${h.toFixed(1)} KB`;
613
- }, L = (_) => {
614
- const h = _ / 1024e3;
615
- return h < 1 ? "success" : h < 5 ? "warning" : "error";
616
- }, k = (_, h) => {
617
- t("openDeleteDialog", _, h);
618
- }, C = (_, h) => {
619
- t("openEditDocumentDialog", _, h);
620
- };
621
- return (_, h) => {
622
- const D = g("v-img"), $ = g("v-icon"), U = g("v-tooltip"), j = g("v-chip"), P = g("v-btn"), H = g("v-table"), u = g("v-col"), f = g("v-row");
623
- return m(), V("div", null, [
624
- r(f, null, {
625
- default: a(() => [
626
- r(u, { cols: "12" }, {
627
- default: a(() => [
628
- r(H, {
629
- "fixed-header": e.tableFixedHeader,
630
- height: e.tableHeight + "px",
631
- class: "elevation-1"
632
- }, {
633
- default: a(() => [
634
- A("thead", null, [
635
- A("tr", null, [
636
- A("th", Ke, x(e.selectedLang[o.lang].table.thumb), 1),
637
- A("th", qe, x(e.selectedLang[o.lang].table.name), 1),
638
- A("th", Ge, x(e.selectedLang[o.lang].table.size), 1),
639
- A("th", Ye, x(e.selectedLang[o.lang].table.action.action), 1)
640
- ])
641
- ]),
642
- A("tbody", null, [
643
- (m(!0), V(O, null, X(e.documentAttachment, (d, n) => (m(), V("tr", {
644
- key: `attachment-${n}`,
645
- class: "table-row"
646
- }, [
647
- A("td", Xe, [
648
- r(U, { location: "top" }, {
649
- activator: a(({ props: l }) => [
650
- A("div", Y({
651
- class: "d-flex justify-center align-center",
652
- style: { height: "60px", width: "60px" }
653
- }, { ref_for: !0 }, l), [
654
- c(d.file.name) ? (m(), V(O, { key: 0 }, [
655
- e.thumb && d.file.base64 ? (m(), b(D, {
656
- key: 0,
657
- style: { height: "40px", width: "40px" },
658
- src: "data:" + d.file.format + ";base64," + d.file.base64,
659
- height: "40",
660
- width: "40",
661
- class: "rounded",
662
- contain: ""
663
- }, null, 8, ["src"])) : (m(), b($, {
664
- key: 1,
665
- size: "40",
666
- color: "deep-purple"
667
- }, {
668
- default: a(() => [...h[0] || (h[0] = [
669
- w(" mdi-file-image-outline ", -1)
670
- ])]),
671
- _: 1
672
- }))
673
- ], 64)) : (m(), b($, {
674
- key: 1,
675
- icon: Z(me)(d.file.name),
676
- color: Z(fe)(d.file.name),
677
- size: "40"
678
- }, null, 8, ["icon", "color"]))
679
- ], 16)
680
- ]),
681
- default: a(() => [
682
- A("span", null, x(d.file.name), 1)
683
- ]),
684
- _: 2
685
- }, 1024)
686
- ]),
687
- A("td", Je, [
688
- r(U, { location: "top" }, {
689
- activator: a(({ props: l }) => [
690
- A("span", Y({ ref_for: !0 }, l), x((() => {
691
- const p = d.file.name.split(".").pop(), s = d.file.name.slice(0, d.file.name.lastIndexOf("."));
692
- return `${s.length > 10 ? s.slice(0, 10) + "..." : s}.${p}`;
693
- })()), 17)
694
- ]),
695
- default: a(() => [
696
- A("span", null, x(d.file.name), 1)
697
- ]),
698
- _: 2
699
- }, 1024)
700
- ]),
701
- A("td", Qe, [
702
- r(j, {
703
- color: L(d.file.size),
704
- variant: "tonal",
705
- size: "small",
706
- class: "text-caption"
707
- }, {
708
- default: a(() => [
709
- w(x(T(d.file.size)), 1)
710
- ]),
711
- _: 2
712
- }, 1032, ["color"])
713
- ]),
714
- A("td", Ze, [
715
- A("div", et, [
716
- o.editPermission ? (m(), b(U, {
717
- key: 0,
718
- location: "top"
719
- }, {
720
- activator: a(({ props: l }) => [
721
- r(P, Y({
722
- icon: "",
723
- size: "small",
724
- color: "success",
725
- variant: "text"
726
- }, { ref_for: !0 }, l, {
727
- onClick: (p) => C(d, n)
728
- }), {
729
- default: a(() => [
730
- r($, { size: "18" }, {
731
- default: a(() => [...h[1] || (h[1] = [
732
- w("mdi-pencil-outline", -1)
733
- ])]),
734
- _: 1
735
- })
736
- ]),
737
- _: 1
738
- }, 16, ["onClick"])
739
- ]),
740
- default: a(() => [
741
- A("span", null, x(o.selectedLang[o.lang].edit), 1)
742
- ]),
743
- _: 2
744
- }, 1024)) : B("", !0),
745
- o.deletePermission ? (m(), b(U, {
746
- key: 1,
747
- location: "top"
748
- }, {
749
- activator: a(({ props: l }) => [
750
- r(P, Y({
751
- icon: "",
752
- size: "small",
753
- color: "error",
754
- variant: "text"
755
- }, { ref_for: !0 }, l, {
756
- onClick: (p) => k(n, "")
757
- }), {
758
- default: a(() => [
759
- r($, { size: "18" }, {
760
- default: a(() => [...h[2] || (h[2] = [
761
- w("mdi-delete", -1)
762
- ])]),
763
- _: 1
764
- })
765
- ]),
766
- _: 1
767
- }, 16, ["onClick"])
768
- ]),
769
- default: a(() => [
770
- A("span", null, x(o.selectedLang[o.lang].table.action.deleteTooltip), 1)
771
- ]),
772
- _: 2
773
- }, 1024)) : B("", !0)
774
- ])
775
- ])
776
- ]))), 128))
777
- ])
778
- ]),
779
- _: 1
780
- }, 8, ["fixed-header", "height"])
781
- ]),
782
- _: 1
783
- })
784
- ]),
785
- _: 1
786
- })
787
- ]);
788
- };
789
- }
790
- }), ke = (o, i) => {
791
- const e = o.__vccOpts || o;
792
- for (const [t, c] of i)
793
- e[t] = c;
794
- return e;
795
- }, he = /* @__PURE__ */ ke(tt, [["__scopeId", "data-v-d05b814b"]]), ot = {
796
- class: "d-flex align-center pa-3",
797
- style: { height: "100%" }
798
- }, nt = {
799
- class: "flex-grow-1 pr-4",
800
- style: { "max-width": "60%" }
801
- }, lt = {
802
- class: "text-subtitle-1 font-weight-medium mb-2",
803
- style: { overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", "max-width": "100%" }
804
- }, it = {
805
- class: "flex-shrink-0",
806
- style: { "min-width": "80px" }
807
- }, at = {
808
- key: 0,
809
- class: "thumbnail-container"
810
- }, rt = {
811
- key: 1,
812
- class: "d-flex align-center justify-center"
813
- }, st = { class: "d-flex gap-2 pb-1" }, dt = /* @__PURE__ */ ee({
814
- __name: "SimpleUploader",
815
- props: {
816
- documentAttachment: {},
817
- lang: { default: "en" },
818
- thumb: { type: Boolean, default: !0 },
819
- cols: { default: 4 },
820
- editPermission: { type: Boolean, default: !0 },
821
- cardType: {},
822
- outlined: { type: Boolean },
823
- raised: { type: Boolean },
824
- shaped: { type: Boolean },
825
- tile: { type: Boolean },
826
- deletePermission: { type: Boolean, default: !0 },
827
- selectedLang: {}
828
- },
829
- emits: ["setCardTheme", "openDeleteDialog", "openEditDocumentDialog"],
830
- setup(o, { emit: i }) {
831
- const e = o, t = i, c = (_) => {
832
- const h = _ / 1e3;
833
- return h < 1024 ? `${h.toFixed(1)} ${e.selectedLang[e.lang].size.kb}` : `${(h / 1024).toFixed(1)} ${e.selectedLang[e.lang].size.mb}`;
834
- }, T = (_) => {
835
- var h;
836
- return ["jpg", "jpeg", "png", "tif", "bmp"].includes(((h = _.split(".").pop()) == null ? void 0 : h.toLowerCase()) || "");
837
- }, L = (_) => _.base64 ? _.base64.startsWith("data:") ? _.base64 : `data:${_.format};base64,${_.base64}` : "", k = (_, h) => t("openDeleteDialog", _, h), C = (_, h) => t("openEditDocumentDialog", _, h);
838
- return (_, h) => {
839
- const D = g("v-icon"), $ = g("v-chip"), U = g("v-img"), j = g("v-divider"), P = g("v-btn"), H = g("v-tooltip"), u = g("v-chip-group"), f = g("v-card-text"), d = g("v-expand-transition"), n = g("v-card"), l = g("v-col"), p = g("v-row");
840
- return m(), V("div", null, [
841
- r(p, null, {
842
- default: a(() => [
843
- (m(!0), V(O, null, X(e.documentAttachment, (s, F) => (m(), b(l, {
844
- key: `attachment-${F}`,
845
- cols: "12",
846
- sm: "6",
847
- md: "4",
848
- lg: "3"
849
- }, {
850
- default: a(() => [
851
- r(n, {
852
- class: "file-card",
853
- shaped: e.shaped,
854
- outlined: e.outlined,
855
- raised: e.raised,
856
- tile: e.tile,
857
- height: "180"
858
- }, {
859
- default: a(() => [
860
- A("div", ot, [
861
- A("div", nt, [
862
- A("div", lt, x(s.file.name), 1),
863
- r($, {
864
- color: "teal",
865
- variant: "flat",
866
- size: "small",
867
- class: "text-white mb-2"
868
- }, {
869
- default: a(() => [
870
- r(D, {
871
- start: "",
872
- size: "16"
873
- }, {
874
- default: a(() => [...h[0] || (h[0] = [
875
- w("mdi-harddisk", -1)
876
- ])]),
877
- _: 1
878
- }),
879
- w(" " + x(c(s.file.size)), 1)
880
- ]),
881
- _: 2
882
- }, 1024)
883
- ]),
884
- A("div", it, [
885
- T(s.file.name) && e.thumb ? (m(), V("div", at, [
886
- r(U, {
887
- src: L(s.file),
888
- height: "80",
889
- width: "80",
890
- cover: "",
891
- class: "rounded"
892
- }, null, 8, ["src"])
893
- ])) : (m(), V("div", rt, [
894
- r(D, {
895
- color: Z(fe)(s.file.name),
896
- size: "60"
897
- }, {
898
- default: a(() => [
899
- w(x(Z(me)(s.file.name)), 1)
900
- ]),
901
- _: 2
902
- }, 1032, ["color"])
903
- ]))
904
- ])
905
- ]),
906
- r(j, { class: "my-2" }),
907
- A("div", st, [
908
- r(H, { bottom: "" }, {
909
- activator: a(({ props: y }) => [
910
- e.deletePermission ? (m(), b(P, Y({
911
- key: 0,
912
- icon: "",
913
- variant: "text",
914
- size: "small"
915
- }, { ref_for: !0 }, y, {
916
- onClick: (S) => k(F, "")
917
- }), {
918
- default: a(() => [
919
- r(D, {
920
- color: "red",
921
- size: "20"
922
- }, {
923
- default: a(() => [...h[1] || (h[1] = [
924
- w("mdi-delete-outline", -1)
925
- ])]),
926
- _: 1
927
- })
928
- ]),
929
- _: 1
930
- }, 16, ["onClick"])) : B("", !0)
931
- ]),
932
- default: a(() => [
933
- A("span", null, x(e.selectedLang[o.lang].delete), 1)
934
- ]),
935
- _: 2
936
- }, 1024),
937
- r(H, { bottom: "" }, {
938
- activator: a(({ props: y }) => [
939
- e.editPermission ? (m(), b(P, Y({
940
- key: 0,
941
- icon: "",
942
- variant: "text",
943
- size: "small"
944
- }, { ref_for: !0 }, y, {
945
- onClick: (S) => C(s, F)
946
- }), {
947
- default: a(() => [
948
- r(D, {
949
- color: "green",
950
- size: "20"
951
- }, {
952
- default: a(() => [...h[2] || (h[2] = [
953
- w("mdi-pencil-outline", -1)
954
- ])]),
955
- _: 1
956
- })
957
- ]),
958
- _: 1
959
- }, 16, ["onClick"])) : B("", !0)
960
- ]),
961
- default: a(() => [
962
- A("span", null, x(e.selectedLang[o.lang].edit), 1)
963
- ]),
964
- _: 2
965
- }, 1024)
966
- ]),
967
- r(d, null, {
968
- default: a(() => [
969
- xe(A("div", null, [
970
- r(j),
971
- s.file.tags.length ? (m(), b(u, {
972
- key: 0,
973
- multiple: "",
974
- "active-class": "primary--text",
975
- style: { padding: "8px" }
976
- }, {
977
- default: a(() => [
978
- (m(!0), V(O, null, X(s.file.tags, (y, S) => (m(), b($, {
979
- key: `tag-${S}`,
980
- style: { margin: "5px" }
981
- }, {
982
- default: a(() => [
983
- w(x(y), 1)
984
- ]),
985
- _: 2
986
- }, 1024))), 128))
987
- ]),
988
- _: 2
989
- }, 1024)) : B("", !0),
990
- s.file.description ? (m(), b(f, {
991
- key: 1,
992
- style: { "text-align": "justify" }
993
- }, {
994
- default: a(() => [
995
- w(x(s.file.description), 1)
996
- ]),
997
- _: 2
998
- }, 1024)) : B("", !0)
999
- ], 512), [
1000
- [we, s.file.showDetailState]
1001
- ])
1002
- ]),
1003
- _: 2
1004
- }, 1024)
1005
- ]),
1006
- _: 2
1007
- }, 1032, ["shaped", "outlined", "raised", "tile"])
1008
- ]),
1009
- _: 2
1010
- }, 1024))), 128))
1011
- ]),
1012
- _: 1
1013
- })
1014
- ]);
1015
- };
1016
- }
1017
- }), ve = /* @__PURE__ */ ke(dt, [["__scopeId", "data-v-f7000da4"]]), be = /* @__PURE__ */ ee({
1018
- __name: "InsertButton",
1019
- props: {
1020
- documentAttachment: {},
1021
- badgeCounter: { type: Boolean },
1022
- btnColor: {},
1023
- lang: {},
1024
- maxFileCount: {},
1025
- selectedLang: {}
1026
- },
1027
- emits: ["openInputDocumentModal"],
1028
- setup(o, { emit: i }) {
1029
- const e = i, t = o, c = () => {
1030
- e("openInputDocumentModal");
1031
- };
1032
- return (T, L) => {
1033
- const k = g("v-btn"), C = g("v-badge");
1034
- return m(), V("div", null, [
1035
- t.badgeCounter ? (m(), V(O, { key: 0 }, [
1036
- t.documentAttachment.length > 0 ? (m(), b(C, {
1037
- key: 0,
1038
- bordered: "",
1039
- color: t.documentAttachment.length === t.maxFileCount ? "error" : "success",
1040
- overlap: "",
1041
- content: o.documentAttachment.length
1042
- }, {
1043
- default: a(() => [
1044
- r(k, {
1045
- color: t.btnColor,
1046
- onClick: c,
1047
- class: "mb-4"
1048
- }, {
1049
- default: a(() => [
1050
- w(x(t.selectedLang[o.lang].insertFile), 1)
1051
- ]),
1052
- _: 1
1053
- }, 8, ["color"])
1054
- ]),
1055
- _: 1
1056
- }, 8, ["color", "content"])) : (m(), b(k, {
1057
- key: 1,
1058
- color: t.btnColor,
1059
- onClick: c,
1060
- class: "mb-4"
1061
- }, {
1062
- default: a(() => [
1063
- w(x(t.selectedLang[o.lang].insertFile), 1)
1064
- ]),
1065
- _: 1
1066
- }, 8, ["color"]))
1067
- ], 64)) : B("", !0),
1068
- t.badgeCounter ? B("", !0) : (m(), b(k, {
1069
- key: 1,
1070
- color: o.btnColor,
1071
- onClick: c,
1072
- class: "mb-4"
1073
- }, {
1074
- default: a(() => [
1075
- w(x(t.selectedLang[o.lang].insertFile), 1)
1076
- ]),
1077
- _: 1
1078
- }, 8, ["color"]))
1079
- ]);
1080
- };
1081
- }
1082
- }), ct = {
1083
- en: {
1084
- insertFile: "Insert File",
1085
- insertNewFile: "Insert New File",
1086
- add: "Add",
1087
- delete: "Delete",
1088
- edit: "Edit",
1089
- deleteDialog: {
1090
- message: "Are you sure you want to delete the file?",
1091
- cancel: "cancel"
1092
- },
1093
- table: {
1094
- thumb: "Thumb",
1095
- name: "Name",
1096
- size: "Size",
1097
- tags: "tags",
1098
- action: {
1099
- action: "Action",
1100
- deleteTooltip: "Delete"
1101
- }
1102
- },
1103
- size: {
1104
- kb: "KB",
1105
- mb: "MB"
1106
- },
1107
- maxFileSizeAlert: "Max file Size is",
1108
- maxFileCountAlert: "Max file Count is",
1109
- fileName: "File Name",
1110
- fileDescription: "File Description",
1111
- fileTags: "File Tags"
1112
- },
1113
- fa: {
1114
- insertFile: "افزودن فایل",
1115
- insertNewFile: "افزودن فایل جدید",
1116
- add: "افزودن",
1117
- delete: "حذف",
1118
- edit: "ویرایش",
1119
- deleteDialog: {
1120
- message: "آیا برای حذف فایل اطمینان دارید؟",
1121
- cancel: "لغو"
1122
- },
1123
- table: {
1124
- thumb: "پیش نمایش",
1125
- name: "نام",
1126
- size: "حجم",
1127
- action: {
1128
- action: "عملیات",
1129
- deleteTooltip: "حذف"
1130
- }
1131
- },
1132
- size: {
1133
- kb: "کیلو بایت",
1134
- mb: "مگابایت"
1135
- },
1136
- maxFileSizeAlert: "حداکثر حجم فایل انتحابی ",
1137
- maxFileCountAlert: "حداکثر تعداد فایل انتخابی",
1138
- fileName: "نام فایل",
1139
- fileDescription: "توضیحات فایل",
1140
- fileTags: "برچسب فایل"
1141
- },
1142
- fr: {
1143
- insertFile: "Insérer un fichier",
1144
- insertNewFile: "Insérer un nouveau fichier",
1145
- add: "Ajouter",
1146
- delete: "Supprimer",
1147
- edit: "Éditer",
1148
- deleteDialog: {
1149
- message: "Voulez-vous vraiment supprimer le fichier?",
1150
- cancel: "Annuler"
1151
- },
1152
- table: {
1153
- thumb: "la vignette",
1154
- name: "Nom",
1155
- size: "Taille",
1156
- action: {
1157
- action: "Action",
1158
- deleteTooltip: "Supprimer"
1159
- }
1160
- },
1161
- size: {
1162
- kb: "KB",
1163
- mb: "MB"
1164
- },
1165
- maxFileSizeAlert: "La taille maximale du fichier est",
1166
- maxFileCountAlert: "Le nombre maximal de fichiers est",
1167
- fileName: "Nom de fichier",
1168
- fileDescription: "description du fichier",
1169
- fileTags: "Balises de fichier"
1170
- },
1171
- ch: {
1172
- insertFile: "插入档案",
1173
- insertNewFile: "插入新文件",
1174
- add: "加",
1175
- delete: "删除",
1176
- edit: "编辑",
1177
- deleteDialog: {
1178
- message: "您确定要删除文件吗?",
1179
- cancel: "取消"
1180
- },
1181
- table: {
1182
- thumb: "缩图",
1183
- name: "名称",
1184
- size: "尺寸",
1185
- action: {
1186
- action: "行动",
1187
- deleteTooltip: "删除"
1188
- }
1189
- },
1190
- size: {
1191
- kb: "KB",
1192
- mb: "MB"
1193
- },
1194
- maxFileSizeAlert: "档案大小上限为",
1195
- maxFileCountAlert: "现“最大文件数”为",
1196
- fileName: "文档名称",
1197
- fileDescription: "文件描述",
1198
- fileTags: "文件标签"
1199
- },
1200
- ar: {
1201
- insertFile: "إدراج ملف",
1202
- insertNewFile: "إدراج ملف جديد",
1203
- add: "أضف",
1204
- delete: "حذف",
1205
- edit: "تعديل",
1206
- deleteDialog: {
1207
- message: "هل أنت متأكد أنك تريد حذف الملف؟",
1208
- cancel: "إلغاء"
1209
- },
1210
- table: {
1211
- thumb: "ظفري",
1212
- name: "اسم",
1213
- size: "بحجم",
1214
- action: {
1215
- action: "عمل",
1216
- deleteTooltip: "حذف"
1217
- }
1218
- },
1219
- size: {
1220
- kb: "کیلو بایت",
1221
- mb: "ميغا بايت"
1222
- },
1223
- maxFileSizeAlert: "الحجم الأقصى للملف هو",
1224
- maxFileCountAlert: "الحد الأقصى لعدد الملفات هو",
1225
- fileName: "اسم الملف",
1226
- fileDescription: "وصف الملف",
1227
- fileTags: "علامات الملف"
1228
- }
1229
- };
1230
- function Dt(o, i = {}) {
1231
- const {
1232
- maxFileSize: e = 5 * 1024 * 1024,
1233
- // 5MB default
1234
- maxFileCount: t = 10,
1235
- imageCompressor: c = !1,
1236
- imageCompressLevel: T = 0.8,
1237
- fileAccept: L = "*"
1238
- } = i, k = ae(!1), C = ae({
1239
- show: !1,
1240
- text: "",
1241
- color: "success"
1242
- }), _ = le(() => o.value.length), h = le(() => _.value < t), D = le(
1243
- () => o.value.reduce((d, n) => d + n.file.size, 0)
1244
- );
1245
- function $(d, n = "success") {
1246
- C.value = { show: !0, text: d, color: n };
1247
- }
1248
- function U(d) {
1249
- var n;
1250
- if (!Ve(d.size, e))
1251
- return {
1252
- valid: !1,
1253
- error: `File size exceeds maximum allowed size of ${(e / 1048576).toFixed(1)}MB`
1254
- };
1255
- if (!Be(_.value, t))
1256
- return {
1257
- valid: !1,
1258
- error: `Maximum file count of ${t} reached`
1259
- };
1260
- if (L !== "*") {
1261
- const l = L.split(",").map((y) => y.trim()), p = `.${(n = d.name.split(".").pop()) == null ? void 0 : n.toLowerCase()}`, s = d.type;
1262
- if (!l.some((y) => y.startsWith(".") ? y === p : y.includes("/*") ? s.startsWith(y.replace("/*", "")) : y === s))
1263
- return {
1264
- valid: !1,
1265
- error: `File type not accepted. Allowed types: ${L}`
1266
- };
1267
- }
1268
- return { valid: !0 };
1269
- }
1270
- async function j(d) {
1271
- let n;
1272
- if (c && pe(d.name, d.type))
1273
- try {
1274
- n = (await Ie(d, T)).split(",")[1];
1275
- } catch (s) {
1276
- console.warn("Image compression failed, using original file:", s), n = await ye(d);
1277
- }
1278
- else
1279
- n = await ye(d);
1280
- const l = ce(d.size), p = Fe(d.name);
1281
- return {
1282
- base64: n,
1283
- size: l.text,
1284
- name: d.name,
1285
- tags: [],
1286
- description: "",
1287
- showDetailState: !1,
1288
- format: p
1289
- };
1290
- }
1291
- async function P(d) {
1292
- if (k.value) return !1;
1293
- k.value = !0;
1294
- const n = Array.from(d), l = [];
1295
- for (const p of n) {
1296
- const s = U(p);
1297
- s.valid ? l.push(p) : $(s.error, "error");
1298
- }
1299
- if (l.length === 0)
1300
- return k.value = !1, !1;
1301
- try {
1302
- const s = (await Promise.all(
1303
- l.map((y) => j(y))
1304
- )).map((y) => {
1305
- var S;
1306
- return {
1307
- file: {
1308
- name: y.name,
1309
- format: y.format,
1310
- base64: y.base64,
1311
- size: ((S = l.find((I) => I.name === y.name)) == null ? void 0 : S.size) || 0,
1312
- tags: y.tags,
1313
- description: y.description,
1314
- showDetailState: y.showDetailState
1315
- }
1316
- };
1317
- });
1318
- o.value.push(...s);
1319
- const F = l.length === 1 ? `File "${l[0].name}" uploaded successfully` : `${l.length} files uploaded successfully`;
1320
- return $(F, "success"), !0;
1321
- } catch (p) {
1322
- return console.error("File upload error:", p), $("Failed to upload files. Please try again.", "error"), !1;
1323
- } finally {
1324
- k.value = !1;
1325
- }
1326
- }
1327
- function H(d) {
1328
- if (d >= 0 && d < o.value.length) {
1329
- const n = o.value[d];
1330
- return o.value.splice(d, 1), $(`File "${n.file.name}" removed`, "warning"), !0;
1331
- }
1332
- return !1;
1333
- }
1334
- function u(d, n) {
1335
- if (d >= 0 && d < o.value.length) {
1336
- const l = o.value[d].file;
1337
- return Object.assign(l, n), $("File updated successfully", "success"), !0;
1338
- }
1339
- return !1;
1340
- }
1341
- function f() {
1342
- const d = o.value.length;
1343
- o.value.splice(0), $(`${d} files cleared`, "warning");
1344
- }
1345
- return {
1346
- // State
1347
- isUploading: k,
1348
- snackbar: C,
1349
- // Computed
1350
- fileCount: _,
1351
- canAddMoreFiles: h,
1352
- totalSize: D,
1353
- // Methods
1354
- uploadFiles: P,
1355
- removeFile: H,
1356
- updateFileMetadata: u,
1357
- clearAllFiles: f,
1358
- validateFile: U,
1359
- showSnackbar: $
1360
- };
1361
- }
1362
- function Ct(o = {}) {
1363
- const {
1364
- maxErrors: i = 10,
1365
- autoRemoveTimeout: e = 5e3,
1366
- logToConsole: t = !0
1367
- } = o, c = ae([]), T = ae(!1);
1368
- function L() {
1369
- return `error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
1370
- }
1371
- function k(n, l = "error", p, s) {
1372
- const F = {
1373
- id: L(),
1374
- message: n,
1375
- type: l,
1376
- timestamp: /* @__PURE__ */ new Date(),
1377
- context: p,
1378
- action: s
1379
- };
1380
- return t && (l === "error" ? console.error : l === "warning" ? console.warn : l === "info" ? console.info : console.log)(`[${l.toUpperCase()}] ${n}`, p || ""), c.value.unshift(F), c.value.length > i && (c.value = c.value.slice(0, i)), e > 0 && setTimeout(() => {
1381
- C(F.id);
1382
- }, e), F.id;
1383
- }
1384
- function C(n) {
1385
- const l = c.value.findIndex((p) => p.id === n);
1386
- return l !== -1 ? (c.value.splice(l, 1), !0) : !1;
1387
- }
1388
- function _() {
1389
- c.value = [];
1390
- }
1391
- function h(n) {
1392
- c.value = c.value.filter((l) => l.type !== n);
1393
- }
1394
- async function D(n, l, p) {
1395
- T.value = !0;
1396
- try {
1397
- return await n();
1398
- } catch (s) {
1399
- const F = l || (s instanceof Error ? s.message : "An unexpected error occurred");
1400
- return k(F, "error", {
1401
- ...p,
1402
- originalError: s instanceof Error ? s.message : String(s)
1403
- }), null;
1404
- } finally {
1405
- T.value = !1;
1406
- }
1407
- }
1408
- function $(n, l, p) {
1409
- return n || k(l, "error", p), n;
1410
- }
1411
- function U(n, l) {
1412
- return k(n, "success", l);
1413
- }
1414
- function j(n, l) {
1415
- return k(n, "warning", l);
1416
- }
1417
- function P(n, l) {
1418
- return k(n, "info", l);
1419
- }
1420
- function H(n) {
1421
- return c.value.filter((l) => l.type === n);
1422
- }
1423
- function u() {
1424
- return c.value[0] || null;
1425
- }
1426
- function f(n) {
1427
- return n ? c.value.some((l) => l.type === n) : c.value.length > 0;
1428
- }
1429
- const d = {
1430
- fileSizeExceeded: (n, l) => k(
1431
- `File "${n}" exceeds maximum size of ${(l / (1024 * 1024)).toFixed(1)}MB`,
1432
- "error",
1433
- { fileName: n, maxSize: l, category: "file-upload" }
1434
- ),
1435
- fileCountExceeded: (n) => k(
1436
- `Maximum file count of ${n} reached`,
1437
- "error",
1438
- { maxCount: n, category: "file-upload" }
1439
- ),
1440
- invalidFileType: (n, l) => k(
1441
- `File "${n}" type not allowed. Accepted types: ${l}`,
1442
- "error",
1443
- { fileName: n, allowedTypes: l, category: "file-upload" }
1444
- ),
1445
- uploadFailed: (n, l) => k(
1446
- `Failed to upload "${n}"${l ? `: ${l}` : ""}`,
1447
- "error",
1448
- { fileName: n, reason: l, category: "file-upload" }
1449
- ),
1450
- compressionFailed: (n) => k(
1451
- `Image compression failed for "${n}", using original file`,
1452
- "warning",
1453
- { fileName: n, category: "file-upload" }
1454
- )
1455
- };
1456
- return {
1457
- // State
1458
- errors: c,
1459
- isLoading: T,
1460
- // Methods
1461
- addError: k,
1462
- removeError: C,
1463
- clearErrors: _,
1464
- clearErrorsByType: h,
1465
- handleAsync: D,
1466
- validate: $,
1467
- showSuccess: U,
1468
- showWarning: j,
1469
- showInfo: P,
1470
- getErrorsByType: H,
1471
- getLatestError: u,
1472
- hasErrors: f,
1473
- // File upload specific
1474
- fileUploadErrors: d
1475
- };
1476
- }
1477
- function ut(o) {
1478
- const i = ["simple", "thumbnail", "table"], e = { isValid: !0, errors: [], warnings: [] };
1479
- return typeof o != "string" ? (e.isValid = !1, e.errors.push("File uploader type must be a string")) : i.includes(o) || (e.isValid = !1, e.errors.push(`File uploader type must be one of: ${i.join(", ")}`)), e;
1480
- }
1481
- function mt(o) {
1482
- const i = ["default", "outlined", "shaped", "raised", "tile"], e = { isValid: !0, errors: [], warnings: [] };
1483
- return o !== void 0 && typeof o != "string" ? (e.isValid = !1, e.errors.push("Card type must be a string")) : o && !i.includes(o) && (e.isValid = !1, e.errors.push(`Card type must be one of: ${i.join(", ")}`)), e;
1484
- }
1485
- function ft(o) {
1486
- const i = ["en", "fa", "fr", "ch", "ar"], e = { isValid: !0, errors: [], warnings: [] };
1487
- return typeof o != "string" ? (e.isValid = !1, e.errors.push("Language code must be a string")) : i.includes(o) || (e.isValid = !1, e.errors.push(`Language code must be one of: ${i.join(", ")}`)), e;
1488
- }
1489
- function pt(o) {
1490
- const i = { isValid: !0, errors: [], warnings: [] };
1491
- return typeof o != "number" ? (i.isValid = !1, i.errors.push("File size must be a number")) : o <= 0 ? (i.isValid = !1, i.errors.push("File size must be greater than 0")) : o > 100 * 1024 * 1024 && i.warnings.push("File size limit is very large (>100MB), consider reducing for better performance"), i;
1492
- }
1493
- function gt(o) {
1494
- const i = { isValid: !0, errors: [], warnings: [] };
1495
- return typeof o != "number" ? (i.isValid = !1, i.errors.push("File count must be a number")) : o < 0 ? (i.isValid = !1, i.errors.push("File count cannot be negative")) : o > 100 && i.warnings.push("File count limit is very high (>100), consider reducing for better performance"), i;
1496
- }
1497
- function ht(o) {
1498
- const i = { isValid: !0, errors: [], warnings: [] };
1499
- return typeof o != "number" ? (i.isValid = !1, i.errors.push("Compression level must be a number")) : o < 0 || o > 1 ? (i.isValid = !1, i.errors.push("Compression level must be between 0 and 1")) : o < 0.1 ? i.warnings.push("Very low compression level may result in poor image quality") : o > 0.9 && i.warnings.push("Very high compression level may not reduce file size significantly"), i;
1500
- }
1501
- function vt(o) {
1502
- const i = { isValid: !0, errors: [], warnings: [] };
1503
- return o !== void 0 && typeof o != "string" ? (i.isValid = !1, i.errors.push("File accept pattern must be a string")) : o && o.trim() === "" && i.warnings.push("Empty file accept pattern will accept all files"), i;
1504
- }
1505
- function bt(o) {
1506
- const i = { isValid: !0, errors: [], warnings: [] };
1507
- return typeof o != "number" ? (i.isValid = !1, i.errors.push("Columns count must be a number")) : (o < 1 || o > 12) && (i.isValid = !1, i.errors.push("Columns count must be between 1 and 12")), i;
1508
- }
1509
- function yt(o) {
1510
- const i = { isValid: !0, errors: [], warnings: [] };
1511
- return o !== void 0 && typeof o != "number" ? (i.isValid = !1, i.errors.push("Table height must be a number")) : o && o < 100 ? i.warnings.push("Table height is very small (<100px), content may not be visible") : o && o > 1e3 && i.warnings.push("Table height is very large (>1000px), consider reducing for better UX"), i;
1512
- }
1513
- function _t(o) {
1514
- const i = { isValid: !0, errors: [], warnings: [] };
1515
- return Array.isArray(o) ? (o.forEach((e, t) => {
1516
- if (!e || typeof e != "object") {
1517
- i.errors.push(`Attachment at index ${t} must be an object`);
1518
- return;
1519
- }
1520
- if (!e.file || typeof e.file != "object") {
1521
- i.errors.push(`Attachment at index ${t} must have a file property`);
1522
- return;
1523
- }
1524
- const c = e.file;
1525
- ["name", "format", "base64", "size"].forEach((L) => {
1526
- L in c || i.errors.push(`File at index ${t} is missing required field: ${L}`);
1527
- }), c.name && typeof c.name != "string" && i.errors.push(`File name at index ${t} must be a string`), c.format && typeof c.format != "string" && i.errors.push(`File format at index ${t} must be a string`), c.base64 && typeof c.base64 != "string" && i.errors.push(`File base64 at index ${t} must be a string`), c.size && typeof c.size != "number" && i.errors.push(`File size at index ${t} must be a number`), c.tags && !Array.isArray(c.tags) && i.errors.push(`File tags at index ${t} must be an array`);
1528
- }), i.errors.length > 0 && (i.isValid = !1), i) : (i.isValid = !1, i.errors.push("Document attachment must be an array"), i);
1529
- }
1530
- function xt(o) {
1531
- const i = { isValid: !0, errors: [], warnings: [] };
1532
- return [
1533
- { key: "fileUploaderType", validator: ut },
1534
- { key: "cardType", validator: mt },
1535
- { key: "lang", validator: ft },
1536
- { key: "maxFileSize", validator: pt },
1537
- { key: "maxFileCount", validator: gt },
1538
- { key: "imageCompressLevel", validator: ht },
1539
- { key: "fileAccept", validator: vt },
1540
- { key: "cols", validator: bt },
1541
- { key: "tableHeight", validator: yt },
1542
- { key: "documentAttachment", validator: _t }
1543
- ].forEach(({ key: t, validator: c }) => {
1544
- if (t in o) {
1545
- const T = c(o[t]);
1546
- i.errors.push(...T.errors.map((L) => `${t}: ${L}`)), i.warnings.push(...T.warnings.map((L) => `${t}: ${L}`)), T.isValid || (i.isValid = !1);
1547
- }
1548
- }), i;
1549
- }
1550
- const De = /* @__PURE__ */ ee({
1551
- __name: "handyUploader",
1552
- props: {
1553
- documentAttachment: {},
1554
- lang: { default: "en" },
1555
- maxFileSize: { default: 5242880 },
1556
- fileUploaderType: { default: "thumbnail" },
1557
- maxFileCount: { default: 10 },
1558
- badgeCounter: { type: Boolean, default: !0 },
1559
- btnColor: { default: "info" },
1560
- imageCompressor: { type: Boolean },
1561
- imageCompressLevel: { default: 0.8 },
1562
- fileAccept: {},
1563
- thumb: { type: Boolean, default: !0 },
1564
- tableThumbColumn: { type: Boolean },
1565
- tableFixedHeader: { type: Boolean, default: !0 },
1566
- tableHeight: { default: 400 },
1567
- rtlSupport: { type: Boolean, default: !1 },
1568
- changeFileName: { type: Boolean, default: !1 },
1569
- addFileDescription: { type: Boolean, default: !1 },
1570
- addFileTag: { type: Boolean, default: !1 },
1571
- tags: {},
1572
- customLang: { default: null },
1573
- insertPermission: { type: Boolean, default: !0 },
1574
- cols: { default: 3 },
1575
- editPermission: { type: Boolean, default: !0 },
1576
- deletePermission: { type: Boolean, default: !0 },
1577
- cardType: { default: "default" },
1578
- outlined: { type: Boolean },
1579
- raised: { type: Boolean },
1580
- shaped: { type: Boolean },
1581
- tile: { type: Boolean }
1582
- },
1583
- emits: [
1584
- "updateCardType",
1585
- "updateBadgeCounter",
1586
- "updateMaxFileCount",
1587
- "updateMaxFileSize",
1588
- "updateImageCompressor",
1589
- "updateImageCompressLevel",
1590
- "updateFileAccept",
1591
- "updateThumb",
1592
- "updateChangeFileName",
1593
- "updateAddFileDescription",
1594
- "updateTableThumbColumn",
1595
- "updateTableFixedHeader",
1596
- "updateTableHeight",
1597
- "updateLang",
1598
- "updateDocumentAttachment"
1599
- ],
1600
- setup(o, { emit: i }) {
1601
- const e = o;
1602
- if (process.env.NODE_ENV === "development") {
1603
- const u = xt(e);
1604
- u.isValid || console.error("HandyUploader prop validation failed:", u.errors), u.warnings.length > 0 && console.warn("HandyUploader prop validation warnings:", u.warnings);
1605
- }
1606
- const t = _e({
1607
- insertDocumentDialog: !1,
1608
- editDocumentDialog: !1,
1609
- deleteDocumentDialog: !1,
1610
- tempAttachment: [],
1611
- tempAttachmentChanged: [],
1612
- fileUploaderSnackBarAlert: !1,
1613
- fileUploaderSnackText: "",
1614
- fileUploaderSnackBarAlertColor: "green",
1615
- readerFile: null,
1616
- registryDocFile: [],
1617
- documentAttachmentAPI: [],
1618
- btnLoader: !1,
1619
- showDetail: !1,
1620
- showDetailState: [],
1621
- selectedIndex: 0,
1622
- selectedId: "",
1623
- returnedRecord: {},
1624
- outlined: !1,
1625
- raised: !1,
1626
- shaped: !1,
1627
- tile: !1,
1628
- selectedLang: {},
1629
- beforeInsertAttachments: {},
1630
- attachmentIndex: 0
1631
- }), c = i;
1632
- $e(() => {
1633
- L(), t.registryDocFile = e.documentAttachment, e.rtlSupport && k(), C();
1634
- }), E(
1635
- () => t.tempAttachment,
1636
- (u) => {
1637
- u && u.length > 0 ? j(u) : t.tempAttachmentChanged = [];
1638
- }
1639
- ), E(() => e.cardType, (u) => {
1640
- c("updateCardType", u), C();
1641
- }), E(() => e.badgeCounter, (u) => {
1642
- c("updateBadgeCounter", u);
1643
- }), E(() => e.maxFileCount, (u) => {
1644
- c("updateMaxFileCount", u);
1645
- }), E(() => e.maxFileSize, (u) => {
1646
- c("updateMaxFileSize", u);
1647
- }), E(() => e.maxFileSize, (u) => {
1648
- c("updateMaxFileSize", u);
1649
- }), E(() => e.imageCompressor, (u) => {
1650
- c("updateImageCompressor", u);
1651
- }), E(() => e.imageCompressLevel, (u) => {
1652
- c("updateImageCompressLevel", u);
1653
- }), E(() => e.fileAccept, (u) => {
1654
- c("updateFileAccept", u);
1655
- }), E(() => e.thumb, (u) => {
1656
- c("updateThumb", u);
1657
- }), E(() => e.changeFileName, (u) => {
1658
- c("updateChangeFileName", u);
1659
- }), E(() => e.addFileDescription, (u) => {
1660
- c("updateAddFileDescription", u);
1661
- }), E(() => e.addFileTag, (u) => {
1662
- c("updateAddFileDescription", u);
1663
- }), E(() => e.tableThumbColumn, (u) => {
1664
- c("updateTableThumbColumn", u);
1665
- }), E(() => e.tableFixedHeader, (u) => {
1666
- c("updateTableFixedHeader", u);
1667
- }), E(() => e.tableHeight, (u) => {
1668
- c("updateTableHeight", u);
1669
- }), E(() => e.lang, (u) => {
1670
- c("updateLang", u);
1671
- }), Le(() => {
1672
- t.registryDocFile = [];
1673
- });
1674
- const T = () => {
1675
- t.btnLoader = !1, t.tempAttachment = [], t.insertDocumentDialog = !0;
1676
- }, L = () => {
1677
- e.customLang !== null ? t.selectedLang = e.customLang : t.selectedLang = ct;
1678
- }, k = () => {
1679
- }, C = () => {
1680
- const f = {
1681
- default: { outlined: !1, raised: !1, shaped: !1, tile: !1 },
1682
- outlined: { outlined: !0, raised: !1, shaped: !1, tile: !1 },
1683
- shaped: { outlined: !1, raised: !1, shaped: !0, tile: !1 },
1684
- raised: { outlined: !1, raised: !0, shaped: !1, tile: !1 },
1685
- tile: { outlined: !1, raised: !1, shaped: !1, tile: !0 }
1686
- }[e.cardType || "default"];
1687
- t.outlined = f.outlined, t.raised = f.raised, t.shaped = f.shaped, t.tile = f.tile;
1688
- }, _ = (u) => {
1689
- const f = new FileReader();
1690
- return new Promise(function(d) {
1691
- f.onloadend = () => {
1692
- d(f.result);
1693
- }, f.readAsDataURL(u);
1694
- });
1695
- }, h = async () => {
1696
- t.btnLoader = !0;
1697
- const u = (f, d) => {
1698
- t.fileUploaderSnackText = f, t.fileUploaderSnackBarAlertColor = d, t.fileUploaderSnackBarAlert = !0;
1699
- };
1700
- for (const [f, d] of t.tempAttachmentChanged.entries()) {
1701
- if (e.documentAttachment.length >= e.maxFileCount) {
1702
- u(
1703
- `${t.selectedLang[e.lang].maxFileCountAlert} ${e.maxFileCount}`,
1704
- "red"
1705
- );
1706
- break;
1707
- }
1708
- if (d.file.size / 1e3 > e.maxFileSize) {
1709
- u(
1710
- `${t.selectedLang[e.lang].maxFileSizeAlert} ${Math.round(e.maxFileSize / 1024)} ${t.selectedLang[e.lang].size.mb}`,
1711
- "red"
1712
- );
1713
- continue;
1714
- }
1715
- let n = {};
1716
- const l = {}, p = d.file, s = p.format;
1717
- let F = !1, y = "", S = p.base64;
1718
- e.imageCompressor && ["image/png", "image/jpg", "image/jpeg", "image/webp"].includes(s) && (F = !0, y = await D(`data:${s};base64,${S}`), S = y.split(",")[1]);
1719
- try {
1720
- const I = S.replace(/\s/g, "");
1721
- n = {
1722
- base64: I,
1723
- size: F ? (atob(I).length / 1024).toFixed(1) : p.size.toString(),
1724
- name: `${p.name}.${p.format}`,
1725
- tags: p.tags || [],
1726
- description: p.description || "",
1727
- showDetailState: !1,
1728
- format: s
1729
- }, l.file = n, t.registryDocFile.push(l), c("updateDocumentAttachment", t.registryDocFile);
1730
- } catch (I) {
1731
- console.error("Error processing Base64 string:", I), u("File could not be processed due to an invalid format.", "red");
1732
- continue;
1733
- }
1734
- }
1735
- t.documentAttachmentAPI = [], t.tempAttachmentChanged = [], t.insertDocumentDialog = !1, t.btnLoader = !1;
1736
- }, D = (u) => {
1737
- const f = document.createElement("canvas"), d = document.createElement("img");
1738
- return new Promise((n, l) => {
1739
- const p = e.imageCompressLevel;
1740
- d.onload = function() {
1741
- const s = d.width, F = d.height;
1742
- f.width = s, f.height = F;
1743
- const y = f.getContext("2d");
1744
- y == null || y.drawImage(d, 0, 0, s, F), n(f.toDataURL("image/jpeg", p));
1745
- }, d.onerror = function(s) {
1746
- l(s);
1747
- }, d.src = u;
1748
- });
1749
- }, $ = (u, f) => {
1750
- t.btnLoader = !1, t.selectedIndex = u, t.selectedId = f, t.deleteDocumentDialog = !0;
1751
- }, U = () => {
1752
- t.registryDocFile.splice(t.selectedIndex, 1), c("updateDocumentAttachment", t.registryDocFile), t.deleteDocumentDialog = !1;
1753
- }, j = async (u) => {
1754
- for (const f of u) {
1755
- let d = "";
1756
- try {
1757
- d = await _(f);
1758
- } catch (p) {
1759
- console.log(p);
1760
- continue;
1761
- }
1762
- const l = { file: {
1763
- name: f.name.split(".")[0],
1764
- format: f.name.substr(f.name.lastIndexOf(".") + 1),
1765
- base64: d.split(",")[1],
1766
- // Remove data:mime;base64, prefix
1767
- size: f.size,
1768
- tags: [],
1769
- description: null,
1770
- showDetailState: !1
1771
- } };
1772
- t.tempAttachmentChanged.push(l);
1773
- }
1774
- }, P = (u, f) => {
1775
- t.btnLoader = !1, t.attachmentIndex = f, t.editDocumentDialog = !0, t.tempAttachmentChanged = [u];
1776
- }, H = () => {
1777
- const u = [...e.documentAttachment];
1778
- u.splice(
1779
- t.attachmentIndex,
1780
- 1,
1781
- t.tempAttachmentChanged[0]
1782
- ), c("updateDocumentAttachment", u), t.editDocumentDialog = !1;
1783
- };
1784
- return (u, f) => {
1785
- const d = g("v-col"), n = g("v-row"), l = g("v-icon"), p = g("v-card-title"), s = g("v-file-input"), F = g("v-expansion-panel-title"), y = g("v-text-field"), S = g("v-textarea"), I = g("v-autocomplete"), J = g("v-img"), W = g("v-card"), N = g("v-expansion-panel-text"), K = g("v-expansion-panel"), G = g("v-expansion-panels"), te = g("v-list-item-title"), se = g("v-list-item"), oe = g("v-card-text"), z = g("v-btn"), Q = g("v-card-actions"), R = g("v-dialog"), ne = g("v-snackbar"), Ce = g("v-spacer"), Ae = g("v-container");
1786
- return m(), b(Ae, null, {
1787
- default: a(() => [
1788
- r(n, null, {
1789
- default: a(() => [
1790
- r(d, {
1791
- cols: "12",
1792
- md: "12",
1793
- xs: "12"
1794
- }, {
1795
- default: a(() => [
1796
- r(be, {
1797
- documentAttachment: e.documentAttachment,
1798
- selectedLang: t.selectedLang,
1799
- lang: e.lang,
1800
- badgeCounter: e.badgeCounter,
1801
- btnColor: e.btnColor,
1802
- maxFileCount: e.maxFileCount,
1803
- onOpenInputDocumentModal: T
1804
- }, null, 8, ["documentAttachment", "selectedLang", "lang", "badgeCounter", "btnColor", "maxFileCount"]),
1805
- e.fileUploaderType === "simple" ? (m(), b(ve, {
1806
- key: 0,
1807
- documentAttachment: e.documentAttachment,
1808
- cols: e.cols,
1809
- thumb: e.thumb,
1810
- outlined: t.outlined,
1811
- raised: t.raised,
1812
- shaped: t.shaped,
1813
- tile: t.tile,
1814
- lang: e.lang,
1815
- cardType: e.cardType,
1816
- deletePermission: e.deletePermission,
1817
- editPermission: e.editPermission,
1818
- selectedLang: t.selectedLang,
1819
- onSetCardTheme: C,
1820
- onOpenDeleteDialog: $,
1821
- onOpenEditDocumentDialog: P
1822
- }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "cardType", "deletePermission", "editPermission", "selectedLang"])) : B("", !0),
1823
- e.fileUploaderType === "thumbnail" ? (m(), b(ge, {
1824
- key: 1,
1825
- documentAttachment: e.documentAttachment,
1826
- cols: e.cols,
1827
- thumb: e.thumb,
1828
- outlined: t.outlined,
1829
- raised: t.raised,
1830
- shaped: t.shaped,
1831
- tile: t.tile,
1832
- lang: e.lang,
1833
- cardType: e.cardType,
1834
- deletePermission: e.deletePermission,
1835
- editPermission: e.editPermission,
1836
- selectedLang: t.selectedLang,
1837
- onSetCardTheme: C,
1838
- onOpenDeleteDialog: f[0] || (f[0] = (v, q) => $(v, q)),
1839
- onOpenEditDocumentDialog: f[1] || (f[1] = (v, q) => P(v, q))
1840
- }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "cardType", "deletePermission", "editPermission", "selectedLang"])) : B("", !0),
1841
- e.fileUploaderType === "table" ? (m(), b(he, {
1842
- key: 2,
1843
- documentAttachment: e.documentAttachment,
1844
- cols: e.cols,
1845
- thumb: e.thumb,
1846
- outlined: t.outlined,
1847
- raised: t.raised,
1848
- shaped: t.shaped,
1849
- tile: t.tile,
1850
- lang: e.lang,
1851
- tableThumbColumn: e.tableThumbColumn,
1852
- tableFixedHeader: e.tableFixedHeader,
1853
- tableHeight: e.tableHeight,
1854
- cardType: e.cardType,
1855
- deletePermission: e.deletePermission,
1856
- editPermission: e.editPermission,
1857
- selectedLang: t.selectedLang,
1858
- onSetCardTheme: C,
1859
- onOpenDeleteDialog: $,
1860
- onOpenEditDocumentDialog: P
1861
- }, null, 8, ["documentAttachment", "cols", "thumb", "outlined", "raised", "shaped", "tile", "lang", "tableThumbColumn", "tableFixedHeader", "tableHeight", "cardType", "deletePermission", "editPermission", "selectedLang"])) : B("", !0)
1862
- ]),
1863
- _: 1
1864
- })
1865
- ]),
1866
- _: 1
1867
- }),
1868
- r(n, { justify: "center" }, {
1869
- default: a(() => [
1870
- r(R, {
1871
- modelValue: t.insertDocumentDialog,
1872
- "onUpdate:modelValue": f[5] || (f[5] = (v) => t.insertDocumentDialog = v),
1873
- scrollable: !1,
1874
- persistent: "",
1875
- width: "50%"
1876
- }, {
1877
- default: a(() => [
1878
- r(W, null, {
1879
- default: a(() => [
1880
- r(p, null, {
1881
- default: a(() => [
1882
- r(l, {
1883
- onClick: f[2] || (f[2] = (v) => t.insertDocumentDialog = !1)
1884
- }, {
1885
- default: a(() => [...f[12] || (f[12] = [
1886
- w("mdi-close", -1)
1887
- ])]),
1888
- _: 1
1889
- })
1890
- ]),
1891
- _: 1
1892
- }),
1893
- r(oe, null, {
1894
- default: a(() => [
1895
- t.tempAttachment.length === 0 ? (m(), V(O, { key: 0 }, [
1896
- e.fileAccept !== "" ? (m(), b(s, {
1897
- key: 0,
1898
- multiple: "",
1899
- accept: e.fileAccept,
1900
- chip: "",
1901
- modelValue: t.tempAttachment,
1902
- "onUpdate:modelValue": f[3] || (f[3] = (v) => t.tempAttachment = v),
1903
- label: t.selectedLang[o.lang].insertNewFile
1904
- }, null, 8, ["accept", "modelValue", "label"])) : (m(), b(s, {
1905
- key: 1,
1906
- multiple: "",
1907
- modelValue: t.tempAttachment,
1908
- "onUpdate:modelValue": f[4] || (f[4] = (v) => t.tempAttachment = v),
1909
- label: t.selectedLang[o.lang].insertNewFile
1910
- }, null, 8, ["modelValue", "label"]))
1911
- ], 64)) : (m(), V(O, { key: 1 }, [
1912
- e.addFileTag || e.addFileDescription || e.changeFileName ? (m(), b(G, { key: 0 }, {
1913
- default: a(() => [
1914
- (m(!0), V(O, null, X(t.tempAttachmentChanged, (v, q) => (m(), b(K, {
1915
- key: `attachment-${q}`
1916
- }, {
1917
- default: a(() => [
1918
- r(F, null, {
1919
- default: a(() => [
1920
- w(x(v.file.name), 1)
1921
- ]),
1922
- _: 2
1923
- }, 1024),
1924
- r(N, null, {
1925
- default: a(() => [
1926
- r(n, {
1927
- align: "center",
1928
- justify: "center"
1929
- }, {
1930
- default: a(() => [
1931
- r(d, {
1932
- cols: "12",
1933
- lg: "9",
1934
- md: "9",
1935
- xs: "12"
1936
- }, {
1937
- default: a(() => [
1938
- e.changeFileName ? (m(), b(y, {
1939
- key: 0,
1940
- label: t.selectedLang[o.lang].fileName,
1941
- modelValue: v.file.name,
1942
- "onUpdate:modelValue": (M) => v.file.name = M
1943
- }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : B("", !0),
1944
- e.addFileDescription ? (m(), b(S, {
1945
- key: 1,
1946
- label: t.selectedLang[o.lang].fileDescription,
1947
- "auto-grow": "",
1948
- "row-height": "1",
1949
- modelValue: v.file.description,
1950
- "onUpdate:modelValue": (M) => v.file.description = M
1951
- }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : B("", !0),
1952
- e.addFileTag ? (m(), b(I, {
1953
- key: 2,
1954
- modelValue: v.file.tags,
1955
- "onUpdate:modelValue": (M) => v.file.tags = M,
1956
- items: e.tags,
1957
- dense: "",
1958
- chips: "",
1959
- label: t.selectedLang[o.lang].fileTags,
1960
- multiple: ""
1961
- }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "label"])) : B("", !0)
1962
- ]),
1963
- _: 2
1964
- }, 1024),
1965
- r(d, {
1966
- align: "center",
1967
- cols: "12",
1968
- lg: "3",
1969
- md: "3",
1970
- xs: "12"
1971
- }, {
1972
- default: a(() => [
1973
- v.file.format === "jpg" || v.file.format === "jpeg" || v.file.format === "png" || v.file.format === "tif" || v.file.format === "bmp" ? (m(), b(W, { key: 0 }, {
1974
- default: a(() => [
1975
- r(J, {
1976
- src: "data:" + v.file.format + ";base64," + v.file.base64
1977
- }, null, 8, ["src"])
1978
- ]),
1979
- _: 2
1980
- }, 1024)) : (m(), b(ie, {
1981
- key: 1,
1982
- "file-format": v.file.format,
1983
- size: 60
1984
- }, null, 8, ["file-format"]))
1985
- ]),
1986
- _: 2
1987
- }, 1024)
1988
- ]),
1989
- _: 2
1990
- }, 1024)
1991
- ]),
1992
- _: 2
1993
- }, 1024)
1994
- ]),
1995
- _: 2
1996
- }, 1024))), 128))
1997
- ]),
1998
- _: 1
1999
- })) : (m(), b(W, {
2000
- key: 1,
2001
- class: "mx-auto",
2002
- tile: ""
2003
- }, {
2004
- default: a(() => [
2005
- (m(!0), V(O, null, X(t.tempAttachmentChanged, (v, q) => (m(), b(se, {
2006
- key: `attachment-${q}`,
2007
- style: { "border-bottom": "1px solid #E0E0E0" }
2008
- }, {
2009
- default: a(() => [
2010
- r(te, null, {
2011
- default: a(() => [
2012
- r(ie, {
2013
- "file-format": v.file.format,
2014
- size: 24
2015
- }, null, 8, ["file-format"]),
2016
- w(" " + x(v.file.name) + "." + x(v.file.format), 1)
2017
- ]),
2018
- _: 2
2019
- }, 1024)
2020
- ]),
2021
- _: 2
2022
- }, 1024))), 128))
2023
- ]),
2024
- _: 1
2025
- }))
2026
- ], 64))
2027
- ]),
2028
- _: 1
2029
- }),
2030
- r(Q, null, {
2031
- default: a(() => [
2032
- r(z, {
2033
- disabled: t.tempAttachment == null || t.btnLoader,
2034
- loading: t.btnLoader,
2035
- color: e.btnColor,
2036
- onClick: h
2037
- }, {
2038
- default: a(() => [
2039
- w(x(t.selectedLang[o.lang].add), 1)
2040
- ]),
2041
- _: 1
2042
- }, 8, ["disabled", "loading", "color"])
2043
- ]),
2044
- _: 1
2045
- })
2046
- ]),
2047
- _: 1
2048
- })
2049
- ]),
2050
- _: 1
2051
- }, 8, ["modelValue"])
2052
- ]),
2053
- _: 1
2054
- }),
2055
- r(n, { justify: "center" }, {
2056
- default: a(() => [
2057
- r(R, {
2058
- modelValue: t.editDocumentDialog,
2059
- "onUpdate:modelValue": f[7] || (f[7] = (v) => t.editDocumentDialog = v),
2060
- scrollable: !1,
2061
- persistent: "",
2062
- width: "50%"
2063
- }, {
2064
- default: a(() => [
2065
- r(W, null, {
2066
- default: a(() => [
2067
- r(p, null, {
2068
- default: a(() => [
2069
- r(l, {
2070
- onClick: f[6] || (f[6] = (v) => t.editDocumentDialog = !1)
2071
- }, {
2072
- default: a(() => [...f[13] || (f[13] = [
2073
- w("mdi-close", -1)
2074
- ])]),
2075
- _: 1
2076
- })
2077
- ]),
2078
- _: 1
2079
- }),
2080
- (m(!0), V(O, null, X(t.tempAttachmentChanged, (v, q) => (m(), b(oe, {
2081
- key: `attachment-${q}`
2082
- }, {
2083
- default: a(() => [
2084
- r(n, {
2085
- align: "center",
2086
- justify: "center"
2087
- }, {
2088
- default: a(() => [
2089
- r(d, {
2090
- cols: "12",
2091
- lg: "9",
2092
- md: "9",
2093
- xs: "12"
2094
- }, {
2095
- default: a(() => [
2096
- e.changeFileName ? (m(), b(y, {
2097
- key: 0,
2098
- label: t.selectedLang[o.lang].fileName,
2099
- modelValue: v.file.name,
2100
- "onUpdate:modelValue": (M) => v.file.name = M
2101
- }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : B("", !0),
2102
- e.addFileDescription ? (m(), b(S, {
2103
- key: 1,
2104
- label: t.selectedLang[o.lang].fileDescription,
2105
- "auto-grow": "",
2106
- "row-height": "1",
2107
- modelValue: v.file.description,
2108
- "onUpdate:modelValue": (M) => v.file.description = M
2109
- }, null, 8, ["label", "modelValue", "onUpdate:modelValue"])) : B("", !0),
2110
- e.addFileTag ? (m(), b(I, {
2111
- key: 2,
2112
- modelValue: v.file.tags,
2113
- "onUpdate:modelValue": (M) => v.file.tags = M,
2114
- items: e.tags,
2115
- dense: "",
2116
- chips: "",
2117
- label: t.selectedLang[o.lang].fileTags,
2118
- multiple: ""
2119
- }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "label"])) : B("", !0)
2120
- ]),
2121
- _: 2
2122
- }, 1024),
2123
- r(d, {
2124
- align: "center",
2125
- cols: "12",
2126
- lg: "3",
2127
- md: "3",
2128
- xs: "12"
2129
- }, {
2130
- default: a(() => {
2131
- var M;
2132
- return [
2133
- v.file.name && ["jpg", "jpeg", "png", "tif", "bmp"].includes(
2134
- ((M = v.file.name.split(".").pop()) == null ? void 0 : M.toLowerCase()) || ""
2135
- ) ? (m(), b(W, { key: 0 }, {
2136
- default: a(() => [
2137
- r(J, {
2138
- src: "data:" + v.file.format + ";base64," + v.file.base64
2139
- }, null, 8, ["src"])
2140
- ]),
2141
- _: 2
2142
- }, 1024)) : (m(), b(ie, {
2143
- key: 1,
2144
- "file-format": v.file.format,
2145
- size: 60
2146
- }, null, 8, ["file-format"]))
2147
- ];
2148
- }),
2149
- _: 2
2150
- }, 1024)
2151
- ]),
2152
- _: 2
2153
- }, 1024)
2154
- ]),
2155
- _: 2
2156
- }, 1024))), 128)),
2157
- r(Q, null, {
2158
- default: a(() => [
2159
- r(z, {
2160
- disabled: t.tempAttachment === null || t.btnLoader,
2161
- loading: t.btnLoader,
2162
- color: e.btnColor,
2163
- onClick: H
2164
- }, {
2165
- default: a(() => [
2166
- w(x(t.selectedLang[o.lang].edit), 1)
2167
- ]),
2168
- _: 1
2169
- }, 8, ["disabled", "loading", "color"])
2170
- ]),
2171
- _: 1
2172
- })
2173
- ]),
2174
- _: 1
2175
- })
2176
- ]),
2177
- _: 1
2178
- }, 8, ["modelValue"])
2179
- ]),
2180
- _: 1
2181
- }),
2182
- r(ne, {
2183
- modelValue: t.fileUploaderSnackBarAlert,
2184
- "onUpdate:modelValue": f[9] || (f[9] = (v) => t.fileUploaderSnackBarAlert = v),
2185
- right: "",
2186
- bottom: "",
2187
- color: t.fileUploaderSnackBarAlertColor,
2188
- timeout: 3e3
2189
- }, {
2190
- default: a(() => [
2191
- w(x(t.fileUploaderSnackText) + " ", 1),
2192
- r(z, {
2193
- color: "white",
2194
- text: "",
2195
- onClick: f[8] || (f[8] = (v) => t.fileUploaderSnackBarAlert = !1)
2196
- }, {
2197
- default: a(() => [
2198
- r(l, null, {
2199
- default: a(() => [...f[14] || (f[14] = [
2200
- w("mdi-close", -1)
2201
- ])]),
2202
- _: 1
2203
- })
2204
- ]),
2205
- _: 1
2206
- })
2207
- ]),
2208
- _: 1
2209
- }, 8, ["modelValue", "color"]),
2210
- r(n, { justify: "center" }, {
2211
- default: a(() => [
2212
- r(R, {
2213
- modelValue: t.deleteDocumentDialog,
2214
- "onUpdate:modelValue": f[11] || (f[11] = (v) => t.deleteDocumentDialog = v),
2215
- persistent: "",
2216
- width: "30%"
2217
- }, {
2218
- default: a(() => [
2219
- r(W, null, {
2220
- default: a(() => [
2221
- r(p, null, {
2222
- default: a(() => [
2223
- r(l, { color: "red" })
2224
- ]),
2225
- _: 1
2226
- }),
2227
- r(oe, null, {
2228
- default: a(() => [
2229
- w(x(t.selectedLang[o.lang].deleteDialog.message), 1)
2230
- ]),
2231
- _: 1
2232
- }),
2233
- r(Q, null, {
2234
- default: a(() => [
2235
- r(Ce),
2236
- r(z, {
2237
- color: "green darken-1",
2238
- text: "",
2239
- onClick: f[10] || (f[10] = (v) => t.deleteDocumentDialog = !1)
2240
- }, {
2241
- default: a(() => [
2242
- w(x(t.selectedLang[o.lang].deleteDialog.cancel), 1)
2243
- ]),
2244
- _: 1
2245
- }),
2246
- r(z, {
2247
- color: "primary",
2248
- disabled: t.btnLoader,
2249
- loading: t.btnLoader,
2250
- onClick: U
2251
- }, {
2252
- default: a(() => [
2253
- w(x(t.selectedLang[o.lang].delete), 1)
2254
- ]),
2255
- _: 1
2256
- }, 8, ["disabled", "loading"])
2257
- ]),
2258
- _: 1
2259
- })
2260
- ]),
2261
- _: 1
2262
- })
2263
- ]),
2264
- _: 1
2265
- }, 8, ["modelValue"])
2266
- ]),
2267
- _: 1
2268
- })
2269
- ]),
2270
- _: 1
2271
- });
2272
- };
2273
- }
2274
- }), At = {
2275
- ThumbnailUploader: ge,
2276
- TableUploader: he,
2277
- SimpleUploader: ve,
2278
- HandyUploader: De,
2279
- InsertButton: be,
2280
- SelectFileIconType: ie
2281
- };
2282
- function wt(o) {
2283
- o.component("ThumbnailUploader", ge), o.component("TableUploader", he), o.component("SimpleUploader", ve), o.component("HandyUploader", De), o.component("InsertButton", be), o.component("SelectFileIconType", ie);
2284
- }
2285
- typeof window < "u" && window.Vue && wt(window.Vue);
2286
- export {
2287
- De as HandyUploader,
2288
- be as InsertButton,
2289
- ie as SelectFileIconType,
2290
- ve as SimpleUploader,
2291
- he as TableUploader,
2292
- ge as ThumbnailUploader,
2293
- Ie as compressImage,
2294
- Se as constructImageDataUrl,
2295
- At as default,
2296
- ye as fileToBase64,
2297
- ce as formatFileSize,
2298
- kt as getFileIcon,
2299
- re as getFileType,
2300
- Fe as getMimeTypeFromExtension,
2301
- wt as install,
2302
- pe as isImageFile,
2303
- ct as languageData,
2304
- Ct as useErrorHandler,
2305
- Dt as useFileUpload,
2306
- Be as validateFileCount,
2307
- Ve as validateFileSize
2308
- };