mimir-ui-kit 1.38.20 → 1.38.21
Sign up to get free protection for your applications and to get access to all the features.
@@ -46,7 +46,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
46
46
|
const {
|
47
47
|
placeholder: P,
|
48
48
|
size: i = D.L,
|
49
|
-
value:
|
49
|
+
value: p,
|
50
50
|
onChange: s,
|
51
51
|
full: le,
|
52
52
|
showArrow: re = !0,
|
@@ -67,29 +67,29 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
67
67
|
id: pe,
|
68
68
|
autoPlacement: z = !1,
|
69
69
|
onIsOpen: v
|
70
|
-
} = se, me = Ne(),
|
71
|
-
() => Y(
|
70
|
+
} = se, me = Ne(), m = pe || `multiselect-${me}`, N = X(null), b = X(null), [a, _] = w(!1), [S, C] = w(
|
71
|
+
() => Y(p, f)
|
72
72
|
), [c, M] = w(
|
73
|
-
|
73
|
+
p || []
|
74
74
|
), [A, j] = w(g), [O, G] = w(!1), [_e, U] = w(!1);
|
75
75
|
T(() => {
|
76
|
-
|
77
|
-
}, [
|
76
|
+
p && (M(p), JSON.stringify(p) !== JSON.stringify(c) && C(Y(p, f)));
|
77
|
+
}, [p, f, c]);
|
78
78
|
const W = Se(() => {
|
79
79
|
var o;
|
80
80
|
if (!q) return h;
|
81
81
|
const e = ((o = S.split(",").pop()) == null ? void 0 : o.trim().toLowerCase()) ?? "";
|
82
82
|
return c.length > 0 && c[c.length - 1].name.toLowerCase() === e ? h : h.filter(
|
83
|
-
(
|
83
|
+
(u) => u.name.toLowerCase().includes(e)
|
84
84
|
);
|
85
85
|
}, [q, h, S, c]), he = (e) => {
|
86
86
|
M(e), s == null || s(e);
|
87
87
|
const o = te(e, f);
|
88
|
-
C(o), _(!0), L(
|
88
|
+
C(o), _(!0), L(m), setTimeout(() => {
|
89
89
|
if (b.current) {
|
90
90
|
b.current.focus(), b.current.scrollLeft = b.current.scrollWidth;
|
91
|
-
const
|
92
|
-
b.current.setSelectionRange(
|
91
|
+
const u = o.length;
|
92
|
+
b.current.setSelectionRange(u, u);
|
93
93
|
}
|
94
94
|
}, 0);
|
95
95
|
}, H = (e) => {
|
@@ -97,20 +97,20 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
97
97
|
if (I) return;
|
98
98
|
const o = e.target.value;
|
99
99
|
C(o), k == null || k(o);
|
100
|
-
const
|
101
|
-
(x) =>
|
100
|
+
const u = o.split(",").map((x) => x.trim()).filter(Boolean), K = h.filter(
|
101
|
+
(x) => u.includes(x[f])
|
102
102
|
);
|
103
|
-
M(K), s == null || s(K), _(!0), L(
|
103
|
+
M(K), s == null || s(K), _(!0), L(m);
|
104
104
|
const V = ($ = N.current) == null ? void 0 : $.querySelector(
|
105
105
|
`.${t.options}`
|
106
106
|
);
|
107
107
|
V && typeof V.scrollTo == "function" && V.scrollTo({ top: 0, behavior: "smooth" });
|
108
108
|
}, fe = (e) => {
|
109
109
|
const o = c.filter(
|
110
|
-
(
|
110
|
+
(u) => u.id !== e.id
|
111
111
|
);
|
112
112
|
M(o), s == null || s(o), C(te(o, f));
|
113
|
-
},
|
113
|
+
}, d = Ce(() => {
|
114
114
|
if (!z) {
|
115
115
|
j(g);
|
116
116
|
return;
|
@@ -118,8 +118,8 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
118
118
|
const e = Me(N, i);
|
119
119
|
j(e ? "top" : g);
|
120
120
|
}, [z, g, i]), J = () => {
|
121
|
-
const e = !
|
122
|
-
e && (
|
121
|
+
const e = !a;
|
122
|
+
e && (d(), L(m)), _(e), v == null || v(e);
|
123
123
|
}, ve = (e) => {
|
124
124
|
e.preventDefault(), e.currentTarget.focus();
|
125
125
|
const o = e.currentTarget.value.length;
|
@@ -133,18 +133,20 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
133
133
|
e.target.blur();
|
134
134
|
return;
|
135
135
|
}
|
136
|
-
|
136
|
+
d(), _(!0), L(m);
|
137
137
|
};
|
138
138
|
return T(() => {
|
139
|
+
if (a) {
|
140
|
+
const e = (o) => {
|
141
|
+
N.current && !N.current.contains(o.target) && !o.defaultPrevented && (_(!1), v == null || v(!1));
|
142
|
+
};
|
143
|
+
return document.addEventListener("mousedown", e), () => {
|
144
|
+
document.removeEventListener("mousedown", e);
|
145
|
+
};
|
146
|
+
}
|
147
|
+
}, [a]), T(() => {
|
139
148
|
const e = (o) => {
|
140
|
-
|
141
|
-
};
|
142
|
-
return document.addEventListener("mousedown", e), () => {
|
143
|
-
document.removeEventListener("mousedown", e);
|
144
|
-
};
|
145
|
-
}, []), T(() => {
|
146
|
-
const e = (o) => {
|
147
|
-
o.detail !== p && _(!1);
|
149
|
+
o.detail !== m && _(!1);
|
148
150
|
};
|
149
151
|
return window.addEventListener(
|
150
152
|
Z,
|
@@ -155,18 +157,18 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
155
157
|
e
|
156
158
|
);
|
157
159
|
};
|
158
|
-
}, [
|
159
|
-
if (
|
160
|
-
|
160
|
+
}, [m]), T(() => {
|
161
|
+
if (a) {
|
162
|
+
d(), window.addEventListener("scroll", d), window.addEventListener("resize", d);
|
161
163
|
const e = requestAnimationFrame(() => {
|
162
164
|
U(!0), G(!0);
|
163
165
|
});
|
164
166
|
return () => {
|
165
|
-
window.removeEventListener("scroll",
|
167
|
+
window.removeEventListener("scroll", d), window.removeEventListener("resize", d), cancelAnimationFrame(e);
|
166
168
|
};
|
167
169
|
} else
|
168
170
|
G(!1), U(!1);
|
169
|
-
}, [
|
171
|
+
}, [a, g, z, i, d]), /* @__PURE__ */ E("div", { ref: N, children: [
|
170
172
|
/* @__PURE__ */ n(
|
171
173
|
Ae,
|
172
174
|
{
|
@@ -185,7 +187,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
185
187
|
"div",
|
186
188
|
{
|
187
189
|
className: l(t.container, t[i], {
|
188
|
-
[t["container-open"]]:
|
190
|
+
[t["container-open"]]: a
|
189
191
|
}),
|
190
192
|
children: [
|
191
193
|
I && /* @__PURE__ */ E("div", { className: t["input-container"], children: [
|
@@ -214,7 +216,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
214
216
|
onFocus: ge,
|
215
217
|
rightAddon: {
|
216
218
|
addonType: "icon",
|
217
|
-
addonContent: Ee(
|
219
|
+
addonContent: Ee(a, i)
|
218
220
|
},
|
219
221
|
autocomplete: F,
|
220
222
|
...B
|
@@ -255,7 +257,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
255
257
|
variant: R,
|
256
258
|
withClearButton: y,
|
257
259
|
onFocus: () => {
|
258
|
-
_(!0), L(
|
260
|
+
_(!0), L(m);
|
259
261
|
},
|
260
262
|
onMouseDown: ve,
|
261
263
|
onChange: H,
|
@@ -275,7 +277,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
275
277
|
{
|
276
278
|
iconName: i == D.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
277
279
|
className: l(t["selector-icon"], {
|
278
|
-
[t["selector-icon-open"]]:
|
280
|
+
[t["selector-icon-open"]]: a
|
279
281
|
})
|
280
282
|
}
|
281
283
|
)
|
@@ -287,7 +289,7 @@ import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De =
|
|
287
289
|
...B
|
288
290
|
}
|
289
291
|
),
|
290
|
-
|
292
|
+
a && _e && /* @__PURE__ */ n(Q, { children: h.length ? W.length ? /* @__PURE__ */ n(
|
291
293
|
Oe,
|
292
294
|
{
|
293
295
|
className: l(
|