zuii 1.4.26 → 1.4.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Form/js/uppy.js +32 -32
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import R from "@uppy/image-editor";
|
|
|
4
4
|
import W from "@uppy/webcam";
|
|
5
5
|
import U from "../../../node_modules/.pnpm/@uppy_locales@5.1.1/node_modules/@uppy/locales/lib/fr_FR.js";
|
|
6
6
|
import I from "../../../node_modules/.pnpm/@uppy_locales@5.1.1/node_modules/@uppy/locales/lib/en_US.js";
|
|
7
|
-
const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang : "fr") || "fr").startsWith("en") ? I : U, S = (t, c,
|
|
7
|
+
const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang : "fr") || "fr").startsWith("en") ? I : U, S = (t, c, o) => {
|
|
8
8
|
const n = new v({
|
|
9
9
|
locale: c,
|
|
10
10
|
restrictions: {
|
|
@@ -15,53 +15,53 @@ const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang :
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
n.use(w), n.use(R);
|
|
18
|
-
const
|
|
19
|
-
return n.use(W, { modes:
|
|
18
|
+
const s = o?.allowVideo === !1 ? ["picture"] : ["video-audio", "picture"];
|
|
19
|
+
return n.use(W, { modes: s }), n;
|
|
20
20
|
}, j = (t, c) => {
|
|
21
|
-
const
|
|
22
|
-
t.getFiles().forEach((
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
else if (
|
|
26
|
-
const e = new File([
|
|
27
|
-
|
|
21
|
+
const o = new DataTransfer();
|
|
22
|
+
t.getFiles().forEach((s) => {
|
|
23
|
+
if (s.data instanceof File)
|
|
24
|
+
o.items.add(s.data);
|
|
25
|
+
else if (s.data instanceof Blob) {
|
|
26
|
+
const e = new File([s.data], s.name, { type: s.data.type });
|
|
27
|
+
o.items.add(e);
|
|
28
28
|
}
|
|
29
|
-
}), c.files =
|
|
30
|
-
}, k = async (t, c,
|
|
31
|
-
for (const
|
|
32
|
-
if (!
|
|
33
|
-
|
|
29
|
+
}), c.files = o.files, c.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
30
|
+
}, k = async (t, c, o, n) => {
|
|
31
|
+
for (const s of c)
|
|
32
|
+
if (!o.has(s.route)) {
|
|
33
|
+
o.add(s.route);
|
|
34
34
|
try {
|
|
35
|
-
if (t.getFiles().some((r) => r.meta?.sourceRoute ===
|
|
36
|
-
const i = await fetch(
|
|
35
|
+
if (t.getFiles().some((r) => r.meta?.sourceRoute === s.route)) continue;
|
|
36
|
+
const i = await fetch(s.route, s.options);
|
|
37
37
|
if (!i.ok) throw new Error(`Erreur lors de la récupération du fichier : ${i.statusText}`);
|
|
38
38
|
const l = await i.blob();
|
|
39
39
|
t.addFile({
|
|
40
|
-
name:
|
|
41
|
-
type:
|
|
40
|
+
name: s.route.split("/").pop() || "file",
|
|
41
|
+
type: s.options?.headers?.["Content-Type"] || l.type,
|
|
42
42
|
data: l,
|
|
43
43
|
meta: {
|
|
44
|
-
sourceRoute:
|
|
44
|
+
sourceRoute: s.route
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
} catch (e) {
|
|
48
48
|
if (e.isRestriction && e.message?.includes("déjà"))
|
|
49
49
|
continue;
|
|
50
|
-
console.error("Uppy fetch error:", e), n && n(e),
|
|
50
|
+
console.error("Uppy fetch error:", e), n && n(e), o.delete(s.route);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}, E = (t) => {
|
|
54
54
|
const c = t.data instanceof Blob ? t.data : null;
|
|
55
55
|
if (!c) return;
|
|
56
|
-
const
|
|
57
|
-
n ? n.addEventListener("load", () => URL.revokeObjectURL(
|
|
56
|
+
const o = URL.createObjectURL(c), n = window.open(o, "_blank");
|
|
57
|
+
n ? n.addEventListener("load", () => URL.revokeObjectURL(o)) : setTimeout(() => URL.revokeObjectURL(o), 1e4);
|
|
58
58
|
}, F = (t) => {
|
|
59
59
|
const c = t.data instanceof Blob ? t.data : null;
|
|
60
60
|
if (!c) return;
|
|
61
|
-
const
|
|
62
|
-
n.href =
|
|
61
|
+
const o = URL.createObjectURL(c), n = document.createElement("a");
|
|
62
|
+
n.href = o, n.download = t.name, n.style.display = "none", document.body.appendChild(n), n.click(), document.body.removeChild(n), setTimeout(() => URL.revokeObjectURL(o), 1e3);
|
|
63
63
|
}, q = (t, c) => {
|
|
64
|
-
const
|
|
64
|
+
const o = (e) => {
|
|
65
65
|
if (e.querySelector("[data-zuii-uppy-actions]")) return;
|
|
66
66
|
const i = e.closest(".uppy-Dashboard-Item");
|
|
67
67
|
if (!i) return;
|
|
@@ -70,8 +70,8 @@ const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang :
|
|
|
70
70
|
const a = document.createElement("div");
|
|
71
71
|
a.dataset.zuiiUppyActions = "true", a.className = "group group--gap-none group--center", a.style.marginRight = "8px";
|
|
72
72
|
const p = (h, d, g) => {
|
|
73
|
-
const u = document.createElement("
|
|
74
|
-
return u.
|
|
73
|
+
const u = document.createElement("a");
|
|
74
|
+
return u.title = d, u.href = "#", u.setAttribute("aria-label", d), u.className = "btn btn-light uppy-Dashboard-Item-action btn-xs btn-icon btn-transparent", u.innerHTML = `<div class="btn-content"><span class="icon icon--size-xs"><i class="${h}"></i></span></div>`, u.addEventListener("click", (L) => {
|
|
75
75
|
L.stopPropagation();
|
|
76
76
|
const m = c.getFile(r);
|
|
77
77
|
m && g(m);
|
|
@@ -81,7 +81,7 @@ const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang :
|
|
|
81
81
|
const f = e.querySelector(".uppy-Dashboard-Item-action--remove");
|
|
82
82
|
e.insertBefore(a, f);
|
|
83
83
|
}, n = () => {
|
|
84
|
-
t.querySelectorAll(".uppy-Dashboard-Item-actionWrapper").forEach(
|
|
84
|
+
t.querySelectorAll(".uppy-Dashboard-Item-actionWrapper").forEach(o), t.querySelectorAll(".uppy-Webcam-buttonContainer").forEach((e) => {
|
|
85
85
|
e.className = "group group--gap-sm group--center uppy-Webcam-buttonContainer";
|
|
86
86
|
}), t.querySelectorAll(".uppy-Webcam-button").forEach((e) => {
|
|
87
87
|
if (!e.classList.contains("uppy-Webcam-button--submit") && !e.classList.contains("uppy-Webcam-button--discard") && !e.classList.contains("uppy-Webcam-button--picture")) {
|
|
@@ -90,9 +90,9 @@ const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang :
|
|
|
90
90
|
}
|
|
91
91
|
e.classList.contains("btn") || (e.classList.contains("uppy-Webcam-button--submit") ? (e.className = "btn btn-primary btn-md btn-icon uppy-Webcam-button uppy-Webcam-button--submit", e.innerHTML = '<div class="btn-content"><span class="icon icon--size-md"><i class="icon-check"></i></span></div>') : e.classList.contains("uppy-Webcam-button--discard") ? (e.className = "btn btn-danger btn-md btn-icon btn-transparent uppy-Webcam-button uppy-Webcam-button--discard", e.innerHTML = '<div class="btn-content"><span class="icon icon--size-md"><i class="icon-trash"></i></span></div>') : e.classList.contains("uppy-Webcam-button--picture") && (e.className = "btn btn-primary btn-lg btn-icon uppy-Webcam-button uppy-Webcam-button--picture", e.innerHTML = '<div class="btn-content"><span class="icon icon--size-md"><i class="icon-camera"></i></span></div>'));
|
|
92
92
|
});
|
|
93
|
-
},
|
|
94
|
-
return
|
|
95
|
-
|
|
93
|
+
}, s = new MutationObserver(n);
|
|
94
|
+
return s.observe(t, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["title"] }), n(), () => {
|
|
95
|
+
s.disconnect(), t.querySelectorAll("[data-zuii-uppy-actions]").forEach((e) => e.remove());
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
export {
|