treeselectjs 0.9.2 → 0.9.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/README.md +14 -5
- package/dist/treeselectjs.d.ts +4 -1
- package/dist/treeselectjs.mjs +263 -257
- package/dist/treeselectjs.umd.js +1 -1
- package/package.json +1 -1
package/dist/treeselectjs.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (l, e, t) => (
|
|
1
|
+
var oi = Object.defineProperty;
|
|
2
|
+
var ri = (l, e, t) => e in l ? oi(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var c = (l, e, t) => (ri(l, typeof e != "symbol" ? e + "" : e, t), t), kt = (l, e, t) => {
|
|
4
4
|
if (!e.has(l))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
7
|
-
var n = (l, e, t) => (
|
|
7
|
+
var n = (l, e, t) => (kt(l, e, "read from private field"), t ? t.call(l) : e.get(l)), r = (l, e, t) => {
|
|
8
8
|
if (e.has(l))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(l) : e.set(l, t);
|
|
11
|
-
}, m = (l, e, t, s) => (
|
|
12
|
-
var o = (l, e, t) => (
|
|
13
|
-
const
|
|
11
|
+
}, m = (l, e, t, s) => (kt(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t);
|
|
12
|
+
var o = (l, e, t) => (kt(l, e, "access private method"), t);
|
|
13
|
+
const Pt = {
|
|
14
14
|
arrowUp: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',
|
|
15
15
|
arrowDown: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',
|
|
16
16
|
arrowRight: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',
|
|
@@ -26,14 +26,14 @@ const It = {
|
|
|
26
26
|
const t = l.cloneNode(!0);
|
|
27
27
|
e.appendChild(t);
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, Bt = (l) => {
|
|
30
30
|
const e = l ? { ...l } : {};
|
|
31
|
-
return Object.keys(
|
|
32
|
-
e[t] || (e[t] =
|
|
31
|
+
return Object.keys(Pt).forEach((t) => {
|
|
32
|
+
e[t] || (e[t] = Pt[t]);
|
|
33
33
|
}), e;
|
|
34
|
-
},
|
|
35
|
-
var T, E, D, v, ue,
|
|
36
|
-
class
|
|
34
|
+
}, ci = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), "");
|
|
35
|
+
var T, E, D, v, ue, Ht, H, R, pe, Gt, me, Mt, G, U, N, V, fe, Ft, Ce, qt, be, jt, ge, $t, ke, Wt, we, Rt, Ee, Ut, ve, zt, Le, Yt, ye, Kt, xe, Xt, Se, Jt, _e, Zt, Ae, Qt, Te, es, Ne, ts, z, wt;
|
|
36
|
+
class hi {
|
|
37
37
|
constructor({
|
|
38
38
|
value: e,
|
|
39
39
|
showTags: t,
|
|
@@ -43,17 +43,17 @@ class oi {
|
|
|
43
43
|
searchable: h,
|
|
44
44
|
placeholder: p,
|
|
45
45
|
disabled: f,
|
|
46
|
-
isSingleSelect:
|
|
47
|
-
id:
|
|
46
|
+
isSingleSelect: C,
|
|
47
|
+
id: b,
|
|
48
48
|
ariaLabel: g,
|
|
49
|
-
iconElements:
|
|
50
|
-
inputCallback:
|
|
49
|
+
iconElements: k,
|
|
50
|
+
inputCallback: w,
|
|
51
51
|
searchCallback: y,
|
|
52
52
|
openCallback: I,
|
|
53
53
|
closeCallback: W,
|
|
54
54
|
keydownCallback: ae,
|
|
55
55
|
focusCallback: bt,
|
|
56
|
-
blurCallback:
|
|
56
|
+
blurCallback: gt,
|
|
57
57
|
nameChangeCallback: oe
|
|
58
58
|
}) {
|
|
59
59
|
// Private methods
|
|
@@ -64,11 +64,11 @@ class oi {
|
|
|
64
64
|
r(this, G);
|
|
65
65
|
r(this, N);
|
|
66
66
|
r(this, fe);
|
|
67
|
-
r(this, be);
|
|
68
67
|
r(this, Ce);
|
|
68
|
+
r(this, be);
|
|
69
69
|
r(this, ge);
|
|
70
|
-
r(this, we);
|
|
71
70
|
r(this, ke);
|
|
71
|
+
r(this, we);
|
|
72
72
|
r(this, Ee);
|
|
73
73
|
r(this, ve);
|
|
74
74
|
r(this, Le);
|
|
@@ -112,7 +112,7 @@ class oi {
|
|
|
112
112
|
c(this, "focusCallback");
|
|
113
113
|
c(this, "blurCallback");
|
|
114
114
|
c(this, "nameChangeCallback");
|
|
115
|
-
this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = h, this.placeholder = p, this.clearable = i, this.isAlwaysOpened = a, this.disabled = f, this.isSingleSelect =
|
|
115
|
+
this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = h, this.placeholder = p, this.clearable = i, this.isAlwaysOpened = a, this.disabled = f, this.isSingleSelect = C, this.id = b, this.ariaLabel = g, this.iconElements = k, this.isOpened = !1, this.searchText = "", m(this, T, o(this, be, jt).call(this)), m(this, E, o(this, Le, Yt).call(this)), m(this, D, o(this, Se, Jt).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = y, this.openCallback = I, this.closeCallback = W, this.keydownCallback = ae, this.focusCallback = bt, this.blurCallback = gt, this.nameChangeCallback = oe, this.srcElement = o(this, fe, Ft).call(this, n(this, T), n(this, E), n(this, D)), o(this, ue, Ht).call(this);
|
|
116
116
|
}
|
|
117
117
|
// Public methods
|
|
118
118
|
focus() {
|
|
@@ -137,22 +137,22 @@ class oi {
|
|
|
137
137
|
this.searchText = "", this.searchCallback(""), o(this, G, U).call(this);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
T = new WeakMap(), E = new WeakMap(), D = new WeakMap(), v = new WeakMap(), ue = new WeakSet(),
|
|
141
|
-
o(this, H, R).call(this), o(this, G, U).call(this), o(this, pe,
|
|
140
|
+
T = new WeakMap(), E = new WeakMap(), D = new WeakMap(), v = new WeakMap(), ue = new WeakSet(), Ht = function() {
|
|
141
|
+
o(this, H, R).call(this), o(this, G, U).call(this), o(this, pe, Gt).call(this);
|
|
142
142
|
}, H = new WeakSet(), R = function() {
|
|
143
143
|
if (n(this, T).innerHTML = "", this.showTags) {
|
|
144
|
-
n(this, T).append(...o(this, ge,
|
|
145
|
-
const e =
|
|
144
|
+
n(this, T).append(...o(this, ge, $t).call(this));
|
|
145
|
+
const e = ci(this.value);
|
|
146
146
|
this.nameChangeCallback(e);
|
|
147
147
|
} else {
|
|
148
|
-
const e = o(this, ve,
|
|
148
|
+
const e = o(this, ve, zt).call(this);
|
|
149
149
|
n(this, T).appendChild(e), this.nameChangeCallback(e.innerText);
|
|
150
150
|
}
|
|
151
151
|
n(this, T).appendChild(n(this, E));
|
|
152
|
-
}, pe = new WeakSet(),
|
|
152
|
+
}, pe = new WeakSet(), Gt = function() {
|
|
153
153
|
const e = [];
|
|
154
|
-
n(this, D).innerHTML = "", this.clearable && e.push(o(this, _e,
|
|
155
|
-
}, me = new WeakSet(),
|
|
154
|
+
n(this, D).innerHTML = "", this.clearable && e.push(o(this, _e, Zt).call(this)), this.isAlwaysOpened || e.push(o(this, Te, es).call(this, this.isOpened)), e.length && n(this, D).append(...e);
|
|
155
|
+
}, me = new WeakSet(), Mt = function() {
|
|
156
156
|
if (!this.isAlwaysOpened && n(this, v)) {
|
|
157
157
|
const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown;
|
|
158
158
|
O(e, n(this, v));
|
|
@@ -161,44 +161,44 @@ T = new WeakMap(), E = new WeakMap(), D = new WeakMap(), v = new WeakMap(), ue =
|
|
|
161
161
|
var e;
|
|
162
162
|
(e = this.value) != null && e.length ? (n(this, E).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, E).setAttribute("placeholder", this.placeholder), this.srcElement.classList.add("treeselect-input--value-not-selected")), this.searchable ? this.srcElement.classList.remove("treeselect-input--unsearchable") : this.srcElement.classList.add("treeselect-input--unsearchable"), this.isSingleSelect ? this.srcElement.classList.add("treeselect-input--is-single-select") : this.srcElement.classList.remove("treeselect-input--is-single-select"), n(this, E).value = this.searchText;
|
|
163
163
|
}, N = new WeakSet(), V = function() {
|
|
164
|
-
this.isOpened = !this.isOpened, o(this, me,
|
|
165
|
-
}, fe = new WeakSet(),
|
|
164
|
+
this.isOpened = !this.isOpened, o(this, me, Mt).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
|
|
165
|
+
}, fe = new WeakSet(), Ft = function(e, t, s) {
|
|
166
166
|
const i = document.createElement("div");
|
|
167
|
-
return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (a) => o(this,
|
|
168
|
-
},
|
|
167
|
+
return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (a) => o(this, Ce, qt).call(this, a)), i.addEventListener("focus", () => this.focusCallback(), !0), i.addEventListener("blur", () => this.blurCallback(), !0), e.appendChild(t), i.append(e, s), i;
|
|
168
|
+
}, Ce = new WeakSet(), qt = function(e) {
|
|
169
169
|
e.stopPropagation(), this.isOpened || o(this, N, V).call(this), this.focus();
|
|
170
|
-
},
|
|
170
|
+
}, be = new WeakSet(), jt = function() {
|
|
171
171
|
const e = document.createElement("div");
|
|
172
172
|
return e.classList.add("treeselect-input__tags"), e;
|
|
173
|
-
}, ge = new WeakSet(),
|
|
173
|
+
}, ge = new WeakSet(), $t = function() {
|
|
174
174
|
return this.value.map((e) => {
|
|
175
175
|
const t = document.createElement("div");
|
|
176
176
|
t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name);
|
|
177
|
-
const s = o(this,
|
|
178
|
-
return t.addEventListener("mousedown", (a) => o(this,
|
|
177
|
+
const s = o(this, we, Rt).call(this, e.name), i = o(this, Ee, Ut).call(this);
|
|
178
|
+
return t.addEventListener("mousedown", (a) => o(this, ke, Wt).call(this, a, e.id)), t.append(s, i), t;
|
|
179
179
|
});
|
|
180
|
-
},
|
|
180
|
+
}, ke = new WeakSet(), Wt = function(e, t) {
|
|
181
181
|
e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus();
|
|
182
|
-
},
|
|
182
|
+
}, we = new WeakSet(), Rt = function(e) {
|
|
183
183
|
const t = document.createElement("span");
|
|
184
184
|
return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t;
|
|
185
|
-
}, Ee = new WeakSet(),
|
|
185
|
+
}, Ee = new WeakSet(), Ut = function() {
|
|
186
186
|
const e = document.createElement("span");
|
|
187
187
|
return e.classList.add("treeselect-input__tags-cross"), O(this.iconElements.cross, e), e;
|
|
188
|
-
}, ve = new WeakSet(),
|
|
188
|
+
}, ve = new WeakSet(), zt = function() {
|
|
189
189
|
const e = document.createElement("span");
|
|
190
190
|
if (e.classList.add("treeselect-input__tags-count"), !this.value.length)
|
|
191
191
|
return e.textContent = "", e.setAttribute("title", ""), e;
|
|
192
192
|
const t = this.value.length === 1 ? this.value[0].name : `${this.value.length} ${this.tagsCountText}`;
|
|
193
193
|
return e.textContent = t, e.setAttribute("title", t), e;
|
|
194
|
-
}, Le = new WeakSet(),
|
|
194
|
+
}, Le = new WeakSet(), Yt = function() {
|
|
195
195
|
const e = document.createElement("input");
|
|
196
|
-
return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), this.ariaLabel.length && e.setAttribute("aria-label", this.ariaLabel), e.addEventListener("keydown", (t) => o(this, ye,
|
|
197
|
-
}, ye = new WeakSet(),
|
|
196
|
+
return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), this.ariaLabel.length && e.setAttribute("aria-label", this.ariaLabel), e.addEventListener("keydown", (t) => o(this, ye, Kt).call(this, t)), e.addEventListener("input", (t) => o(this, xe, Xt).call(this, t, e)), e;
|
|
197
|
+
}, ye = new WeakSet(), Kt = function(e) {
|
|
198
198
|
e.stopPropagation();
|
|
199
199
|
const t = e.key;
|
|
200
200
|
t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && o(this, N, V).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
|
|
201
|
-
}, xe = new WeakSet(),
|
|
201
|
+
}, xe = new WeakSet(), Xt = function(e, t) {
|
|
202
202
|
e.stopPropagation();
|
|
203
203
|
const s = this.searchText, i = t.value.trim();
|
|
204
204
|
if (s.length === 0 && i.length === 0) {
|
|
@@ -211,25 +211,25 @@ T = new WeakMap(), E = new WeakMap(), D = new WeakMap(), v = new WeakMap(), ue =
|
|
|
211
211
|
} else
|
|
212
212
|
t.value = "";
|
|
213
213
|
this.searchText = t.value;
|
|
214
|
-
}, Se = new WeakSet(),
|
|
214
|
+
}, Se = new WeakSet(), Jt = function() {
|
|
215
215
|
const e = document.createElement("div");
|
|
216
216
|
return e.classList.add("treeselect-input__operators"), e;
|
|
217
|
-
}, _e = new WeakSet(),
|
|
217
|
+
}, _e = new WeakSet(), Zt = function() {
|
|
218
218
|
const e = document.createElement("span");
|
|
219
|
-
return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), O(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => o(this, Ae,
|
|
220
|
-
}, Ae = new WeakSet(),
|
|
219
|
+
return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), O(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => o(this, Ae, Qt).call(this, t)), e;
|
|
220
|
+
}, Ae = new WeakSet(), Qt = function(e) {
|
|
221
221
|
e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus();
|
|
222
|
-
}, Te = new WeakSet(),
|
|
222
|
+
}, Te = new WeakSet(), es = function(e) {
|
|
223
223
|
m(this, v, document.createElement("span")), n(this, v).classList.add("treeselect-input__arrow");
|
|
224
224
|
const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown;
|
|
225
|
-
return O(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => o(this, Ne,
|
|
226
|
-
}, Ne = new WeakSet(),
|
|
225
|
+
return O(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => o(this, Ne, ts).call(this, s)), n(this, v);
|
|
226
|
+
}, Ne = new WeakSet(), ts = function(e) {
|
|
227
227
|
e.stopPropagation(), e.preventDefault(), this.focus(), o(this, N, V).call(this);
|
|
228
228
|
}, z = new WeakSet(), wt = function() {
|
|
229
229
|
this.inputCallback(this.value);
|
|
230
230
|
};
|
|
231
|
-
const
|
|
232
|
-
|
|
231
|
+
const ss = (l, e, t, s) => {
|
|
232
|
+
mi(e);
|
|
233
233
|
const i = e.filter((a) => !a.disabled && l.some((h) => h === a.id));
|
|
234
234
|
if (t && i.length) {
|
|
235
235
|
i[0].checked = !0;
|
|
@@ -237,64 +237,64 @@ const ts = (l, e, t, s) => {
|
|
|
237
237
|
}
|
|
238
238
|
i.forEach((a) => {
|
|
239
239
|
a.checked = !0;
|
|
240
|
-
const h =
|
|
240
|
+
const h = It(a, e, s);
|
|
241
241
|
a.checked = h;
|
|
242
242
|
});
|
|
243
|
-
},
|
|
243
|
+
}, It = ({ id: l, checked: e }, t, s) => {
|
|
244
244
|
const i = t.find((h) => h.id === l);
|
|
245
245
|
if (!i)
|
|
246
246
|
return !1;
|
|
247
247
|
if (s)
|
|
248
248
|
return i.checked = i.disabled ? !1 : !!e, i.checked;
|
|
249
|
-
const a =
|
|
250
|
-
return
|
|
251
|
-
},
|
|
249
|
+
const a = is(!!e, i, t);
|
|
250
|
+
return ls(i, t), a;
|
|
251
|
+
}, is = (l, e, t) => {
|
|
252
252
|
if (!e.isGroup)
|
|
253
253
|
return e.checked = e.disabled ? !1 : !!l, e.isPartialChecked = !1, e.checked;
|
|
254
254
|
const s = t.filter((p) => p.childOf === e.id);
|
|
255
|
-
return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1,
|
|
256
|
-
|
|
257
|
-
}), e.checked) : (e.checked = !0, e.isPartialChecked = !1,
|
|
258
|
-
},
|
|
255
|
+
return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, Et(e, s, t), e.checked) : ns(s, t) ? as(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((p) => {
|
|
256
|
+
is(l, p, t);
|
|
257
|
+
}), e.checked) : (e.checked = !0, e.isPartialChecked = !1, Et(e, s, t), e.checked);
|
|
258
|
+
}, ls = (l, e) => {
|
|
259
259
|
const t = e.find((s) => s.id === l.childOf);
|
|
260
|
-
t && (
|
|
261
|
-
},
|
|
262
|
-
const t =
|
|
263
|
-
if (
|
|
260
|
+
t && (di(t, e), ls(t, e));
|
|
261
|
+
}, di = (l, e) => {
|
|
262
|
+
const t = ft(l, e);
|
|
263
|
+
if (as(t)) {
|
|
264
264
|
l.checked = !1, l.isPartialChecked = !1, l.disabled = !0;
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
if (
|
|
267
|
+
if (ui(t)) {
|
|
268
268
|
l.checked = !0, l.isPartialChecked = !1;
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
if (
|
|
271
|
+
if (pi(t)) {
|
|
272
272
|
l.checked = !1, l.isPartialChecked = !0;
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
l.checked = !1, l.isPartialChecked = !1;
|
|
276
|
-
},
|
|
276
|
+
}, Et = ({ checked: l, disabled: e }, t, s) => {
|
|
277
277
|
t.forEach((i) => {
|
|
278
278
|
i.disabled = !!e || !!i.disabled, i.checked = !!l && !i.disabled, i.isPartialChecked = !1;
|
|
279
|
-
const a =
|
|
280
|
-
|
|
279
|
+
const a = ft(i, s);
|
|
280
|
+
Et({ checked: l, disabled: e }, a, s);
|
|
281
281
|
});
|
|
282
|
-
},
|
|
282
|
+
}, ns = (l, e) => l.some((i) => i.disabled) ? !0 : l.some((i) => {
|
|
283
283
|
if (i.isGroup) {
|
|
284
|
-
const a =
|
|
285
|
-
return
|
|
284
|
+
const a = ft(i, e);
|
|
285
|
+
return ns(a, e);
|
|
286
286
|
}
|
|
287
287
|
return !1;
|
|
288
|
-
}),
|
|
288
|
+
}), as = (l) => l.every((e) => !!e.disabled), ui = (l) => l.every((e) => !!e.checked), pi = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked), mi = (l) => {
|
|
289
289
|
l.forEach((e) => {
|
|
290
290
|
e.checked = !1, e.isPartialChecked = !1;
|
|
291
291
|
});
|
|
292
|
-
},
|
|
293
|
-
const s = { level: 0, groupId: "" }, i =
|
|
294
|
-
return
|
|
295
|
-
},
|
|
296
|
-
var
|
|
297
|
-
const h = !!((
|
|
292
|
+
}, fi = (l, e, t) => {
|
|
293
|
+
const s = { level: 0, groupId: "" }, i = os(l, e, s.groupId, s.level);
|
|
294
|
+
return bi(i, t);
|
|
295
|
+
}, os = (l, e, t, s) => l.reduce((i, a) => {
|
|
296
|
+
var C;
|
|
297
|
+
const h = !!((C = a.children) != null && C.length), p = s >= e && h, f = s > e;
|
|
298
298
|
if (i.push({
|
|
299
299
|
id: a.value,
|
|
300
300
|
name: a.name,
|
|
@@ -307,11 +307,11 @@ const ts = (l, e, t, s) => {
|
|
|
307
307
|
hidden: f,
|
|
308
308
|
disabled: a.disabled ?? !1
|
|
309
309
|
}), h) {
|
|
310
|
-
const
|
|
311
|
-
i.push(...
|
|
310
|
+
const b = os(a.children, e, a.value, s + 1);
|
|
311
|
+
i.push(...b);
|
|
312
312
|
}
|
|
313
313
|
return i;
|
|
314
|
-
}, []),
|
|
314
|
+
}, []), ft = ({ id: l }, e) => e.filter((t) => t.childOf === l), Ci = (l) => {
|
|
315
315
|
const { ungroupedNodes: e, allGroupedNodes: t, allNodes: s } = l.reduce(
|
|
316
316
|
(a, h) => (h.checked && (a.allNodes.push(h), h.isGroup ? a.allGroupedNodes.push(h) : a.ungroupedNodes.push(h)), a),
|
|
317
317
|
{
|
|
@@ -321,34 +321,34 @@ const ts = (l, e, t, s) => {
|
|
|
321
321
|
}
|
|
322
322
|
), i = s.filter((a) => !t.some(({ id: h }) => h === a.childOf));
|
|
323
323
|
return { ungroupedNodes: e, groupedNodes: i, allNodes: s };
|
|
324
|
-
},
|
|
325
|
-
({ id: s }) =>
|
|
326
|
-
), l),
|
|
327
|
-
|
|
328
|
-
i.hidden = t ?? !1, i.isGroup && !i.isClosed &&
|
|
324
|
+
}, bi = (l, e) => (l.filter((s) => !!s.disabled).forEach(
|
|
325
|
+
({ id: s }) => It({ id: s, checked: !1 }, l, e)
|
|
326
|
+
), l), Ct = (l, { id: e, isClosed: t }) => {
|
|
327
|
+
ft({ id: e }, l).forEach((i) => {
|
|
328
|
+
i.hidden = t ?? !1, i.isGroup && !i.isClosed && Ct(l, { id: i.id, isClosed: t });
|
|
329
329
|
});
|
|
330
|
-
},
|
|
330
|
+
}, gi = (l) => {
|
|
331
331
|
l.filter((e) => e.isGroup && !e.disabled && (e.checked || e.isPartialChecked)).forEach((e) => {
|
|
332
|
-
e.isClosed = !1,
|
|
332
|
+
e.isClosed = !1, Ct(l, e);
|
|
333
333
|
});
|
|
334
|
-
},
|
|
335
|
-
const t =
|
|
334
|
+
}, ki = (l, e) => {
|
|
335
|
+
const t = wi(l, e);
|
|
336
336
|
l.forEach((s) => {
|
|
337
|
-
t.some(({ id: a }) => a === s.id) ? (s.isGroup && (s.isClosed = !1,
|
|
337
|
+
t.some(({ id: a }) => a === s.id) ? (s.isGroup && (s.isClosed = !1, Ct(l, s)), s.hidden = !1) : s.hidden = !0;
|
|
338
338
|
});
|
|
339
|
-
},
|
|
339
|
+
}, wi = (l, e) => l.reduce((t, s) => {
|
|
340
340
|
if (s.name.toLowerCase().includes(e.toLowerCase())) {
|
|
341
341
|
if (t.push(s), s.isGroup) {
|
|
342
|
-
const a =
|
|
342
|
+
const a = rs(s.id, l);
|
|
343
343
|
t.push(...a);
|
|
344
344
|
}
|
|
345
345
|
if (s.childOf) {
|
|
346
|
-
const a =
|
|
346
|
+
const a = cs(s.childOf, l);
|
|
347
347
|
t.push(...a);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
return t;
|
|
351
|
-
}, []),
|
|
351
|
+
}, []), rs = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...rs(s.id, e))), t), []), cs = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...cs(s.childOf, e))), t), []), Ei = (l) => {
|
|
352
352
|
const { duplications: e } = l.reduce(
|
|
353
353
|
(t, s) => (t.allItems.some((i) => i.toString() === s.id.toString()) && t.duplications.push(s.id), t.allItems.push(s.id), t),
|
|
354
354
|
{
|
|
@@ -357,30 +357,30 @@ const ts = (l, e, t, s) => {
|
|
|
357
357
|
}
|
|
358
358
|
);
|
|
359
359
|
e.length && console.error(`Validation: You have duplicated values: ${e.join(", ")}! You should use unique values.`);
|
|
360
|
-
},
|
|
361
|
-
|
|
360
|
+
}, vi = (l, e, t, s, i, a, h, p, f) => {
|
|
361
|
+
ss(l, e, i, f), p && h && gi(e), ce(e, t, s, a);
|
|
362
362
|
}, ce = (l, e, t, s) => {
|
|
363
363
|
l.forEach((i) => {
|
|
364
364
|
const a = e.querySelector(`[input-id="${i.id}"]`), h = A(a);
|
|
365
|
-
a.checked = i.checked,
|
|
366
|
-
}),
|
|
367
|
-
},
|
|
365
|
+
a.checked = i.checked, Li(i, h, s), yi(i, h), xi(i, h), Si(i, h, t), _i(i, h), Ti(i, h, l), Ai(i, a, t);
|
|
366
|
+
}), Ni(l, e);
|
|
367
|
+
}, Li = (l, e, t) => {
|
|
368
368
|
l.checked ? e.classList.add("treeselect-list__item--checked") : e.classList.remove("treeselect-list__item--checked"), Array.isArray(t) && t[0] === l.id && !l.disabled ? e.classList.add("treeselect-list__item--single-selected") : e.classList.remove("treeselect-list__item--single-selected");
|
|
369
|
-
},
|
|
369
|
+
}, yi = (l, e) => {
|
|
370
370
|
l.isPartialChecked ? e.classList.add("treeselect-list__item--partial-checked") : e.classList.remove("treeselect-list__item--partial-checked");
|
|
371
|
-
},
|
|
371
|
+
}, xi = (l, e) => {
|
|
372
372
|
l.disabled ? e.classList.add("treeselect-list__item--disabled") : e.classList.remove("treeselect-list__item--disabled");
|
|
373
|
-
},
|
|
373
|
+
}, Si = (l, e, t) => {
|
|
374
374
|
if (l.isGroup) {
|
|
375
375
|
const s = e.querySelector(".treeselect-list__item-icon"), i = l.isClosed ? t.arrowRight : t.arrowDown;
|
|
376
376
|
O(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed");
|
|
377
377
|
}
|
|
378
|
-
},
|
|
378
|
+
}, _i = (l, e) => {
|
|
379
379
|
l.hidden ? e.classList.add("treeselect-list__item--hidden") : e.classList.remove("treeselect-list__item--hidden");
|
|
380
|
-
},
|
|
380
|
+
}, Ai = (l, e, t) => {
|
|
381
381
|
const i = e.parentNode.querySelector(".treeselect-list__item-checkbox-icon");
|
|
382
382
|
l.checked ? O(t.check, i) : l.isPartialChecked ? O(t.partialCheck, i) : i.innerHTML = "";
|
|
383
|
-
},
|
|
383
|
+
}, Ti = (l, e, t) => {
|
|
384
384
|
const s = l.level === 0, i = 20, a = 5;
|
|
385
385
|
if (s) {
|
|
386
386
|
const h = t.some((f) => f.isGroup && f.level === l.level), p = !l.isGroup && h ? `${i}px` : `${a}px`;
|
|
@@ -388,17 +388,17 @@ const ts = (l, e, t, s) => {
|
|
|
388
388
|
} else
|
|
389
389
|
e.style.paddingLeft = l.isGroup ? `${l.level * i}px` : `${l.level * i + i}px`;
|
|
390
390
|
e.setAttribute("level", l.level.toString()), e.setAttribute("group", l.isGroup.toString());
|
|
391
|
-
},
|
|
391
|
+
}, Ni = (l, e) => {
|
|
392
392
|
const t = l.some((i) => !i.hidden), s = e.querySelector(".treeselect-list__empty");
|
|
393
393
|
t ? s.classList.add("treeselect-list__empty--hidden") : s.classList.remove("treeselect-list__empty--hidden");
|
|
394
|
-
}, A = (l) => l.parentNode.parentNode,
|
|
394
|
+
}, A = (l) => l.parentNode.parentNode, Vt = (l, e) => e.find((t) => t.id.toString() === l), Oi = (l) => A(l).querySelector(".treeselect-list__item-icon"), Ii = (l, e) => {
|
|
395
395
|
e && Object.keys(e).forEach((t) => {
|
|
396
396
|
const s = e[t];
|
|
397
397
|
typeof s == "string" && l.setAttribute(t, s);
|
|
398
398
|
});
|
|
399
399
|
};
|
|
400
|
-
var M, P, x, Y, Oe,
|
|
401
|
-
class
|
|
400
|
+
var M, P, x, Y, Oe, hs, Ie, ds, Pe, us, Be, ps, Ve, ms, De, fs, K, vt, He, Cs, Ge, bs, Me, gs, X, Lt, Fe, ks, qe, ws, je, Es, $e, vs, We, Ls, Re, ys, Ue, xs, ze, Ss, Ye, _s, Ke, As, Xe, Ts, J, yt, Z, xt, Je, Ns;
|
|
401
|
+
class Pi {
|
|
402
402
|
constructor({
|
|
403
403
|
options: e,
|
|
404
404
|
value: t,
|
|
@@ -408,11 +408,11 @@ class Ni {
|
|
|
408
408
|
isSingleSelect: h,
|
|
409
409
|
iconElements: p,
|
|
410
410
|
showCount: f,
|
|
411
|
-
disabledBranchNode:
|
|
412
|
-
expandSelected:
|
|
411
|
+
disabledBranchNode: C,
|
|
412
|
+
expandSelected: b,
|
|
413
413
|
isIndependentNodes: g,
|
|
414
|
-
inputCallback:
|
|
415
|
-
arrowClickCallback:
|
|
414
|
+
inputCallback: k,
|
|
415
|
+
arrowClickCallback: w,
|
|
416
416
|
mouseupCallback: y
|
|
417
417
|
}) {
|
|
418
418
|
// Private methods
|
|
@@ -470,11 +470,11 @@ class Ni {
|
|
|
470
470
|
r(this, P, !0);
|
|
471
471
|
r(this, x, []);
|
|
472
472
|
r(this, Y, !0);
|
|
473
|
-
this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = a ?? "No results found...", this.isSingleSelect = h ?? !1, this.showCount = f ?? !1, this.disabledBranchNode =
|
|
473
|
+
this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = a ?? "No results found...", this.isSingleSelect = h ?? !1, this.showCount = f ?? !1, this.disabledBranchNode = C ?? !1, this.expandSelected = b ?? !1, this.isIndependentNodes = g ?? !1, this.iconElements = p, this.searchText = "", this.flattedOptions = fi(this.options, this.openLevel, this.isIndependentNodes), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [], allNodes: [] }, this.srcElement = o(this, Pe, us).call(this), this.inputCallback = k, this.arrowClickCallback = w, this.mouseupCallback = y, Ei(this.flattedOptions);
|
|
474
474
|
}
|
|
475
475
|
// Public methods
|
|
476
476
|
updateValue(e) {
|
|
477
|
-
this.value = e, m(this, x, this.isSingleSelect ? this.value : []),
|
|
477
|
+
this.value = e, m(this, x, this.isSingleSelect ? this.value : []), vi(
|
|
478
478
|
e,
|
|
479
479
|
this.flattedOptions,
|
|
480
480
|
this.srcElement,
|
|
@@ -484,7 +484,7 @@ class Ni {
|
|
|
484
484
|
this.expandSelected,
|
|
485
485
|
n(this, Y),
|
|
486
486
|
this.isIndependentNodes
|
|
487
|
-
), m(this, Y, !1), o(this, Z,
|
|
487
|
+
), m(this, Y, !1), o(this, Z, xt).call(this);
|
|
488
488
|
}
|
|
489
489
|
updateSearchValue(e) {
|
|
490
490
|
if (e === this.searchText)
|
|
@@ -493,7 +493,7 @@ class Ni {
|
|
|
493
493
|
this.searchText = e, t && (this.flattedOptionsBeforeSearch = JSON.parse(JSON.stringify(this.flattedOptions))), this.searchText === "" && (this.flattedOptions = this.flattedOptionsBeforeSearch.map((s) => {
|
|
494
494
|
const i = this.flattedOptions.find((a) => a.id === s.id);
|
|
495
495
|
return i.isClosed = s.isClosed, i.hidden = s.hidden, i;
|
|
496
|
-
}), this.flattedOptionsBeforeSearch = []), this.searchText &&
|
|
496
|
+
}), this.flattedOptionsBeforeSearch = []), this.searchText && ki(this.flattedOptions, e), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), this.focusFirstListElement();
|
|
497
497
|
}
|
|
498
498
|
callKeyAction(e) {
|
|
499
499
|
m(this, P, !1);
|
|
@@ -501,7 +501,7 @@ class Ni {
|
|
|
501
501
|
if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden"))
|
|
502
502
|
return;
|
|
503
503
|
const i = e.key;
|
|
504
|
-
i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && o(this, Oe,
|
|
504
|
+
i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && o(this, Oe, hs).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && o(this, Ie, ds).call(this, t, i);
|
|
505
505
|
}
|
|
506
506
|
focusFirstListElement() {
|
|
507
507
|
const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
|
|
@@ -515,12 +515,12 @@ class Ni {
|
|
|
515
515
|
return !!n(this, M);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe = new WeakSet(),
|
|
518
|
+
M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe = new WeakSet(), hs = function(e, t) {
|
|
519
519
|
if (!e)
|
|
520
520
|
return;
|
|
521
|
-
const s = t.key, a = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), h =
|
|
521
|
+
const s = t.key, a = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), h = Vt(a, this.flattedOptions), p = e.querySelector(".treeselect-list__item-icon");
|
|
522
522
|
s === "ArrowLeft" && !h.isClosed && h.isGroup && (p.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && h.isClosed && h.isGroup && (p.dispatchEvent(new Event("mousedown")), t.preventDefault());
|
|
523
|
-
}, Ie = new WeakSet(),
|
|
523
|
+
}, Ie = new WeakSet(), ds = function(e, t) {
|
|
524
524
|
var i;
|
|
525
525
|
const s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
|
|
526
526
|
(a) => window.getComputedStyle(A(a)).display !== "none"
|
|
@@ -533,52 +533,52 @@ M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe =
|
|
|
533
533
|
(I) => A(I).classList.contains("treeselect-list__item--focused")
|
|
534
534
|
);
|
|
535
535
|
A(s[a]).classList.remove("treeselect-list__item--focused");
|
|
536
|
-
const p = t === "ArrowDown" ? a + 1 : a - 1, f = t === "ArrowDown" ? 0 : s.length - 1,
|
|
536
|
+
const p = t === "ArrowDown" ? a + 1 : a - 1, f = t === "ArrowDown" ? 0 : s.length - 1, C = s[p] ?? s[f], b = !s[p], g = A(C);
|
|
537
537
|
g.classList.add("treeselect-list__item--focused");
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
538
|
+
const k = this.srcElement.getBoundingClientRect(), w = g.getBoundingClientRect();
|
|
539
|
+
if (b && t === "ArrowDown") {
|
|
540
540
|
this.srcElement.scroll(0, 0);
|
|
541
541
|
return;
|
|
542
542
|
}
|
|
543
|
-
if (
|
|
543
|
+
if (b && t === "ArrowUp") {
|
|
544
544
|
this.srcElement.scroll(0, this.srcElement.scrollHeight);
|
|
545
545
|
return;
|
|
546
546
|
}
|
|
547
547
|
const y = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0;
|
|
548
|
-
if (
|
|
549
|
-
this.srcElement.scroll(0, this.srcElement.scrollTop +
|
|
548
|
+
if (k.y + k.height < w.y + w.height + y) {
|
|
549
|
+
this.srcElement.scroll(0, this.srcElement.scrollTop + w.height);
|
|
550
550
|
return;
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
553
|
-
this.srcElement.scroll(0, this.srcElement.scrollTop -
|
|
552
|
+
if (k.y > w.y) {
|
|
553
|
+
this.srcElement.scroll(0, this.srcElement.scrollTop - w.height);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
}, Pe = new WeakSet(),
|
|
558
|
-
const e = o(this, Be,
|
|
557
|
+
}, Pe = new WeakSet(), us = function() {
|
|
558
|
+
const e = o(this, Be, ps).call(this), t = o(this, K, vt).call(this, this.options);
|
|
559
559
|
e.append(...t);
|
|
560
560
|
const s = o(this, Ge, bs).call(this);
|
|
561
561
|
e.append(s);
|
|
562
|
-
const i = o(this, He,
|
|
562
|
+
const i = o(this, He, Cs).call(this);
|
|
563
563
|
return i && e.append(i), e;
|
|
564
|
-
}, Be = new WeakSet(),
|
|
564
|
+
}, Be = new WeakSet(), ps = function() {
|
|
565
565
|
const e = document.createElement("div");
|
|
566
|
-
return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => o(this, Ve,
|
|
567
|
-
}, Ve = new WeakSet(),
|
|
566
|
+
return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => o(this, Ve, ms).call(this, t)), e.addEventListener("mousemove", () => o(this, De, fs).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), e;
|
|
567
|
+
}, Ve = new WeakSet(), ms = function(e) {
|
|
568
568
|
e.stopPropagation(), n(this, M) && n(this, P) && n(this, M).classList.add("treeselect-list__item--focused");
|
|
569
|
-
}, De = new WeakSet(),
|
|
569
|
+
}, De = new WeakSet(), fs = function() {
|
|
570
570
|
m(this, P, !0);
|
|
571
|
-
}, K = new WeakSet(),
|
|
571
|
+
}, K = new WeakSet(), vt = function(e) {
|
|
572
572
|
return e.reduce((t, s) => {
|
|
573
573
|
var a;
|
|
574
574
|
if ((a = s.children) != null && a.length) {
|
|
575
|
-
const h = o(this, Me,
|
|
575
|
+
const h = o(this, Me, gs).call(this, s), p = o(this, K, vt).call(this, s.children);
|
|
576
576
|
return h.append(...p), t.push(h), t;
|
|
577
577
|
}
|
|
578
|
-
const i = o(this, X,
|
|
578
|
+
const i = o(this, X, Lt).call(this, s, !1);
|
|
579
579
|
return t.push(i), t;
|
|
580
580
|
}, []);
|
|
581
|
-
}, He = new WeakSet(),
|
|
581
|
+
}, He = new WeakSet(), Cs = function() {
|
|
582
582
|
if (!this.listSlotHtmlComponent)
|
|
583
583
|
return null;
|
|
584
584
|
const e = document.createElement("div");
|
|
@@ -590,59 +590,59 @@ M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe =
|
|
|
590
590
|
t.classList.add("treeselect-list__empty-icon"), O(this.iconElements.attention, t);
|
|
591
591
|
const s = document.createElement("span");
|
|
592
592
|
return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), e;
|
|
593
|
-
}, Me = new WeakSet(),
|
|
593
|
+
}, Me = new WeakSet(), gs = function(e) {
|
|
594
594
|
const t = document.createElement("div");
|
|
595
595
|
t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container");
|
|
596
|
-
const s = o(this, X,
|
|
596
|
+
const s = o(this, X, Lt).call(this, e, !0);
|
|
597
597
|
return t.appendChild(s), t;
|
|
598
|
-
}, X = new WeakSet(),
|
|
599
|
-
const s = o(this, Fe,
|
|
598
|
+
}, X = new WeakSet(), Lt = function(e, t) {
|
|
599
|
+
const s = o(this, Fe, ks).call(this, e);
|
|
600
600
|
if (t) {
|
|
601
|
-
const h = o(this, We,
|
|
601
|
+
const h = o(this, We, Ls).call(this);
|
|
602
602
|
s.appendChild(h), s.classList.add("treeselect-list__item--group");
|
|
603
603
|
}
|
|
604
|
-
const i = o(this, Ue,
|
|
604
|
+
const i = o(this, Ue, xs).call(this, e), a = o(this, ze, Ss).call(this, e, t);
|
|
605
605
|
return s.append(i, a), s;
|
|
606
|
-
}, Fe = new WeakSet(),
|
|
606
|
+
}, Fe = new WeakSet(), ks = function(e) {
|
|
607
607
|
const t = document.createElement("div");
|
|
608
|
-
return
|
|
608
|
+
return Ii(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => o(this, qe, ws).call(this, t), !0), t.addEventListener("mouseout", () => o(this, je, Es).call(this, t), !0), t.addEventListener("mousedown", (s) => o(this, $e, vs).call(this, s, e)), t;
|
|
609
609
|
}, qe = new WeakSet(), ws = function(e) {
|
|
610
|
-
n(this, P) && o(this, J,
|
|
611
|
-
}, je = new WeakSet(),
|
|
612
|
-
n(this, P) && (o(this, J,
|
|
613
|
-
}, $e = new WeakSet(),
|
|
610
|
+
n(this, P) && o(this, J, yt).call(this, !0, e);
|
|
611
|
+
}, je = new WeakSet(), Es = function(e) {
|
|
612
|
+
n(this, P) && (o(this, J, yt).call(this, !1, e), m(this, M, e));
|
|
613
|
+
}, $e = new WeakSet(), vs = function(e, t) {
|
|
614
614
|
var a;
|
|
615
615
|
if (e.preventDefault(), e.stopPropagation(), (a = this.flattedOptions.find((h) => h.id === t.value)) == null ? void 0 : a.disabled)
|
|
616
616
|
return;
|
|
617
617
|
const i = e.target.querySelector(".treeselect-list__item-checkbox");
|
|
618
|
-
i.checked = !i.checked, o(this, Ke,
|
|
619
|
-
}, We = new WeakSet(),
|
|
618
|
+
i.checked = !i.checked, o(this, Ke, As).call(this, i, t);
|
|
619
|
+
}, We = new WeakSet(), Ls = function() {
|
|
620
620
|
const e = document.createElement("span");
|
|
621
|
-
return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), O(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => o(this, Re,
|
|
622
|
-
}, Re = new WeakSet(),
|
|
623
|
-
e.preventDefault(), e.stopPropagation(), o(this, Xe,
|
|
624
|
-
}, Ue = new WeakSet(),
|
|
621
|
+
return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), O(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => o(this, Re, ys).call(this, t)), e;
|
|
622
|
+
}, Re = new WeakSet(), ys = function(e) {
|
|
623
|
+
e.preventDefault(), e.stopPropagation(), o(this, Xe, Ts).call(this, e);
|
|
624
|
+
}, Ue = new WeakSet(), xs = function(e) {
|
|
625
625
|
const t = document.createElement("div");
|
|
626
626
|
t.classList.add("treeselect-list__item-checkbox-container");
|
|
627
627
|
const s = document.createElement("span");
|
|
628
628
|
s.classList.add("treeselect-list__item-checkbox-icon"), s.innerHTML = "";
|
|
629
629
|
const i = document.createElement("input");
|
|
630
630
|
return i.setAttribute("tabindex", "-1"), i.setAttribute("type", "checkbox"), i.setAttribute("input-id", e.value.toString()), i.classList.add("treeselect-list__item-checkbox"), t.append(s, i), t;
|
|
631
|
-
}, ze = new WeakSet(),
|
|
631
|
+
}, ze = new WeakSet(), Ss = function(e, t) {
|
|
632
632
|
const s = document.createElement("label");
|
|
633
633
|
if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) {
|
|
634
|
-
const i = o(this, Ye,
|
|
634
|
+
const i = o(this, Ye, _s).call(this, e);
|
|
635
635
|
s.appendChild(i);
|
|
636
636
|
}
|
|
637
637
|
return s;
|
|
638
|
-
}, Ye = new WeakSet(),
|
|
638
|
+
}, Ye = new WeakSet(), _s = function(e) {
|
|
639
639
|
const t = document.createElement("span"), s = this.flattedOptions.filter((i) => i.childOf === e.value);
|
|
640
640
|
return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t;
|
|
641
|
-
}, Ke = new WeakSet(),
|
|
641
|
+
}, Ke = new WeakSet(), As = function(e, t) {
|
|
642
642
|
const s = this.flattedOptions.find((i) => i.id === t.value);
|
|
643
643
|
if (s) {
|
|
644
644
|
if (s != null && s.isGroup && this.disabledBranchNode) {
|
|
645
|
-
const i =
|
|
645
|
+
const i = Oi(e);
|
|
646
646
|
i == null || i.dispatchEvent(new Event("mousedown"));
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
@@ -650,32 +650,32 @@ M = new WeakMap(), P = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), Oe =
|
|
|
650
650
|
const [i] = n(this, x);
|
|
651
651
|
if (s.id === i)
|
|
652
652
|
return;
|
|
653
|
-
m(this, x, [s.id]),
|
|
653
|
+
m(this, x, [s.id]), ss([s.id], this.flattedOptions, this.isSingleSelect, this.isIndependentNodes);
|
|
654
654
|
} else {
|
|
655
655
|
s.checked = e.checked;
|
|
656
|
-
const i =
|
|
656
|
+
const i = It(s, this.flattedOptions, this.isIndependentNodes);
|
|
657
657
|
e.checked = i;
|
|
658
658
|
}
|
|
659
|
-
ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), o(this, Je,
|
|
659
|
+
ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), o(this, Je, Ns).call(this);
|
|
660
660
|
}
|
|
661
|
-
}, Xe = new WeakSet(),
|
|
661
|
+
}, Xe = new WeakSet(), Ts = function(e) {
|
|
662
662
|
var a, h;
|
|
663
|
-
const t = (h = (a = e.target) == null ? void 0 : a.parentNode) == null ? void 0 : h.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i =
|
|
664
|
-
i && (i.isClosed = !i.isClosed,
|
|
665
|
-
}, J = new WeakSet(),
|
|
663
|
+
const t = (h = (a = e.target) == null ? void 0 : a.parentNode) == null ? void 0 : h.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Vt(s, this.flattedOptions);
|
|
664
|
+
i && (i.isClosed = !i.isClosed, Ct(this.flattedOptions, i), ce(this.flattedOptions, this.srcElement, this.iconElements, n(this, x)), this.arrowClickCallback(i.id, i.isClosed));
|
|
665
|
+
}, J = new WeakSet(), yt = function(e, t) {
|
|
666
666
|
const s = "treeselect-list__item--focused";
|
|
667
667
|
if (e) {
|
|
668
668
|
const i = Array.from(this.srcElement.querySelectorAll(`.${s}`));
|
|
669
669
|
i.length && i.forEach((a) => a.classList.remove(s)), t.classList.add(s);
|
|
670
670
|
} else
|
|
671
671
|
t.classList.remove(s);
|
|
672
|
-
}, Z = new WeakSet(),
|
|
673
|
-
const { ungroupedNodes: e, groupedNodes: t, allNodes: s } =
|
|
672
|
+
}, Z = new WeakSet(), xt = function() {
|
|
673
|
+
const { ungroupedNodes: e, groupedNodes: t, allNodes: s } = Ci(this.flattedOptions);
|
|
674
674
|
this.selectedNodes = { nodes: e, groupedNodes: t, allNodes: s };
|
|
675
|
-
}, Je = new WeakSet(),
|
|
676
|
-
o(this, Z,
|
|
675
|
+
}, Je = new WeakSet(), Ns = function() {
|
|
676
|
+
o(this, Z, xt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
|
|
677
677
|
};
|
|
678
|
-
const
|
|
678
|
+
const Dt = ({
|
|
679
679
|
parentHtmlContainer: l,
|
|
680
680
|
staticList: e,
|
|
681
681
|
appendToBody: t,
|
|
@@ -684,15 +684,15 @@ const Vt = ({
|
|
|
684
684
|
direction: a
|
|
685
685
|
}) => {
|
|
686
686
|
l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), a && a !== "auto" && a !== "bottom" && a !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
|
|
687
|
-
}, re = (l) => l.map((e) => e.id),
|
|
687
|
+
}, re = (l) => l.map((e) => e.id), Bi = (l) => l ? Array.isArray(l) ? l : [l] : [], Vi = (l, e) => {
|
|
688
688
|
if (e) {
|
|
689
689
|
const [t] = l;
|
|
690
690
|
return t ?? null;
|
|
691
691
|
}
|
|
692
692
|
return l;
|
|
693
693
|
};
|
|
694
|
-
var d, u, F, Q, q, S, _, L, B, ee,
|
|
695
|
-
class
|
|
694
|
+
var d, u, F, Q, q, S, _, L, B, ee, St, te, _t, Ze, Os, Qe, Is, et, Ps, tt, Bs, st, Vs, it, Ds, se, At, lt, Hs, nt, Gs, at, Ms, ot, Fs, ie, Tt, rt, qs, j, he, le, Nt, $, de, ct, js, ne, Ot, ht, $s, dt, Ws, ut, Rs, pt, Us, mt, zs;
|
|
695
|
+
class Hi {
|
|
696
696
|
constructor({
|
|
697
697
|
parentHtmlContainer: e,
|
|
698
698
|
value: t,
|
|
@@ -702,30 +702,31 @@ class Bi {
|
|
|
702
702
|
alwaysOpen: h,
|
|
703
703
|
showTags: p,
|
|
704
704
|
tagsCountText: f,
|
|
705
|
-
clearable:
|
|
706
|
-
searchable:
|
|
705
|
+
clearable: C,
|
|
706
|
+
searchable: b,
|
|
707
707
|
placeholder: g,
|
|
708
|
-
grouped:
|
|
709
|
-
isGroupedValue:
|
|
708
|
+
grouped: k,
|
|
709
|
+
isGroupedValue: w,
|
|
710
710
|
listSlotHtmlComponent: y,
|
|
711
711
|
disabled: I,
|
|
712
712
|
emptyText: W,
|
|
713
713
|
staticList: ae,
|
|
714
714
|
id: bt,
|
|
715
|
-
ariaLabel:
|
|
715
|
+
ariaLabel: gt,
|
|
716
716
|
isSingleSelect: oe,
|
|
717
|
-
showCount:
|
|
718
|
-
disabledBranchNode:
|
|
719
|
-
direction:
|
|
720
|
-
expandSelected:
|
|
721
|
-
saveScrollPosition:
|
|
722
|
-
isIndependentNodes:
|
|
723
|
-
iconElements:
|
|
724
|
-
inputCallback:
|
|
725
|
-
openCallback:
|
|
726
|
-
closeCallback:
|
|
727
|
-
nameChangeCallback:
|
|
728
|
-
searchCallback:
|
|
717
|
+
showCount: Ys,
|
|
718
|
+
disabledBranchNode: Ks,
|
|
719
|
+
direction: Xs,
|
|
720
|
+
expandSelected: Js,
|
|
721
|
+
saveScrollPosition: Zs,
|
|
722
|
+
isIndependentNodes: Qs,
|
|
723
|
+
iconElements: ei,
|
|
724
|
+
inputCallback: ti,
|
|
725
|
+
openCallback: si,
|
|
726
|
+
closeCallback: ii,
|
|
727
|
+
nameChangeCallback: li,
|
|
728
|
+
searchCallback: ni,
|
|
729
|
+
openCloseGroupCallback: ai
|
|
729
730
|
}) {
|
|
730
731
|
r(this, ee);
|
|
731
732
|
r(this, te);
|
|
@@ -752,6 +753,7 @@ class Bi {
|
|
|
752
753
|
r(this, dt);
|
|
753
754
|
r(this, ut);
|
|
754
755
|
r(this, pt);
|
|
756
|
+
r(this, mt);
|
|
755
757
|
// Props
|
|
756
758
|
c(this, "parentHtmlContainer");
|
|
757
759
|
c(this, "value");
|
|
@@ -785,6 +787,7 @@ class Bi {
|
|
|
785
787
|
c(this, "closeCallback");
|
|
786
788
|
c(this, "nameChangeCallback");
|
|
787
789
|
c(this, "searchCallback");
|
|
790
|
+
c(this, "openCloseGroupCallback");
|
|
788
791
|
// InnerState
|
|
789
792
|
c(this, "ungroupedValue");
|
|
790
793
|
c(this, "groupedValue");
|
|
@@ -806,29 +809,29 @@ class Bi {
|
|
|
806
809
|
r(this, _, null);
|
|
807
810
|
r(this, L, null);
|
|
808
811
|
r(this, B, null);
|
|
809
|
-
|
|
812
|
+
Dt({
|
|
810
813
|
parentHtmlContainer: e,
|
|
811
814
|
value: t,
|
|
812
815
|
staticList: ae,
|
|
813
816
|
appendToBody: a,
|
|
814
817
|
isSingleSelect: oe
|
|
815
|
-
}), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = a ?? !1, this.alwaysOpen = !!(h && !I), this.showTags = p ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable =
|
|
818
|
+
}), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = a ?? !1, this.alwaysOpen = !!(h && !I), this.showTags = p ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable = C ?? !0, this.searchable = b ?? !0, this.placeholder = g ?? "Search...", this.grouped = k ?? !0, this.isGroupedValue = w ?? !1, this.listSlotHtmlComponent = y ?? null, this.disabled = I ?? !1, this.emptyText = W ?? "No results found...", this.staticList = !!(ae && !this.appendToBody), this.id = bt ?? "", this.ariaLabel = gt ?? "", this.isSingleSelect = oe ?? !1, this.showCount = Ys ?? !1, this.disabledBranchNode = Ks ?? !1, this.direction = Xs ?? "auto", this.expandSelected = Js ?? !1, this.saveScrollPosition = Zs ?? !0, this.isIndependentNodes = Qs ?? !1, this.iconElements = Bt(ei), this.inputCallback = ti, this.openCallback = si, this.closeCallback = ii, this.nameChangeCallback = li, this.searchCallback = ni, this.openCloseGroupCallback = ai, this.ungroupedValue = [], this.groupedValue = [], this.allValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, o(this, ee, St).call(this, t);
|
|
816
819
|
}
|
|
817
820
|
mount() {
|
|
818
|
-
|
|
821
|
+
Dt({
|
|
819
822
|
parentHtmlContainer: this.parentHtmlContainer,
|
|
820
823
|
value: this.value,
|
|
821
824
|
staticList: this.staticList,
|
|
822
825
|
appendToBody: this.appendToBody,
|
|
823
826
|
isSingleSelect: this.isSingleSelect
|
|
824
|
-
}), this.iconElements =
|
|
827
|
+
}), this.iconElements = Bt(this.iconElements), o(this, ee, St).call(this, this.value);
|
|
825
828
|
}
|
|
826
829
|
updateValue(e) {
|
|
827
|
-
const t =
|
|
828
|
-
s && (s.updateValue(t), o(this, se,
|
|
830
|
+
const t = Bi(e), s = n(this, d);
|
|
831
|
+
s && (s.updateValue(t), o(this, se, At).call(this, s == null ? void 0 : s.selectedNodes));
|
|
829
832
|
}
|
|
830
833
|
destroy() {
|
|
831
|
-
this.srcElement && (o(this, ie,
|
|
834
|
+
this.srcElement && (o(this, ie, Tt).call(this), this.srcElement.innerHTML = "", this.srcElement = null, o(this, $, de).call(this, !0));
|
|
832
835
|
}
|
|
833
836
|
focus() {
|
|
834
837
|
n(this, u) && n(this, u).focus();
|
|
@@ -859,34 +862,34 @@ class Bi {
|
|
|
859
862
|
y: a,
|
|
860
863
|
height: h,
|
|
861
864
|
width: p
|
|
862
|
-
} = e.getBoundingClientRect(), f = window.innerHeight,
|
|
863
|
-
let g =
|
|
865
|
+
} = e.getBoundingClientRect(), f = window.innerHeight, C = a, b = f - a - h;
|
|
866
|
+
let g = C > b && C >= s && b < s;
|
|
864
867
|
if (this.direction !== "auto" && (g = this.direction === "top"), this.appendToBody) {
|
|
865
868
|
(t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px");
|
|
866
869
|
const I = i + window.scrollX, W = g ? a + window.scrollY - s : a + window.scrollY + h;
|
|
867
870
|
t.style.transform = `translate(${I}px,${W}px)`, t.style.width = `${p}px`;
|
|
868
871
|
}
|
|
869
|
-
const
|
|
870
|
-
t.getAttribute("direction") !==
|
|
872
|
+
const k = g ? "top" : "bottom";
|
|
873
|
+
t.getAttribute("direction") !== k && (t.setAttribute("direction", k), o(this, rt, qs).call(this, g, this.appendToBody));
|
|
871
874
|
}
|
|
872
875
|
}
|
|
873
|
-
d = new WeakMap(), u = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), q = new WeakMap(), S = new WeakMap(), _ = new WeakMap(), L = new WeakMap(), B = new WeakMap(), ee = new WeakSet(),
|
|
876
|
+
d = new WeakMap(), u = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), q = new WeakMap(), S = new WeakMap(), _ = new WeakMap(), L = new WeakMap(), B = new WeakMap(), ee = new WeakSet(), St = function(e) {
|
|
874
877
|
var a;
|
|
875
878
|
this.destroy();
|
|
876
|
-
const { container: t, list: s, input: i } = o(this, Ze,
|
|
879
|
+
const { container: t, list: s, input: i } = o(this, Ze, Os).call(this);
|
|
877
880
|
this.srcElement = t, m(this, d, s), m(this, u, i), m(this, S, this.scrollWindowHandler.bind(this)), m(this, _, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, B, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((a = n(this, u)) == null || a.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
|
|
878
|
-
}, te = new WeakSet(),
|
|
881
|
+
}, te = new WeakSet(), _t = function({
|
|
879
882
|
groupedNodes: e,
|
|
880
883
|
nodes: t,
|
|
881
884
|
allNodes: s
|
|
882
885
|
}) {
|
|
883
886
|
this.ungroupedValue = t ? re(t) : [], this.groupedValue = e ? re(e) : [], this.allValue = s ? re(s) : [];
|
|
884
887
|
let i = [];
|
|
885
|
-
this.isIndependentNodes || this.isSingleSelect ? i = this.allValue : this.isGroupedValue ? i = this.groupedValue : i = this.ungroupedValue, this.value =
|
|
886
|
-
}, Ze = new WeakSet(),
|
|
888
|
+
this.isIndependentNodes || this.isSingleSelect ? i = this.allValue : this.isGroupedValue ? i = this.groupedValue : i = this.ungroupedValue, this.value = Vi(i, this.isSingleSelect);
|
|
889
|
+
}, Ze = new WeakSet(), Os = function() {
|
|
887
890
|
const e = this.parentHtmlContainer;
|
|
888
891
|
e.classList.add("treeselect");
|
|
889
|
-
const t = new
|
|
892
|
+
const t = new Pi({
|
|
890
893
|
value: [],
|
|
891
894
|
// updateValue method calls in initMount method to set actual value
|
|
892
895
|
options: this.options,
|
|
@@ -899,13 +902,13 @@ d = new WeakMap(), u = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), q =
|
|
|
899
902
|
expandSelected: this.expandSelected,
|
|
900
903
|
isIndependentNodes: this.isIndependentNodes,
|
|
901
904
|
iconElements: this.iconElements,
|
|
902
|
-
inputCallback: (i) => o(this, lt,
|
|
903
|
-
arrowClickCallback: () => o(this, nt,
|
|
905
|
+
inputCallback: (i) => o(this, lt, Hs).call(this, i),
|
|
906
|
+
arrowClickCallback: (i, a) => o(this, nt, Gs).call(this, i, a),
|
|
904
907
|
mouseupCallback: () => {
|
|
905
908
|
var i;
|
|
906
909
|
return (i = n(this, u)) == null ? void 0 : i.focus();
|
|
907
910
|
}
|
|
908
|
-
}), s = new
|
|
911
|
+
}), s = new hi({
|
|
909
912
|
value: [],
|
|
910
913
|
// updateValue method calls in initMount method to set actual value
|
|
911
914
|
showTags: this.showTags,
|
|
@@ -919,91 +922,94 @@ d = new WeakMap(), u = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), q =
|
|
|
919
922
|
id: this.id,
|
|
920
923
|
ariaLabel: this.ariaLabel,
|
|
921
924
|
iconElements: this.iconElements,
|
|
922
|
-
inputCallback: (i) => o(this, Qe,
|
|
923
|
-
searchCallback: (i) => o(this, tt,
|
|
924
|
-
openCallback: () => o(this, ot,
|
|
925
|
-
closeCallback: () => o(this, ie,
|
|
926
|
-
keydownCallback: (i) => o(this, et,
|
|
927
|
-
focusCallback: () => o(this, st,
|
|
928
|
-
blurCallback: () => o(this, it,
|
|
929
|
-
nameChangeCallback: (i) => o(this, at,
|
|
925
|
+
inputCallback: (i) => o(this, Qe, Is).call(this, i),
|
|
926
|
+
searchCallback: (i) => o(this, tt, Bs).call(this, i),
|
|
927
|
+
openCallback: () => o(this, ot, Fs).call(this),
|
|
928
|
+
closeCallback: () => o(this, ie, Tt).call(this),
|
|
929
|
+
keydownCallback: (i) => o(this, et, Ps).call(this, i),
|
|
930
|
+
focusCallback: () => o(this, st, Vs).call(this),
|
|
931
|
+
blurCallback: () => o(this, it, Ds).call(this),
|
|
932
|
+
nameChangeCallback: (i) => o(this, at, Ms).call(this, i)
|
|
930
933
|
});
|
|
931
934
|
return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(s.srcElement), { container: e, list: t, input: s };
|
|
932
|
-
}, Qe = new WeakSet(),
|
|
935
|
+
}, Qe = new WeakSet(), Is = function(e) {
|
|
933
936
|
var i, a;
|
|
934
937
|
const t = re(e);
|
|
935
938
|
(i = n(this, d)) == null || i.updateValue(t);
|
|
936
939
|
const s = ((a = n(this, d)) == null ? void 0 : a.selectedNodes) ?? {};
|
|
937
|
-
o(this, te,
|
|
938
|
-
}, et = new WeakSet(),
|
|
940
|
+
o(this, te, _t).call(this, s), o(this, ne, Ot).call(this);
|
|
941
|
+
}, et = new WeakSet(), Ps = function(e) {
|
|
939
942
|
var t;
|
|
940
943
|
this.isListOpened && ((t = n(this, d)) == null || t.callKeyAction(e));
|
|
941
|
-
}, tt = new WeakSet(),
|
|
944
|
+
}, tt = new WeakSet(), Bs = function(e) {
|
|
942
945
|
n(this, q) && clearTimeout(n(this, q)), m(this, q, window.setTimeout(() => {
|
|
943
946
|
var t;
|
|
944
947
|
(t = n(this, d)) == null || t.updateSearchValue(e), this.updateListPosition();
|
|
945
|
-
}, 350)), o(this, pt,
|
|
946
|
-
}, st = new WeakSet(),
|
|
948
|
+
}, 350)), o(this, pt, Us).call(this, e);
|
|
949
|
+
}, st = new WeakSet(), Vs = function() {
|
|
947
950
|
o(this, j, he).call(this, !0), n(this, L) && n(this, L) && n(this, B) && (document.addEventListener("mousedown", n(this, L), !0), document.addEventListener("focus", n(this, L), !0), window.addEventListener("blur", n(this, B)));
|
|
948
|
-
}, it = new WeakSet(),
|
|
951
|
+
}, it = new WeakSet(), Ds = function() {
|
|
949
952
|
setTimeout(() => {
|
|
950
953
|
var s, i;
|
|
951
954
|
const e = (s = n(this, u)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, d)) == null ? void 0 : i.srcElement.contains(document.activeElement);
|
|
952
955
|
!e && !t && this.blurWindowHandler();
|
|
953
956
|
}, 1);
|
|
954
|
-
}, se = new WeakSet(),
|
|
957
|
+
}, se = new WeakSet(), At = function(e) {
|
|
955
958
|
var s;
|
|
956
959
|
if (!e)
|
|
957
960
|
return;
|
|
958
961
|
let t = [];
|
|
959
|
-
this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, u)) == null || s.updateValue(t), o(this, te,
|
|
960
|
-
}, lt = new WeakSet(),
|
|
962
|
+
this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, u)) == null || s.updateValue(t), o(this, te, _t).call(this, e);
|
|
963
|
+
}, lt = new WeakSet(), Hs = function(e) {
|
|
961
964
|
var t, s, i;
|
|
962
|
-
o(this, se,
|
|
963
|
-
}, nt = new WeakSet(),
|
|
964
|
-
var
|
|
965
|
-
(
|
|
966
|
-
}, at = new WeakSet(),
|
|
967
|
-
this.selectedName !== e && (this.selectedName = e, o(this, ht,
|
|
968
|
-
}, ot = new WeakSet(),
|
|
965
|
+
o(this, se, At).call(this, e), this.isSingleSelect && !this.alwaysOpen && ((t = n(this, u)) == null || t.openClose(), (s = n(this, u)) == null || s.clearSearch()), (i = n(this, u)) == null || i.focus(), o(this, ne, Ot).call(this);
|
|
966
|
+
}, nt = new WeakSet(), Gs = function(e, t) {
|
|
967
|
+
var s;
|
|
968
|
+
(s = n(this, u)) == null || s.focus(), this.updateListPosition(), o(this, mt, zs).call(this, e, t);
|
|
969
|
+
}, at = new WeakSet(), Ms = function(e) {
|
|
970
|
+
this.selectedName !== e && (this.selectedName = e, o(this, ht, $s).call(this));
|
|
971
|
+
}, ot = new WeakSet(), Fs = function() {
|
|
969
972
|
var e;
|
|
970
|
-
this.isListOpened = !0, n(this, S) && n(this, _) && (window.addEventListener("scroll", n(this, S), !0), window.addEventListener("resize", n(this, _))), !(!n(this, d) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, d).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, d).srcElement), this.updateListPosition(), o(this, le,
|
|
971
|
-
}, ie = new WeakSet(),
|
|
973
|
+
this.isListOpened = !0, n(this, S) && n(this, _) && (window.addEventListener("scroll", n(this, S), !0), window.addEventListener("resize", n(this, _))), !(!n(this, d) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, d).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, d).srcElement), this.updateListPosition(), o(this, le, Nt).call(this, !0), o(this, ct, js).call(this), o(this, dt, Ws).call(this));
|
|
974
|
+
}, ie = new WeakSet(), Tt = function() {
|
|
972
975
|
var t;
|
|
973
|
-
this.alwaysOpen || (this.isListOpened = !1, n(this, S) && n(this, _) && (window.removeEventListener("scroll", n(this, S), !0), window.removeEventListener("resize", n(this, _))), !n(this, d) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, d).srcElement) : this.srcElement.contains(n(this, d).srcElement)) || (m(this, Q, n(this, d).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, d).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, d).srcElement), o(this, le,
|
|
974
|
-
}, rt = new WeakSet(),
|
|
976
|
+
this.alwaysOpen || (this.isListOpened = !1, n(this, S) && n(this, _) && (window.removeEventListener("scroll", n(this, S), !0), window.removeEventListener("resize", n(this, _))), !n(this, d) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, d).srcElement) : this.srcElement.contains(n(this, d).srcElement)) || (m(this, Q, n(this, d).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, d).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, d).srcElement), o(this, le, Nt).call(this, !1), o(this, ut, Rs).call(this));
|
|
977
|
+
}, rt = new WeakSet(), qs = function(e, t) {
|
|
975
978
|
if (!n(this, d) || !n(this, u))
|
|
976
979
|
return;
|
|
977
980
|
const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", i = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom";
|
|
978
981
|
e ? (n(this, d).srcElement.classList.add(s), n(this, d).srcElement.classList.remove(i), n(this, u).srcElement.classList.add("treeselect-input--top"), n(this, u).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, d).srcElement.classList.remove(s), n(this, d).srcElement.classList.add(i), n(this, u).srcElement.classList.remove("treeselect-input--top"), n(this, u).srcElement.classList.add("treeselect-input--bottom"));
|
|
979
982
|
}, j = new WeakSet(), he = function(e) {
|
|
980
983
|
!n(this, u) || !n(this, d) || (e ? (n(this, u).srcElement.classList.add("treeselect-input--focused"), n(this, d).srcElement.classList.add("treeselect-list--focused")) : (n(this, u).srcElement.classList.remove("treeselect-input--focused"), n(this, d).srcElement.classList.remove("treeselect-list--focused")));
|
|
981
|
-
}, le = new WeakSet(),
|
|
984
|
+
}, le = new WeakSet(), Nt = function(e) {
|
|
982
985
|
var t, s, i, a;
|
|
983
986
|
e ? (t = n(this, u)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, u)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, d)) == null || i.srcElement.classList.add("treeselect-list--static") : (a = n(this, d)) == null || a.srcElement.classList.remove("treeselect-list--static");
|
|
984
987
|
}, $ = new WeakSet(), de = function(e) {
|
|
985
988
|
!n(this, S) || !n(this, _) || !n(this, L) || !n(this, B) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, S), !0), window.removeEventListener("resize", n(this, _))), document.removeEventListener("mousedown", n(this, L), !0), document.removeEventListener("focus", n(this, L), !0), window.removeEventListener("blur", n(this, B)));
|
|
986
|
-
}, ct = new WeakSet(),
|
|
989
|
+
}, ct = new WeakSet(), js = function() {
|
|
987
990
|
var t, s, i;
|
|
988
991
|
const e = (t = n(this, d)) == null ? void 0 : t.isLastFocusedElementExist();
|
|
989
992
|
this.saveScrollPosition && e ? (s = n(this, d)) == null || s.srcElement.scroll(0, n(this, Q)) : (i = n(this, d)) == null || i.focusFirstListElement();
|
|
990
|
-
}, ne = new WeakSet(),
|
|
993
|
+
}, ne = new WeakSet(), Ot = function() {
|
|
991
994
|
var e;
|
|
992
995
|
(e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value);
|
|
993
|
-
}, ht = new WeakSet(),
|
|
996
|
+
}, ht = new WeakSet(), $s = function() {
|
|
994
997
|
var e;
|
|
995
998
|
(e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName);
|
|
996
|
-
}, dt = new WeakSet(),
|
|
999
|
+
}, dt = new WeakSet(), Ws = function() {
|
|
997
1000
|
var e;
|
|
998
1001
|
this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value));
|
|
999
|
-
}, ut = new WeakSet(),
|
|
1002
|
+
}, ut = new WeakSet(), Rs = function() {
|
|
1000
1003
|
var e;
|
|
1001
1004
|
this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value));
|
|
1002
|
-
}, pt = new WeakSet(),
|
|
1005
|
+
}, pt = new WeakSet(), Us = function(e) {
|
|
1003
1006
|
var s;
|
|
1004
1007
|
const t = (e == null ? void 0 : e.trim()) ?? "";
|
|
1005
1008
|
(s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("search", { detail: t })), this.searchCallback && this.searchCallback(t);
|
|
1009
|
+
}, mt = new WeakSet(), zs = function(e, t) {
|
|
1010
|
+
var s;
|
|
1011
|
+
(s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("open-close-group", { detail: { groupId: e, isClosed: t } })), this.openCloseGroupCallback && this.openCloseGroupCallback(e, t);
|
|
1006
1012
|
};
|
|
1007
1013
|
export {
|
|
1008
|
-
|
|
1014
|
+
Hi as default
|
|
1009
1015
|
};
|