@snmt-react-ui/user-select 2.5.6 → 2.5.7
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/user-select.js +227 -225
- package/package.json +3 -3
package/dist/user-select.js
CHANGED
|
@@ -3,7 +3,7 @@ var ae = (i, e, t) => e in i ? le(i, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var y1 = (i, e, t) => ae(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { jsx as r, Fragment as e1, jsxs as C } from "react/jsx-runtime";
|
|
6
|
-
import { createContext as r1, forwardRef as o1, useState as
|
|
6
|
+
import { createContext as r1, forwardRef as o1, useState as W, useRef as l1, useEffect as K, useCallback as G, useImperativeHandle as he, useContext as a1 } from "react";
|
|
7
7
|
import { Select as ce, Flex as de, Avatar as ge, Checkbox as Ce, Typography as P1, Tag as $1, Popover as ue } from "antd";
|
|
8
8
|
import { SNMTUiContext as pe } from "@snmt-react-ui/core";
|
|
9
9
|
const d1 = ({
|
|
@@ -56,7 +56,7 @@ const we = ({
|
|
|
56
56
|
disabled: n = !1,
|
|
57
57
|
disableUncheck: l = !1
|
|
58
58
|
}) => {
|
|
59
|
-
const [c, o] =
|
|
59
|
+
const [c, o] = W(i), [d, g] = W(e);
|
|
60
60
|
K(() => {
|
|
61
61
|
o(i), g(e);
|
|
62
62
|
}, [i, e]);
|
|
@@ -263,7 +263,7 @@ const me = ({
|
|
|
263
263
|
}
|
|
264
264
|
)
|
|
265
265
|
}
|
|
266
|
-
),
|
|
266
|
+
), Me = ({
|
|
267
267
|
width: i = 20,
|
|
268
268
|
height: e = 20,
|
|
269
269
|
color: t = "#001E52",
|
|
@@ -284,7 +284,7 @@ const me = ({
|
|
|
284
284
|
/* @__PURE__ */ r("path", { d: "M16 4L4 16", stroke: t, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
285
285
|
]
|
|
286
286
|
}
|
|
287
|
-
),
|
|
287
|
+
), Re = ({
|
|
288
288
|
width: i = 20,
|
|
289
289
|
height: e = 20,
|
|
290
290
|
color: t = "#001E52",
|
|
@@ -2235,7 +2235,7 @@ const me = ({
|
|
|
2235
2235
|
)
|
|
2236
2236
|
]
|
|
2237
2237
|
}
|
|
2238
|
-
),
|
|
2238
|
+
), Mt = ({
|
|
2239
2239
|
className: i,
|
|
2240
2240
|
color: e = L.GREY_DARK_5,
|
|
2241
2241
|
height: t = 24,
|
|
@@ -2261,7 +2261,7 @@ const me = ({
|
|
|
2261
2261
|
}
|
|
2262
2262
|
)
|
|
2263
2263
|
}
|
|
2264
|
-
),
|
|
2264
|
+
), Rt = ({
|
|
2265
2265
|
className: i,
|
|
2266
2266
|
color: e = L.GREY_DARK_5,
|
|
2267
2267
|
height: t = 24,
|
|
@@ -3133,7 +3133,7 @@ const me = ({
|
|
|
3133
3133
|
disabled: l = !1,
|
|
3134
3134
|
onClick: c
|
|
3135
3135
|
}) => {
|
|
3136
|
-
const [o, d] =
|
|
3136
|
+
const [o, d] = W(n), { theme: g } = a1(Y1), a = l ? g && g === "dark" ? L.GREY_LIGHT_4 : L.GREY_DARK_1 : s, h = l ? void 0 : c;
|
|
3137
3137
|
return K(() => {
|
|
3138
3138
|
if (n) {
|
|
3139
3139
|
h && !l && d(`${n} clickable`);
|
|
@@ -3159,9 +3159,9 @@ const me = ({
|
|
|
3159
3159
|
case "ok":
|
|
3160
3160
|
return xe({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3161
3161
|
case "cancel":
|
|
3162
|
-
return Re({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3163
|
-
case "add":
|
|
3164
3162
|
return Me({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3163
|
+
case "add":
|
|
3164
|
+
return Re({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3165
3165
|
case "list":
|
|
3166
3166
|
return ye({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3167
3167
|
case "dragAndDrop":
|
|
@@ -3335,9 +3335,9 @@ const me = ({
|
|
|
3335
3335
|
case "warning":
|
|
3336
3336
|
return xt({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3337
3337
|
case "back":
|
|
3338
|
-
return Rt({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3339
|
-
case "bell":
|
|
3340
3338
|
return Mt({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3339
|
+
case "bell":
|
|
3340
|
+
return Rt({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3341
3341
|
case "contract":
|
|
3342
3342
|
return bt({ width: e, height: t, color: a, className: o, onClick: h });
|
|
3343
3343
|
case "trash2":
|
|
@@ -4385,7 +4385,7 @@ const qt = ({
|
|
|
4385
4385
|
)
|
|
4386
4386
|
]
|
|
4387
4387
|
}
|
|
4388
|
-
),
|
|
4388
|
+
), M2 = ({
|
|
4389
4389
|
width: i = 20,
|
|
4390
4390
|
height: e = 20,
|
|
4391
4391
|
color: t = "#001E52",
|
|
@@ -4425,7 +4425,7 @@ const qt = ({
|
|
|
4425
4425
|
)
|
|
4426
4426
|
]
|
|
4427
4427
|
}
|
|
4428
|
-
),
|
|
4428
|
+
), R2 = ({
|
|
4429
4429
|
width: i = 32,
|
|
4430
4430
|
height: e = 25,
|
|
4431
4431
|
color: t = "#001E52",
|
|
@@ -6326,7 +6326,7 @@ const qt = ({
|
|
|
6326
6326
|
)
|
|
6327
6327
|
]
|
|
6328
6328
|
}
|
|
6329
|
-
),
|
|
6329
|
+
), M5 = ({
|
|
6330
6330
|
className: i,
|
|
6331
6331
|
color: e = "#001E52",
|
|
6332
6332
|
height: t = 24,
|
|
@@ -6352,7 +6352,7 @@ const qt = ({
|
|
|
6352
6352
|
}
|
|
6353
6353
|
)
|
|
6354
6354
|
}
|
|
6355
|
-
),
|
|
6355
|
+
), R5 = ({
|
|
6356
6356
|
className: i,
|
|
6357
6357
|
color: e = "#131314",
|
|
6358
6358
|
height: t = 20,
|
|
@@ -6483,7 +6483,7 @@ const qt = ({
|
|
|
6483
6483
|
disabled: l = !1,
|
|
6484
6484
|
onClick: c
|
|
6485
6485
|
}) => {
|
|
6486
|
-
const [o, d] =
|
|
6486
|
+
const [o, d] = W(n), { theme: g } = a1(U1), a = l ? g && g === "dark" ? v.GREY_LIGHT_4 : v.GREY_DARK_1 : s, h = l ? void 0 : c;
|
|
6487
6487
|
return K(() => {
|
|
6488
6488
|
if (n) {
|
|
6489
6489
|
h && !l && d(`${n} clickable`);
|
|
@@ -6567,9 +6567,9 @@ const qt = ({
|
|
|
6567
6567
|
case "settings4":
|
|
6568
6568
|
return x2({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6569
6569
|
case "edit2":
|
|
6570
|
-
return
|
|
6570
|
+
return M2({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6571
6571
|
case "notifications":
|
|
6572
|
-
return
|
|
6572
|
+
return R2({
|
|
6573
6573
|
width: e,
|
|
6574
6574
|
height: t,
|
|
6575
6575
|
color: a,
|
|
@@ -6725,9 +6725,9 @@ const qt = ({
|
|
|
6725
6725
|
case "filledArrowRight":
|
|
6726
6726
|
return x5({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6727
6727
|
case "burgerMenu":
|
|
6728
|
-
return R5({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6729
|
-
case "signOut":
|
|
6730
6728
|
return M5({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6729
|
+
case "signOut":
|
|
6730
|
+
return R5({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6731
6731
|
case "refresh":
|
|
6732
6732
|
return y5({ width: e, height: t, color: a, className: o, onClick: h });
|
|
6733
6733
|
case "projects":
|
|
@@ -6811,7 +6811,7 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
6811
6811
|
placement: n = "topRight",
|
|
6812
6812
|
noPadding: l = !1
|
|
6813
6813
|
}) => {
|
|
6814
|
-
const [c, o] =
|
|
6814
|
+
const [c, o] = W(!1);
|
|
6815
6815
|
return /* @__PURE__ */ r(
|
|
6816
6816
|
ue,
|
|
6817
6817
|
{
|
|
@@ -6835,7 +6835,7 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
6835
6835
|
options: n,
|
|
6836
6836
|
extraOptions: l
|
|
6837
6837
|
}) => {
|
|
6838
|
-
const [c, o] =
|
|
6838
|
+
const [c, o] = W(!1);
|
|
6839
6839
|
K(() => {
|
|
6840
6840
|
i.length || o(!1);
|
|
6841
6841
|
}, [i]);
|
|
@@ -6897,97 +6897,97 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
6897
6897
|
onDropdownVisibleChange: u,
|
|
6898
6898
|
onScrollToEnd: p,
|
|
6899
6899
|
onPopupScroll: N,
|
|
6900
|
-
id:
|
|
6900
|
+
id: M,
|
|
6901
6901
|
extraOptions: k,
|
|
6902
6902
|
dropdownRender: b,
|
|
6903
|
-
optionRender:
|
|
6904
|
-
isLoading:
|
|
6903
|
+
optionRender: R,
|
|
6904
|
+
isLoading: S,
|
|
6905
6905
|
readOnly: f
|
|
6906
6906
|
}, y) => {
|
|
6907
|
-
const [x, w] =
|
|
6907
|
+
const [x, w] = W(!1), [B, Z] = W(!1), [I, H] = W(!0), [V, D] = W(i), T = l1(null);
|
|
6908
6908
|
K(() => {
|
|
6909
|
-
|
|
6909
|
+
D(i);
|
|
6910
6910
|
}, [i]);
|
|
6911
|
-
const
|
|
6911
|
+
const E = (m) => {
|
|
6912
6912
|
w(m), u && u(m);
|
|
6913
|
-
}, F = (m,
|
|
6913
|
+
}, F = (m, _) => {
|
|
6914
6914
|
var P;
|
|
6915
|
-
return !!((P =
|
|
6916
|
-
},
|
|
6915
|
+
return !!((P = _ == null ? void 0 : _.label) != null && P.toString().toLowerCase().includes(m.toLowerCase()));
|
|
6916
|
+
}, J = () => {
|
|
6917
6917
|
Z(!0);
|
|
6918
|
-
},
|
|
6918
|
+
}, A = () => {
|
|
6919
6919
|
Z(!1);
|
|
6920
|
-
},
|
|
6920
|
+
}, O = G(
|
|
6921
6921
|
(m) => {
|
|
6922
|
-
if (
|
|
6922
|
+
if (D(m), s) {
|
|
6923
6923
|
const P = m;
|
|
6924
6924
|
e == null || e(P);
|
|
6925
6925
|
return;
|
|
6926
6926
|
}
|
|
6927
|
-
const
|
|
6928
|
-
e == null || e(
|
|
6927
|
+
const _ = m;
|
|
6928
|
+
e == null || e(_);
|
|
6929
6929
|
},
|
|
6930
6930
|
[s, e]
|
|
6931
|
-
),
|
|
6931
|
+
), Y = G(() => {
|
|
6932
6932
|
if (!f) {
|
|
6933
6933
|
if (s) {
|
|
6934
|
-
|
|
6934
|
+
O([]);
|
|
6935
6935
|
return;
|
|
6936
6936
|
}
|
|
6937
|
-
|
|
6937
|
+
O("");
|
|
6938
6938
|
}
|
|
6939
|
-
}, [
|
|
6939
|
+
}, [O, s, f]), U = G(
|
|
6940
6940
|
(m) => {
|
|
6941
|
-
const
|
|
6942
|
-
|
|
6941
|
+
const _ = V.filter((P) => P !== m);
|
|
6942
|
+
O(_), D(_);
|
|
6943
6943
|
},
|
|
6944
|
-
[
|
|
6945
|
-
),
|
|
6946
|
-
(m) => (
|
|
6944
|
+
[O, V]
|
|
6945
|
+
), R1 = G(
|
|
6946
|
+
(m) => (V == null ? void 0 : V.indexOf(m)) === 0 ? (
|
|
6947
6947
|
// if the search input is empty
|
|
6948
6948
|
// then display the placeholder, else do not display it
|
|
6949
|
-
/* @__PURE__ */ r("span", { className: "custom-placeholder", children:
|
|
6949
|
+
/* @__PURE__ */ r("span", { className: "custom-placeholder", children: I ? t : "" })
|
|
6950
6950
|
) : /* @__PURE__ */ r(e1, {}),
|
|
6951
|
-
[
|
|
6951
|
+
[I, V, t]
|
|
6952
6952
|
), se = (m) => {
|
|
6953
6953
|
m.preventDefault(), m.stopPropagation();
|
|
6954
6954
|
}, ne = async (m) => {
|
|
6955
|
-
const { target:
|
|
6956
|
-
|
|
6957
|
-
}, m1 =
|
|
6955
|
+
const { target: _ } = m;
|
|
6956
|
+
_.scrollTop + _.offsetHeight >= _.scrollHeight - a && (p == null || p(!0)), N && await N(m);
|
|
6957
|
+
}, m1 = G(
|
|
6958
6958
|
(m) => {
|
|
6959
|
-
var
|
|
6960
|
-
return ((
|
|
6959
|
+
var _, P;
|
|
6960
|
+
return ((_ = l.find((k1) => k1.value === m)) == null ? void 0 : _.label) || ((P = k == null ? void 0 : k.find(
|
|
6961
6961
|
(k1) => k1.value === m
|
|
6962
6962
|
)) == null ? void 0 : P.label) || m;
|
|
6963
6963
|
},
|
|
6964
6964
|
[k, l]
|
|
6965
|
-
), re =
|
|
6965
|
+
), re = G(
|
|
6966
6966
|
(m) => {
|
|
6967
|
-
var
|
|
6967
|
+
var _;
|
|
6968
6968
|
return /* @__PURE__ */ r(
|
|
6969
6969
|
S5,
|
|
6970
6970
|
{
|
|
6971
6971
|
values: m,
|
|
6972
|
-
onTagClose:
|
|
6973
|
-
maxWidth: ((
|
|
6972
|
+
onTagClose: U,
|
|
6973
|
+
maxWidth: ((_ = T.current) == null ? void 0 : _.clientWidth) || 0,
|
|
6974
6974
|
disabled: o || f,
|
|
6975
6975
|
options: l,
|
|
6976
6976
|
extraOptions: k
|
|
6977
6977
|
}
|
|
6978
6978
|
);
|
|
6979
6979
|
},
|
|
6980
|
-
[o, k,
|
|
6981
|
-
), oe =
|
|
6982
|
-
({ label: m, value:
|
|
6983
|
-
[o, m1,
|
|
6980
|
+
[o, k, U, l, f]
|
|
6981
|
+
), oe = G(
|
|
6982
|
+
({ label: m, value: _, mode: P }) => P === "filter" ? R1(_) : /* @__PURE__ */ r("div", { onMouseDown: se, className: "tag-wrapper", children: /* @__PURE__ */ r(J1, { onClose: () => U(_), closable: !o, children: /* @__PURE__ */ r(Q1, { variant: "body4", children: typeof m == "object" ? m : m1(_) }) }) }),
|
|
6983
|
+
[o, m1, U, R1]
|
|
6984
6984
|
);
|
|
6985
6985
|
return /* @__PURE__ */ C(
|
|
6986
6986
|
"div",
|
|
6987
6987
|
{
|
|
6988
|
-
className: `snmt-select ${
|
|
6988
|
+
className: `snmt-select ${B ? "snmt-select-focused" : ""}
|
|
6989
6989
|
${s ? "" : "snmt-select-single"} ${f ? "snmt-select-read-only" : ""}`,
|
|
6990
|
-
ref:
|
|
6990
|
+
ref: T,
|
|
6991
6991
|
style: { width: c },
|
|
6992
6992
|
children: [
|
|
6993
6993
|
/* @__PURE__ */ r(
|
|
@@ -6995,31 +6995,31 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
6995
6995
|
{
|
|
6996
6996
|
className: "snmt-select-blank",
|
|
6997
6997
|
popupClassName: f ? "dropdown-read-only" : "",
|
|
6998
|
-
id:
|
|
6998
|
+
id: M,
|
|
6999
6999
|
ref: y,
|
|
7000
7000
|
showSearch: !!n,
|
|
7001
7001
|
filterOption: n && F,
|
|
7002
|
-
onDropdownVisibleChange:
|
|
7002
|
+
onDropdownVisibleChange: E,
|
|
7003
7003
|
placeholder: t ? d ? `${t}*` : t : void 0,
|
|
7004
7004
|
disabled: o,
|
|
7005
|
-
value:
|
|
7005
|
+
value: V || void 0,
|
|
7006
7006
|
labelRender: (m) => m1(m.value),
|
|
7007
7007
|
mode: s === "filter" ? "multiple" : s,
|
|
7008
|
-
onChange:
|
|
7009
|
-
onFocus:
|
|
7010
|
-
onBlur:
|
|
7008
|
+
onChange: O,
|
|
7009
|
+
onFocus: J,
|
|
7010
|
+
onBlur: A,
|
|
7011
7011
|
onSearch: (m) => {
|
|
7012
|
-
|
|
7012
|
+
H(!m), h && h(m);
|
|
7013
7013
|
},
|
|
7014
|
-
onSelect: () =>
|
|
7015
|
-
onDeselect: () =>
|
|
7014
|
+
onSelect: () => H(!0),
|
|
7015
|
+
onDeselect: () => H(!0),
|
|
7016
7016
|
tagRender: (m) => oe({ ...m, mode: s }),
|
|
7017
7017
|
maxTagCount: "responsive",
|
|
7018
7018
|
maxTagPlaceholder: re,
|
|
7019
7019
|
onPopupScroll: ne,
|
|
7020
|
-
prefix:
|
|
7020
|
+
prefix: S && /* @__PURE__ */ r(b1, { size: 15 }),
|
|
7021
7021
|
suffixIcon: /* @__PURE__ */ r("div", { className: "wrapper-suffix-icon", children: s !== "filter" && /* @__PURE__ */ C(e1, { children: [
|
|
7022
|
-
|
|
7022
|
+
V && !!V.length && (s || g) && /* @__PURE__ */ r("div", { onClick: Y, children: /* @__PURE__ */ r(h1, { name: "cancel" }) }),
|
|
7023
7023
|
/* @__PURE__ */ r(
|
|
7024
7024
|
h1,
|
|
7025
7025
|
{
|
|
@@ -7032,12 +7032,12 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
7032
7032
|
] }) }),
|
|
7033
7033
|
removeIcon: /* @__PURE__ */ r(h1, { name: "errorSmall", color: X.GREY_DARK_2 }),
|
|
7034
7034
|
options: l,
|
|
7035
|
-
optionRender: (m) =>
|
|
7035
|
+
optionRender: (m) => R ? R(m.data) : /* @__PURE__ */ C(d1, { justifyContent: "space-between", alignItems: "center", flex: "1", children: [
|
|
7036
7036
|
/* @__PURE__ */ C(d1, { alignItems: "center", gap: 12, children: [
|
|
7037
7037
|
s && /* @__PURE__ */ r(
|
|
7038
7038
|
we,
|
|
7039
7039
|
{
|
|
7040
|
-
checked: !!(
|
|
7040
|
+
checked: !!(V != null && V.includes(m.value))
|
|
7041
7041
|
}
|
|
7042
7042
|
),
|
|
7043
7043
|
/* @__PURE__ */ C(d1, { alignItems: "center", gap: 8, children: [
|
|
@@ -7045,7 +7045,7 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
7045
7045
|
/* @__PURE__ */ r("span", { children: m.label })
|
|
7046
7046
|
] })
|
|
7047
7047
|
] }),
|
|
7048
|
-
!s &&
|
|
7048
|
+
!s && V === m.value && /* @__PURE__ */ r(
|
|
7049
7049
|
h1,
|
|
7050
7050
|
{
|
|
7051
7051
|
name: "ok",
|
|
@@ -7055,7 +7055,7 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
7055
7055
|
}
|
|
7056
7056
|
)
|
|
7057
7057
|
] }),
|
|
7058
|
-
dropdownRender:
|
|
7058
|
+
dropdownRender: S ? () => /* @__PURE__ */ r(
|
|
7059
7059
|
"div",
|
|
7060
7060
|
{
|
|
7061
7061
|
style: {
|
|
@@ -7071,7 +7071,7 @@ const J1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: n
|
|
|
7071
7071
|
/* @__PURE__ */ r(
|
|
7072
7072
|
"fieldset",
|
|
7073
7073
|
{
|
|
7074
|
-
className: `${
|
|
7074
|
+
className: `${B ? "fieldset-focused" : ""}
|
|
7075
7075
|
${o ? "fieldset-disabled" : ""}
|
|
7076
7076
|
${typeof i == "string" && i ? "fieldset-filled" : ""}
|
|
7077
7077
|
${typeof i == "object" && i != null && i.length ? "fieldset-filled" : ""}`,
|
|
@@ -7113,69 +7113,71 @@ const t1 = {
|
|
|
7113
7113
|
onDropdownVisibleChange: h,
|
|
7114
7114
|
optionRender: u,
|
|
7115
7115
|
dropdownRender: p,
|
|
7116
|
-
readOnly: N
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7116
|
+
readOnly: N,
|
|
7117
|
+
clearable: M
|
|
7118
|
+
}, k) => {
|
|
7119
|
+
const [b, R] = W([]), [S, f] = W(t1), [y, x] = W(!1), [w, B] = W(null), Z = G(
|
|
7120
|
+
async (E = !1, F) => {
|
|
7121
|
+
if (!y) {
|
|
7122
|
+
x(!0);
|
|
7122
7123
|
try {
|
|
7123
|
-
const
|
|
7124
|
-
|
|
7125
|
-
(O) => E ?
|
|
7126
|
-
),
|
|
7124
|
+
const J = E ? { ...t1, search: F } : S, A = await i(J);
|
|
7125
|
+
R(
|
|
7126
|
+
(O) => E ? A.options : [...O, ...A.options]
|
|
7127
|
+
), B(A.count), f((O) => ({
|
|
7127
7128
|
...O,
|
|
7128
7129
|
offset: O.offset + O.limit
|
|
7129
7130
|
}));
|
|
7130
7131
|
} finally {
|
|
7131
|
-
|
|
7132
|
+
x(!1);
|
|
7132
7133
|
}
|
|
7133
7134
|
}
|
|
7134
7135
|
},
|
|
7135
|
-
[
|
|
7136
|
-
),
|
|
7136
|
+
[S, i, y]
|
|
7137
|
+
), I = A5(Z), H = G(
|
|
7137
7138
|
(E) => {
|
|
7138
|
-
E === "" || E === void 0 || E === null ? (
|
|
7139
|
+
E === "" || E === void 0 || E === null ? (f(t1), I(!0)) : I(!0, E);
|
|
7139
7140
|
},
|
|
7140
|
-
[
|
|
7141
|
-
),
|
|
7142
|
-
E &&
|
|
7143
|
-
},
|
|
7141
|
+
[I]
|
|
7142
|
+
), V = async (E) => {
|
|
7143
|
+
E && w !== null && w > b.length && await Z(!1);
|
|
7144
|
+
}, D = G(
|
|
7144
7145
|
(E) => {
|
|
7145
|
-
E && !g && (
|
|
7146
|
+
E && !g && (R([]), f(t1), Z(!0)), h == null || h(E);
|
|
7146
7147
|
},
|
|
7147
7148
|
// eslint-disable-next-line
|
|
7148
7149
|
[g]
|
|
7149
7150
|
);
|
|
7150
7151
|
K(() => {
|
|
7151
|
-
g &&
|
|
7152
|
+
g && Z(!1);
|
|
7152
7153
|
}, []);
|
|
7153
|
-
const
|
|
7154
|
+
const T = {
|
|
7154
7155
|
id: n,
|
|
7155
7156
|
width: e,
|
|
7156
|
-
options:
|
|
7157
|
+
options: b,
|
|
7157
7158
|
onChange: t,
|
|
7158
|
-
ref:
|
|
7159
|
+
ref: k,
|
|
7159
7160
|
placeholder: o,
|
|
7160
7161
|
search: !0,
|
|
7161
7162
|
value: s,
|
|
7162
|
-
onSearchChange:
|
|
7163
|
-
onDropdownVisibleChange:
|
|
7163
|
+
onSearchChange: H,
|
|
7164
|
+
onDropdownVisibleChange: D,
|
|
7164
7165
|
scrollThresholdValue: c,
|
|
7165
|
-
onScrollToEnd:
|
|
7166
|
+
onScrollToEnd: V,
|
|
7166
7167
|
loadOnClosedState: g,
|
|
7167
7168
|
disabled: l,
|
|
7168
7169
|
extraOptions: a,
|
|
7169
|
-
isLoading:
|
|
7170
|
+
isLoading: y,
|
|
7170
7171
|
optionRender: u,
|
|
7171
7172
|
dropdownRender: p,
|
|
7172
|
-
readOnly: N
|
|
7173
|
+
readOnly: N,
|
|
7174
|
+
clearable: M
|
|
7173
7175
|
};
|
|
7174
|
-
return he(
|
|
7176
|
+
return he(k, () => ({
|
|
7175
7177
|
refetchOptions: async () => {
|
|
7176
|
-
|
|
7178
|
+
f(t1), await Z(!0);
|
|
7177
7179
|
}
|
|
7178
|
-
})), d ? /* @__PURE__ */ r(E1, { ...
|
|
7180
|
+
})), d ? /* @__PURE__ */ r(E1, { ...T, onChange: t, value: s, mode: d }) : /* @__PURE__ */ r("div", { className: "snmt-async-select", children: /* @__PURE__ */ r(E1, { ...T, onChange: t, value: s }) });
|
|
7179
7181
|
}
|
|
7180
7182
|
);
|
|
7181
7183
|
var g1 = /* @__PURE__ */ ((i) => (i.ACTIVE = "Active", i.ARCHIVED = "Archived", i))(g1 || {});
|
|
@@ -7192,14 +7194,14 @@ function Z5() {
|
|
|
7192
7194
|
if (console && console.warn) {
|
|
7193
7195
|
for (var i = arguments.length, e = new Array(i), t = 0; t < i; t++)
|
|
7194
7196
|
e[t] = arguments[t];
|
|
7195
|
-
|
|
7197
|
+
z(e[0]) && (e[0] = `react-i18next:: ${e[0]}`), console.warn(...e);
|
|
7196
7198
|
}
|
|
7197
7199
|
}
|
|
7198
7200
|
const V1 = {};
|
|
7199
7201
|
function N1() {
|
|
7200
7202
|
for (var i = arguments.length, e = new Array(i), t = 0; t < i; t++)
|
|
7201
7203
|
e[t] = arguments[t];
|
|
7202
|
-
|
|
7204
|
+
z(e[0]) && V1[e[0]] || (z(e[0]) && (V1[e[0]] = /* @__PURE__ */ new Date()), Z5(...e));
|
|
7203
7205
|
}
|
|
7204
7206
|
const q1 = (i, e) => () => {
|
|
7205
7207
|
if (i.isInitialized)
|
|
@@ -7215,7 +7217,7 @@ const q1 = (i, e) => () => {
|
|
|
7215
7217
|
}, _1 = (i, e, t) => {
|
|
7216
7218
|
i.loadNamespaces(e, q1(i, t));
|
|
7217
7219
|
}, I1 = (i, e, t, s) => {
|
|
7218
|
-
|
|
7220
|
+
z(t) && (t = [t]), t.forEach((n) => {
|
|
7219
7221
|
i.options.ns.indexOf(n) < 0 && i.options.ns.push(n);
|
|
7220
7222
|
}), i.loadLanguages(e, q1(i, s));
|
|
7221
7223
|
}, W5 = function(i, e) {
|
|
@@ -7235,7 +7237,7 @@ const q1 = (i, e) => () => {
|
|
|
7235
7237
|
if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && n.services.backendConnector.backend && n.isLanguageChangingTo && !l(n.isLanguageChangingTo, i)) return !1;
|
|
7236
7238
|
}
|
|
7237
7239
|
}) : W5(i, e, t);
|
|
7238
|
-
},
|
|
7240
|
+
}, z = (i) => typeof i == "string", D5 = (i) => typeof i == "object" && i !== null, T5 = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, G5 = {
|
|
7239
7241
|
"&": "&",
|
|
7240
7242
|
"&": "&",
|
|
7241
7243
|
"<": "<",
|
|
@@ -7299,7 +7301,7 @@ const q5 = (i, e) => {
|
|
|
7299
7301
|
return K(() => {
|
|
7300
7302
|
t.current = i;
|
|
7301
7303
|
}, [i, e]), t.current;
|
|
7302
|
-
}, ee = (i, e, t, s) => i.getFixedT(e, t, s), X5 = (i, e, t, s) =>
|
|
7304
|
+
}, ee = (i, e, t, s) => i.getFixedT(e, t, s), X5 = (i, e, t, s) => G(ee(i, e, t, s), [i, e, t, s]), e3 = function(i) {
|
|
7303
7305
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
7304
7306
|
const {
|
|
7305
7307
|
i18n: t
|
|
@@ -7309,7 +7311,7 @@ const q5 = (i, e) => {
|
|
|
7309
7311
|
} = a1(J5) || {}, l = t || s || U5();
|
|
7310
7312
|
if (l && !l.reportNamespaces && (l.reportNamespaces = new Q5()), !l) {
|
|
7311
7313
|
N1("You will need to pass in an i18next instance by using initReactI18next");
|
|
7312
|
-
const f = (x, w) =>
|
|
7314
|
+
const f = (x, w) => z(w) ? w : D5(w) && z(w.defaultValue) ? w.defaultValue : Array.isArray(x) ? x[x.length - 1] : x, y = [f, {}, !1];
|
|
7313
7315
|
return y.t = f, y.i18n = {}, y.ready = !1, y;
|
|
7314
7316
|
}
|
|
7315
7317
|
l.options.react && l.options.react.wait !== void 0 && N1("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
@@ -7322,32 +7324,32 @@ const q5 = (i, e) => {
|
|
|
7322
7324
|
keyPrefix: d
|
|
7323
7325
|
} = c;
|
|
7324
7326
|
let g = i;
|
|
7325
|
-
g =
|
|
7326
|
-
const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => j5(f, l, c)), h = X5(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), u = () => h, p = () => ee(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [N,
|
|
7327
|
+
g = z(g) ? [g] : g || ["translation"], l.reportNamespaces.addUsedNamespaces && l.reportNamespaces.addUsedNamespaces(g);
|
|
7328
|
+
const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => j5(f, l, c)), h = X5(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), u = () => h, p = () => ee(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [N, M] = W(u);
|
|
7327
7329
|
let k = g.join();
|
|
7328
7330
|
e.lng && (k = `${e.lng}${k}`);
|
|
7329
|
-
const b = q5(k),
|
|
7331
|
+
const b = q5(k), R = l1(!0);
|
|
7330
7332
|
K(() => {
|
|
7331
7333
|
const {
|
|
7332
7334
|
bindI18n: f,
|
|
7333
7335
|
bindI18nStore: y
|
|
7334
7336
|
} = c;
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
+
R.current = !0, !a && !o && (e.lng ? I1(l, e.lng, g, () => {
|
|
7338
|
+
R.current && M(p);
|
|
7337
7339
|
}) : _1(l, g, () => {
|
|
7338
|
-
|
|
7339
|
-
})), a && b && b !== k &&
|
|
7340
|
+
R.current && M(p);
|
|
7341
|
+
})), a && b && b !== k && R.current && M(p);
|
|
7340
7342
|
const x = () => {
|
|
7341
|
-
|
|
7343
|
+
R.current && M(p);
|
|
7342
7344
|
};
|
|
7343
7345
|
return f && l && l.on(f, x), y && l && l.store.on(y, x), () => {
|
|
7344
|
-
|
|
7346
|
+
R.current = !1, f && l && f.split(" ").forEach((w) => l.off(w, x)), y && l && y.split(" ").forEach((w) => l.store.off(w, x));
|
|
7345
7347
|
};
|
|
7346
7348
|
}, [l, k]), K(() => {
|
|
7347
|
-
|
|
7349
|
+
R.current && a && M(u);
|
|
7348
7350
|
}, [l, d, a]);
|
|
7349
|
-
const
|
|
7350
|
-
if (
|
|
7351
|
+
const S = [N, l, a];
|
|
7352
|
+
if (S.t = N, S.i18n = l, S.ready = a, a || !a && !o) return S;
|
|
7351
7353
|
throw new Promise((f) => {
|
|
7352
7354
|
e.lng ? I1(l, e.lng, g, () => f()) : _1(l, g, () => f());
|
|
7353
7355
|
});
|
|
@@ -7531,7 +7533,7 @@ const h3 = [" ", ",", "?", "!", ";"], c3 = new a3(20), d3 = (i, e, t) => {
|
|
|
7531
7533
|
c > 0 && !n.test(i.substring(0, c)) && (l = !0);
|
|
7532
7534
|
}
|
|
7533
7535
|
return l;
|
|
7534
|
-
},
|
|
7536
|
+
}, M1 = function(i, e) {
|
|
7535
7537
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
7536
7538
|
if (!i) return;
|
|
7537
7539
|
if (i[e]) return i[e];
|
|
@@ -7573,7 +7575,7 @@ class Z1 extends w1 {
|
|
|
7573
7575
|
let o;
|
|
7574
7576
|
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : typeof s == "string" && l ? o.push(...s.split(l)) : o.push(s)));
|
|
7575
7577
|
const d = u1(this.data, o);
|
|
7576
|
-
return !d && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), d || !c || typeof s != "string" ? d :
|
|
7578
|
+
return !d && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), d || !c || typeof s != "string" ? d : M1(this.data && this.data[e] && this.data[e][t], s, l);
|
|
7577
7579
|
}
|
|
7578
7580
|
addResource(e, t, s, n) {
|
|
7579
7581
|
let l = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
@@ -7709,8 +7711,8 @@ class f1 extends w1 {
|
|
|
7709
7711
|
}
|
|
7710
7712
|
const h = this.resolve(e, t);
|
|
7711
7713
|
let u = h && h.res;
|
|
7712
|
-
const p = h && h.usedKey || c, N = h && h.exactUsedKey || c,
|
|
7713
|
-
if (
|
|
7714
|
+
const p = h && h.usedKey || c, N = h && h.exactUsedKey || c, M = Object.prototype.toString.apply(u), k = ["[object Number]", "[object Function]", "[object RegExp]"], b = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, R = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
7715
|
+
if (R && u && (typeof u != "string" && typeof u != "boolean" && typeof u != "number") && k.indexOf(M) < 0 && !(typeof b == "string" && Array.isArray(u))) {
|
|
7714
7716
|
if (!t.returnObjects && !this.options.returnObjects) {
|
|
7715
7717
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
7716
7718
|
const f = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, u, {
|
|
@@ -7723,48 +7725,48 @@ class f1 extends w1 {
|
|
|
7723
7725
|
const f = Array.isArray(u), y = f ? [] : {}, x = f ? N : p;
|
|
7724
7726
|
for (const w in u)
|
|
7725
7727
|
if (Object.prototype.hasOwnProperty.call(u, w)) {
|
|
7726
|
-
const
|
|
7727
|
-
y[w] = this.translate(
|
|
7728
|
+
const B = `${x}${l}${w}`;
|
|
7729
|
+
y[w] = this.translate(B, {
|
|
7728
7730
|
...t,
|
|
7729
7731
|
joinArrays: !1,
|
|
7730
7732
|
ns: o
|
|
7731
|
-
}), y[w] ===
|
|
7733
|
+
}), y[w] === B && (y[w] = u[w]);
|
|
7732
7734
|
}
|
|
7733
7735
|
u = y;
|
|
7734
7736
|
}
|
|
7735
|
-
} else if (
|
|
7737
|
+
} else if (R && typeof b == "string" && Array.isArray(u))
|
|
7736
7738
|
u = u.join(b), u && (u = this.extendTranslation(u, e, t, s));
|
|
7737
7739
|
else {
|
|
7738
7740
|
let f = !1, y = !1;
|
|
7739
|
-
const x = t.count !== void 0 && typeof t.count != "string", w = f1.hasDefaultValue(t),
|
|
7741
|
+
const x = t.count !== void 0 && typeof t.count != "string", w = f1.hasDefaultValue(t), B = x ? this.pluralResolver.getSuffix(g, t.count, t) : "", Z = t.ordinal && x ? this.pluralResolver.getSuffix(g, t.count, {
|
|
7740
7742
|
ordinal: !1
|
|
7741
|
-
}) : "",
|
|
7742
|
-
!this.isValidLookup(u) && w && (f = !0, u =
|
|
7743
|
-
const
|
|
7744
|
-
if (y || f ||
|
|
7745
|
-
if (this.logger.log(
|
|
7746
|
-
const
|
|
7743
|
+
}) : "", I = x && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), H = I && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${B}`] || t[`defaultValue${Z}`] || t.defaultValue;
|
|
7744
|
+
!this.isValidLookup(u) && w && (f = !0, u = H), this.isValidLookup(u) || (y = !0, u = c);
|
|
7745
|
+
const D = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && y ? void 0 : u, T = w && H !== u && this.options.updateMissing;
|
|
7746
|
+
if (y || f || T) {
|
|
7747
|
+
if (this.logger.log(T ? "updateKey" : "missingKey", g, d, c, T ? H : u), l) {
|
|
7748
|
+
const A = this.resolve(c, {
|
|
7747
7749
|
...t,
|
|
7748
7750
|
keySeparator: !1
|
|
7749
7751
|
});
|
|
7750
|
-
|
|
7752
|
+
A && A.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
7751
7753
|
}
|
|
7752
|
-
let
|
|
7754
|
+
let E = [];
|
|
7753
7755
|
const F = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
|
|
7754
7756
|
if (this.options.saveMissingTo === "fallback" && F && F[0])
|
|
7755
|
-
for (let
|
|
7756
|
-
|
|
7757
|
-
else this.options.saveMissingTo === "all" ?
|
|
7758
|
-
const
|
|
7759
|
-
const
|
|
7760
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(
|
|
7757
|
+
for (let A = 0; A < F.length; A++)
|
|
7758
|
+
E.push(F[A]);
|
|
7759
|
+
else this.options.saveMissingTo === "all" ? E = this.languageUtils.toResolveHierarchy(t.lng || this.language) : E.push(t.lng || this.language);
|
|
7760
|
+
const J = (A, O, Y) => {
|
|
7761
|
+
const U = w && Y !== u ? Y : D;
|
|
7762
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(A, d, O, U, T, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(A, d, O, U, T, t), this.emit("missingKey", A, d, O, u);
|
|
7761
7763
|
};
|
|
7762
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && x ?
|
|
7763
|
-
const
|
|
7764
|
-
|
|
7765
|
-
|
|
7764
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && x ? E.forEach((A) => {
|
|
7765
|
+
const O = this.pluralResolver.getSuffixes(A, t);
|
|
7766
|
+
I && t[`defaultValue${this.options.pluralSeparator}zero`] && O.indexOf(`${this.options.pluralSeparator}zero`) < 0 && O.push(`${this.options.pluralSeparator}zero`), O.forEach((Y) => {
|
|
7767
|
+
J([A], c + Y, t[`defaultValue${Y}`] || H);
|
|
7766
7768
|
});
|
|
7767
|
-
}) :
|
|
7769
|
+
}) : J(E, c, H));
|
|
7768
7770
|
}
|
|
7769
7771
|
u = this.extendTranslation(u, e, t, h, s), y && u === c && this.options.appendNamespaceToMissingKey && (u = `${d}:${c}`), (y || f) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? u = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${d}:${c}` : c, f ? u : void 0) : u = this.options.parseMissingKeyHandler(u));
|
|
7770
7772
|
}
|
|
@@ -7824,26 +7826,26 @@ class f1 extends w1 {
|
|
|
7824
7826
|
n = a;
|
|
7825
7827
|
let h = g.namespaces;
|
|
7826
7828
|
this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
|
|
7827
|
-
const u = t.count !== void 0 && typeof t.count != "string", p = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), N = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "",
|
|
7829
|
+
const u = t.count !== void 0 && typeof t.count != "string", p = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), N = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "", M = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
7828
7830
|
h.forEach((k) => {
|
|
7829
|
-
this.isValidLookup(s) || (o = k, !W1[`${
|
|
7831
|
+
this.isValidLookup(s) || (o = k, !W1[`${M[0]}-${k}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (W1[`${M[0]}-${k}`] = !0, this.logger.warn(`key "${n}" for languages "${M.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), M.forEach((b) => {
|
|
7830
7832
|
if (this.isValidLookup(s)) return;
|
|
7831
7833
|
c = b;
|
|
7832
|
-
const
|
|
7834
|
+
const R = [a];
|
|
7833
7835
|
if (this.i18nFormat && this.i18nFormat.addLookupKeys)
|
|
7834
|
-
this.i18nFormat.addLookupKeys(
|
|
7836
|
+
this.i18nFormat.addLookupKeys(R, a, b, k, t);
|
|
7835
7837
|
else {
|
|
7836
7838
|
let f;
|
|
7837
7839
|
u && (f = this.pluralResolver.getSuffix(b, t.count, t));
|
|
7838
7840
|
const y = `${this.options.pluralSeparator}zero`, x = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
7839
|
-
if (u && (
|
|
7841
|
+
if (u && (R.push(a + f), t.ordinal && f.indexOf(x) === 0 && R.push(a + f.replace(x, this.options.pluralSeparator)), p && R.push(a + y)), N) {
|
|
7840
7842
|
const w = `${a}${this.options.contextSeparator}${t.context}`;
|
|
7841
|
-
|
|
7843
|
+
R.push(w), u && (R.push(w + f), t.ordinal && f.indexOf(x) === 0 && R.push(w + f.replace(x, this.options.pluralSeparator)), p && R.push(w + y));
|
|
7842
7844
|
}
|
|
7843
7845
|
}
|
|
7844
|
-
let
|
|
7845
|
-
for (;
|
|
7846
|
-
this.isValidLookup(s) || (l =
|
|
7846
|
+
let S;
|
|
7847
|
+
for (; S = R.pop(); )
|
|
7848
|
+
this.isValidLookup(s) || (l = S, s = this.getResource(b, k, S, t));
|
|
7847
7849
|
}));
|
|
7848
7850
|
});
|
|
7849
7851
|
}), {
|
|
@@ -8141,7 +8143,7 @@ class w3 {
|
|
|
8141
8143
|
}
|
|
8142
8144
|
const T1 = function(i, e, t) {
|
|
8143
8145
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, l = r3(i, e, t);
|
|
8144
|
-
return !l && n && typeof t == "string" && (l =
|
|
8146
|
+
return !l && n && typeof t == "string" && (l = M1(i, t, s), l === void 0 && (l = M1(e, t, s))), l;
|
|
8145
8147
|
}, v1 = (i) => i.replace(/\$/g, "$$$$");
|
|
8146
8148
|
class m3 {
|
|
8147
8149
|
constructor() {
|
|
@@ -8167,12 +8169,12 @@ class m3 {
|
|
|
8167
8169
|
nestingPrefix: u,
|
|
8168
8170
|
nestingPrefixEscaped: p,
|
|
8169
8171
|
nestingSuffix: N,
|
|
8170
|
-
nestingSuffixEscaped:
|
|
8172
|
+
nestingSuffixEscaped: M,
|
|
8171
8173
|
nestingOptionsSeparator: k,
|
|
8172
8174
|
maxReplaces: b,
|
|
8173
|
-
alwaysFormat:
|
|
8175
|
+
alwaysFormat: R
|
|
8174
8176
|
} = e.interpolation;
|
|
8175
|
-
this.escape = t !== void 0 ? t : l3, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = l ? Q(l) : c || "{{", this.suffix = o ? Q(o) : d || "}}", this.formatSeparator = g || ",", this.unescapePrefix = a ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : a || "", this.nestingPrefix = u ? Q(u) : p || Q("$t("), this.nestingSuffix = N ? Q(N) :
|
|
8177
|
+
this.escape = t !== void 0 ? t : l3, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = l ? Q(l) : c || "{{", this.suffix = o ? Q(o) : d || "}}", this.formatSeparator = g || ",", this.unescapePrefix = a ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : a || "", this.nestingPrefix = u ? Q(u) : p || Q("$t("), this.nestingSuffix = N ? Q(N) : M || Q(")"), this.nestingOptionsSeparator = k || ",", this.maxReplaces = b || 1e3, this.alwaysFormat = R !== void 0 ? R : !1, this.resetRegExp();
|
|
8176
8178
|
}
|
|
8177
8179
|
reset() {
|
|
8178
8180
|
this.options && this.init(this.options);
|
|
@@ -8192,11 +8194,11 @@ class m3 {
|
|
|
8192
8194
|
interpolationkey: p
|
|
8193
8195
|
}) : b;
|
|
8194
8196
|
}
|
|
8195
|
-
const N = p.split(this.formatSeparator),
|
|
8196
|
-
return this.format(T1(t, d,
|
|
8197
|
+
const N = p.split(this.formatSeparator), M = N.shift().trim(), k = N.join(this.formatSeparator).trim();
|
|
8198
|
+
return this.format(T1(t, d, M, this.options.keySeparator, this.options.ignoreJSONStructure), k, s, {
|
|
8197
8199
|
...n,
|
|
8198
8200
|
...t,
|
|
8199
|
-
interpolationkey:
|
|
8201
|
+
interpolationkey: M
|
|
8200
8202
|
});
|
|
8201
8203
|
};
|
|
8202
8204
|
this.resetRegExp();
|
|
@@ -8222,8 +8224,8 @@ class m3 {
|
|
|
8222
8224
|
} else
|
|
8223
8225
|
this.logger.warn(`missed to pass in variable ${N} for interpolating ${e}`), c = "";
|
|
8224
8226
|
else typeof c != "string" && !this.useRawValueToEscape && (c = O1(c));
|
|
8225
|
-
const
|
|
8226
|
-
if (e = e.replace(l[0],
|
|
8227
|
+
const M = p.safeValue(c);
|
|
8228
|
+
if (e = e.replace(l[0], M), h ? (p.regex.lastIndex += c.length, p.regex.lastIndex -= l[0].length) : p.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
8227
8229
|
break;
|
|
8228
8230
|
}
|
|
8229
8231
|
}), e;
|
|
@@ -8243,8 +8245,8 @@ class m3 {
|
|
|
8243
8245
|
...g,
|
|
8244
8246
|
...c
|
|
8245
8247
|
});
|
|
8246
|
-
} catch (
|
|
8247
|
-
return this.logger.warn(`failed parsing options string in nesting for key ${d}`,
|
|
8248
|
+
} catch (M) {
|
|
8249
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${d}`, M), `${d}${a}${u}`;
|
|
8248
8250
|
}
|
|
8249
8251
|
return c.defaultValue && c.defaultValue.indexOf(this.prefix) > -1 && delete c.defaultValue, d;
|
|
8250
8252
|
};
|
|
@@ -8619,13 +8621,13 @@ class n1 extends w1 {
|
|
|
8619
8621
|
}), a && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter = l(a), u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new m3(this.options), u.utils = {
|
|
8620
8622
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
8621
8623
|
}, u.backendConnector = new N3(l(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(p) {
|
|
8622
|
-
for (var N = arguments.length,
|
|
8623
|
-
|
|
8624
|
-
e.emit(p, ...
|
|
8624
|
+
for (var N = arguments.length, M = new Array(N > 1 ? N - 1 : 0), k = 1; k < N; k++)
|
|
8625
|
+
M[k - 1] = arguments[k];
|
|
8626
|
+
e.emit(p, ...M);
|
|
8625
8627
|
}), this.modules.languageDetector && (u.languageDetector = l(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = l(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new f1(this.services, this.options), this.translator.on("*", function(p) {
|
|
8626
|
-
for (var N = arguments.length,
|
|
8627
|
-
|
|
8628
|
-
e.emit(p, ...
|
|
8628
|
+
for (var N = arguments.length, M = new Array(N > 1 ? N - 1 : 0), k = 1; k < N; k++)
|
|
8629
|
+
M[k - 1] = arguments[k];
|
|
8630
|
+
e.emit(p, ...M);
|
|
8629
8631
|
}), this.modules.external.forEach((p) => {
|
|
8630
8632
|
p.init && p.init(this);
|
|
8631
8633
|
});
|
|
@@ -8832,9 +8834,9 @@ j.setDefaultNamespace;
|
|
|
8832
8834
|
j.hasLoadedNamespace;
|
|
8833
8835
|
j.loadNamespaces;
|
|
8834
8836
|
j.loadLanguages;
|
|
8835
|
-
const
|
|
8836
|
-
archived:
|
|
8837
|
-
deleted:
|
|
8837
|
+
const M3 = "Archived", R3 = "Deleted", y3 = {
|
|
8838
|
+
archived: M3,
|
|
8839
|
+
deleted: R3
|
|
8838
8840
|
}, b3 = "Заархивирован", E3 = "Удалён", H3 = {
|
|
8839
8841
|
archived: b3,
|
|
8840
8842
|
deleted: E3
|
|
@@ -8862,44 +8864,44 @@ const B3 = o1(
|
|
|
8862
8864
|
onError: c,
|
|
8863
8865
|
allowEmpty: o = !1
|
|
8864
8866
|
}, d) => {
|
|
8865
|
-
const { axiosPeople: g, locale: a } = a1(pe), { t: h } = e3("common", { lng: a }), [u, p] =
|
|
8867
|
+
const { axiosPeople: g, locale: a } = a1(pe), { t: h } = e3("common", { lng: a }), [u, p] = W([]), [N, M] = W(!0), k = l1(u);
|
|
8866
8868
|
if (!g)
|
|
8867
8869
|
throw new Error(
|
|
8868
8870
|
`UserSelect requires "axiosPeople" to fetch users.
|
|
8869
8871
|
Please provide it via SNMTUiContext.`
|
|
8870
8872
|
);
|
|
8871
|
-
const b =
|
|
8873
|
+
const b = G(
|
|
8872
8874
|
(x) => {
|
|
8873
8875
|
let w = "";
|
|
8874
8876
|
return x.deletedAt && (w += `[${h("deleted")}] `), x.status === g1.ARCHIVED && (w += `[${h("archived")}] `), `${w}${x.firstName} ${x.lastName}`;
|
|
8875
8877
|
},
|
|
8876
8878
|
[h]
|
|
8877
|
-
),
|
|
8879
|
+
), R = G(
|
|
8878
8880
|
async ({
|
|
8879
8881
|
offset: x,
|
|
8880
8882
|
limit: w,
|
|
8881
|
-
search:
|
|
8883
|
+
search: B
|
|
8882
8884
|
}) => {
|
|
8883
|
-
var Z,
|
|
8885
|
+
var Z, I, H;
|
|
8884
8886
|
try {
|
|
8885
|
-
const
|
|
8887
|
+
const V = await g.post("v1/users/search", {
|
|
8886
8888
|
offset: x,
|
|
8887
8889
|
limit: w,
|
|
8888
|
-
search:
|
|
8890
|
+
search: B,
|
|
8889
8891
|
...i,
|
|
8890
8892
|
includeCount: !0
|
|
8891
|
-
}), { data:
|
|
8893
|
+
}), { data: D, metadata: T } = V.data;
|
|
8892
8894
|
return {
|
|
8893
|
-
options:
|
|
8894
|
-
value:
|
|
8895
|
-
label: b(
|
|
8895
|
+
options: D.map((E) => ({
|
|
8896
|
+
value: E.id,
|
|
8897
|
+
label: b(E)
|
|
8896
8898
|
})),
|
|
8897
|
-
count:
|
|
8899
|
+
count: T.count
|
|
8898
8900
|
};
|
|
8899
|
-
} catch (
|
|
8901
|
+
} catch (V) {
|
|
8900
8902
|
return c && c({
|
|
8901
|
-
status: ((Z =
|
|
8902
|
-
message: ((
|
|
8903
|
+
status: ((Z = V.response) == null ? void 0 : Z.status) ?? 500,
|
|
8904
|
+
message: ((H = (I = V.response) == null ? void 0 : I.data) == null ? void 0 : H.message) ?? "Error while fetching options"
|
|
8903
8905
|
}), {
|
|
8904
8906
|
options: [],
|
|
8905
8907
|
count: 0
|
|
@@ -8907,29 +8909,29 @@ const B3 = o1(
|
|
|
8907
8909
|
}
|
|
8908
8910
|
},
|
|
8909
8911
|
[g, i, c, b]
|
|
8910
|
-
),
|
|
8912
|
+
), S = G(
|
|
8911
8913
|
async (x) => {
|
|
8912
|
-
var w,
|
|
8914
|
+
var w, B, Z;
|
|
8913
8915
|
try {
|
|
8914
|
-
const
|
|
8915
|
-
(
|
|
8916
|
+
const I = x.filter(
|
|
8917
|
+
(D) => !k.current.some((T) => T.value === D)
|
|
8916
8918
|
);
|
|
8917
|
-
let
|
|
8918
|
-
|
|
8919
|
+
let H = [];
|
|
8920
|
+
I.length && (H = (await g.post("v1/users/search", {
|
|
8919
8921
|
filters: {
|
|
8920
|
-
id:
|
|
8922
|
+
id: I,
|
|
8921
8923
|
status: [g1.ACTIVE, g1.ARCHIVED]
|
|
8922
8924
|
}
|
|
8923
8925
|
})).data.data);
|
|
8924
|
-
const
|
|
8925
|
-
value:
|
|
8926
|
-
label: b(
|
|
8926
|
+
const V = H.map((D) => ({
|
|
8927
|
+
value: D.id,
|
|
8928
|
+
label: b(D)
|
|
8927
8929
|
}));
|
|
8928
|
-
return [...k.current, ...
|
|
8929
|
-
} catch (
|
|
8930
|
+
return [...k.current, ...V];
|
|
8931
|
+
} catch (I) {
|
|
8930
8932
|
return c && c({
|
|
8931
|
-
status: ((w =
|
|
8932
|
-
message: ((Z = (
|
|
8933
|
+
status: ((w = I.response) == null ? void 0 : w.status) ?? 500,
|
|
8934
|
+
message: ((Z = (B = I.response) == null ? void 0 : B.data) == null ? void 0 : Z.message) ?? "Error while fetching selected items"
|
|
8933
8935
|
}), [];
|
|
8934
8936
|
}
|
|
8935
8937
|
},
|
|
@@ -8939,33 +8941,33 @@ const B3 = o1(
|
|
|
8939
8941
|
k.current = u;
|
|
8940
8942
|
}, [u]), K(() => {
|
|
8941
8943
|
if (!n) {
|
|
8942
|
-
|
|
8944
|
+
M(!1);
|
|
8943
8945
|
return;
|
|
8944
8946
|
}
|
|
8945
8947
|
(async () => {
|
|
8946
|
-
const w = Array.isArray(n) ? n : [n],
|
|
8947
|
-
p(
|
|
8948
|
+
const w = Array.isArray(n) ? n : [n], B = await S(w);
|
|
8949
|
+
p(B), M(!1);
|
|
8948
8950
|
})();
|
|
8949
|
-
}, [
|
|
8950
|
-
const f =
|
|
8951
|
+
}, [S, n]);
|
|
8952
|
+
const f = G(
|
|
8951
8953
|
async ({
|
|
8952
8954
|
limit: x,
|
|
8953
8955
|
offset: w,
|
|
8954
|
-
search:
|
|
8956
|
+
search: B
|
|
8955
8957
|
}) => {
|
|
8956
|
-
const { count: Z, ...
|
|
8958
|
+
const { count: Z, ...I } = await R({
|
|
8957
8959
|
offset: w,
|
|
8958
8960
|
limit: x,
|
|
8959
|
-
search:
|
|
8961
|
+
search: B
|
|
8960
8962
|
});
|
|
8961
|
-
let
|
|
8962
|
-
return o && w === 0 && (
|
|
8963
|
-
options:
|
|
8963
|
+
let H = I.options;
|
|
8964
|
+
return o && w === 0 && (H = [{ value: null, label: "None" }, ...H]), {
|
|
8965
|
+
options: H,
|
|
8964
8966
|
count: Z,
|
|
8965
8967
|
limit: x
|
|
8966
8968
|
};
|
|
8967
8969
|
},
|
|
8968
|
-
[o,
|
|
8970
|
+
[o, R]
|
|
8969
8971
|
);
|
|
8970
8972
|
if (N)
|
|
8971
8973
|
return /* @__PURE__ */ r(B5, {});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snmt-react-ui/user-select",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/user-select.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "tsc && vite build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@snmt-react-ui/async-select": "^1.
|
|
21
|
+
"@snmt-react-ui/async-select": "^1.6.0",
|
|
22
22
|
"@snmt-react-ui/core": "^2.1.0",
|
|
23
23
|
"@snmt-react-ui/loader": "^1.4.0",
|
|
24
24
|
"@snmt-react-ui/select": "^1.14.0"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"i18next": "^23.11.1",
|
|
29
29
|
"react-i18next": "^14.1.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "a980976c645c51a1f9f8441a30d086e54736e823"
|
|
32
32
|
}
|