slim-select 3.4.0 → 3.4.1
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/react/index.js +187 -172
- package/dist/react/index.umd.js +2 -2
- package/dist/slimselect.cjs.js +1 -1
- package/dist/slimselect.cjs.js.map +1 -1
- package/dist/slimselect.es.js +170 -155
- package/dist/slimselect.es.js.map +1 -1
- package/dist/slimselect.iife.js +1 -1
- package/dist/slimselect.iife.js.map +1 -1
- package/dist/slimselect.js +1 -1
- package/dist/slimselect.js.map +1 -1
- package/dist/vue/index.js +51 -36
- package/dist/vue/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/slim-select/render.ts +29 -0
package/dist/react/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import re, { forwardRef as oe, useRef as I, useImperativeHandle as ce, useEffect as $ } from "react";
|
|
2
|
-
var V = { exports: {} },
|
|
2
|
+
var V = { exports: {} }, M = {};
|
|
3
3
|
var ee;
|
|
4
4
|
function he() {
|
|
5
|
-
if (ee) return
|
|
5
|
+
if (ee) return M;
|
|
6
6
|
ee = 1;
|
|
7
7
|
var p = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
8
|
function t(s, i, n) {
|
|
9
9
|
var r = null;
|
|
10
10
|
if (n !== void 0 && (r = "" + n), i.key !== void 0 && (r = "" + i.key), "key" in i) {
|
|
11
11
|
n = {};
|
|
12
|
-
for (var
|
|
13
|
-
|
|
12
|
+
for (var l in i)
|
|
13
|
+
l !== "key" && (n[l] = i[l]);
|
|
14
14
|
} else n = i;
|
|
15
15
|
return i = n.ref, {
|
|
16
16
|
$$typeof: p,
|
|
@@ -20,18 +20,18 @@ function he() {
|
|
|
20
20
|
props: n
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return M.Fragment = e, M.jsx = t, M.jsxs = t, M;
|
|
24
24
|
}
|
|
25
25
|
var _ = {};
|
|
26
26
|
var te;
|
|
27
27
|
function de() {
|
|
28
28
|
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
-
function p(
|
|
30
|
-
if (
|
|
31
|
-
if (typeof
|
|
32
|
-
return
|
|
33
|
-
if (typeof
|
|
34
|
-
switch (
|
|
29
|
+
function p(a) {
|
|
30
|
+
if (a == null) return null;
|
|
31
|
+
if (typeof a == "function")
|
|
32
|
+
return a.$$typeof === ne ? null : a.displayName || a.name || null;
|
|
33
|
+
if (typeof a == "string") return a;
|
|
34
|
+
switch (a) {
|
|
35
35
|
case A:
|
|
36
36
|
return "Fragment";
|
|
37
37
|
case v:
|
|
@@ -42,130 +42,130 @@ function de() {
|
|
|
42
42
|
return "Suspense";
|
|
43
43
|
case P:
|
|
44
44
|
return "SuspenseList";
|
|
45
|
-
case
|
|
45
|
+
case R:
|
|
46
46
|
return "Activity";
|
|
47
47
|
}
|
|
48
|
-
if (typeof
|
|
49
|
-
switch (typeof
|
|
48
|
+
if (typeof a == "object")
|
|
49
|
+
switch (typeof a.tag == "number" && console.error(
|
|
50
50
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
|
-
),
|
|
52
|
-
case
|
|
51
|
+
), a.$$typeof) {
|
|
52
|
+
case g:
|
|
53
53
|
return "Portal";
|
|
54
54
|
case L:
|
|
55
|
-
return
|
|
55
|
+
return a.displayName || "Context";
|
|
56
56
|
case k:
|
|
57
|
-
return (
|
|
57
|
+
return (a._context.displayName || "Context") + ".Consumer";
|
|
58
58
|
case b:
|
|
59
|
-
var u =
|
|
60
|
-
return
|
|
59
|
+
var u = a.render;
|
|
60
|
+
return a = a.displayName, a || (a = u.displayName || u.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
61
61
|
case B:
|
|
62
|
-
return u =
|
|
62
|
+
return u = a.displayName || null, u !== null ? u : p(a.type) || "Memo";
|
|
63
63
|
case T:
|
|
64
|
-
u =
|
|
64
|
+
u = a._payload, a = a._init;
|
|
65
65
|
try {
|
|
66
|
-
return p(
|
|
66
|
+
return p(a(u));
|
|
67
67
|
} catch {
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
-
function e(
|
|
73
|
-
return "" +
|
|
72
|
+
function e(a) {
|
|
73
|
+
return "" + a;
|
|
74
74
|
}
|
|
75
|
-
function t(
|
|
75
|
+
function t(a) {
|
|
76
76
|
try {
|
|
77
|
-
e(
|
|
77
|
+
e(a);
|
|
78
78
|
var u = !1;
|
|
79
79
|
} catch {
|
|
80
80
|
u = !0;
|
|
81
81
|
}
|
|
82
82
|
if (u) {
|
|
83
83
|
u = console;
|
|
84
|
-
var C = u.error, O = typeof Symbol == "function" && Symbol.toStringTag &&
|
|
84
|
+
var C = u.error, O = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
85
85
|
return C.call(
|
|
86
86
|
u,
|
|
87
87
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
88
|
O
|
|
89
|
-
), e(
|
|
89
|
+
), e(a);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function s(
|
|
93
|
-
if (
|
|
94
|
-
if (typeof
|
|
92
|
+
function s(a) {
|
|
93
|
+
if (a === A) return "<>";
|
|
94
|
+
if (typeof a == "object" && a !== null && a.$$typeof === T)
|
|
95
95
|
return "<...>";
|
|
96
96
|
try {
|
|
97
|
-
var u = p(
|
|
97
|
+
var u = p(a);
|
|
98
98
|
return u ? "<" + u + ">" : "<...>";
|
|
99
99
|
} catch {
|
|
100
100
|
return "<...>";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
function i() {
|
|
104
|
-
var
|
|
105
|
-
return
|
|
104
|
+
var a = j.A;
|
|
105
|
+
return a === null ? null : a.getOwner();
|
|
106
106
|
}
|
|
107
107
|
function n() {
|
|
108
108
|
return Error("react-stack-top-frame");
|
|
109
109
|
}
|
|
110
|
-
function r(
|
|
111
|
-
if (J.call(
|
|
112
|
-
var u = Object.getOwnPropertyDescriptor(
|
|
110
|
+
function r(a) {
|
|
111
|
+
if (J.call(a, "key")) {
|
|
112
|
+
var u = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
113
113
|
if (u && u.isReactWarning) return !1;
|
|
114
114
|
}
|
|
115
|
-
return
|
|
115
|
+
return a.key !== void 0;
|
|
116
116
|
}
|
|
117
|
-
function a
|
|
117
|
+
function l(a, u) {
|
|
118
118
|
function C() {
|
|
119
119
|
G || (G = !0, console.error(
|
|
120
120
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
121
121
|
u
|
|
122
122
|
));
|
|
123
123
|
}
|
|
124
|
-
C.isReactWarning = !0, Object.defineProperty(
|
|
124
|
+
C.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
125
125
|
get: C,
|
|
126
126
|
configurable: !0
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
function c() {
|
|
130
|
-
var
|
|
131
|
-
return X[
|
|
130
|
+
var a = p(this.type);
|
|
131
|
+
return X[a] || (X[a] = !0, console.error(
|
|
132
132
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
|
-
)),
|
|
133
|
+
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
134
134
|
}
|
|
135
|
-
function h(
|
|
135
|
+
function h(a, u, C, O, F, U) {
|
|
136
136
|
var y = C.ref;
|
|
137
|
-
return
|
|
137
|
+
return a = {
|
|
138
138
|
$$typeof: E,
|
|
139
|
-
type:
|
|
139
|
+
type: a,
|
|
140
140
|
key: u,
|
|
141
141
|
props: C,
|
|
142
142
|
_owner: O
|
|
143
|
-
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(
|
|
143
|
+
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(a, "ref", {
|
|
144
144
|
enumerable: !1,
|
|
145
145
|
get: c
|
|
146
|
-
}) : Object.defineProperty(
|
|
146
|
+
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
147
147
|
configurable: !1,
|
|
148
148
|
enumerable: !1,
|
|
149
149
|
writable: !0,
|
|
150
150
|
value: 0
|
|
151
|
-
}), Object.defineProperty(
|
|
151
|
+
}), Object.defineProperty(a, "_debugInfo", {
|
|
152
152
|
configurable: !1,
|
|
153
153
|
enumerable: !1,
|
|
154
154
|
writable: !0,
|
|
155
155
|
value: null
|
|
156
|
-
}), Object.defineProperty(
|
|
156
|
+
}), Object.defineProperty(a, "_debugStack", {
|
|
157
157
|
configurable: !1,
|
|
158
158
|
enumerable: !1,
|
|
159
159
|
writable: !0,
|
|
160
160
|
value: F
|
|
161
|
-
}), Object.defineProperty(
|
|
161
|
+
}), Object.defineProperty(a, "_debugTask", {
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
166
|
-
}), Object.freeze && (Object.freeze(
|
|
165
|
+
value: U
|
|
166
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
167
167
|
}
|
|
168
|
-
function o(
|
|
168
|
+
function o(a, u, C, O, F, U) {
|
|
169
169
|
var y = u.children;
|
|
170
170
|
if (y !== void 0)
|
|
171
171
|
if (O)
|
|
@@ -179,7 +179,7 @@ function de() {
|
|
|
179
179
|
);
|
|
180
180
|
else d(y);
|
|
181
181
|
if (J.call(u, "key")) {
|
|
182
|
-
y = p(
|
|
182
|
+
y = p(a);
|
|
183
183
|
var N = Object.keys(u).filter(function(ae) {
|
|
184
184
|
return ae !== "key";
|
|
185
185
|
});
|
|
@@ -201,55 +201,55 @@ React keys must be passed directly to JSX without using spread:
|
|
|
201
201
|
for (var W in u)
|
|
202
202
|
W !== "key" && (C[W] = u[W]);
|
|
203
203
|
} else C = u;
|
|
204
|
-
return y &&
|
|
204
|
+
return y && l(
|
|
205
205
|
C,
|
|
206
|
-
typeof
|
|
206
|
+
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
207
207
|
), h(
|
|
208
|
-
|
|
208
|
+
a,
|
|
209
209
|
y,
|
|
210
210
|
C,
|
|
211
211
|
i(),
|
|
212
212
|
F,
|
|
213
|
-
|
|
213
|
+
U
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
function d(
|
|
217
|
-
|
|
216
|
+
function d(a) {
|
|
217
|
+
m(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === T && (a._payload.status === "fulfilled" ? m(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return typeof
|
|
219
|
+
function m(a) {
|
|
220
|
+
return typeof a == "object" && a !== null && a.$$typeof === E;
|
|
221
221
|
}
|
|
222
|
-
var f = re, E = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
222
|
+
var f = re, E = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.portal"), A = /* @__PURE__ */ Symbol.for("react.fragment"), S = /* @__PURE__ */ Symbol.for("react.strict_mode"), v = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), L = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), P = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), R = /* @__PURE__ */ Symbol.for("react.activity"), ne = /* @__PURE__ */ Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, le = Array.isArray, q = console.createTask ? console.createTask : function() {
|
|
223
223
|
return null;
|
|
224
224
|
};
|
|
225
225
|
f = {
|
|
226
|
-
react_stack_bottom_frame: function(
|
|
227
|
-
return
|
|
226
|
+
react_stack_bottom_frame: function(a) {
|
|
227
|
+
return a();
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
var G, X = {}, K = f.react_stack_bottom_frame.bind(
|
|
231
231
|
f,
|
|
232
232
|
n
|
|
233
|
-
)(), Z =
|
|
234
|
-
_.Fragment = A, _.jsx = function(
|
|
233
|
+
)(), Z = q(s(n)), Q = {};
|
|
234
|
+
_.Fragment = A, _.jsx = function(a, u, C) {
|
|
235
235
|
var O = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
236
236
|
return o(
|
|
237
|
-
|
|
237
|
+
a,
|
|
238
238
|
u,
|
|
239
239
|
C,
|
|
240
240
|
!1,
|
|
241
241
|
O ? Error("react-stack-top-frame") : K,
|
|
242
|
-
O ?
|
|
242
|
+
O ? q(s(a)) : Z
|
|
243
243
|
);
|
|
244
|
-
}, _.jsxs = function(
|
|
244
|
+
}, _.jsxs = function(a, u, C) {
|
|
245
245
|
var O = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
246
246
|
return o(
|
|
247
|
-
|
|
247
|
+
a,
|
|
248
248
|
u,
|
|
249
249
|
C,
|
|
250
250
|
!0,
|
|
251
251
|
O ? Error("react-stack-top-frame") : K,
|
|
252
|
-
O ?
|
|
252
|
+
O ? q(s(a)) : Z
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
255
|
})()), _;
|
|
@@ -345,8 +345,8 @@ function H(p, e = 50, t = !1) {
|
|
|
345
345
|
return function(...i) {
|
|
346
346
|
const n = self, r = () => {
|
|
347
347
|
s = null, t || p.apply(n, i);
|
|
348
|
-
},
|
|
349
|
-
clearTimeout(s), s = setTimeout(r, e),
|
|
348
|
+
}, l = t && !s;
|
|
349
|
+
clearTimeout(s), s = setTimeout(r, e), l && p.apply(n, i);
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
function Y(p, e) {
|
|
@@ -441,21 +441,21 @@ class ge {
|
|
|
441
441
|
if (t) {
|
|
442
442
|
const i = this.getSelectedOptions(), n = [];
|
|
443
443
|
i.forEach((r) => {
|
|
444
|
-
let
|
|
444
|
+
let l = !1;
|
|
445
445
|
for (const c of s) {
|
|
446
446
|
if (c instanceof w && c.id === r.id) {
|
|
447
|
-
|
|
447
|
+
l = !0;
|
|
448
448
|
break;
|
|
449
449
|
}
|
|
450
450
|
if (c instanceof x) {
|
|
451
451
|
for (const h of c.options)
|
|
452
452
|
if (h.id === r.id) {
|
|
453
|
-
|
|
453
|
+
l = !0;
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
|
-
|
|
458
|
+
l || n.push(r);
|
|
459
459
|
}), this.data = [...n, ...s];
|
|
460
460
|
} else
|
|
461
461
|
this.data = s;
|
|
@@ -483,17 +483,17 @@ class ge {
|
|
|
483
483
|
setSelectedBy(e, t) {
|
|
484
484
|
let s = null, i = !1;
|
|
485
485
|
const n = [];
|
|
486
|
-
for (let
|
|
487
|
-
if (
|
|
488
|
-
for (let c of
|
|
486
|
+
for (let l of this.data) {
|
|
487
|
+
if (l instanceof x)
|
|
488
|
+
for (let c of l.options) {
|
|
489
489
|
s || (s = c);
|
|
490
490
|
let h = c[e] || "";
|
|
491
491
|
c.selected = i ? !1 : t.includes(h), c.selected && (n.push(c), this.selectType === "single" && (i = !0));
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
l instanceof w && (s || (s = l), l.selected = i ? !1 : t.includes(l[e]), l.selected && (n.push(l), this.selectType === "single" && (i = !0)));
|
|
494
494
|
}
|
|
495
495
|
this.selectType === "single" && s && !i && (s.selected = !0, n.push(s));
|
|
496
|
-
const r = t.map((
|
|
496
|
+
const r = t.map((l) => n.find((c) => c[e] === l)?.id || "");
|
|
497
497
|
this.selectedOrder = r;
|
|
498
498
|
}
|
|
499
499
|
getSelected() {
|
|
@@ -536,11 +536,11 @@ class ge {
|
|
|
536
536
|
return this.data.forEach((i) => {
|
|
537
537
|
if (i instanceof x) {
|
|
538
538
|
let n = [];
|
|
539
|
-
if (i.options.forEach((
|
|
540
|
-
(!e || e(
|
|
539
|
+
if (i.options.forEach((l) => {
|
|
540
|
+
(!e || e(l)) && (t ? n.push(new w(l)) : s.push(new w(l)));
|
|
541
541
|
}), n.length > 0) {
|
|
542
|
-
let
|
|
543
|
-
|
|
542
|
+
let l = new x(i);
|
|
543
|
+
l.options = n, s.push(l);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
i instanceof w && (!e || e(i)) && s.push(new w(i));
|
|
@@ -674,8 +674,8 @@ class ve {
|
|
|
674
674
|
if (h.stopPropagation(), this.settings.disabled)
|
|
675
675
|
return;
|
|
676
676
|
let o = !0;
|
|
677
|
-
const d = this.store.getSelectedOptions(),
|
|
678
|
-
if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(
|
|
677
|
+
const d = this.store.getSelectedOptions(), m = [];
|
|
678
|
+
if (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(m, d) === !0), o) {
|
|
679
679
|
if (this.settings.isMultiple)
|
|
680
680
|
this.callbacks.setSelected([], !1), this.updateDeselectAll();
|
|
681
681
|
else {
|
|
@@ -689,10 +689,10 @@ class ve {
|
|
|
689
689
|
n.setAttribute("viewBox", "0 0 100 100");
|
|
690
690
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
691
691
|
r.setAttribute("d", this.classes.deselectPath), n.appendChild(r), s.appendChild(n), e.appendChild(s);
|
|
692
|
-
const
|
|
693
|
-
this.addClasses(
|
|
692
|
+
const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
693
|
+
this.addClasses(l, this.classes.arrow), l.setAttribute("viewBox", "0 0 100 100");
|
|
694
694
|
const c = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
695
|
-
return c.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && this.addClasses(
|
|
695
|
+
return c.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && this.addClasses(l, this.classes.hide), l.appendChild(c), e.appendChild(l), {
|
|
696
696
|
main: e,
|
|
697
697
|
values: t,
|
|
698
698
|
deselect: {
|
|
@@ -701,7 +701,7 @@ class ve {
|
|
|
701
701
|
path: r
|
|
702
702
|
},
|
|
703
703
|
arrow: {
|
|
704
|
-
main:
|
|
704
|
+
main: l,
|
|
705
705
|
path: c
|
|
706
706
|
}
|
|
707
707
|
};
|
|
@@ -776,18 +776,18 @@ class ve {
|
|
|
776
776
|
const s = document.createElement("div");
|
|
777
777
|
if (this.addClasses(s, this.classes.valueText), s.textContent = e.text, t.appendChild(s), !e.mandatory) {
|
|
778
778
|
const i = document.createElement("div");
|
|
779
|
-
this.addClasses(i, this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (
|
|
780
|
-
if (
|
|
779
|
+
this.addClasses(i, this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (l) => {
|
|
780
|
+
if (l.preventDefault(), l.stopPropagation(), this.settings.disabled)
|
|
781
781
|
return;
|
|
782
782
|
let c = !0;
|
|
783
783
|
const h = this.store.getSelectedOptions(), o = h.filter((d) => d.selected && d.id !== e.id, !0);
|
|
784
784
|
if (!(this.settings.minSelected && o.length < this.settings.minSelected) && (this.callbacks.beforeChange && (c = this.callbacks.beforeChange(o, h) === !0), c)) {
|
|
785
785
|
let d = [];
|
|
786
|
-
for (const
|
|
787
|
-
if (
|
|
788
|
-
for (const f of
|
|
786
|
+
for (const m of o) {
|
|
787
|
+
if (m instanceof x)
|
|
788
|
+
for (const f of m.options)
|
|
789
789
|
f.id && d.push(f.id);
|
|
790
|
-
|
|
790
|
+
m instanceof w && d.push(m.id);
|
|
791
791
|
}
|
|
792
792
|
this.callbacks.setSelected(d, !1), this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(o), this.updateDeselectAll();
|
|
793
793
|
}
|
|
@@ -795,8 +795,8 @@ class ve {
|
|
|
795
795
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
796
796
|
n.setAttribute("viewBox", "0 0 100 100");
|
|
797
797
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
798
|
-
r.setAttribute("d", this.classes.optionDelete), n.appendChild(r), i.appendChild(n), t.appendChild(i), i.onkeydown = (
|
|
799
|
-
|
|
798
|
+
r.setAttribute("d", this.classes.optionDelete), n.appendChild(r), i.appendChild(n), t.appendChild(i), i.onkeydown = (l) => {
|
|
799
|
+
l.key === "Enter" && i.click();
|
|
800
800
|
};
|
|
801
801
|
}
|
|
802
802
|
return t;
|
|
@@ -852,10 +852,10 @@ class ve {
|
|
|
852
852
|
);
|
|
853
853
|
return r ? (r.click(), !1) : !0;
|
|
854
854
|
case "Enter":
|
|
855
|
-
const
|
|
855
|
+
const l = this.content.list.querySelector(
|
|
856
856
|
"." + this.classes.getFirst("highlighted")
|
|
857
857
|
);
|
|
858
|
-
return
|
|
858
|
+
return l ? (l.click(), !1) : this.callbacks.addable ? (s.click(), !1) : !0;
|
|
859
859
|
}
|
|
860
860
|
return !0;
|
|
861
861
|
}, e.appendChild(t), this.callbacks.addable) {
|
|
@@ -863,8 +863,8 @@ class ve {
|
|
|
863
863
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
864
864
|
n.setAttribute("viewBox", "0 0 100 100");
|
|
865
865
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
866
|
-
r.setAttribute("d", this.classes.addablePath), n.appendChild(r), s.appendChild(n), s.onclick = (
|
|
867
|
-
if (
|
|
866
|
+
r.setAttribute("d", this.classes.addablePath), n.appendChild(r), s.appendChild(n), s.onclick = (l) => {
|
|
867
|
+
if (l.preventDefault(), l.stopPropagation(), !this.callbacks.addable)
|
|
868
868
|
return;
|
|
869
869
|
const c = this.content.search.input.value.trim();
|
|
870
870
|
if (c === "") {
|
|
@@ -872,12 +872,12 @@ class ve {
|
|
|
872
872
|
return;
|
|
873
873
|
}
|
|
874
874
|
const h = (d) => {
|
|
875
|
-
let
|
|
876
|
-
if (this.callbacks.addOption(
|
|
875
|
+
let m = new w(d);
|
|
876
|
+
if (this.callbacks.addOption(m), this.settings.isMultiple) {
|
|
877
877
|
let f = this.store.getSelected();
|
|
878
|
-
f.push(
|
|
878
|
+
f.push(m.id), this.callbacks.setSelected(f, !0);
|
|
879
879
|
} else
|
|
880
|
-
this.callbacks.setSelected([
|
|
880
|
+
this.callbacks.setSelected([m.id], !0);
|
|
881
881
|
this.callbacks.search(""), this.settings.closeOnSelect && setTimeout(() => {
|
|
882
882
|
this.callbacks.close();
|
|
883
883
|
}, 100);
|
|
@@ -929,9 +929,9 @@ class ve {
|
|
|
929
929
|
if (t[n].classList.contains(this.classes.getFirst("highlighted"))) {
|
|
930
930
|
const r = t[n];
|
|
931
931
|
this.removeClasses(r, this.classes.highlighted);
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
const o =
|
|
932
|
+
const l = r.parentElement;
|
|
933
|
+
if (l && l.classList.contains(this.classes.getFirst("mainOpen"))) {
|
|
934
|
+
const o = l.querySelector("." + this.classes.getFirst("optgroupLabel"));
|
|
935
935
|
o && o.click();
|
|
936
936
|
}
|
|
937
937
|
let c = t[e === "down" ? n + 1 < t.length ? n + 1 : 0 : n - 1 >= 0 ? n - 1 : t.length - 1];
|
|
@@ -990,8 +990,8 @@ class ve {
|
|
|
990
990
|
this.addClasses(n, this.classes.optgroupLabel), i.appendChild(n);
|
|
991
991
|
const r = document.createElement("div");
|
|
992
992
|
this.addClasses(r, this.classes.optgroupLabelText), r.textContent = s.label, n.appendChild(r);
|
|
993
|
-
const
|
|
994
|
-
if (this.addClasses(
|
|
993
|
+
const l = document.createElement("div");
|
|
994
|
+
if (this.addClasses(l, this.classes.optgroupActions), n.appendChild(l), this.settings.isMultiple && s.selectAll) {
|
|
995
995
|
const c = document.createElement("div");
|
|
996
996
|
this.addClasses(c, this.classes.optgroupSelectAll);
|
|
997
997
|
let h = !0;
|
|
@@ -1005,14 +1005,14 @@ class ve {
|
|
|
1005
1005
|
o.textContent = s.selectAllText, c.appendChild(o);
|
|
1006
1006
|
const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1007
1007
|
d.setAttribute("viewBox", "0 0 100 100"), c.appendChild(d);
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1008
|
+
const m = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1009
|
+
m.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(m);
|
|
1010
1010
|
const f = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1011
1011
|
f.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(f), c.addEventListener("click", (E) => {
|
|
1012
1012
|
E.preventDefault(), E.stopPropagation();
|
|
1013
|
-
const
|
|
1013
|
+
const g = this.store.getSelected();
|
|
1014
1014
|
if (h) {
|
|
1015
|
-
const A =
|
|
1015
|
+
const A = g.filter((S) => {
|
|
1016
1016
|
for (const v of s.options)
|
|
1017
1017
|
if (S === v.id)
|
|
1018
1018
|
return !1;
|
|
@@ -1022,13 +1022,13 @@ class ve {
|
|
|
1022
1022
|
return;
|
|
1023
1023
|
} else {
|
|
1024
1024
|
let A = s.options.map((v) => v.id).filter((v) => v !== void 0);
|
|
1025
|
-
const S =
|
|
1025
|
+
const S = g.concat(A);
|
|
1026
1026
|
for (const v of s.options)
|
|
1027
1027
|
v.id && !this.store.getOptionByID(v.id) && this.callbacks.addOption(new w(v));
|
|
1028
1028
|
this.callbacks.setSelected(S, !0);
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
|
-
}),
|
|
1031
|
+
}), l.appendChild(c);
|
|
1032
1032
|
}
|
|
1033
1033
|
if (s.closable !== "off") {
|
|
1034
1034
|
const c = document.createElement("div");
|
|
@@ -1038,7 +1038,7 @@ class ve {
|
|
|
1038
1038
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1039
1039
|
h.appendChild(o), s.options.some((d) => d.selected) || this.content.search.input.value.trim() !== "" ? (this.addClasses(c, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "open" ? (this.addClasses(i, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : s.closable === "close" && (this.addClasses(i, this.classes.close), o.setAttribute("d", this.classes.arrowClose)), n.addEventListener("click", (d) => {
|
|
1040
1040
|
d.preventDefault(), d.stopPropagation(), i.classList.contains(this.classes.getFirst("close")) ? (this.removeClasses(i, this.classes.close), this.addClasses(i, this.classes.mainOpen), o.setAttribute("d", this.classes.arrowOpen)) : (this.removeClasses(i, this.classes.mainOpen), this.addClasses(i, this.classes.close), o.setAttribute("d", this.classes.arrowClose));
|
|
1041
|
-
}),
|
|
1041
|
+
}), l.appendChild(c);
|
|
1042
1042
|
}
|
|
1043
1043
|
i.appendChild(n);
|
|
1044
1044
|
for (const c of s.options)
|
|
@@ -1063,8 +1063,8 @@ class ve {
|
|
|
1063
1063
|
this.classes.searchHighlighter
|
|
1064
1064
|
) : e.html !== "" ? t.innerHTML = e.html : t.textContent = e.text, this.settings.showOptionTooltips && t.textContent && t.setAttribute("title", t.textContent), e.display || this.addClasses(t, this.classes.hide), e.disabled && this.addClasses(t, this.classes.disabled), e.selected && this.settings.hideSelected && this.addClasses(t, this.classes.hide), e.selected ? (this.addClasses(t, this.classes.selected), t.setAttribute("aria-selected", "true"), this.main.main.setAttribute("aria-activedescendant", t.id)) : (this.removeClasses(t, this.classes.selected), t.setAttribute("aria-selected", "false")), t.addEventListener("click", (s) => {
|
|
1065
1065
|
s.preventDefault(), s.stopPropagation();
|
|
1066
|
-
const i = this.store.getSelected(), n = s.currentTarget, r = String(n.dataset.id),
|
|
1067
|
-
if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !
|
|
1066
|
+
const i = this.store.getSelected(), n = s.currentTarget, r = String(n.dataset.id), l = s.ctrlKey || s.metaKey;
|
|
1067
|
+
if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !l)
|
|
1068
1068
|
return;
|
|
1069
1069
|
let c = !1;
|
|
1070
1070
|
const h = this.store.getSelectedOptions();
|
|
@@ -1072,13 +1072,13 @@ class ve {
|
|
|
1072
1072
|
if (this.settings.isMultiple) {
|
|
1073
1073
|
const d = h.some((f) => f.id === r);
|
|
1074
1074
|
if (s.shiftKey && this.lastSelectedOption) {
|
|
1075
|
-
const f = this.store.getDataOptions(), E = f.findIndex((A) => A.id === this.lastSelectedOption.id),
|
|
1076
|
-
if (E >= 0 &&
|
|
1077
|
-
const A = Math.min(E,
|
|
1075
|
+
const f = this.store.getDataOptions(), E = f.findIndex((A) => A.id === this.lastSelectedOption.id), g = f.findIndex((A) => A.id === e.id);
|
|
1076
|
+
if (E >= 0 && g >= 0) {
|
|
1077
|
+
const A = Math.min(E, g), S = Math.max(E, g), k = f.slice(A, S + 1).filter((L) => !h.find((b) => b.id === L.id));
|
|
1078
1078
|
h.length + k.length <= this.settings.maxSelected ? o = h.concat(k) : o = h;
|
|
1079
1079
|
} else
|
|
1080
1080
|
o = h;
|
|
1081
|
-
} else
|
|
1081
|
+
} else l ? (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e) : (d ? o = h.filter((f) => f.id !== r) : o = h.concat(e), this.lastSelectedOption = e);
|
|
1082
1082
|
}
|
|
1083
1083
|
if (this.settings.isMultiple || (e.selected ? o = [] : o = [e]), this.callbacks.beforeChange || (c = !0), this.callbacks.beforeChange && (this.callbacks.beforeChange(o, h) === !1 ? c = !1 : c = !0), c) {
|
|
1084
1084
|
this.store.getOptionByID(r) || this.callbacks.addOption(e), this.callbacks.setSelected(
|
|
@@ -1099,21 +1099,21 @@ class ve {
|
|
|
1099
1099
|
return e;
|
|
1100
1100
|
const n = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = document.createElement("div");
|
|
1101
1101
|
r.innerHTML = e;
|
|
1102
|
-
const
|
|
1102
|
+
const l = (c) => {
|
|
1103
1103
|
if (c.nodeType === Node.TEXT_NODE) {
|
|
1104
1104
|
const h = c.textContent || "", o = new RegExp("(" + n + ")", "i");
|
|
1105
1105
|
if (o.test(h)) {
|
|
1106
1106
|
const d = document.createElement("span");
|
|
1107
1107
|
h.split(o).forEach((f, E) => {
|
|
1108
1108
|
if (f && o.test(f)) {
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1109
|
+
const g = document.createElement("mark");
|
|
1110
|
+
g.className = s, g.textContent = f, d.appendChild(g);
|
|
1111
1111
|
} else f && d.appendChild(document.createTextNode(f));
|
|
1112
1112
|
}), c.parentNode?.replaceChild(d, c);
|
|
1113
1113
|
}
|
|
1114
|
-
} else c.nodeType === Node.ELEMENT_NODE && Array.from(c.childNodes).forEach((h) =>
|
|
1114
|
+
} else c.nodeType === Node.ELEMENT_NODE && Array.from(c.childNodes).forEach((h) => l(h));
|
|
1115
1115
|
};
|
|
1116
|
-
return Array.from(r.childNodes).forEach((c) =>
|
|
1116
|
+
return Array.from(r.childNodes).forEach((c) => l(c)), r.innerHTML;
|
|
1117
1117
|
}
|
|
1118
1118
|
setContentDirection(e) {
|
|
1119
1119
|
const t = e === "above", s = t ? this.classes.dirAbove : this.classes.dirBelow, i = t ? this.classes.dirBelow : this.classes.dirAbove;
|
|
@@ -1131,6 +1131,21 @@ class ve {
|
|
|
1131
1131
|
this.settings.contentPosition === "fixed" ? (t = e.top + e.height, s = e.left) : (t = e.top + window.scrollY + e.height, s = e.left + window.scrollX), this.content.main.style.top = t + "px", this.content.main.style.left = s + "px";
|
|
1132
1132
|
const i = this.settings.contentWidth;
|
|
1133
1133
|
this.content.main.style.width = "", this.content.main.style.minWidth = "", this.content.main.style.maxWidth = "", i ? i.startsWith(">") ? this.content.main.style.minWidth = i.slice(1) : i.startsWith("<") ? this.content.main.style.maxWidth = i.slice(1) : this.content.main.style.width = i : this.content.main.style.width = e.width + "px";
|
|
1134
|
+
const n = 20, r = window.innerWidth - n, l = () => {
|
|
1135
|
+
const h = this.content.main.getBoundingClientRect().right;
|
|
1136
|
+
if (h <= r) return;
|
|
1137
|
+
const o = h - r, d = parseFloat(this.content.main.style.left) || 0;
|
|
1138
|
+
if (this.settings.contentPosition === "fixed") {
|
|
1139
|
+
const m = Math.max(n, d - o);
|
|
1140
|
+
this.content.main.style.left = m + "px";
|
|
1141
|
+
} else {
|
|
1142
|
+
const m = Math.max(window.scrollX + n, d - o);
|
|
1143
|
+
this.content.main.style.left = m + "px";
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
requestAnimationFrame(() => {
|
|
1147
|
+
l(), requestAnimationFrame(l);
|
|
1148
|
+
});
|
|
1134
1149
|
}
|
|
1135
1150
|
moveContentAbove() {
|
|
1136
1151
|
this.setContentDirection("above"), this.setContentPosition();
|
|
@@ -1216,8 +1231,8 @@ class be {
|
|
|
1216
1231
|
let t = !1, s = !1, i = !1, n = !1;
|
|
1217
1232
|
for (const r of e) {
|
|
1218
1233
|
if (r.target === this.select && (r.attributeName === "disabled" && (s = !0), r.attributeName === "class" && (t = !0), r.type === "childList")) {
|
|
1219
|
-
for (const
|
|
1220
|
-
if (
|
|
1234
|
+
for (const l of Array.from(r.addedNodes))
|
|
1235
|
+
if (l.nodeName === "OPTION" && l.value === this.select.value) {
|
|
1221
1236
|
n = !0;
|
|
1222
1237
|
break;
|
|
1223
1238
|
}
|
|
@@ -1308,8 +1323,8 @@ class be {
|
|
|
1308
1323
|
const n = s.childNodes;
|
|
1309
1324
|
for (const r of n)
|
|
1310
1325
|
if (r.nodeName === "OPTION") {
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1326
|
+
const l = r;
|
|
1327
|
+
l.selected = e.includes(l.id);
|
|
1313
1328
|
}
|
|
1314
1329
|
}
|
|
1315
1330
|
if (s.nodeName === "OPTION") {
|
|
@@ -1331,8 +1346,8 @@ class be {
|
|
|
1331
1346
|
const n = s.childNodes;
|
|
1332
1347
|
for (const r of n)
|
|
1333
1348
|
if (r.nodeName === "OPTION") {
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1349
|
+
const l = r;
|
|
1350
|
+
l.selected = e.includes(l.value);
|
|
1336
1351
|
}
|
|
1337
1352
|
}
|
|
1338
1353
|
if (s.nodeName === "OPTION") {
|
|
@@ -1388,9 +1403,9 @@ class be {
|
|
|
1388
1403
|
Array.from(new Set(e)).forEach((n) => {
|
|
1389
1404
|
if (n.__slimSelectLabelHandler)
|
|
1390
1405
|
return;
|
|
1391
|
-
const r = (
|
|
1392
|
-
const c =
|
|
1393
|
-
|
|
1406
|
+
const r = (l) => {
|
|
1407
|
+
const c = l.target, h = ie(c, this.select.dataset.id);
|
|
1408
|
+
l.preventDefault(), !h && this.onLabelClick && this.onLabelClick();
|
|
1394
1409
|
};
|
|
1395
1410
|
n.__slimSelectLabelHandler = r, n.addEventListener("click", r, { capture: !0, passive: !1 });
|
|
1396
1411
|
});
|
|
@@ -1493,16 +1508,16 @@ let we = class {
|
|
|
1493
1508
|
}
|
|
1494
1509
|
this.selectEl.dataset.ssid && this.destroy(), this.settings = new Ce(e.settings), this.cssClasses = new pe(e.cssClasses);
|
|
1495
1510
|
const t = ["beforeOpen", "afterOpen", "beforeClose", "afterClose"];
|
|
1496
|
-
for (const
|
|
1497
|
-
e.events.hasOwnProperty(
|
|
1498
|
-
this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new be(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (
|
|
1499
|
-
this.setSelected(
|
|
1500
|
-
}, this.select.onClassChange = (
|
|
1501
|
-
this.settings.class =
|
|
1502
|
-
}, this.select.onDisabledChange = (
|
|
1503
|
-
|
|
1504
|
-
}, this.select.onOptionsChange = (
|
|
1505
|
-
this.setData(
|
|
1511
|
+
for (const l in e.events)
|
|
1512
|
+
e.events.hasOwnProperty(l) && (t.indexOf(l) !== -1 ? this.events[l] = H(e.events[l], 100) : this.events[l] = e.events[l]);
|
|
1513
|
+
this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new be(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (l) => {
|
|
1514
|
+
this.setSelected(l.map((c) => c.id));
|
|
1515
|
+
}, this.select.onClassChange = (l) => {
|
|
1516
|
+
this.settings.class = l, this.render.updateClassStyles();
|
|
1517
|
+
}, this.select.onDisabledChange = (l) => {
|
|
1518
|
+
l ? this.disable() : this.enable();
|
|
1519
|
+
}, this.select.onOptionsChange = (l) => {
|
|
1520
|
+
this.setData(l || []);
|
|
1506
1521
|
}, this.select.onLabelClick = () => {
|
|
1507
1522
|
this.settings.disabled || (this.settings.isOpen ? this.close() : this.open());
|
|
1508
1523
|
};
|
|
@@ -1552,12 +1567,12 @@ let we = class {
|
|
|
1552
1567
|
const s = this.store.getSelected(), i = this.store.getDataOptions();
|
|
1553
1568
|
e = Array.isArray(e) ? e : [e];
|
|
1554
1569
|
const n = [];
|
|
1555
|
-
for (const
|
|
1556
|
-
if (i.find((c) => c.id ==
|
|
1557
|
-
n.push(
|
|
1570
|
+
for (const l of e) {
|
|
1571
|
+
if (i.find((c) => c.id == l)) {
|
|
1572
|
+
n.push(l);
|
|
1558
1573
|
continue;
|
|
1559
1574
|
}
|
|
1560
|
-
for (const c of i.filter((h) => h.value ==
|
|
1575
|
+
for (const c of i.filter((h) => h.value == l))
|
|
1561
1576
|
n.push(c.id);
|
|
1562
1577
|
}
|
|
1563
1578
|
this.store.setSelectedBy("id", n);
|
|
@@ -1622,15 +1637,15 @@ let we = class {
|
|
|
1622
1637
|
};
|
|
1623
1638
|
};
|
|
1624
1639
|
const Se = oe(
|
|
1625
|
-
({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: n, children: r, multiple:
|
|
1626
|
-
const h = I(null), o = I(null), d = I(!0),
|
|
1640
|
+
({ data: p, settings: e, events: t, cssClasses: s, value: i, onChange: n, children: r, multiple: l }, c) => {
|
|
1641
|
+
const h = I(null), o = I(null), d = I(!0), m = I(i);
|
|
1627
1642
|
ce(c, () => ({
|
|
1628
1643
|
slimSelect: o.current
|
|
1629
1644
|
}));
|
|
1630
|
-
const f = (
|
|
1631
|
-
if (!o.current ||
|
|
1645
|
+
const f = (g) => typeof g == "string" ? l ? [g] : g : Array.isArray(g) ? l ? g : g[0] : l ? [] : "", E = (g, A = !1) => {
|
|
1646
|
+
if (!o.current || g === void 0)
|
|
1632
1647
|
return;
|
|
1633
|
-
const S = f(
|
|
1648
|
+
const S = f(g), k = o.current.getData().flatMap((b) => "label" in b ? b.options : [b]);
|
|
1634
1649
|
if (!(Array.isArray(S) ? S.length > 0 && S.every((b) => k.some((D) => D.value === b)) : S !== "" && k.some((b) => b.value === S)) && !Array.isArray(S) && !k.some((D) => D.placeholder)) {
|
|
1635
1650
|
const D = o.current.getData(), P = {
|
|
1636
1651
|
value: "",
|
|
@@ -1643,32 +1658,32 @@ const Se = oe(
|
|
|
1643
1658
|
};
|
|
1644
1659
|
return $(() => {
|
|
1645
1660
|
if (!h.current) return;
|
|
1646
|
-
const
|
|
1661
|
+
const g = {
|
|
1647
1662
|
select: h.current
|
|
1648
1663
|
};
|
|
1649
|
-
p && (
|
|
1664
|
+
p && (g.data = p), e && (g.settings = e), s && (g.cssClasses = s);
|
|
1650
1665
|
const A = t?.afterChange;
|
|
1651
|
-
return
|
|
1666
|
+
return g.events = {
|
|
1652
1667
|
...t,
|
|
1653
1668
|
afterChange: (S) => {
|
|
1654
1669
|
if (!o.current) return;
|
|
1655
|
-
const v =
|
|
1670
|
+
const v = l ? S.map((T) => T.value) : S[0]?.value ?? "", L = o.current.getData().flatMap(
|
|
1656
1671
|
(T) => "label" in T ? T.options : [T]
|
|
1657
|
-
), b =
|
|
1658
|
-
n && B && (D || P) && (n(v),
|
|
1672
|
+
), b = m.current, D = b === void 0 ? !1 : Array.isArray(b) ? b.length > 0 && b.every((T) => L.some((R) => R.value === T)) : b !== "" && L.some((T) => T.value === b), P = Array.isArray(v) ? v.length > 0 && v.every((T) => L.some((R) => R.value === T)) : v !== "" && L.some((T) => T.value === v), B = Array.isArray(v) && Array.isArray(b) ? JSON.stringify(v.sort()) !== JSON.stringify(b.sort()) : b !== v;
|
|
1673
|
+
n && B && (D || P) && (n(v), m.current = v), A && A(S);
|
|
1659
1674
|
}
|
|
1660
|
-
}, o.current = new we(
|
|
1675
|
+
}, o.current = new we(g), i !== void 0 && E(i, !1), () => {
|
|
1661
1676
|
o.current && (o.current.destroy(), o.current = null);
|
|
1662
1677
|
};
|
|
1663
1678
|
}, []), $(() => {
|
|
1664
1679
|
if (d.current) {
|
|
1665
|
-
d.current = !1,
|
|
1680
|
+
d.current = !1, m.current = i;
|
|
1666
1681
|
return;
|
|
1667
1682
|
}
|
|
1668
|
-
o.current && i !== void 0 && (
|
|
1683
|
+
o.current && i !== void 0 && (m.current = i, E(i, !1));
|
|
1669
1684
|
}, [i]), $(() => {
|
|
1670
1685
|
o.current && p && !d.current && (o.current.setData(p), i !== void 0 && E(i, !1));
|
|
1671
|
-
}, [p]), /* @__PURE__ */ fe.jsx("select", { ref: h, multiple:
|
|
1686
|
+
}, [p]), /* @__PURE__ */ fe.jsx("select", { ref: h, multiple: l, children: r });
|
|
1672
1687
|
}
|
|
1673
1688
|
);
|
|
1674
1689
|
Se.displayName = "SlimSelect";
|