@snmt-react-ui/async-select 1.5.2 → 1.5.3
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/async-select.js +53 -53
- package/package.json +3 -3
package/dist/async-select.js
CHANGED
|
@@ -6780,25 +6780,25 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6780
6780
|
extraOptions: _,
|
|
6781
6781
|
dropdownRender: A,
|
|
6782
6782
|
optionRender: G,
|
|
6783
|
-
isLoading:
|
|
6784
|
-
readOnly:
|
|
6785
|
-
},
|
|
6786
|
-
const [
|
|
6783
|
+
isLoading: D,
|
|
6784
|
+
readOnly: f
|
|
6785
|
+
}, j) => {
|
|
6786
|
+
const [T, y] = u(!1), [S, R] = u(!1), [Z, Y] = u(!0), [v, K] = u(i), O = r1(null);
|
|
6787
6787
|
E(() => {
|
|
6788
|
-
|
|
6788
|
+
K(i);
|
|
6789
6789
|
}, [i]);
|
|
6790
6790
|
const m = (a) => {
|
|
6791
|
-
|
|
6791
|
+
y(a), n && n(a);
|
|
6792
6792
|
}, J = (a, L) => {
|
|
6793
6793
|
var M;
|
|
6794
6794
|
return !!((M = L == null ? void 0 : L.label) != null && M.toString().toLowerCase().includes(a.toLowerCase()));
|
|
6795
6795
|
}, Q = () => {
|
|
6796
6796
|
R(!0);
|
|
6797
|
-
},
|
|
6797
|
+
}, b = () => {
|
|
6798
6798
|
R(!1);
|
|
6799
|
-
},
|
|
6799
|
+
}, N = x(
|
|
6800
6800
|
(a) => {
|
|
6801
|
-
if (
|
|
6801
|
+
if (K(a), l) {
|
|
6802
6802
|
const M = a;
|
|
6803
6803
|
o == null || o(M);
|
|
6804
6804
|
return;
|
|
@@ -6808,19 +6808,19 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6808
6808
|
},
|
|
6809
6809
|
[l, o]
|
|
6810
6810
|
), k1 = x(() => {
|
|
6811
|
-
if (!
|
|
6811
|
+
if (!f) {
|
|
6812
6812
|
if (l) {
|
|
6813
|
-
|
|
6813
|
+
N([]);
|
|
6814
6814
|
return;
|
|
6815
6815
|
}
|
|
6816
|
-
|
|
6816
|
+
N("");
|
|
6817
6817
|
}
|
|
6818
|
-
}, [
|
|
6818
|
+
}, [N, l, f]), U = x(
|
|
6819
6819
|
(a) => {
|
|
6820
6820
|
const L = v.filter((M) => M !== a);
|
|
6821
|
-
|
|
6821
|
+
N(L), K(L);
|
|
6822
6822
|
},
|
|
6823
|
-
[
|
|
6823
|
+
[N, v]
|
|
6824
6824
|
), i1 = x(
|
|
6825
6825
|
(a) => (v == null ? void 0 : v.indexOf(a)) === 0 ? (
|
|
6826
6826
|
// if the search input is empty
|
|
@@ -6849,14 +6849,14 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6849
6849
|
{
|
|
6850
6850
|
values: a,
|
|
6851
6851
|
onTagClose: U,
|
|
6852
|
-
maxWidth: ((L =
|
|
6853
|
-
disabled: s ||
|
|
6852
|
+
maxWidth: ((L = O.current) == null ? void 0 : L.clientWidth) || 0,
|
|
6853
|
+
disabled: s || f,
|
|
6854
6854
|
options: w,
|
|
6855
6855
|
extraOptions: _
|
|
6856
6856
|
}
|
|
6857
6857
|
);
|
|
6858
6858
|
},
|
|
6859
|
-
[s, _, U, w,
|
|
6859
|
+
[s, _, U, w, f]
|
|
6860
6860
|
), m1 = x(
|
|
6861
6861
|
({ label: a, value: L, mode: M }) => M === "filter" ? i1(L) : /* @__PURE__ */ t("div", { onMouseDown: g1, className: "tag-wrapper", children: /* @__PURE__ */ t(C1, { onClose: () => U(L), closable: !s, children: /* @__PURE__ */ t(w1, { variant: "body4", children: typeof a == "object" ? a : X(L) }) }) }),
|
|
6862
6862
|
[s, X, U, i1]
|
|
@@ -6865,17 +6865,17 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6865
6865
|
"div",
|
|
6866
6866
|
{
|
|
6867
6867
|
className: `snmt-select ${S ? "snmt-select-focused" : ""}
|
|
6868
|
-
${l ? "" : "snmt-select-single"} ${
|
|
6869
|
-
ref:
|
|
6868
|
+
${l ? "" : "snmt-select-single"} ${f ? "snmt-select-read-only" : ""}`,
|
|
6869
|
+
ref: O,
|
|
6870
6870
|
style: { width: g },
|
|
6871
6871
|
children: [
|
|
6872
6872
|
/* @__PURE__ */ t(
|
|
6873
6873
|
v1,
|
|
6874
6874
|
{
|
|
6875
6875
|
className: "snmt-select-blank",
|
|
6876
|
-
popupClassName:
|
|
6876
|
+
popupClassName: f ? "dropdown-read-only" : "",
|
|
6877
6877
|
id: V,
|
|
6878
|
-
ref:
|
|
6878
|
+
ref: j,
|
|
6879
6879
|
showSearch: !!r,
|
|
6880
6880
|
filterOption: r && J,
|
|
6881
6881
|
onDropdownVisibleChange: m,
|
|
@@ -6884,19 +6884,19 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6884
6884
|
value: v || void 0,
|
|
6885
6885
|
labelRender: (a) => X(a.value),
|
|
6886
6886
|
mode: l === "filter" ? "multiple" : l,
|
|
6887
|
-
onChange:
|
|
6887
|
+
onChange: N,
|
|
6888
6888
|
onFocus: Q,
|
|
6889
|
-
onBlur:
|
|
6889
|
+
onBlur: b,
|
|
6890
6890
|
onSearch: (a) => {
|
|
6891
|
-
|
|
6891
|
+
Y(!a), h && h(a);
|
|
6892
6892
|
},
|
|
6893
|
-
onSelect: () =>
|
|
6894
|
-
onDeselect: () =>
|
|
6893
|
+
onSelect: () => Y(!0),
|
|
6894
|
+
onDeselect: () => Y(!0),
|
|
6895
6895
|
tagRender: (a) => m1({ ...a, mode: l }),
|
|
6896
6896
|
maxTagCount: "responsive",
|
|
6897
6897
|
maxTagPlaceholder: L1,
|
|
6898
6898
|
onPopupScroll: p1,
|
|
6899
|
-
prefix:
|
|
6899
|
+
prefix: D && /* @__PURE__ */ t(t1, { size: 15 }),
|
|
6900
6900
|
suffixIcon: /* @__PURE__ */ t("div", { className: "wrapper-suffix-icon", children: l !== "filter" && /* @__PURE__ */ c(I, { children: [
|
|
6901
6901
|
l && v && !!v.length && /* @__PURE__ */ t("div", { onClick: k1, children: /* @__PURE__ */ t(P, { name: "cancel" }) }),
|
|
6902
6902
|
/* @__PURE__ */ t(
|
|
@@ -6904,8 +6904,8 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6904
6904
|
{
|
|
6905
6905
|
name: "selectArrowIcon",
|
|
6906
6906
|
color: s ? W.GREY_DARK_1 : W.GREY_DARK_5,
|
|
6907
|
-
className:
|
|
6908
|
-
onClick: () =>
|
|
6907
|
+
className: T ? "select-arrow-rotated" : "select-arrow",
|
|
6908
|
+
onClick: () => y(!T)
|
|
6909
6909
|
}
|
|
6910
6910
|
)
|
|
6911
6911
|
] }) }),
|
|
@@ -6934,7 +6934,7 @@ const C1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6934
6934
|
}
|
|
6935
6935
|
)
|
|
6936
6936
|
] }),
|
|
6937
|
-
dropdownRender:
|
|
6937
|
+
dropdownRender: D ? () => /* @__PURE__ */ t(
|
|
6938
6938
|
"div",
|
|
6939
6939
|
{
|
|
6940
6940
|
style: {
|
|
@@ -6973,7 +6973,7 @@ function O3(i, o = 500) {
|
|
|
6973
6973
|
clearTimeout(e.current), e.current = w;
|
|
6974
6974
|
};
|
|
6975
6975
|
}
|
|
6976
|
-
const
|
|
6976
|
+
const F = {
|
|
6977
6977
|
limit: 100,
|
|
6978
6978
|
offset: 0
|
|
6979
6979
|
}, $3 = q(
|
|
@@ -6994,34 +6994,34 @@ const b = {
|
|
|
6994
6994
|
dropdownRender: B,
|
|
6995
6995
|
readOnly: V
|
|
6996
6996
|
}, _) => {
|
|
6997
|
-
const [A, G] = u([]), [
|
|
6997
|
+
const [A, G] = u([]), [D, f] = u(F), [j, T] = u(!1), [y, S] = u(null), R = x(
|
|
6998
6998
|
async (m = !1, J) => {
|
|
6999
|
-
if (!
|
|
7000
|
-
|
|
6999
|
+
if (!j) {
|
|
7000
|
+
T(!0);
|
|
7001
7001
|
try {
|
|
7002
|
-
const Q = m ? { ...
|
|
7002
|
+
const Q = m ? { ...F, search: J } : D, b = await i(Q);
|
|
7003
7003
|
G(
|
|
7004
|
-
(
|
|
7005
|
-
), S(
|
|
7006
|
-
...
|
|
7007
|
-
offset:
|
|
7004
|
+
(N) => m ? b.options : [...N, ...b.options]
|
|
7005
|
+
), S(b.count), f((N) => ({
|
|
7006
|
+
...N,
|
|
7007
|
+
offset: N.offset + N.limit
|
|
7008
7008
|
}));
|
|
7009
7009
|
} finally {
|
|
7010
|
-
|
|
7010
|
+
T(!1);
|
|
7011
7011
|
}
|
|
7012
7012
|
}
|
|
7013
7013
|
},
|
|
7014
|
-
[
|
|
7015
|
-
), Z = O3(R),
|
|
7014
|
+
[D, i, j]
|
|
7015
|
+
), Z = O3(R), Y = x(
|
|
7016
7016
|
(m) => {
|
|
7017
|
-
m === "" || m === void 0 || m === null ? (
|
|
7017
|
+
m === "" || m === void 0 || m === null ? (f(F), Z(!0)) : Z(!0, m);
|
|
7018
7018
|
},
|
|
7019
7019
|
[Z]
|
|
7020
7020
|
), v = async (m) => {
|
|
7021
|
-
m &&
|
|
7022
|
-
},
|
|
7021
|
+
m && y !== null && y > A.length && await R(!1);
|
|
7022
|
+
}, K = x(
|
|
7023
7023
|
(m) => {
|
|
7024
|
-
m && !k && (G([]),
|
|
7024
|
+
m && !k && (G([]), f(F), R(!0)), n == null || n(m);
|
|
7025
7025
|
},
|
|
7026
7026
|
// eslint-disable-next-line
|
|
7027
7027
|
[k]
|
|
@@ -7029,7 +7029,7 @@ const b = {
|
|
|
7029
7029
|
E(() => {
|
|
7030
7030
|
k && R(!1);
|
|
7031
7031
|
}, []);
|
|
7032
|
-
const
|
|
7032
|
+
const O = {
|
|
7033
7033
|
id: r,
|
|
7034
7034
|
width: o,
|
|
7035
7035
|
options: A,
|
|
@@ -7038,23 +7038,23 @@ const b = {
|
|
|
7038
7038
|
placeholder: s,
|
|
7039
7039
|
search: !0,
|
|
7040
7040
|
value: l,
|
|
7041
|
-
onSearchChange:
|
|
7042
|
-
onDropdownVisibleChange:
|
|
7041
|
+
onSearchChange: Y,
|
|
7042
|
+
onDropdownVisibleChange: K,
|
|
7043
7043
|
scrollThresholdValue: g,
|
|
7044
7044
|
onScrollToEnd: v,
|
|
7045
7045
|
loadOnClosedState: k,
|
|
7046
7046
|
disabled: w,
|
|
7047
7047
|
extraOptions: h,
|
|
7048
|
-
isLoading:
|
|
7048
|
+
isLoading: j,
|
|
7049
7049
|
optionRender: H,
|
|
7050
7050
|
dropdownRender: B,
|
|
7051
7051
|
readOnly: V
|
|
7052
7052
|
};
|
|
7053
7053
|
return u1(_, () => ({
|
|
7054
7054
|
refetchOptions: async () => {
|
|
7055
|
-
|
|
7055
|
+
f(F), await R(!0);
|
|
7056
7056
|
}
|
|
7057
|
-
})), p ? /* @__PURE__ */ t(l1, { ...
|
|
7057
|
+
})), p ? /* @__PURE__ */ t(l1, { ...O, onChange: e, value: l, mode: p }) : /* @__PURE__ */ t("div", { className: "snmt-async-select", children: /* @__PURE__ */ t(l1, { ...O, onChange: e, value: l }) });
|
|
7058
7058
|
}
|
|
7059
7059
|
);
|
|
7060
7060
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snmt-react-ui/async-select",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/async-select.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"build": "tsc && vite build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@snmt-react-ui/select": "^1.13.
|
|
21
|
+
"@snmt-react-ui/select": "^1.13.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"antd": "^5.18.3"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "87f6c40269debe98b4f49c9a61be7437ea9e38bd"
|
|
27
27
|
}
|