@snmt-react-ui/async-select 1.5.6 → 1.6.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.
- package/dist/async-select.js +141 -139
- package/package.json +2 -2
package/dist/async-select.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import { jsx as t, Fragment as
|
|
3
|
-
import { createContext as
|
|
2
|
+
import { jsx as t, Fragment as I, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as z, forwardRef as q, useState as u, useRef as s1, useEffect as E, useCallback as x, useContext as i1, useImperativeHandle as v1 } from "react";
|
|
4
4
|
import { Select as N1, Flex as f1, Avatar as M1, Checkbox as x1, Typography as n1, Tag as h1, Popover as _1 } from "antd";
|
|
5
|
-
const
|
|
5
|
+
const $ = ({
|
|
6
6
|
children: i,
|
|
7
7
|
direction: o = "row",
|
|
8
8
|
flexWrap: e = "nowrap",
|
|
@@ -38,8 +38,8 @@ const z = ({
|
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
|
-
var
|
|
42
|
-
const c1 =
|
|
41
|
+
var W = /* @__PURE__ */ ((i) => (i.GREY_LIGHT_0 = "var(--grey-light-0)", i.GREY_LIGHT_1 = "var(--grey-light-1)", i.GREY_LIGHT_2 = "var(--grey-light-2)", i.GREY_LIGHT_3 = "var(--grey-light-3)", i.GREY_LIGHT_4 = "var(--grey-light-4)", i.GREY_DARK_1 = "var(--grey-dark-1)", i.GREY_DARK_2 = "var(--grey-dark-2)", i.GREY_DARK_3 = "var(--grey-dark-3)", i.GREY_DARK_4 = "var(--grey-dark-4)", i.GREY_DARK_5 = "var(--grey-dark-5)", i.BLUE_PRIMARY = "var(--blue-primary)", i.BLUE_HOVER = "var(--blue-hover)", i.BLUE_LIGHT_1 = "var(--blue-light-1)", i.BLUE_LIGHT_2 = "var(--blue-light-2)", i.BLUE_LIGHT_3 = "var(--blue-light-3)", i.BLUE_LIGHT_4 = "var(--blue-light-4)", i.BLUE_DARK_1 = "var(--blue-dark-1)", i.PURPLE_LIGHT = "var(--purple-light)", i.PURPLE_DARK = "var(--purple-dark)", i.NOTIFICATION_WARNING_LIGHT = "var(--notification-warning-light)", i.NOTIFICATION_WARNING_DARK = "var(--notification-warning-dark)", i.NOTIFICATION_SUCCESS_LIGHT = "var(--notification-success-light)", i.NOTIFICATION_SUCCESS_DARK = "var(--notification-success-dark)", i.NOTIFICATION_ERROR_LIGHT = "var(--notification-error-light)", i.NOTIFICATION_ERROR_DARK = "var(--notification-error-dark)", i.NOTIFICATION_ERROR_DARK_MODE = "var(--notification-error-dark-mode)", i))(W || {});
|
|
42
|
+
const c1 = z({
|
|
43
43
|
locale: "en",
|
|
44
44
|
theme: "light"
|
|
45
45
|
});
|
|
@@ -53,7 +53,7 @@ const H1 = ({
|
|
|
53
53
|
disableUncheck: w = !1
|
|
54
54
|
}) => {
|
|
55
55
|
const [g, s] = u(i), [p, k] = u(o);
|
|
56
|
-
|
|
56
|
+
E(() => {
|
|
57
57
|
s(i), k(o);
|
|
58
58
|
}, [i, o]);
|
|
59
59
|
const { theme: h } = i1(c1);
|
|
@@ -72,7 +72,7 @@ const H1 = ({
|
|
|
72
72
|
);
|
|
73
73
|
};
|
|
74
74
|
var C = /* @__PURE__ */ ((i) => (i.GREY_LIGHT_0 = "var(--grey-light-0)", i.GREY_LIGHT_1 = "var(--grey-light-1)", i.GREY_LIGHT_2 = "var(--grey-light-2)", i.GREY_LIGHT_3 = "var(--grey-light-3)", i.GREY_LIGHT_4 = "var(--grey-light-4)", i.GREY_DARK_1 = "var(--grey-dark-1)", i.GREY_DARK_2 = "var(--grey-dark-2)", i.GREY_DARK_3 = "var(--grey-dark-3)", i.GREY_DARK_4 = "var(--grey-dark-4)", i.GREY_DARK_5 = "var(--grey-dark-5)", i.BLUE_PRIMARY = "var(--blue-primary)", i.BLUE_HOVER = "var(--blue-hover)", i.BLUE_LIGHT_1 = "var(--blue-light-1)", i.BLUE_LIGHT_2 = "var(--blue-light-2)", i.BLUE_LIGHT_3 = "var(--blue-light-3)", i.BLUE_LIGHT_4 = "var(--blue-light-4)", i.BLUE_DARK_1 = "var(--blue-dark-1)", i.PURPLE_LIGHT = "var(--purple-light)", i.PURPLE_DARK = "var(--purple-dark)", i.NOTIFICATION_WARNING_LIGHT = "var(--notification-warning-light)", i.NOTIFICATION_WARNING_DARK = "var(--notification-warning-dark)", i.NOTIFICATION_SUCCESS_LIGHT = "var(--notification-success-light)", i.NOTIFICATION_SUCCESS_DARK = "var(--notification-success-dark)", i.NOTIFICATION_ERROR_LIGHT = "var(--notification-error-light)", i.NOTIFICATION_ERROR_DARK = "var(--notification-error-dark)", i.NOTIFICATION_ERROR_DARK_MODE = "var(--notification-error-dark-mode)", i))(C || {});
|
|
75
|
-
const a1 =
|
|
75
|
+
const a1 = z({
|
|
76
76
|
locale: "en",
|
|
77
77
|
theme: "light"
|
|
78
78
|
});
|
|
@@ -3120,7 +3120,7 @@ const V1 = ({
|
|
|
3120
3120
|
}
|
|
3121
3121
|
)
|
|
3122
3122
|
}
|
|
3123
|
-
),
|
|
3123
|
+
), P = ({
|
|
3124
3124
|
name: i,
|
|
3125
3125
|
width: o,
|
|
3126
3126
|
height: e,
|
|
@@ -3130,13 +3130,13 @@ const V1 = ({
|
|
|
3130
3130
|
onClick: g
|
|
3131
3131
|
}) => {
|
|
3132
3132
|
const [s, p] = u(r), { theme: k } = i1(a1), h = w ? k && k === "dark" ? C.GREY_LIGHT_4 : C.GREY_DARK_1 : l, n = w ? void 0 : g;
|
|
3133
|
-
return
|
|
3133
|
+
return E(() => {
|
|
3134
3134
|
if (r) {
|
|
3135
3135
|
n && !w && p(`${r} clickable`);
|
|
3136
3136
|
return;
|
|
3137
3137
|
}
|
|
3138
3138
|
n && !w && p("clickable");
|
|
3139
|
-
}, [n, r, w]), /* @__PURE__ */ t(
|
|
3139
|
+
}, [n, r, w]), /* @__PURE__ */ t(I, { children: (() => {
|
|
3140
3140
|
switch (i) {
|
|
3141
3141
|
case "nextIcon":
|
|
3142
3142
|
return v2({ width: o, height: e, color: h, className: s, onClick: n });
|
|
@@ -3379,7 +3379,7 @@ const V1 = ({
|
|
|
3379
3379
|
case "projects":
|
|
3380
3380
|
return t5({ width: o, height: e, color: h, className: s, onClick: n });
|
|
3381
3381
|
default:
|
|
3382
|
-
return /* @__PURE__ */ t(
|
|
3382
|
+
return /* @__PURE__ */ t(I, { children: "No Icon provided" });
|
|
3383
3383
|
}
|
|
3384
3384
|
})() });
|
|
3385
3385
|
}, { Title: l5, Text: r5 } = n1, s5 = {
|
|
@@ -3387,7 +3387,7 @@ const V1 = ({
|
|
|
3387
3387
|
h2: 2,
|
|
3388
3388
|
h3: 3,
|
|
3389
3389
|
h4: 4
|
|
3390
|
-
}, n5 =
|
|
3390
|
+
}, n5 = q(
|
|
3391
3391
|
({
|
|
3392
3392
|
align: i = "inherit",
|
|
3393
3393
|
variant: o = "body1",
|
|
@@ -3422,7 +3422,7 @@ const V1 = ({
|
|
|
3422
3422
|
}
|
|
3423
3423
|
);
|
|
3424
3424
|
var d = /* @__PURE__ */ ((i) => (i.GREY_LIGHT_0 = "var(--grey-light-0)", i.GREY_LIGHT_1 = "var(--grey-light-1)", i.GREY_LIGHT_2 = "var(--grey-light-2)", i.GREY_LIGHT_3 = "var(--grey-light-3)", i.GREY_LIGHT_4 = "var(--grey-light-4)", i.GREY_DARK_1 = "var(--grey-dark-1)", i.GREY_DARK_2 = "var(--grey-dark-2)", i.GREY_DARK_3 = "var(--grey-dark-3)", i.GREY_DARK_4 = "var(--grey-dark-4)", i.GREY_DARK_5 = "var(--grey-dark-5)", i.BLUE_PRIMARY = "var(--blue-primary)", i.BLUE_HOVER = "var(--blue-hover)", i.BLUE_LIGHT_1 = "var(--blue-light-1)", i.BLUE_LIGHT_2 = "var(--blue-light-2)", i.BLUE_LIGHT_3 = "var(--blue-light-3)", i.BLUE_LIGHT_4 = "var(--blue-light-4)", i.BLUE_DARK_1 = "var(--blue-dark-1)", i.PURPLE_LIGHT = "var(--purple-light)", i.PURPLE_DARK = "var(--purple-dark)", i.NOTIFICATION_WARNING_LIGHT = "var(--notification-warning-light)", i.NOTIFICATION_WARNING_DARK = "var(--notification-warning-dark)", i.NOTIFICATION_SUCCESS_LIGHT = "var(--notification-success-light)", i.NOTIFICATION_SUCCESS_DARK = "var(--notification-success-dark)", i.NOTIFICATION_ERROR_LIGHT = "var(--notification-error-light)", i.NOTIFICATION_ERROR_DARK = "var(--notification-error-dark)", i.NOTIFICATION_ERROR_DARK_MODE = "var(--notification-error-dark-mode)", i))(d || {});
|
|
3425
|
-
const C1 =
|
|
3425
|
+
const C1 = z({
|
|
3426
3426
|
locale: "en",
|
|
3427
3427
|
theme: "light"
|
|
3428
3428
|
});
|
|
@@ -6480,13 +6480,13 @@ const h5 = ({
|
|
|
6480
6480
|
onClick: g
|
|
6481
6481
|
}) => {
|
|
6482
6482
|
const [s, p] = u(r), { theme: k } = i1(C1), h = w ? k && k === "dark" ? d.GREY_LIGHT_4 : d.GREY_DARK_1 : l, n = w ? void 0 : g;
|
|
6483
|
-
return
|
|
6483
|
+
return E(() => {
|
|
6484
6484
|
if (r) {
|
|
6485
6485
|
n && !w && p(`${r} clickable`);
|
|
6486
6486
|
return;
|
|
6487
6487
|
}
|
|
6488
6488
|
n && !w && p("clickable");
|
|
6489
|
-
}, [n, r, w]), /* @__PURE__ */ t(
|
|
6489
|
+
}, [n, r, w]), /* @__PURE__ */ t(I, { children: (() => {
|
|
6490
6490
|
switch (i) {
|
|
6491
6491
|
case "nextIcon":
|
|
6492
6492
|
return e3({ width: o, height: e, color: h, className: s, onClick: n });
|
|
@@ -6729,12 +6729,12 @@ const h5 = ({
|
|
|
6729
6729
|
case "projects":
|
|
6730
6730
|
return j3({ width: o, height: e, color: h, className: s, onClick: n });
|
|
6731
6731
|
default:
|
|
6732
|
-
return /* @__PURE__ */ t(
|
|
6732
|
+
return /* @__PURE__ */ t(I, { children: "No Icon provided" });
|
|
6733
6733
|
}
|
|
6734
6734
|
})() });
|
|
6735
6735
|
};
|
|
6736
6736
|
var d1 = /* @__PURE__ */ ((i) => (i.GREY_LIGHT_0 = "var(--grey-light-0)", i.GREY_LIGHT_1 = "var(--grey-light-1)", i.GREY_LIGHT_2 = "var(--grey-light-2)", i.GREY_LIGHT_3 = "var(--grey-light-3)", i.GREY_LIGHT_4 = "var(--grey-light-4)", i.GREY_DARK_1 = "var(--grey-dark-1)", i.GREY_DARK_2 = "var(--grey-dark-2)", i.GREY_DARK_3 = "var(--grey-dark-3)", i.GREY_DARK_4 = "var(--grey-dark-4)", i.GREY_DARK_5 = "var(--grey-dark-5)", i.BLUE_PRIMARY = "var(--blue-primary)", i.BLUE_HOVER = "var(--blue-hover)", i.BLUE_LIGHT_1 = "var(--blue-light-1)", i.BLUE_LIGHT_2 = "var(--blue-light-2)", i.BLUE_LIGHT_3 = "var(--blue-light-3)", i.BLUE_LIGHT_4 = "var(--blue-light-4)", i.BLUE_DARK_1 = "var(--blue-dark-1)", i.PURPLE_LIGHT = "var(--purple-light)", i.PURPLE_DARK = "var(--purple-dark)", i.NOTIFICATION_WARNING_LIGHT = "var(--notification-warning-light)", i.NOTIFICATION_WARNING_DARK = "var(--notification-warning-dark)", i.NOTIFICATION_SUCCESS_LIGHT = "var(--notification-success-light)", i.NOTIFICATION_SUCCESS_DARK = "var(--notification-success-dark)", i.NOTIFICATION_ERROR_LIGHT = "var(--notification-error-light)", i.NOTIFICATION_ERROR_DARK = "var(--notification-error-dark)", i.NOTIFICATION_ERROR_DARK_MODE = "var(--notification-error-dark-mode)", i))(d1 || {});
|
|
6737
|
-
const y3 =
|
|
6737
|
+
const y3 = z({
|
|
6738
6738
|
locale: "en",
|
|
6739
6739
|
theme: "light"
|
|
6740
6740
|
});
|
|
@@ -6766,7 +6766,7 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6766
6766
|
h2: 2,
|
|
6767
6767
|
h3: 3,
|
|
6768
6768
|
h4: 4
|
|
6769
|
-
}, k1 =
|
|
6769
|
+
}, k1 = q(
|
|
6770
6770
|
({
|
|
6771
6771
|
align: i = "inherit",
|
|
6772
6772
|
variant: o = "body1",
|
|
@@ -6832,7 +6832,7 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6832
6832
|
extraOptions: w
|
|
6833
6833
|
}) => {
|
|
6834
6834
|
const [g, s] = u(!1);
|
|
6835
|
-
|
|
6835
|
+
E(() => {
|
|
6836
6836
|
i.length || s(!1);
|
|
6837
6837
|
}, [i]);
|
|
6838
6838
|
const p = (h) => {
|
|
@@ -6841,15 +6841,15 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6841
6841
|
if (!i.length)
|
|
6842
6842
|
return null;
|
|
6843
6843
|
const k = (h) => {
|
|
6844
|
-
var n,
|
|
6845
|
-
return ((n = r == null ? void 0 : r.find((
|
|
6844
|
+
var n, V;
|
|
6845
|
+
return ((n = r == null ? void 0 : r.find((_) => _.value === h)) == null ? void 0 : n.label) || ((V = w == null ? void 0 : w.find((_) => _.value === h)) == null ? void 0 : V.label) || h;
|
|
6846
6846
|
};
|
|
6847
6847
|
return /* @__PURE__ */ t("div", { onMouseDown: p, className: "wrapper", children: /* @__PURE__ */ t(
|
|
6848
6848
|
b3,
|
|
6849
6849
|
{
|
|
6850
6850
|
content: (
|
|
6851
6851
|
// 90: paddings + margins + gaps and so on
|
|
6852
|
-
/* @__PURE__ */ t("div", { style: { maxWidth: e - 90 }, children: /* @__PURE__ */ t(
|
|
6852
|
+
/* @__PURE__ */ t("div", { style: { maxWidth: e - 90 }, children: /* @__PURE__ */ t($, { gap: 6, flexWrap: "wrap", children: i.map(({ value: h }) => /* @__PURE__ */ t(
|
|
6853
6853
|
w1,
|
|
6854
6854
|
{
|
|
6855
6855
|
onClose: () => o(h),
|
|
@@ -6862,7 +6862,7 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6862
6862
|
placement: "bottomRight",
|
|
6863
6863
|
isOpen: g,
|
|
6864
6864
|
setIsOpen: s,
|
|
6865
|
-
children: /* @__PURE__ */ t(h1, { className: `overflow-button ${g ? "open" : ""}`, bordered: !1, children: /* @__PURE__ */ c(k1, { variant: "body4", color: g ?
|
|
6865
|
+
children: /* @__PURE__ */ t(h1, { className: `overflow-button ${g ? "open" : ""}`, bordered: !1, children: /* @__PURE__ */ c(k1, { variant: "body4", color: g ? W.BLUE_PRIMARY : void 0, children: [
|
|
6866
6866
|
i.length,
|
|
6867
6867
|
" more"
|
|
6868
6868
|
] }) })
|
|
@@ -6876,7 +6876,7 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6876
6876
|
backgroundSize: "20% calc(200% + 20px)"
|
|
6877
6877
|
};
|
|
6878
6878
|
return /* @__PURE__ */ t("span", { className: "snmt-loader", style: l });
|
|
6879
|
-
}, r1 =
|
|
6879
|
+
}, r1 = q(
|
|
6880
6880
|
({
|
|
6881
6881
|
value: i,
|
|
6882
6882
|
onChange: o,
|
|
@@ -6890,100 +6890,100 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6890
6890
|
clearable: k = !1,
|
|
6891
6891
|
scrollThresholdValue: h = 50,
|
|
6892
6892
|
onSearchChange: n,
|
|
6893
|
-
onDropdownVisibleChange:
|
|
6894
|
-
onScrollToEnd:
|
|
6895
|
-
onPopupScroll:
|
|
6896
|
-
id:
|
|
6897
|
-
extraOptions:
|
|
6898
|
-
dropdownRender:
|
|
6899
|
-
optionRender:
|
|
6900
|
-
isLoading:
|
|
6893
|
+
onDropdownVisibleChange: V,
|
|
6894
|
+
onScrollToEnd: B,
|
|
6895
|
+
onPopupScroll: _,
|
|
6896
|
+
id: J,
|
|
6897
|
+
extraOptions: R,
|
|
6898
|
+
dropdownRender: A,
|
|
6899
|
+
optionRender: G,
|
|
6900
|
+
isLoading: D,
|
|
6901
6901
|
readOnly: f
|
|
6902
|
-
},
|
|
6903
|
-
const [
|
|
6904
|
-
|
|
6905
|
-
|
|
6902
|
+
}, j) => {
|
|
6903
|
+
const [T, y] = u(!1), [S, H] = u(!1), [Z, Y] = u(!0), [v, K] = u(i), O = s1(null);
|
|
6904
|
+
E(() => {
|
|
6905
|
+
K(i);
|
|
6906
6906
|
}, [i]);
|
|
6907
|
-
const
|
|
6908
|
-
|
|
6909
|
-
},
|
|
6910
|
-
var
|
|
6911
|
-
return !!((
|
|
6912
|
-
},
|
|
6913
|
-
|
|
6914
|
-
},
|
|
6915
|
-
|
|
6916
|
-
},
|
|
6907
|
+
const m = (a) => {
|
|
6908
|
+
y(a), V && V(a);
|
|
6909
|
+
}, Q = (a, L) => {
|
|
6910
|
+
var M;
|
|
6911
|
+
return !!((M = L == null ? void 0 : L.label) != null && M.toString().toLowerCase().includes(a.toLowerCase()));
|
|
6912
|
+
}, X = () => {
|
|
6913
|
+
H(!0);
|
|
6914
|
+
}, b = () => {
|
|
6915
|
+
H(!1);
|
|
6916
|
+
}, N = x(
|
|
6917
6917
|
(a) => {
|
|
6918
|
-
if (
|
|
6919
|
-
const
|
|
6920
|
-
o == null || o(
|
|
6918
|
+
if (K(a), l) {
|
|
6919
|
+
const M = a;
|
|
6920
|
+
o == null || o(M);
|
|
6921
6921
|
return;
|
|
6922
6922
|
}
|
|
6923
6923
|
const L = a;
|
|
6924
6924
|
o == null || o(L);
|
|
6925
6925
|
},
|
|
6926
6926
|
[l, o]
|
|
6927
|
-
), g1 =
|
|
6927
|
+
), g1 = x(() => {
|
|
6928
6928
|
if (!f) {
|
|
6929
6929
|
if (l) {
|
|
6930
|
-
|
|
6930
|
+
N([]);
|
|
6931
6931
|
return;
|
|
6932
6932
|
}
|
|
6933
|
-
|
|
6933
|
+
N("");
|
|
6934
6934
|
}
|
|
6935
|
-
}, [
|
|
6935
|
+
}, [N, l, f]), U = x(
|
|
6936
6936
|
(a) => {
|
|
6937
|
-
const L = v.filter((
|
|
6938
|
-
|
|
6937
|
+
const L = v.filter((M) => M !== a);
|
|
6938
|
+
N(L), K(L);
|
|
6939
6939
|
},
|
|
6940
|
-
[
|
|
6941
|
-
), t1 =
|
|
6940
|
+
[N, v]
|
|
6941
|
+
), t1 = x(
|
|
6942
6942
|
(a) => (v == null ? void 0 : v.indexOf(a)) === 0 ? (
|
|
6943
6943
|
// if the search input is empty
|
|
6944
6944
|
// then display the placeholder, else do not display it
|
|
6945
|
-
/* @__PURE__ */ t("span", { className: "custom-placeholder", children:
|
|
6946
|
-
) : /* @__PURE__ */ t(
|
|
6947
|
-
[
|
|
6945
|
+
/* @__PURE__ */ t("span", { className: "custom-placeholder", children: Z ? e : "" })
|
|
6946
|
+
) : /* @__PURE__ */ t(I, {}),
|
|
6947
|
+
[Z, v, e]
|
|
6948
6948
|
), p1 = (a) => {
|
|
6949
6949
|
a.preventDefault(), a.stopPropagation();
|
|
6950
6950
|
}, L1 = async (a) => {
|
|
6951
6951
|
const { target: L } = a;
|
|
6952
|
-
L.scrollTop + L.offsetHeight >= L.scrollHeight - h && (
|
|
6953
|
-
}, e1 =
|
|
6952
|
+
L.scrollTop + L.offsetHeight >= L.scrollHeight - h && (B == null || B(!0)), _ && await _(a);
|
|
6953
|
+
}, e1 = x(
|
|
6954
6954
|
(a) => {
|
|
6955
|
-
var L,
|
|
6956
|
-
return ((L = w.find((o1) => o1.value === a)) == null ? void 0 : L.label) || ((
|
|
6955
|
+
var L, M;
|
|
6956
|
+
return ((L = w.find((o1) => o1.value === a)) == null ? void 0 : L.label) || ((M = R == null ? void 0 : R.find(
|
|
6957
6957
|
(o1) => o1.value === a
|
|
6958
|
-
)) == null ? void 0 :
|
|
6958
|
+
)) == null ? void 0 : M.label) || a;
|
|
6959
6959
|
},
|
|
6960
|
-
[
|
|
6961
|
-
), m1 =
|
|
6960
|
+
[R, w]
|
|
6961
|
+
), m1 = x(
|
|
6962
6962
|
(a) => {
|
|
6963
6963
|
var L;
|
|
6964
6964
|
return /* @__PURE__ */ t(
|
|
6965
6965
|
F3,
|
|
6966
6966
|
{
|
|
6967
6967
|
values: a,
|
|
6968
|
-
onTagClose:
|
|
6969
|
-
maxWidth: ((L =
|
|
6968
|
+
onTagClose: U,
|
|
6969
|
+
maxWidth: ((L = O.current) == null ? void 0 : L.clientWidth) || 0,
|
|
6970
6970
|
disabled: s || f,
|
|
6971
6971
|
options: w,
|
|
6972
|
-
extraOptions:
|
|
6972
|
+
extraOptions: R
|
|
6973
6973
|
}
|
|
6974
6974
|
);
|
|
6975
6975
|
},
|
|
6976
|
-
[s,
|
|
6977
|
-
), u1 =
|
|
6978
|
-
({ label: a, value: L, mode:
|
|
6979
|
-
[s, e1,
|
|
6976
|
+
[s, R, U, w, f]
|
|
6977
|
+
), u1 = x(
|
|
6978
|
+
({ label: a, value: L, mode: M }) => M === "filter" ? t1(L) : /* @__PURE__ */ t("div", { onMouseDown: p1, className: "tag-wrapper", children: /* @__PURE__ */ t(w1, { onClose: () => U(L), closable: !s, children: /* @__PURE__ */ t(k1, { variant: "body4", children: typeof a == "object" ? a : e1(L) }) }) }),
|
|
6979
|
+
[s, e1, U, t1]
|
|
6980
6980
|
);
|
|
6981
6981
|
return /* @__PURE__ */ c(
|
|
6982
6982
|
"div",
|
|
6983
6983
|
{
|
|
6984
|
-
className: `snmt-select ${
|
|
6984
|
+
className: `snmt-select ${S ? "snmt-select-focused" : ""}
|
|
6985
6985
|
${l ? "" : "snmt-select-single"} ${f ? "snmt-select-read-only" : ""}`,
|
|
6986
|
-
ref:
|
|
6986
|
+
ref: O,
|
|
6987
6987
|
style: { width: g },
|
|
6988
6988
|
children: [
|
|
6989
6989
|
/* @__PURE__ */ t(
|
|
@@ -6991,19 +6991,19 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
6991
6991
|
{
|
|
6992
6992
|
className: "snmt-select-blank",
|
|
6993
6993
|
popupClassName: f ? "dropdown-read-only" : "",
|
|
6994
|
-
id:
|
|
6995
|
-
ref:
|
|
6994
|
+
id: J,
|
|
6995
|
+
ref: j,
|
|
6996
6996
|
showSearch: !!r,
|
|
6997
|
-
filterOption: r &&
|
|
6998
|
-
onDropdownVisibleChange:
|
|
6997
|
+
filterOption: r && Q,
|
|
6998
|
+
onDropdownVisibleChange: m,
|
|
6999
6999
|
placeholder: e ? p ? `${e}*` : e : void 0,
|
|
7000
7000
|
disabled: s,
|
|
7001
7001
|
value: v || void 0,
|
|
7002
7002
|
labelRender: (a) => e1(a.value),
|
|
7003
7003
|
mode: l === "filter" ? "multiple" : l,
|
|
7004
|
-
onChange:
|
|
7005
|
-
onFocus:
|
|
7006
|
-
onBlur:
|
|
7004
|
+
onChange: N,
|
|
7005
|
+
onFocus: X,
|
|
7006
|
+
onBlur: b,
|
|
7007
7007
|
onSearch: (a) => {
|
|
7008
7008
|
Y(!a), n && n(a);
|
|
7009
7009
|
},
|
|
@@ -7013,45 +7013,45 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
7013
7013
|
maxTagCount: "responsive",
|
|
7014
7014
|
maxTagPlaceholder: m1,
|
|
7015
7015
|
onPopupScroll: L1,
|
|
7016
|
-
prefix:
|
|
7017
|
-
suffixIcon: /* @__PURE__ */ t("div", { className: "wrapper-suffix-icon", children: l !== "filter" && /* @__PURE__ */ c(
|
|
7018
|
-
v && !!v.length && (l || k) && /* @__PURE__ */ t("div", { onClick: g1, children: /* @__PURE__ */ t(
|
|
7016
|
+
prefix: D && /* @__PURE__ */ t(l1, { size: 15 }),
|
|
7017
|
+
suffixIcon: /* @__PURE__ */ t("div", { className: "wrapper-suffix-icon", children: l !== "filter" && /* @__PURE__ */ c(I, { children: [
|
|
7018
|
+
v && !!v.length && (l || k) && /* @__PURE__ */ t("div", { onClick: g1, children: /* @__PURE__ */ t(P, { name: "cancel" }) }),
|
|
7019
7019
|
/* @__PURE__ */ t(
|
|
7020
|
-
|
|
7020
|
+
P,
|
|
7021
7021
|
{
|
|
7022
7022
|
name: "selectArrowIcon",
|
|
7023
|
-
color: s ?
|
|
7024
|
-
className:
|
|
7025
|
-
onClick: () =>
|
|
7023
|
+
color: s ? W.GREY_DARK_1 : W.GREY_DARK_5,
|
|
7024
|
+
className: T ? "select-arrow-rotated" : "select-arrow",
|
|
7025
|
+
onClick: () => y(!T)
|
|
7026
7026
|
}
|
|
7027
7027
|
)
|
|
7028
7028
|
] }) }),
|
|
7029
|
-
removeIcon: /* @__PURE__ */ t(
|
|
7029
|
+
removeIcon: /* @__PURE__ */ t(P, { name: "errorSmall", color: W.GREY_DARK_2 }),
|
|
7030
7030
|
options: w,
|
|
7031
|
-
optionRender: (a) =>
|
|
7032
|
-
/* @__PURE__ */ c(
|
|
7031
|
+
optionRender: (a) => G ? G(a.data) : /* @__PURE__ */ c($, { justifyContent: "space-between", alignItems: "center", flex: "1", children: [
|
|
7032
|
+
/* @__PURE__ */ c($, { alignItems: "center", gap: 12, children: [
|
|
7033
7033
|
l && /* @__PURE__ */ t(
|
|
7034
7034
|
H1,
|
|
7035
7035
|
{
|
|
7036
7036
|
checked: !!(v != null && v.includes(a.value))
|
|
7037
7037
|
}
|
|
7038
7038
|
),
|
|
7039
|
-
/* @__PURE__ */ c(
|
|
7039
|
+
/* @__PURE__ */ c($, { alignItems: "center", gap: 8, children: [
|
|
7040
7040
|
a.data.image && /* @__PURE__ */ t(R1, { src: a.data.image, size: 20 }),
|
|
7041
7041
|
/* @__PURE__ */ t("span", { children: a.label })
|
|
7042
7042
|
] })
|
|
7043
7043
|
] }),
|
|
7044
7044
|
!l && v === a.value && /* @__PURE__ */ t(
|
|
7045
|
-
|
|
7045
|
+
P,
|
|
7046
7046
|
{
|
|
7047
7047
|
name: "ok",
|
|
7048
|
-
color:
|
|
7048
|
+
color: W.BLUE_PRIMARY,
|
|
7049
7049
|
width: 16,
|
|
7050
7050
|
height: 16
|
|
7051
7051
|
}
|
|
7052
7052
|
)
|
|
7053
7053
|
] }),
|
|
7054
|
-
dropdownRender:
|
|
7054
|
+
dropdownRender: D ? () => /* @__PURE__ */ t(
|
|
7055
7055
|
"div",
|
|
7056
7056
|
{
|
|
7057
7057
|
style: {
|
|
@@ -7061,13 +7061,13 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
7061
7061
|
},
|
|
7062
7062
|
children: /* @__PURE__ */ t(l1, { size: 28 })
|
|
7063
7063
|
}
|
|
7064
|
-
) : (a) =>
|
|
7064
|
+
) : (a) => A ? A(a) : a
|
|
7065
7065
|
}
|
|
7066
7066
|
),
|
|
7067
7067
|
/* @__PURE__ */ t(
|
|
7068
7068
|
"fieldset",
|
|
7069
7069
|
{
|
|
7070
|
-
className: `${
|
|
7070
|
+
className: `${S ? "fieldset-focused" : ""}
|
|
7071
7071
|
${s ? "fieldset-disabled" : ""}
|
|
7072
7072
|
${typeof i == "string" && i ? "fieldset-filled" : ""}
|
|
7073
7073
|
${typeof i == "object" && i != null && i.length ? "fieldset-filled" : ""}`,
|
|
@@ -7081,7 +7081,7 @@ const w1 = ({ children: i, width: o, size: e = "small", onClose: l, closable: r
|
|
|
7081
7081
|
);
|
|
7082
7082
|
function S3(i, o = 500) {
|
|
7083
7083
|
const e = s1();
|
|
7084
|
-
return
|
|
7084
|
+
return E(() => () => {
|
|
7085
7085
|
e.current && clearTimeout(e.current);
|
|
7086
7086
|
}, []), (...r) => {
|
|
7087
7087
|
const w = setTimeout(() => {
|
|
@@ -7090,10 +7090,10 @@ function S3(i, o = 500) {
|
|
|
7090
7090
|
clearTimeout(e.current), e.current = w;
|
|
7091
7091
|
};
|
|
7092
7092
|
}
|
|
7093
|
-
const
|
|
7093
|
+
const F = {
|
|
7094
7094
|
limit: 100,
|
|
7095
7095
|
offset: 0
|
|
7096
|
-
}, J3 =
|
|
7096
|
+
}, J3 = q(
|
|
7097
7097
|
({
|
|
7098
7098
|
loadOptions: i,
|
|
7099
7099
|
width: o,
|
|
@@ -7107,71 +7107,73 @@ const O = {
|
|
|
7107
7107
|
loadOnClosedState: k,
|
|
7108
7108
|
extraOptions: h,
|
|
7109
7109
|
onDropdownVisibleChange: n,
|
|
7110
|
-
optionRender:
|
|
7111
|
-
dropdownRender:
|
|
7112
|
-
readOnly:
|
|
7113
|
-
|
|
7114
|
-
|
|
7110
|
+
optionRender: V,
|
|
7111
|
+
dropdownRender: B,
|
|
7112
|
+
readOnly: _,
|
|
7113
|
+
clearable: J
|
|
7114
|
+
}, R) => {
|
|
7115
|
+
const [A, G] = u([]), [D, f] = u(F), [j, T] = u(!1), [y, S] = u(null), H = x(
|
|
7115
7116
|
async (m = !1, Q) => {
|
|
7116
|
-
if (!
|
|
7117
|
-
|
|
7117
|
+
if (!j) {
|
|
7118
|
+
T(!0);
|
|
7118
7119
|
try {
|
|
7119
|
-
const X = m ? { ...
|
|
7120
|
-
|
|
7121
|
-
(
|
|
7122
|
-
), S(
|
|
7123
|
-
...
|
|
7124
|
-
offset:
|
|
7120
|
+
const X = m ? { ...F, search: Q } : D, b = await i(X);
|
|
7121
|
+
G(
|
|
7122
|
+
(N) => m ? b.options : [...N, ...b.options]
|
|
7123
|
+
), S(b.count), f((N) => ({
|
|
7124
|
+
...N,
|
|
7125
|
+
offset: N.offset + N.limit
|
|
7125
7126
|
}));
|
|
7126
7127
|
} finally {
|
|
7127
|
-
|
|
7128
|
+
T(!1);
|
|
7128
7129
|
}
|
|
7129
7130
|
}
|
|
7130
7131
|
},
|
|
7131
|
-
[
|
|
7132
|
-
),
|
|
7132
|
+
[D, i, j]
|
|
7133
|
+
), Z = S3(H), Y = x(
|
|
7133
7134
|
(m) => {
|
|
7134
|
-
m === "" || m === void 0 || m === null ? (
|
|
7135
|
+
m === "" || m === void 0 || m === null ? (f(F), Z(!0)) : Z(!0, m);
|
|
7135
7136
|
},
|
|
7136
|
-
[
|
|
7137
|
-
),
|
|
7138
|
-
m && y !== null && y >
|
|
7139
|
-
},
|
|
7137
|
+
[Z]
|
|
7138
|
+
), v = async (m) => {
|
|
7139
|
+
m && y !== null && y > A.length && await H(!1);
|
|
7140
|
+
}, K = x(
|
|
7140
7141
|
(m) => {
|
|
7141
|
-
m && !k && (
|
|
7142
|
+
m && !k && (G([]), f(F), H(!0)), n == null || n(m);
|
|
7142
7143
|
},
|
|
7143
7144
|
// eslint-disable-next-line
|
|
7144
7145
|
[k]
|
|
7145
7146
|
);
|
|
7146
|
-
|
|
7147
|
-
k &&
|
|
7147
|
+
E(() => {
|
|
7148
|
+
k && H(!1);
|
|
7148
7149
|
}, []);
|
|
7149
|
-
const
|
|
7150
|
+
const O = {
|
|
7150
7151
|
id: r,
|
|
7151
7152
|
width: o,
|
|
7152
|
-
options:
|
|
7153
|
+
options: A,
|
|
7153
7154
|
onChange: e,
|
|
7154
|
-
ref:
|
|
7155
|
+
ref: R,
|
|
7155
7156
|
placeholder: s,
|
|
7156
7157
|
search: !0,
|
|
7157
7158
|
value: l,
|
|
7158
|
-
onSearchChange:
|
|
7159
|
-
onDropdownVisibleChange:
|
|
7159
|
+
onSearchChange: Y,
|
|
7160
|
+
onDropdownVisibleChange: K,
|
|
7160
7161
|
scrollThresholdValue: g,
|
|
7161
|
-
onScrollToEnd:
|
|
7162
|
+
onScrollToEnd: v,
|
|
7162
7163
|
loadOnClosedState: k,
|
|
7163
7164
|
disabled: w,
|
|
7164
7165
|
extraOptions: h,
|
|
7165
|
-
isLoading:
|
|
7166
|
-
optionRender:
|
|
7167
|
-
dropdownRender:
|
|
7168
|
-
readOnly:
|
|
7166
|
+
isLoading: j,
|
|
7167
|
+
optionRender: V,
|
|
7168
|
+
dropdownRender: B,
|
|
7169
|
+
readOnly: _,
|
|
7170
|
+
clearable: J
|
|
7169
7171
|
};
|
|
7170
|
-
return v1(
|
|
7172
|
+
return v1(R, () => ({
|
|
7171
7173
|
refetchOptions: async () => {
|
|
7172
|
-
|
|
7174
|
+
f(F), await H(!0);
|
|
7173
7175
|
}
|
|
7174
|
-
})), p ? /* @__PURE__ */ t(r1, { ...
|
|
7176
|
+
})), p ? /* @__PURE__ */ t(r1, { ...O, onChange: e, value: l, mode: p }) : /* @__PURE__ */ t("div", { className: "snmt-async-select", children: /* @__PURE__ */ t(r1, { ...O, onChange: e, value: l }) });
|
|
7175
7177
|
}
|
|
7176
7178
|
);
|
|
7177
7179
|
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.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/async-select.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"antd": "^5.18.3"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "a980976c645c51a1f9f8441a30d086e54736e823"
|
|
27
27
|
}
|