zuii 1.5.9 → 1.5.10
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.
|
@@ -9,8 +9,8 @@ const q = {
|
|
|
9
9
|
noChoicesText: "Aucun choix disponible",
|
|
10
10
|
uniqueItemText: "Seules les valeurs uniques peuvent être ajoutées",
|
|
11
11
|
customAddItemText: "Seules les valeurs correspondant à un critère spécifique peuvent être ajoutées",
|
|
12
|
-
addItemText: (
|
|
13
|
-
maxItemText: (
|
|
12
|
+
addItemText: (n) => `Appuyez sur Entrée pour ajouter **${n}**`,
|
|
13
|
+
maxItemText: (n) => `Seulement ${n} options peuvent être sélectionnées`
|
|
14
14
|
},
|
|
15
15
|
en: {
|
|
16
16
|
placeholder: "Select an option",
|
|
@@ -18,40 +18,40 @@ const q = {
|
|
|
18
18
|
noChoicesText: "No choices to choose from",
|
|
19
19
|
uniqueItemText: "Only unique values can be added",
|
|
20
20
|
customAddItemText: "Only values matching specific conditions can be added",
|
|
21
|
-
addItemText: (
|
|
22
|
-
maxItemText: (
|
|
21
|
+
addItemText: (n) => `Press Enter to add **${n}**`,
|
|
22
|
+
maxItemText: (n) => `Only ${n} options can be selected`
|
|
23
23
|
}
|
|
24
24
|
}, J = ({
|
|
25
|
-
required:
|
|
26
|
-
options:
|
|
25
|
+
required: n = !1,
|
|
26
|
+
options: h,
|
|
27
27
|
value: t,
|
|
28
28
|
onChange: a,
|
|
29
29
|
multiple: i = !1,
|
|
30
|
-
placeholder:
|
|
30
|
+
placeholder: y = "Sélectionnez une option",
|
|
31
31
|
disabled: v = !1,
|
|
32
|
-
searchable:
|
|
32
|
+
searchable: T = !0,
|
|
33
33
|
className: I = "",
|
|
34
34
|
name: N,
|
|
35
|
-
variant:
|
|
36
|
-
icon:
|
|
35
|
+
variant: S = "default",
|
|
36
|
+
icon: A,
|
|
37
37
|
lang: O
|
|
38
38
|
}) => {
|
|
39
|
-
const o = l(null), r = l(null), d = l(a), f = l(t), g = O || (typeof document < "u" ? document.documentElement.lang : "fr") || "fr", m = q[g.startsWith("en") ? "en" : "fr"], p =
|
|
39
|
+
const o = l(null), r = l(null), d = l(a), f = l(t), g = O || (typeof document < "u" ? document.documentElement.lang : "fr") || "fr", m = q[g.startsWith("en") ? "en" : "fr"], p = y === "Sélectionnez une option" ? m.placeholder : y;
|
|
40
40
|
u(() => {
|
|
41
41
|
d.current = a;
|
|
42
42
|
}, [a]), u(() => {
|
|
43
43
|
f.current = t;
|
|
44
44
|
}, [t]);
|
|
45
|
-
const R = JSON.stringify(
|
|
45
|
+
const R = JSON.stringify(h);
|
|
46
46
|
return u(() => {
|
|
47
47
|
if (o.current) {
|
|
48
48
|
o.current.innerHTML = "";
|
|
49
|
-
const e = t ?? f.current, c =
|
|
50
|
-
value:
|
|
51
|
-
label:
|
|
52
|
-
selected: Array.isArray(e) ? e.includes(
|
|
49
|
+
const e = t ?? f.current, c = h.map((s) => ({
|
|
50
|
+
value: s.value,
|
|
51
|
+
label: s.text,
|
|
52
|
+
selected: Array.isArray(e) ? e.includes(s.value) : e === s.value,
|
|
53
53
|
customProperties: {
|
|
54
|
-
flag:
|
|
54
|
+
flag: s.flag
|
|
55
55
|
}
|
|
56
56
|
}));
|
|
57
57
|
i || c.unshift({
|
|
@@ -63,22 +63,23 @@ const q = {
|
|
|
63
63
|
choices: c,
|
|
64
64
|
removeItemButton: i,
|
|
65
65
|
placeholderValue: p,
|
|
66
|
-
searchEnabled:
|
|
66
|
+
searchEnabled: T,
|
|
67
67
|
silent: !0,
|
|
68
|
-
variant:
|
|
68
|
+
variant: S,
|
|
69
69
|
...m
|
|
70
|
-
}, (
|
|
71
|
-
|
|
72
|
-
A && (A.hidden = !1), f.current = n, d.current && d.current(n);
|
|
70
|
+
}, (s) => {
|
|
71
|
+
f.current = s, d.current && d.current(s);
|
|
73
72
|
});
|
|
73
|
+
const x = o.current;
|
|
74
|
+
x.hidden = !1;
|
|
74
75
|
}
|
|
75
76
|
return () => {
|
|
76
77
|
r.current && (r.current.destroy(), r.current = null);
|
|
77
78
|
};
|
|
78
|
-
}, [R, i, p,
|
|
79
|
+
}, [R, i, p, S, T, m]), u(() => {
|
|
79
80
|
if (r.current && t !== void 0) {
|
|
80
|
-
const e = r.current.getValue(!0), c = Array.isArray(t) ? t : [t],
|
|
81
|
-
JSON.stringify(c.sort()) !== JSON.stringify(
|
|
81
|
+
const e = r.current.getValue(!0), c = Array.isArray(t) ? t : [t], x = Array.isArray(e) ? e : [e];
|
|
82
|
+
JSON.stringify(c.sort()) !== JSON.stringify(x.sort()) && r.current.setChoiceByValue(t);
|
|
82
83
|
}
|
|
83
84
|
}, [t]), u(() => {
|
|
84
85
|
const e = o.current?.closest("fieldset");
|
|
@@ -89,7 +90,7 @@ const q = {
|
|
|
89
90
|
return c.observe(e, { attributes: !0 }), () => c.disconnect();
|
|
90
91
|
}
|
|
91
92
|
}, []), /* @__PURE__ */ E("div", { className: `form__input ${I}`.trim(), children: [
|
|
92
|
-
|
|
93
|
+
A && /* @__PURE__ */ b(j, { name: A, size: "sm" }),
|
|
93
94
|
/* @__PURE__ */ b(
|
|
94
95
|
"select",
|
|
95
96
|
{
|
|
@@ -98,7 +99,7 @@ const q = {
|
|
|
98
99
|
disabled: v,
|
|
99
100
|
className: "select",
|
|
100
101
|
name: N,
|
|
101
|
-
required:
|
|
102
|
+
required: n
|
|
102
103
|
}
|
|
103
104
|
)
|
|
104
105
|
] });
|