treeselectjs 0.13.0 → 0.13.2
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 +4 -4
- package/dist/treeselectjs.mjs +288 -296
- package/dist/treeselectjs.umd.js +1 -1
- package/package.json +1 -1
package/dist/treeselectjs.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Kt = Object.defineProperty;
|
|
2
2
|
var we = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var c = (i, e, t) =>
|
|
7
|
-
var n = (i, e, t) => (
|
|
8
|
-
const
|
|
5
|
+
var Xt = (i, e, t) => e in i ? Kt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var c = (i, e, t) => Xt(i, typeof e != "symbol" ? e + "" : e, t), ee = (i, e, t) => e.has(i) || we("Cannot " + t);
|
|
7
|
+
var n = (i, e, t) => (ee(i, e, "read from private field"), t ? t.call(i) : e.get(i)), g = (i, e, t) => e.has(i) ? we("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, s) => (ee(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), a = (i, e, t) => (ee(i, e, "access private method"), t);
|
|
8
|
+
const ve = {
|
|
9
9
|
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>',
|
|
10
10
|
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>',
|
|
11
11
|
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>',
|
|
@@ -21,14 +21,14 @@ const ke = {
|
|
|
21
21
|
const t = i.cloneNode(!0);
|
|
22
22
|
e.appendChild(t);
|
|
23
23
|
}
|
|
24
|
-
},
|
|
24
|
+
}, ke = (i) => {
|
|
25
25
|
const e = i ? { ...i } : {};
|
|
26
|
-
return Object.keys(
|
|
27
|
-
e[t] || (e[t] =
|
|
26
|
+
return Object.keys(ve).forEach((t) => {
|
|
27
|
+
e[t] || (e[t] = ve[t]);
|
|
28
28
|
}), e;
|
|
29
|
-
},
|
|
30
|
-
var _, S, D, x,
|
|
31
|
-
class
|
|
29
|
+
}, Zt = (i) => i.reduce((e, { name: t }, s) => (e += t, s < i.length - 1 && (e += ", "), e), "");
|
|
30
|
+
var _, S, D, x, h, Se, j, xe, ye, U, B, Te, Ae, Ie, Ne, _e, Oe, He, Pe, Ve, Be, De, Ge, Me, Re, Fe, $e, te;
|
|
31
|
+
class Jt {
|
|
32
32
|
constructor({
|
|
33
33
|
value: e,
|
|
34
34
|
showTags: t,
|
|
@@ -37,21 +37,20 @@ class Qt {
|
|
|
37
37
|
isAlwaysOpened: r,
|
|
38
38
|
searchable: u,
|
|
39
39
|
placeholder: f,
|
|
40
|
-
disabled:
|
|
40
|
+
disabled: w,
|
|
41
41
|
isSingleSelect: k,
|
|
42
42
|
id: E,
|
|
43
43
|
ariaLabel: C,
|
|
44
|
-
iconElements:
|
|
44
|
+
iconElements: v,
|
|
45
45
|
inputCallback: L,
|
|
46
46
|
searchCallback: T,
|
|
47
47
|
openCallback: N,
|
|
48
48
|
closeCallback: H,
|
|
49
49
|
keydownCallback: W,
|
|
50
|
-
focusCallback:
|
|
51
|
-
|
|
52
|
-
nameChangeCallback: se
|
|
50
|
+
focusCallback: R,
|
|
51
|
+
nameChangeCallback: Q
|
|
53
52
|
}) {
|
|
54
|
-
g(this,
|
|
53
|
+
g(this, h);
|
|
55
54
|
// Props
|
|
56
55
|
c(this, "value");
|
|
57
56
|
c(this, "showTags");
|
|
@@ -81,54 +80,53 @@ class Qt {
|
|
|
81
80
|
c(this, "closeCallback");
|
|
82
81
|
c(this, "keydownCallback");
|
|
83
82
|
c(this, "focusCallback");
|
|
84
|
-
c(this, "blurCallback");
|
|
85
83
|
c(this, "nameChangeCallback");
|
|
86
|
-
this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = u, this.placeholder = f, this.clearable = l, this.isAlwaysOpened = r, this.disabled =
|
|
84
|
+
this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = u, this.placeholder = f, this.clearable = l, this.isAlwaysOpened = r, this.disabled = w, this.isSingleSelect = k, this.id = E, this.ariaLabel = C, this.iconElements = v, this.isOpened = !1, this.searchText = "", b(this, _, a(this, h, Ie).call(this)), b(this, S, a(this, h, Ve).call(this)), b(this, D, a(this, h, Ge).call(this)), b(this, x, null), this.inputCallback = L, this.searchCallback = T, this.openCallback = N, this.closeCallback = H, this.keydownCallback = W, this.focusCallback = R, this.nameChangeCallback = Q, this.srcElement = a(this, h, Te).call(this, {
|
|
87
85
|
htmlTagsSection: n(this, _),
|
|
88
86
|
htmlEditControl: n(this, S),
|
|
89
87
|
htmlOperators: n(this, D)
|
|
90
|
-
}), a(this,
|
|
88
|
+
}), a(this, h, Se).call(this);
|
|
91
89
|
}
|
|
92
90
|
// Public methods
|
|
93
91
|
focus() {
|
|
94
92
|
setTimeout(() => n(this, S).focus(), 0);
|
|
95
93
|
}
|
|
96
94
|
blur() {
|
|
97
|
-
this.isOpened && a(this,
|
|
95
|
+
this.isOpened && a(this, h, B).call(this), this.clearSearch(), n(this, S).blur();
|
|
98
96
|
}
|
|
99
97
|
updateValue(e) {
|
|
100
|
-
this.value = e, a(this,
|
|
98
|
+
this.value = e, a(this, h, j).call(this), a(this, h, U).call(this);
|
|
101
99
|
}
|
|
102
100
|
removeItem(e) {
|
|
103
|
-
this.value = this.value.filter((t) => t.id !== e), a(this,
|
|
101
|
+
this.value = this.value.filter((t) => t.id !== e), a(this, h, te).call(this), a(this, h, j).call(this), a(this, h, U).call(this);
|
|
104
102
|
}
|
|
105
103
|
clear() {
|
|
106
|
-
this.value = [], a(this,
|
|
104
|
+
this.value = [], a(this, h, te).call(this), a(this, h, j).call(this), this.clearSearch();
|
|
107
105
|
}
|
|
108
106
|
openClose() {
|
|
109
|
-
a(this,
|
|
107
|
+
a(this, h, B).call(this);
|
|
110
108
|
}
|
|
111
109
|
clearSearch() {
|
|
112
|
-
this.searchText = "", this.searchCallback(""), a(this,
|
|
110
|
+
this.searchText = "", this.searchCallback(""), a(this, h, U).call(this);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
_ = new WeakMap(), S = new WeakMap(), D = new WeakMap(), x = new WeakMap(),
|
|
116
|
-
|
|
117
|
-
a(this,
|
|
113
|
+
_ = new WeakMap(), S = new WeakMap(), D = new WeakMap(), x = new WeakMap(), h = new WeakSet(), // Private methods
|
|
114
|
+
Se = function() {
|
|
115
|
+
a(this, h, j).call(this), a(this, h, U).call(this), a(this, h, xe).call(this);
|
|
118
116
|
}, j = function() {
|
|
119
117
|
if (n(this, _).innerHTML = "", this.showTags) {
|
|
120
|
-
n(this, _).append(...a(this,
|
|
121
|
-
const e =
|
|
118
|
+
n(this, _).append(...a(this, h, Ne).call(this));
|
|
119
|
+
const e = Zt(this.value);
|
|
122
120
|
this.nameChangeCallback(e);
|
|
123
121
|
} else {
|
|
124
|
-
const e = a(this,
|
|
122
|
+
const e = a(this, h, Pe).call(this);
|
|
125
123
|
n(this, _).appendChild(e), this.nameChangeCallback(e.innerText);
|
|
126
124
|
}
|
|
127
125
|
n(this, _).appendChild(n(this, S));
|
|
128
|
-
},
|
|
126
|
+
}, xe = function() {
|
|
129
127
|
const e = [];
|
|
130
|
-
n(this, D).innerHTML = "", this.clearable && e.push(a(this,
|
|
131
|
-
},
|
|
128
|
+
n(this, D).innerHTML = "", this.clearable && e.push(a(this, h, Me).call(this)), this.isAlwaysOpened || e.push(a(this, h, Fe).call(this, this.isOpened)), e.length && n(this, D).append(...e);
|
|
129
|
+
}, ye = function() {
|
|
132
130
|
if (!this.isAlwaysOpened && n(this, x)) {
|
|
133
131
|
const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown;
|
|
134
132
|
O(e, n(this, x));
|
|
@@ -136,36 +134,36 @@ xe = function() {
|
|
|
136
134
|
}, U = function() {
|
|
137
135
|
var e;
|
|
138
136
|
(e = this.value) != null && e.length ? (n(this, S).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, S).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, S).value = this.searchText;
|
|
139
|
-
},
|
|
140
|
-
this.isOpened = !this.isOpened, a(this,
|
|
141
|
-
},
|
|
137
|
+
}, B = function() {
|
|
138
|
+
this.isOpened = !this.isOpened, a(this, h, ye).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
|
|
139
|
+
}, Te = function({
|
|
142
140
|
htmlTagsSection: e,
|
|
143
141
|
htmlEditControl: t,
|
|
144
142
|
htmlOperators: s
|
|
145
143
|
}) {
|
|
146
144
|
const l = document.createElement("div");
|
|
147
|
-
return l.classList.add("treeselect-input"), l.setAttribute("tabindex", "-1"), l.addEventListener("mousedown", (r) => a(this,
|
|
148
|
-
},
|
|
149
|
-
e.stopPropagation(), this.isOpened || a(this,
|
|
150
|
-
},
|
|
145
|
+
return l.classList.add("treeselect-input"), l.setAttribute("tabindex", "-1"), l.addEventListener("mousedown", (r) => a(this, h, Ae).call(this, r)), l.addEventListener("focus", () => this.focusCallback(), !0), e.appendChild(t), l.append(e, s), l;
|
|
146
|
+
}, Ae = function(e) {
|
|
147
|
+
e.stopPropagation(), this.isOpened || a(this, h, B).call(this), this.focus();
|
|
148
|
+
}, Ie = function() {
|
|
151
149
|
const e = document.createElement("div");
|
|
152
150
|
return e.classList.add("treeselect-input__tags"), e;
|
|
153
|
-
},
|
|
151
|
+
}, Ne = function() {
|
|
154
152
|
return this.value.map((e) => {
|
|
155
153
|
const t = document.createElement("div");
|
|
156
154
|
t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name);
|
|
157
|
-
const s = a(this,
|
|
158
|
-
return t.addEventListener("mousedown", (r) => a(this,
|
|
155
|
+
const s = a(this, h, Oe).call(this, e.name), l = a(this, h, He).call(this);
|
|
156
|
+
return t.addEventListener("mousedown", (r) => a(this, h, _e).call(this, r, e.id)), t.append(s, l), t;
|
|
159
157
|
});
|
|
160
|
-
},
|
|
158
|
+
}, _e = function(e, t) {
|
|
161
159
|
e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus();
|
|
162
|
-
},
|
|
160
|
+
}, Oe = function(e) {
|
|
163
161
|
const t = document.createElement("span");
|
|
164
162
|
return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t;
|
|
165
|
-
},
|
|
163
|
+
}, He = function() {
|
|
166
164
|
const e = document.createElement("span");
|
|
167
165
|
return e.classList.add("treeselect-input__tags-cross"), O(this.iconElements.cross, e), e;
|
|
168
|
-
},
|
|
166
|
+
}, Pe = function() {
|
|
169
167
|
const e = document.createElement("span");
|
|
170
168
|
if (e.classList.add("treeselect-input__tags-count"), !this.value.length)
|
|
171
169
|
return e.textContent = "", e.setAttribute("title", ""), e;
|
|
@@ -173,12 +171,12 @@ xe = function() {
|
|
|
173
171
|
return e.textContent = t, e.setAttribute("title", t), e;
|
|
174
172
|
}, Ve = function() {
|
|
175
173
|
const e = document.createElement("input");
|
|
176
|
-
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) => a(this,
|
|
177
|
-
},
|
|
174
|
+
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) => a(this, h, Be).call(this, t)), e.addEventListener("input", (t) => a(this, h, De).call(this, t, e)), e;
|
|
175
|
+
}, Be = function(e) {
|
|
178
176
|
e.stopPropagation();
|
|
179
177
|
const t = e.key;
|
|
180
|
-
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) && a(this,
|
|
181
|
-
},
|
|
178
|
+
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) && a(this, h, B).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
|
|
179
|
+
}, De = function(e, t) {
|
|
182
180
|
e.stopPropagation();
|
|
183
181
|
const s = this.searchText, l = t.value.trim();
|
|
184
182
|
if (s.length === 0 && l.length === 0) {
|
|
@@ -187,35 +185,35 @@ xe = function() {
|
|
|
187
185
|
}
|
|
188
186
|
if (this.searchable) {
|
|
189
187
|
const r = e.target.value;
|
|
190
|
-
this.searchCallback(r), this.isOpened || a(this,
|
|
188
|
+
this.searchCallback(r), this.isOpened || a(this, h, B).call(this);
|
|
191
189
|
} else
|
|
192
190
|
t.value = "";
|
|
193
191
|
this.searchText = t.value;
|
|
194
|
-
},
|
|
192
|
+
}, Ge = function() {
|
|
195
193
|
const e = document.createElement("div");
|
|
196
194
|
return e.classList.add("treeselect-input__operators"), e;
|
|
197
|
-
},
|
|
195
|
+
}, Me = function() {
|
|
198
196
|
const e = document.createElement("span");
|
|
199
|
-
return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), O(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => a(this,
|
|
197
|
+
return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), O(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => a(this, h, Re).call(this, t)), e;
|
|
200
198
|
}, Re = function(e) {
|
|
201
199
|
e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus();
|
|
202
|
-
},
|
|
200
|
+
}, Fe = function(e) {
|
|
203
201
|
b(this, x, document.createElement("span")), n(this, x).classList.add("treeselect-input__arrow");
|
|
204
202
|
const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown;
|
|
205
|
-
return O(t, n(this, x)), n(this, x).addEventListener("mousedown", (s) => a(this,
|
|
206
|
-
},
|
|
207
|
-
e.stopPropagation(), e.preventDefault(), this.focus(), a(this,
|
|
203
|
+
return O(t, n(this, x)), n(this, x).addEventListener("mousedown", (s) => a(this, h, $e).call(this, s)), n(this, x);
|
|
204
|
+
}, $e = function(e) {
|
|
205
|
+
e.stopPropagation(), e.preventDefault(), this.focus(), a(this, h, B).call(this);
|
|
208
206
|
}, // Emits
|
|
209
|
-
|
|
207
|
+
te = function() {
|
|
210
208
|
this.inputCallback(this.value);
|
|
211
209
|
};
|
|
212
|
-
const
|
|
210
|
+
const We = ({
|
|
213
211
|
newValue: i,
|
|
214
212
|
optionsTreeMap: e,
|
|
215
213
|
isSingleSelect: t,
|
|
216
214
|
isIndependentNodes: s
|
|
217
215
|
}) => {
|
|
218
|
-
|
|
216
|
+
ss(e);
|
|
219
217
|
const l = i.map((u) => e.get(u) ?? null).filter((u) => u !== null && !u.disabled), [r] = l;
|
|
220
218
|
if (t && l.length && r) {
|
|
221
219
|
r.checked = !0;
|
|
@@ -223,14 +221,14 @@ const je = ({
|
|
|
223
221
|
}
|
|
224
222
|
l.forEach((u) => {
|
|
225
223
|
u.checked = !0;
|
|
226
|
-
const f =
|
|
224
|
+
const f = be({
|
|
227
225
|
option: u,
|
|
228
226
|
optionsTreeMap: e,
|
|
229
227
|
isIndependentNodes: s
|
|
230
228
|
});
|
|
231
229
|
u.checked = f;
|
|
232
230
|
});
|
|
233
|
-
},
|
|
231
|
+
}, be = ({
|
|
234
232
|
option: { id: i, checked: e },
|
|
235
233
|
optionsTreeMap: t,
|
|
236
234
|
isIndependentNodes: s
|
|
@@ -240,16 +238,16 @@ const je = ({
|
|
|
240
238
|
return !1;
|
|
241
239
|
if (s)
|
|
242
240
|
return l.checked = !l.disabled && e, l.checked;
|
|
243
|
-
const r =
|
|
241
|
+
const r = je({
|
|
244
242
|
checked: e,
|
|
245
243
|
currentOption: l,
|
|
246
244
|
optionsTreeMap: t
|
|
247
245
|
});
|
|
248
|
-
return
|
|
246
|
+
return Ue({
|
|
249
247
|
childOption: l,
|
|
250
248
|
optionsTreeMap: t
|
|
251
249
|
}), r;
|
|
252
|
-
},
|
|
250
|
+
}, je = ({
|
|
253
251
|
checked: i,
|
|
254
252
|
currentOption: e,
|
|
255
253
|
optionsTreeMap: t
|
|
@@ -257,52 +255,52 @@ const je = ({
|
|
|
257
255
|
if (!e.isGroup)
|
|
258
256
|
return e.checked = !e.disabled && i, e.isPartialChecked = !1, e.checked;
|
|
259
257
|
const s = K({ id: e.id, optionsTreeMap: t });
|
|
260
|
-
return !i || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1,
|
|
258
|
+
return !i || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, se({
|
|
261
259
|
option: e,
|
|
262
260
|
children: s,
|
|
263
261
|
optionsTreeMap: t
|
|
264
|
-
}), e.checked) :
|
|
262
|
+
}), e.checked) : ze({
|
|
265
263
|
children: s,
|
|
266
264
|
optionsTreeMap: t
|
|
267
|
-
}) ?
|
|
268
|
-
|
|
265
|
+
}) ? Ye(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((f) => {
|
|
266
|
+
je({
|
|
269
267
|
checked: i,
|
|
270
268
|
currentOption: f,
|
|
271
269
|
optionsTreeMap: t
|
|
272
270
|
});
|
|
273
|
-
}), e.checked) : (e.checked = !0, e.isPartialChecked = !1,
|
|
271
|
+
}), e.checked) : (e.checked = !0, e.isPartialChecked = !1, se({
|
|
274
272
|
option: e,
|
|
275
273
|
children: s,
|
|
276
274
|
optionsTreeMap: t
|
|
277
275
|
}), e.checked);
|
|
278
|
-
},
|
|
276
|
+
}, Ue = ({
|
|
279
277
|
childOption: i,
|
|
280
278
|
optionsTreeMap: e
|
|
281
279
|
}) => {
|
|
282
280
|
const t = e.get(i.childOf) ?? null;
|
|
283
|
-
t !== null && (
|
|
281
|
+
t !== null && (Qt({ parentOption: t, optionsTreeMap: e }), Ue({
|
|
284
282
|
childOption: t,
|
|
285
283
|
optionsTreeMap: e
|
|
286
284
|
}));
|
|
287
|
-
},
|
|
285
|
+
}, Qt = ({
|
|
288
286
|
parentOption: i,
|
|
289
287
|
optionsTreeMap: e
|
|
290
288
|
}) => {
|
|
291
289
|
const t = K({ id: i.id, optionsTreeMap: e });
|
|
292
|
-
if (
|
|
290
|
+
if (Ye(t)) {
|
|
293
291
|
i.checked = !1, i.isPartialChecked = !1, i.disabled = !0;
|
|
294
292
|
return;
|
|
295
293
|
}
|
|
296
|
-
if (
|
|
294
|
+
if (es(t)) {
|
|
297
295
|
i.checked = !0, i.isPartialChecked = !1;
|
|
298
296
|
return;
|
|
299
297
|
}
|
|
300
|
-
if (
|
|
298
|
+
if (ts(t)) {
|
|
301
299
|
i.checked = !1, i.isPartialChecked = !0;
|
|
302
300
|
return;
|
|
303
301
|
}
|
|
304
302
|
i.checked = !1, i.isPartialChecked = !1;
|
|
305
|
-
},
|
|
303
|
+
}, se = ({
|
|
306
304
|
option: { checked: i, disabled: e },
|
|
307
305
|
children: t,
|
|
308
306
|
optionsTreeMap: s
|
|
@@ -310,38 +308,38 @@ const je = ({
|
|
|
310
308
|
t.forEach((l) => {
|
|
311
309
|
l.disabled = e || l.disabled, l.checked = i && !l.disabled, l.isPartialChecked = !1;
|
|
312
310
|
const r = K({ id: l.id, optionsTreeMap: s });
|
|
313
|
-
|
|
311
|
+
se({
|
|
314
312
|
option: { checked: i, disabled: e },
|
|
315
313
|
children: r,
|
|
316
314
|
optionsTreeMap: s
|
|
317
315
|
});
|
|
318
316
|
});
|
|
319
|
-
},
|
|
317
|
+
}, ze = ({
|
|
320
318
|
children: i,
|
|
321
319
|
optionsTreeMap: e
|
|
322
320
|
}) => i.some((s) => s.disabled) ? !0 : i.some((s) => {
|
|
323
321
|
if (!s.isGroup)
|
|
324
322
|
return !1;
|
|
325
323
|
const l = K({ id: s.id, optionsTreeMap: e });
|
|
326
|
-
return
|
|
327
|
-
}),
|
|
324
|
+
return ze({ children: l, optionsTreeMap: e });
|
|
325
|
+
}), Ye = (i) => i.every((e) => !!e.disabled), es = (i) => i.every((e) => e.checked), ts = (i) => i.some((e) => e.checked || e.isPartialChecked), ss = (i) => {
|
|
328
326
|
i.forEach((e) => {
|
|
329
327
|
e.checked = !1, e.isPartialChecked = !1;
|
|
330
328
|
});
|
|
331
|
-
},
|
|
329
|
+
}, is = ({
|
|
332
330
|
options: i,
|
|
333
331
|
openLevel: e,
|
|
334
332
|
isIndependentNodes: t
|
|
335
333
|
}) => {
|
|
336
334
|
const s = { level: 0, groupId: "" }, l = /* @__PURE__ */ new Map();
|
|
337
|
-
return
|
|
335
|
+
return qe({
|
|
338
336
|
optionsTreeMap: l,
|
|
339
337
|
options: i,
|
|
340
338
|
openLevel: e,
|
|
341
339
|
groupId: s.groupId,
|
|
342
340
|
level: s.level
|
|
343
|
-
}),
|
|
344
|
-
},
|
|
341
|
+
}), as({ optionsTreeMap: l, isIndependentNodes: t }), l;
|
|
342
|
+
}, qe = ({
|
|
345
343
|
optionsTreeMap: i,
|
|
346
344
|
options: e,
|
|
347
345
|
openLevel: t,
|
|
@@ -349,8 +347,8 @@ const je = ({
|
|
|
349
347
|
level: l
|
|
350
348
|
}) => {
|
|
351
349
|
e.forEach((r) => {
|
|
352
|
-
var C,
|
|
353
|
-
const u = (((C = r.children) == null ? void 0 : C.length) ?? 0) > 0, f = l >= t && u,
|
|
350
|
+
var C, v;
|
|
351
|
+
const u = (((C = r.children) == null ? void 0 : C.length) ?? 0) > 0, f = l >= t && u, w = l > t, k = ((v = r.children) == null ? void 0 : v.map((L) => L.value)) ?? [], E = r.value;
|
|
354
352
|
i.has(E) && console.error(
|
|
355
353
|
`Validation: You have duplicated option value: ${E}! You should use unique values. Duplicates will lead to unexpected behavior.`
|
|
356
354
|
), i.set(E, {
|
|
@@ -362,7 +360,7 @@ const je = ({
|
|
|
362
360
|
isPartialChecked: !1,
|
|
363
361
|
level: l,
|
|
364
362
|
isClosed: f,
|
|
365
|
-
hidden:
|
|
363
|
+
hidden: w,
|
|
366
364
|
disabled: r.disabled ?? !1,
|
|
367
365
|
isGroupSelectable: !u || (r.isGroupSelectable ?? !0),
|
|
368
366
|
children: k,
|
|
@@ -371,7 +369,7 @@ const je = ({
|
|
|
371
369
|
itemHtmlElement: null,
|
|
372
370
|
arrowItemHtmlElement: null,
|
|
373
371
|
checkboxIconHtmlElement: null
|
|
374
|
-
}), u &&
|
|
372
|
+
}), u && qe({
|
|
375
373
|
optionsTreeMap: i,
|
|
376
374
|
options: r.children,
|
|
377
375
|
openLevel: t,
|
|
@@ -379,7 +377,7 @@ const je = ({
|
|
|
379
377
|
level: l + 1
|
|
380
378
|
});
|
|
381
379
|
});
|
|
382
|
-
},
|
|
380
|
+
}, ls = (i, e) => i === null ? null : e.get(i) ?? e.get(parseInt(i)) ?? null, K = ({
|
|
383
381
|
id: i,
|
|
384
382
|
optionsTreeMap: e
|
|
385
383
|
}) => {
|
|
@@ -388,14 +386,14 @@ const je = ({
|
|
|
388
386
|
const r = e.get(l) ?? null;
|
|
389
387
|
return r !== null && s.push(r), s;
|
|
390
388
|
}, []);
|
|
391
|
-
},
|
|
389
|
+
}, ns = (i) => {
|
|
392
390
|
const e = [], t = [], s = [];
|
|
393
391
|
i.forEach((r) => {
|
|
394
392
|
r.checked && (s.push(r), r.isGroup ? t.push(r) : e.push(r));
|
|
395
393
|
});
|
|
396
394
|
const l = s.filter((r) => !t.some(({ id: u }) => u === r.childOf));
|
|
397
395
|
return { ungroupedNodes: e, groupedNodes: l, allNodes: s };
|
|
398
|
-
},
|
|
396
|
+
}, as = ({
|
|
399
397
|
optionsTreeMap: i,
|
|
400
398
|
isIndependentNodes: e
|
|
401
399
|
}) => {
|
|
@@ -403,7 +401,7 @@ const je = ({
|
|
|
403
401
|
i.forEach((s) => {
|
|
404
402
|
s.disabled && t.push(s);
|
|
405
403
|
}), t.forEach(
|
|
406
|
-
({ id: s }) =>
|
|
404
|
+
({ id: s }) => be({
|
|
407
405
|
option: { id: s, checked: !1 },
|
|
408
406
|
optionsTreeMap: i,
|
|
409
407
|
isIndependentNodes: e
|
|
@@ -413,34 +411,34 @@ const je = ({
|
|
|
413
411
|
K({ id: e, optionsTreeMap: i }).forEach((l) => {
|
|
414
412
|
l.hidden = t ?? !1, l.isGroup && !l.isClosed && X(i, { id: l.id, isClosed: t });
|
|
415
413
|
});
|
|
416
|
-
},
|
|
414
|
+
}, rs = (i, e) => {
|
|
417
415
|
if (e) {
|
|
418
|
-
|
|
416
|
+
cs(i);
|
|
419
417
|
return;
|
|
420
418
|
}
|
|
421
419
|
i.forEach((t) => {
|
|
422
|
-
t.checked &&
|
|
420
|
+
t.checked && Ce(t.childOf, i), t.isGroup && !t.disabled && (t.checked || t.isPartialChecked) && (t.isClosed = !1, X(i, t));
|
|
423
421
|
});
|
|
424
|
-
},
|
|
422
|
+
}, cs = (i) => {
|
|
425
423
|
let e = null;
|
|
426
424
|
for (const [t, s] of i)
|
|
427
425
|
if (s.checked && !s.disabled) {
|
|
428
426
|
e = s;
|
|
429
427
|
break;
|
|
430
428
|
}
|
|
431
|
-
e && (e.isGroup && (e.isClosed = !1, X(i, e)),
|
|
432
|
-
},
|
|
429
|
+
e && (e.isGroup && (e.isClosed = !1, X(i, e)), Ce(e.childOf, i));
|
|
430
|
+
}, Ce = (i, e) => {
|
|
433
431
|
const t = e.get(i) ?? null;
|
|
434
|
-
t && (t.isClosed = !1, X(e, t),
|
|
435
|
-
},
|
|
432
|
+
t && (t.isClosed = !1, X(e, t), Ce(t.childOf, e));
|
|
433
|
+
}, os = (i, e) => {
|
|
436
434
|
i.forEach((t) => {
|
|
437
435
|
const s = t.name.toLowerCase().includes(e.toLowerCase());
|
|
438
|
-
s && (t.isGroup && (t.isClosed = !0), t.childOf &&
|
|
436
|
+
s && (t.isGroup && (t.isClosed = !0), t.childOf && Ke(t.childOf, i)), t.hidden = !s;
|
|
439
437
|
});
|
|
440
|
-
},
|
|
438
|
+
}, Ke = (i, e) => {
|
|
441
439
|
const t = e.get(i) ?? null;
|
|
442
|
-
t && (t.hidden = !1, t.isClosed = !1,
|
|
443
|
-
},
|
|
440
|
+
t && (t.hidden = !1, t.isClosed = !1, Ke(t.childOf, e));
|
|
441
|
+
}, hs = ({
|
|
444
442
|
optionsTreeMap: i,
|
|
445
443
|
beforeSearchStateMap: e
|
|
446
444
|
}) => {
|
|
@@ -448,7 +446,7 @@ const je = ({
|
|
|
448
446
|
const s = e.get(t.id);
|
|
449
447
|
s && (t.hidden = s.hidden, t.isClosed = s.isClosed);
|
|
450
448
|
}), e.clear();
|
|
451
|
-
},
|
|
449
|
+
}, ds = ({
|
|
452
450
|
optionsTreeMap: i,
|
|
453
451
|
beforeSearchStateMap: e
|
|
454
452
|
}) => {
|
|
@@ -458,14 +456,14 @@ const je = ({
|
|
|
458
456
|
isClosed: t.isClosed
|
|
459
457
|
});
|
|
460
458
|
});
|
|
461
|
-
},
|
|
459
|
+
}, us = (i) => new IntersectionObserver(
|
|
462
460
|
(e) => {
|
|
463
461
|
e.forEach((t) => {
|
|
464
462
|
t.target.classList.toggle("treeselect-list__item--scroll-not-visible", !t.isIntersecting);
|
|
465
463
|
});
|
|
466
464
|
},
|
|
467
465
|
{ root: i, threshold: 0.5 }
|
|
468
|
-
),
|
|
466
|
+
), ms = ({
|
|
469
467
|
optionsTreeMap: i,
|
|
470
468
|
emptyListHtmlElement: e,
|
|
471
469
|
iconElements: t,
|
|
@@ -474,9 +472,9 @@ const je = ({
|
|
|
474
472
|
}) => {
|
|
475
473
|
i.forEach((r) => {
|
|
476
474
|
const u = r.checkboxHtmlElement;
|
|
477
|
-
u && (u.checked = r.checked),
|
|
478
|
-
}),
|
|
479
|
-
},
|
|
475
|
+
u && (u.checked = r.checked), bs({ option: r, previousSingleSelectedValue: s }), Cs(r), Es(r), ws({ option: r, iconElements: t }), vs(r), ps({ option: r, optionsTreeMap: i, rtl: l }), ks({ option: r, iconElements: t }), Ls(r);
|
|
476
|
+
}), fs({ optionsTreeMap: i, emptyListHtmlElement: e });
|
|
477
|
+
}, ps = ({
|
|
480
478
|
option: i,
|
|
481
479
|
optionsTreeMap: e,
|
|
482
480
|
rtl: t
|
|
@@ -484,19 +482,19 @@ const je = ({
|
|
|
484
482
|
const s = i.level === 0, l = 20, r = 5;
|
|
485
483
|
let u = "0";
|
|
486
484
|
if (s) {
|
|
487
|
-
let
|
|
485
|
+
let w = !1;
|
|
488
486
|
for (const [E, C] of e)
|
|
489
487
|
if (C.isGroup && C.level === i.level) {
|
|
490
|
-
|
|
488
|
+
w = !0;
|
|
491
489
|
break;
|
|
492
490
|
}
|
|
493
|
-
const k = !i.isGroup &&
|
|
491
|
+
const k = !i.isGroup && w ? `${l}px` : `${r}px`;
|
|
494
492
|
u = i.isGroup ? "0" : k;
|
|
495
493
|
} else
|
|
496
494
|
u = i.isGroup ? `${i.level * l}px` : `${i.level * l + l}px`;
|
|
497
495
|
const f = i.itemHtmlElement;
|
|
498
496
|
f && (t ? f.style.paddingRight = u : f.style.paddingLeft = u, f.setAttribute("level", i.level.toString()), f.setAttribute("group", i.isGroup.toString()));
|
|
499
|
-
},
|
|
497
|
+
}, fs = ({
|
|
500
498
|
optionsTreeMap: i,
|
|
501
499
|
emptyListHtmlElement: e
|
|
502
500
|
}) => {
|
|
@@ -507,12 +505,12 @@ const je = ({
|
|
|
507
505
|
break;
|
|
508
506
|
}
|
|
509
507
|
e == null || e.classList.toggle("treeselect-list__empty--hidden", t);
|
|
510
|
-
},
|
|
508
|
+
}, gs = (i, e) => {
|
|
511
509
|
e && Object.keys(e).forEach((t) => {
|
|
512
510
|
const s = e[t];
|
|
513
511
|
typeof s == "string" && i.setAttribute(t, s);
|
|
514
512
|
});
|
|
515
|
-
},
|
|
513
|
+
}, bs = ({
|
|
516
514
|
option: i,
|
|
517
515
|
previousSingleSelectedValue: e
|
|
518
516
|
}) => {
|
|
@@ -520,10 +518,10 @@ const je = ({
|
|
|
520
518
|
t == null || t.classList.toggle("treeselect-list__item--checked", i.checked);
|
|
521
519
|
const s = Array.isArray(e) && e[0] === i.id && !i.disabled;
|
|
522
520
|
t == null || t.classList.toggle("treeselect-list__item--single-selected", s);
|
|
523
|
-
},
|
|
521
|
+
}, Cs = (i) => {
|
|
524
522
|
const e = i.itemHtmlElement;
|
|
525
523
|
e == null || e.classList.toggle("treeselect-list__item--partial-checked", i.isPartialChecked);
|
|
526
|
-
},
|
|
524
|
+
}, Es = (i) => {
|
|
527
525
|
const e = i.itemHtmlElement;
|
|
528
526
|
e == null || e.classList.toggle("treeselect-list__item--disabled", i.disabled);
|
|
529
527
|
}, ws = ({ option: i, iconElements: e }) => {
|
|
@@ -534,16 +532,16 @@ const je = ({
|
|
|
534
532
|
const l = i.itemHtmlElement;
|
|
535
533
|
l == null || l.classList.toggle("treeselect-list__item--closed", i.isClosed);
|
|
536
534
|
}
|
|
537
|
-
},
|
|
535
|
+
}, vs = (i) => {
|
|
538
536
|
const e = i.itemHtmlElement;
|
|
539
537
|
e == null || e.classList.toggle("treeselect-list__item--hidden", i.hidden);
|
|
540
|
-
},
|
|
538
|
+
}, ks = ({ option: i, iconElements: e }) => {
|
|
541
539
|
const t = i.checkboxIconHtmlElement;
|
|
542
540
|
t && (i.checked ? O(e.check, t) : i.isPartialChecked ? O(e.partialCheck, t) : t.innerHTML = "");
|
|
543
|
-
},
|
|
541
|
+
}, Ls = (i) => {
|
|
544
542
|
const e = i.itemHtmlElement;
|
|
545
543
|
e == null || e.classList.toggle("treeselect-list__item--non-selectable-group", !i.isGroupSelectable);
|
|
546
|
-
},
|
|
544
|
+
}, Ss = ({
|
|
547
545
|
newValue: i,
|
|
548
546
|
optionsTreeMap: e,
|
|
549
547
|
isSingleSelect: t,
|
|
@@ -551,15 +549,15 @@ const je = ({
|
|
|
551
549
|
isFirstValueUpdate: l,
|
|
552
550
|
isIndependentNodes: r
|
|
553
551
|
}) => {
|
|
554
|
-
|
|
552
|
+
We({
|
|
555
553
|
newValue: i,
|
|
556
554
|
optionsTreeMap: e,
|
|
557
555
|
isSingleSelect: t,
|
|
558
556
|
isIndependentNodes: r
|
|
559
|
-
}), l && s &&
|
|
557
|
+
}), l && s && rs(e, t);
|
|
560
558
|
};
|
|
561
|
-
var G, P, M, Y, o, z, Ze, Je, Qe, et, tt,
|
|
562
|
-
class
|
|
559
|
+
var G, P, M, Y, o, z, Xe, Ze, Je, Qe, et, tt, ie, st, it, lt, le, nt, at, rt, ct, ot, ht, dt, ut, mt, ne, pt, ft, ae, J, re, gt;
|
|
560
|
+
class xs {
|
|
563
561
|
constructor({
|
|
564
562
|
options: e,
|
|
565
563
|
value: t,
|
|
@@ -568,17 +566,17 @@ class ys {
|
|
|
568
566
|
tagsSortFn: r,
|
|
569
567
|
emptyText: u,
|
|
570
568
|
isSingleSelect: f,
|
|
571
|
-
iconElements:
|
|
569
|
+
iconElements: w,
|
|
572
570
|
showCount: k,
|
|
573
571
|
disabledBranchNode: E,
|
|
574
572
|
expandSelected: C,
|
|
575
|
-
isIndependentNodes:
|
|
573
|
+
isIndependentNodes: v,
|
|
576
574
|
rtl: L,
|
|
577
575
|
listClassName: T,
|
|
578
576
|
isBoostedRendering: N,
|
|
579
577
|
inputCallback: H,
|
|
580
578
|
arrowClickCallback: W,
|
|
581
|
-
mouseupCallback:
|
|
579
|
+
mouseupCallback: R
|
|
582
580
|
}) {
|
|
583
581
|
g(this, o);
|
|
584
582
|
// Props
|
|
@@ -614,34 +612,34 @@ class ys {
|
|
|
614
612
|
g(this, P, !0);
|
|
615
613
|
g(this, M, []);
|
|
616
614
|
g(this, Y, !0);
|
|
617
|
-
this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = l ?? null, this.tagsSortFn = r ?? null, this.emptyText = u ?? "No results found...", this.isSingleSelect = f ?? !1, this.showCount = k ?? !1, this.disabledBranchNode = E ?? !1, this.expandSelected = C ?? !1, this.isIndependentNodes =
|
|
615
|
+
this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = l ?? null, this.tagsSortFn = r ?? null, this.emptyText = u ?? "No results found...", this.isSingleSelect = f ?? !1, this.showCount = k ?? !1, this.disabledBranchNode = E ?? !1, this.expandSelected = C ?? !1, this.isIndependentNodes = v ?? !1, this.rtl = L ?? !1, this.listClassName = T ?? "", this.isBoostedRendering = N, this.iconElements = w, this.searchText = "", this.intersectionItemsObserver = null, this.selectedNodes = { nodes: [], groupedNodes: [], allNodes: [] }, this.optionsTreeMap = is({
|
|
618
616
|
options: this.options,
|
|
619
617
|
openLevel: this.openLevel,
|
|
620
618
|
isIndependentNodes: this.isIndependentNodes
|
|
621
|
-
}), this.beforeSearchStateMap = /* @__PURE__ */ new Map(), this.emptyListHtmlElement = null, this.srcElement = a(this, o,
|
|
619
|
+
}), this.beforeSearchStateMap = /* @__PURE__ */ new Map(), this.emptyListHtmlElement = null, this.srcElement = a(this, o, Je).call(this), this.inputCallback = H, this.arrowClickCallback = W, this.mouseupCallback = R;
|
|
622
620
|
}
|
|
623
621
|
// Public methods
|
|
624
622
|
updateValue(e) {
|
|
625
|
-
this.value = e, b(this, M, this.isSingleSelect ? this.value : []),
|
|
623
|
+
this.value = e, b(this, M, this.isSingleSelect ? this.value : []), Ss({
|
|
626
624
|
newValue: e,
|
|
627
625
|
optionsTreeMap: this.optionsTreeMap,
|
|
628
626
|
isSingleSelect: this.isSingleSelect,
|
|
629
627
|
expandSelected: this.expandSelected,
|
|
630
628
|
isFirstValueUpdate: n(this, Y),
|
|
631
629
|
isIndependentNodes: this.isIndependentNodes
|
|
632
|
-
}), a(this, o, z).call(this), b(this, Y, !1), a(this, o,
|
|
630
|
+
}), a(this, o, z).call(this), b(this, Y, !1), a(this, o, re).call(this);
|
|
633
631
|
}
|
|
634
632
|
updateSearchValue(e) {
|
|
635
633
|
if (e === this.searchText)
|
|
636
634
|
return;
|
|
637
635
|
const t = this.searchText === "" && e !== "";
|
|
638
|
-
this.searchText = e, t &&
|
|
636
|
+
this.searchText = e, t && ds({
|
|
639
637
|
beforeSearchStateMap: this.beforeSearchStateMap,
|
|
640
638
|
optionsTreeMap: this.optionsTreeMap
|
|
641
|
-
}), this.searchText === "" &&
|
|
639
|
+
}), this.searchText === "" && hs({
|
|
642
640
|
beforeSearchStateMap: this.beforeSearchStateMap,
|
|
643
641
|
optionsTreeMap: this.optionsTreeMap
|
|
644
|
-
}), this.searchText &&
|
|
642
|
+
}), this.searchText && os(this.optionsTreeMap, e), a(this, o, z).call(this), this.focusFirstListElement();
|
|
645
643
|
}
|
|
646
644
|
callKeyAction(e) {
|
|
647
645
|
b(this, P, !1);
|
|
@@ -649,10 +647,10 @@ class ys {
|
|
|
649
647
|
if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden"))
|
|
650
648
|
return;
|
|
651
649
|
const l = e.key;
|
|
652
|
-
l === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (l === "ArrowLeft" || l === "ArrowRight") && a(this, o,
|
|
650
|
+
l === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (l === "ArrowLeft" || l === "ArrowRight") && a(this, o, Xe).call(this, t, e), (l === "ArrowDown" || l === "ArrowUp") && a(this, o, Ze).call(this, t, l);
|
|
653
651
|
}
|
|
654
652
|
focusFirstListElement() {
|
|
655
|
-
const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = a(this, o,
|
|
653
|
+
const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = a(this, o, ne).call(this);
|
|
656
654
|
if (!s.length)
|
|
657
655
|
return;
|
|
658
656
|
t && t.classList.remove(e);
|
|
@@ -668,30 +666,30 @@ class ys {
|
|
|
668
666
|
}
|
|
669
667
|
G = new WeakMap(), P = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), o = new WeakSet(), // Private methods
|
|
670
668
|
z = function() {
|
|
671
|
-
|
|
669
|
+
ms({
|
|
672
670
|
optionsTreeMap: this.optionsTreeMap,
|
|
673
671
|
emptyListHtmlElement: this.emptyListHtmlElement,
|
|
674
672
|
iconElements: this.iconElements,
|
|
675
673
|
previousSingleSelectedValue: n(this, M),
|
|
676
674
|
rtl: this.rtl
|
|
677
675
|
});
|
|
678
|
-
},
|
|
676
|
+
}, Xe = function(e, t) {
|
|
679
677
|
if (!e)
|
|
680
678
|
return;
|
|
681
|
-
const s = t.key, r = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), u =
|
|
679
|
+
const s = t.key, r = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), u = ls(r, this.optionsTreeMap), f = u.arrowItemHtmlElement;
|
|
682
680
|
s === "ArrowLeft" && !u.isClosed && u.isGroup && (f.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && u.isClosed && u.isGroup && (f.dispatchEvent(new Event("mousedown")), t.preventDefault());
|
|
683
|
-
},
|
|
681
|
+
}, Ze = function(e, t) {
|
|
684
682
|
var r;
|
|
685
|
-
const s = a(this, o,
|
|
683
|
+
const s = a(this, o, ne).call(this);
|
|
686
684
|
if (!s.length)
|
|
687
685
|
return;
|
|
688
686
|
const l = "treeselect-list__item--focused";
|
|
689
687
|
if (e) {
|
|
690
688
|
const u = s.findIndex((N) => N.classList.contains(l));
|
|
691
689
|
s[u].classList.remove(l);
|
|
692
|
-
const
|
|
690
|
+
const w = t === "ArrowDown" ? u + 1 : u - 1, k = t === "ArrowDown" ? 0 : s.length - 1, E = !s[w], C = s[w] ?? s[k];
|
|
693
691
|
C.classList.add(l);
|
|
694
|
-
const
|
|
692
|
+
const v = this.srcElement.getBoundingClientRect(), L = C.getBoundingClientRect();
|
|
695
693
|
if (E && t === "ArrowDown") {
|
|
696
694
|
this.srcElement.scroll(0, 0);
|
|
697
695
|
return;
|
|
@@ -701,11 +699,11 @@ z = function() {
|
|
|
701
699
|
return;
|
|
702
700
|
}
|
|
703
701
|
const T = ((r = this.listSlotHtmlComponent) == null ? void 0 : r.clientHeight) ?? 0;
|
|
704
|
-
if (
|
|
702
|
+
if (v.y + v.height < L.y + L.height + T) {
|
|
705
703
|
this.srcElement.scroll(0, this.srcElement.scrollTop + L.height);
|
|
706
704
|
return;
|
|
707
705
|
}
|
|
708
|
-
if (
|
|
706
|
+
if (v.y > L.y) {
|
|
709
707
|
this.srcElement.scroll(0, this.srcElement.scrollTop - L.height);
|
|
710
708
|
return;
|
|
711
709
|
}
|
|
@@ -713,79 +711,79 @@ z = function() {
|
|
|
713
711
|
const [u] = s;
|
|
714
712
|
u.classList.add(l);
|
|
715
713
|
}
|
|
716
|
-
},
|
|
717
|
-
const e = a(this, o,
|
|
714
|
+
}, Je = function() {
|
|
715
|
+
const e = a(this, o, Qe).call(this), t = a(this, o, ie).call(this, this.options);
|
|
718
716
|
e.append(...t);
|
|
719
|
-
const s = a(this, o,
|
|
717
|
+
const s = a(this, o, it).call(this);
|
|
720
718
|
e.append(s);
|
|
721
|
-
const l = a(this, o,
|
|
719
|
+
const l = a(this, o, st).call(this);
|
|
722
720
|
return l && e.append(l), e;
|
|
723
|
-
},
|
|
721
|
+
}, Qe = function() {
|
|
724
722
|
const e = document.createElement("div");
|
|
725
|
-
return e.classList.add("treeselect-list"), this.listClassName.length > 0 && e.classList.add(this.listClassName), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => a(this, o,
|
|
726
|
-
},
|
|
723
|
+
return e.classList.add("treeselect-list"), this.listClassName.length > 0 && e.classList.add(this.listClassName), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => a(this, o, et).call(this, t)), e.addEventListener("mousemove", () => a(this, o, tt).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), this.isBoostedRendering && (this.intersectionItemsObserver = us(e)), e;
|
|
724
|
+
}, et = function(e) {
|
|
727
725
|
e.stopPropagation(), n(this, G) && n(this, P) && n(this, G).classList.add("treeselect-list__item--focused");
|
|
728
|
-
},
|
|
726
|
+
}, tt = function() {
|
|
729
727
|
b(this, P, !0);
|
|
730
|
-
},
|
|
728
|
+
}, ie = function(e) {
|
|
731
729
|
return e.reduce((t, s) => {
|
|
732
730
|
var r;
|
|
733
731
|
if ((r = s.children) != null && r.length) {
|
|
734
|
-
const u = a(this, o,
|
|
732
|
+
const u = a(this, o, lt).call(this, s), f = a(this, o, ie).call(this, s.children);
|
|
735
733
|
return u.append(...f), t.push(u), t;
|
|
736
734
|
}
|
|
737
|
-
const l = a(this, o,
|
|
735
|
+
const l = a(this, o, le).call(this, s, !1);
|
|
738
736
|
return t.push(l), t;
|
|
739
737
|
}, []);
|
|
740
|
-
},
|
|
738
|
+
}, st = function() {
|
|
741
739
|
if (!this.listSlotHtmlComponent)
|
|
742
740
|
return null;
|
|
743
741
|
const e = document.createElement("div");
|
|
744
742
|
return e.classList.add("treeselect-list__slot"), e.appendChild(this.listSlotHtmlComponent), e;
|
|
745
|
-
},
|
|
743
|
+
}, it = function() {
|
|
746
744
|
const e = document.createElement("div");
|
|
747
745
|
e.classList.add("treeselect-list__empty"), e.setAttribute("title", this.emptyText);
|
|
748
746
|
const t = document.createElement("span");
|
|
749
747
|
t.classList.add("treeselect-list__empty-icon"), O(this.iconElements.attention, t);
|
|
750
748
|
const s = document.createElement("span");
|
|
751
749
|
return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), this.emptyListHtmlElement = e, e;
|
|
752
|
-
},
|
|
750
|
+
}, lt = function(e) {
|
|
753
751
|
const t = document.createElement("div");
|
|
754
752
|
t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container");
|
|
755
|
-
const s = a(this, o,
|
|
753
|
+
const s = a(this, o, le).call(this, e, !0);
|
|
756
754
|
return t.appendChild(s), t;
|
|
757
|
-
},
|
|
758
|
-
const s = a(this, o,
|
|
755
|
+
}, le = function(e, t) {
|
|
756
|
+
const s = a(this, o, nt).call(this, e);
|
|
759
757
|
if (t) {
|
|
760
|
-
const u = a(this, o,
|
|
758
|
+
const u = a(this, o, ot).call(this, e);
|
|
761
759
|
s.appendChild(u), s.classList.add("treeselect-list__item--group");
|
|
762
760
|
}
|
|
763
|
-
const l = a(this, o,
|
|
761
|
+
const l = a(this, o, dt).call(this, e), r = a(this, o, ut).call(this, e, t);
|
|
764
762
|
return s.append(l, r), s;
|
|
765
|
-
},
|
|
763
|
+
}, nt = function(e) {
|
|
766
764
|
const t = document.createElement("div");
|
|
767
|
-
t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name),
|
|
765
|
+
t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), gs(t, e.htmlAttr), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => a(this, o, at).call(this, t), !0), t.addEventListener("mouseout", () => a(this, o, rt).call(this, t), !0), t.addEventListener("mousedown", (l) => a(this, o, ct).call(this, l, e)), this.intersectionItemsObserver && this.intersectionItemsObserver.observe(t);
|
|
768
766
|
const s = this.optionsTreeMap.get(e.value);
|
|
769
767
|
return s && (s.itemHtmlElement = t), t;
|
|
768
|
+
}, at = function(e) {
|
|
769
|
+
n(this, P) && a(this, o, ae).call(this, !0, e);
|
|
770
770
|
}, rt = function(e) {
|
|
771
|
-
n(this, P) && a(this, o,
|
|
772
|
-
}, ct = function(e) {
|
|
773
|
-
n(this, P) && (a(this, o, oe).call(this, !1, e), b(this, G, e));
|
|
774
|
-
}, ot = function(e, t) {
|
|
771
|
+
n(this, P) && (a(this, o, ae).call(this, !1, e), b(this, G, e));
|
|
772
|
+
}, ct = function(e, t) {
|
|
775
773
|
e.preventDefault(), e.stopPropagation();
|
|
776
774
|
const s = this.optionsTreeMap.get(t.value) ?? null;
|
|
777
775
|
if (s != null && s.disabled)
|
|
778
776
|
return;
|
|
779
777
|
const l = s == null ? void 0 : s.checkboxHtmlElement;
|
|
780
|
-
l && (l.checked = !l.checked, a(this, o,
|
|
781
|
-
},
|
|
778
|
+
l && (l.checked = !l.checked, a(this, o, pt).call(this, l, t));
|
|
779
|
+
}, ot = function(e) {
|
|
782
780
|
const t = document.createElement("span");
|
|
783
|
-
t.setAttribute("tabindex", "-1"), t.classList.add("treeselect-list__item-icon"), O(this.iconElements.arrowDown, t), t.addEventListener("mousedown", (l) => a(this, o,
|
|
781
|
+
t.setAttribute("tabindex", "-1"), t.classList.add("treeselect-list__item-icon"), O(this.iconElements.arrowDown, t), t.addEventListener("mousedown", (l) => a(this, o, ht).call(this, l, e));
|
|
784
782
|
const s = this.optionsTreeMap.get(e.value);
|
|
785
783
|
return s && (s.arrowItemHtmlElement = t), t;
|
|
786
|
-
},
|
|
787
|
-
e.preventDefault(), e.stopPropagation(), a(this, o,
|
|
788
|
-
},
|
|
784
|
+
}, ht = function(e, t) {
|
|
785
|
+
e.preventDefault(), e.stopPropagation(), a(this, o, ft).call(this, t);
|
|
786
|
+
}, dt = function(e) {
|
|
789
787
|
const t = document.createElement("div");
|
|
790
788
|
t.classList.add("treeselect-list__item-checkbox-container");
|
|
791
789
|
const s = document.createElement("span");
|
|
@@ -794,24 +792,24 @@ z = function() {
|
|
|
794
792
|
l.setAttribute("tabindex", "-1"), l.setAttribute("type", "checkbox"), l.setAttribute("input-id", e.value.toString()), l.classList.add("treeselect-list__item-checkbox"), t.append(s, l);
|
|
795
793
|
const r = this.optionsTreeMap.get(e.value);
|
|
796
794
|
return r && (r.checkboxHtmlElement = l, r.checkboxIconHtmlElement = s), t;
|
|
797
|
-
},
|
|
795
|
+
}, ut = function(e, t) {
|
|
798
796
|
const s = document.createElement("label");
|
|
799
797
|
if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) {
|
|
800
|
-
const l = a(this, o,
|
|
798
|
+
const l = a(this, o, mt).call(this, e);
|
|
801
799
|
s.appendChild(l);
|
|
802
800
|
}
|
|
803
801
|
return s;
|
|
804
|
-
},
|
|
802
|
+
}, mt = function(e) {
|
|
805
803
|
var l;
|
|
806
804
|
const t = document.createElement("span"), s = ((l = this.optionsTreeMap.get(e.value)) == null ? void 0 : l.children) ?? [];
|
|
807
805
|
return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t;
|
|
808
|
-
},
|
|
806
|
+
}, ne = function() {
|
|
809
807
|
const e = [];
|
|
810
808
|
return this.optionsTreeMap.forEach((t) => {
|
|
811
809
|
!t.hidden && t.itemHtmlElement && e.push(t.itemHtmlElement);
|
|
812
810
|
}), e;
|
|
813
811
|
}, // Actions
|
|
814
|
-
|
|
812
|
+
pt = function(e, t) {
|
|
815
813
|
const s = this.optionsTreeMap.get(t.value) ?? null;
|
|
816
814
|
if (s === null)
|
|
817
815
|
return;
|
|
@@ -825,7 +823,7 @@ ft = function(e, t) {
|
|
|
825
823
|
const [r] = n(this, M);
|
|
826
824
|
if (s.id === r)
|
|
827
825
|
return;
|
|
828
|
-
b(this, M, [s.id]),
|
|
826
|
+
b(this, M, [s.id]), We({
|
|
829
827
|
newValue: [s.id],
|
|
830
828
|
optionsTreeMap: this.optionsTreeMap,
|
|
831
829
|
isSingleSelect: this.isSingleSelect,
|
|
@@ -833,18 +831,18 @@ ft = function(e, t) {
|
|
|
833
831
|
});
|
|
834
832
|
} else {
|
|
835
833
|
s.checked = e.checked;
|
|
836
|
-
const r =
|
|
834
|
+
const r = be({
|
|
837
835
|
option: s,
|
|
838
836
|
optionsTreeMap: this.optionsTreeMap,
|
|
839
837
|
isIndependentNodes: this.isIndependentNodes
|
|
840
838
|
});
|
|
841
839
|
e.checked = r;
|
|
842
840
|
}
|
|
843
|
-
a(this, o, z).call(this), a(this, o,
|
|
844
|
-
},
|
|
841
|
+
a(this, o, z).call(this), a(this, o, gt).call(this);
|
|
842
|
+
}, ft = function(e) {
|
|
845
843
|
const t = this.optionsTreeMap.get(e.value) ?? null;
|
|
846
844
|
t !== null && (t.isClosed = !t.isClosed, X(this.optionsTreeMap, t), a(this, o, z).call(this), this.arrowClickCallback(t.id, t.isClosed));
|
|
847
|
-
},
|
|
845
|
+
}, ae = function(e, t) {
|
|
848
846
|
const s = "treeselect-list__item--focused";
|
|
849
847
|
if (e) {
|
|
850
848
|
const l = Array.from(this.srcElement.querySelectorAll(`.${s}`));
|
|
@@ -853,18 +851,18 @@ ft = function(e, t) {
|
|
|
853
851
|
t.classList.remove(s);
|
|
854
852
|
}, J = function(e) {
|
|
855
853
|
return this.tagsSortFn === null ? e : [...e].sort((t, s) => this.tagsSortFn({ value: t.id, name: t.name }, { value: s.id, name: s.name }));
|
|
856
|
-
},
|
|
857
|
-
const { ungroupedNodes: e, groupedNodes: t, allNodes: s } =
|
|
854
|
+
}, re = function() {
|
|
855
|
+
const { ungroupedNodes: e, groupedNodes: t, allNodes: s } = ns(this.optionsTreeMap);
|
|
858
856
|
this.selectedNodes = {
|
|
859
857
|
nodes: a(this, o, J).call(this, e),
|
|
860
858
|
groupedNodes: a(this, o, J).call(this, t),
|
|
861
859
|
allNodes: a(this, o, J).call(this, s)
|
|
862
860
|
};
|
|
863
861
|
}, // Emits
|
|
864
|
-
|
|
865
|
-
a(this, o,
|
|
862
|
+
gt = function() {
|
|
863
|
+
a(this, o, re).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
|
|
866
864
|
};
|
|
867
|
-
const
|
|
865
|
+
const Le = ({
|
|
868
866
|
parentHtmlContainer: i,
|
|
869
867
|
staticList: e,
|
|
870
868
|
appendToBody: t,
|
|
@@ -873,15 +871,15 @@ const Se = ({
|
|
|
873
871
|
direction: r
|
|
874
872
|
}) => {
|
|
875
873
|
i || 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(l) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(l) && console.error("Validation: you should pass an array as a value!"), r && r !== "auto" && r !== "bottom" && r !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
|
|
876
|
-
}, Z = (i) => i.map((e) => e.id),
|
|
874
|
+
}, Z = (i) => i.map((e) => e.id), ys = (i) => i == null ? [] : Array.isArray(i) ? i : [i], Ts = (i, e) => {
|
|
877
875
|
if (e) {
|
|
878
876
|
const [t] = i;
|
|
879
877
|
return t ?? null;
|
|
880
878
|
}
|
|
881
879
|
return i;
|
|
882
880
|
};
|
|
883
|
-
var m, p,
|
|
884
|
-
class
|
|
881
|
+
var m, p, F, q, $, A, I, y, V, d, ce, oe, bt, Ct, Et, wt, vt, he, kt, Lt, St, xt, de, ue, me, pe, fe, yt, ge, Tt, At, It, Nt, _t;
|
|
882
|
+
class Is {
|
|
885
883
|
constructor({
|
|
886
884
|
parentHtmlContainer: e,
|
|
887
885
|
value: t,
|
|
@@ -890,38 +888,38 @@ class Ns {
|
|
|
890
888
|
appendToBody: r,
|
|
891
889
|
alwaysOpen: u,
|
|
892
890
|
showTags: f,
|
|
893
|
-
tagsCountText:
|
|
891
|
+
tagsCountText: w,
|
|
894
892
|
tagsSortFn: k,
|
|
895
893
|
clearable: E,
|
|
896
894
|
searchable: C,
|
|
897
|
-
placeholder:
|
|
895
|
+
placeholder: v,
|
|
898
896
|
grouped: L,
|
|
899
897
|
isGroupedValue: T,
|
|
900
898
|
listSlotHtmlComponent: N,
|
|
901
899
|
disabled: H,
|
|
902
900
|
emptyText: W,
|
|
903
|
-
staticList:
|
|
904
|
-
id:
|
|
905
|
-
ariaLabel:
|
|
906
|
-
isSingleSelect:
|
|
907
|
-
showCount:
|
|
908
|
-
disabledBranchNode:
|
|
901
|
+
staticList: R,
|
|
902
|
+
id: Q,
|
|
903
|
+
ariaLabel: Ot,
|
|
904
|
+
isSingleSelect: Ee,
|
|
905
|
+
showCount: Ht,
|
|
906
|
+
disabledBranchNode: Pt,
|
|
909
907
|
direction: Vt,
|
|
910
|
-
expandSelected:
|
|
911
|
-
saveScrollPosition:
|
|
912
|
-
isIndependentNodes:
|
|
913
|
-
rtl:
|
|
908
|
+
expandSelected: Bt,
|
|
909
|
+
saveScrollPosition: Dt,
|
|
910
|
+
isIndependentNodes: Gt,
|
|
911
|
+
rtl: Mt,
|
|
914
912
|
listClassName: Rt,
|
|
915
|
-
isBoostedRendering:
|
|
916
|
-
iconElements:
|
|
917
|
-
inputCallback:
|
|
918
|
-
openCallback:
|
|
919
|
-
closeCallback:
|
|
920
|
-
nameChangeCallback:
|
|
921
|
-
searchCallback:
|
|
922
|
-
openCloseGroupCallback:
|
|
913
|
+
isBoostedRendering: Ft,
|
|
914
|
+
iconElements: $t,
|
|
915
|
+
inputCallback: Wt,
|
|
916
|
+
openCallback: jt,
|
|
917
|
+
closeCallback: Ut,
|
|
918
|
+
nameChangeCallback: zt,
|
|
919
|
+
searchCallback: Yt,
|
|
920
|
+
openCloseGroupCallback: qt
|
|
923
921
|
}) {
|
|
924
|
-
g(this,
|
|
922
|
+
g(this, d);
|
|
925
923
|
// Props
|
|
926
924
|
c(this, "parentHtmlContainer");
|
|
927
925
|
c(this, "value");
|
|
@@ -971,7 +969,7 @@ class Ns {
|
|
|
971
969
|
g(this, m, null);
|
|
972
970
|
g(this, p, null);
|
|
973
971
|
// Resize props
|
|
974
|
-
g(this,
|
|
972
|
+
g(this, F, null);
|
|
975
973
|
// List position scroll
|
|
976
974
|
g(this, q, 0);
|
|
977
975
|
// Timer for search text
|
|
@@ -980,31 +978,31 @@ class Ns {
|
|
|
980
978
|
g(this, A, null);
|
|
981
979
|
g(this, I, null);
|
|
982
980
|
g(this, y, null);
|
|
983
|
-
g(this,
|
|
984
|
-
|
|
981
|
+
g(this, V, null);
|
|
982
|
+
Le({
|
|
985
983
|
parentHtmlContainer: e,
|
|
986
984
|
value: t,
|
|
987
|
-
staticList:
|
|
985
|
+
staticList: R,
|
|
988
986
|
appendToBody: r,
|
|
989
|
-
isSingleSelect:
|
|
990
|
-
}), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = l ?? 0, this.appendToBody = r ?? !1, this.alwaysOpen = !!(u && !H), this.showTags = f ?? !0, this.tagsCountText =
|
|
987
|
+
isSingleSelect: Ee
|
|
988
|
+
}), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = l ?? 0, this.appendToBody = r ?? !1, this.alwaysOpen = !!(u && !H), this.showTags = f ?? !0, this.tagsCountText = w ?? "elements selected", this.tagsSortFn = k ?? null, this.clearable = E ?? !0, this.searchable = C ?? !0, this.placeholder = v ?? "Search...", this.grouped = L ?? !0, this.isGroupedValue = T ?? !1, this.listSlotHtmlComponent = N ?? null, this.disabled = H ?? !1, this.emptyText = W ?? "No results found...", this.staticList = !!(R && !this.appendToBody), this.id = Q ?? "", this.ariaLabel = Ot ?? "", this.isSingleSelect = Ee ?? !1, this.showCount = Ht ?? !1, this.disabledBranchNode = Pt ?? !1, this.direction = Vt ?? "auto", this.expandSelected = Bt ?? !1, this.saveScrollPosition = Dt ?? !0, this.isIndependentNodes = Gt ?? !1, this.rtl = Mt ?? !1, this.listClassName = Rt ?? "", this.isBoostedRendering = Ft ?? !1, this.iconElements = ke($t), this.inputCallback = Wt, this.openCallback = jt, this.closeCallback = Ut, this.nameChangeCallback = zt, this.searchCallback = Yt, this.openCloseGroupCallback = qt, this.ungroupedValue = [], this.groupedValue = [], this.allValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, a(this, d, ce).call(this, t);
|
|
991
989
|
}
|
|
992
990
|
mount() {
|
|
993
|
-
|
|
991
|
+
Le({
|
|
994
992
|
parentHtmlContainer: this.parentHtmlContainer,
|
|
995
993
|
value: this.value,
|
|
996
994
|
staticList: this.staticList,
|
|
997
995
|
appendToBody: this.appendToBody,
|
|
998
996
|
isSingleSelect: this.isSingleSelect
|
|
999
|
-
}), this.iconElements =
|
|
997
|
+
}), this.iconElements = ke(this.iconElements), a(this, d, ce).call(this, this.value);
|
|
1000
998
|
}
|
|
1001
999
|
updateValue(e) {
|
|
1002
|
-
const t =
|
|
1003
|
-
s && (s.updateValue(t), a(this,
|
|
1000
|
+
const t = ys(e), s = n(this, m);
|
|
1001
|
+
s && (s.updateValue(t), a(this, d, he).call(this, s == null ? void 0 : s.selectedNodes));
|
|
1004
1002
|
}
|
|
1005
1003
|
destroy() {
|
|
1006
1004
|
var e;
|
|
1007
|
-
this.srcElement && (a(this,
|
|
1005
|
+
this.srcElement && (a(this, d, de).call(this), this.srcElement.innerHTML = "", this.srcElement = null, a(this, d, fe).call(this, !0), (e = n(this, m)) == null || e.destroy());
|
|
1008
1006
|
}
|
|
1009
1007
|
focus() {
|
|
1010
1008
|
n(this, p) && n(this, p).focus();
|
|
@@ -1017,12 +1015,13 @@ class Ns {
|
|
|
1017
1015
|
this.updateListPosition();
|
|
1018
1016
|
}
|
|
1019
1017
|
focusWindowHandler(e) {
|
|
1020
|
-
var
|
|
1021
|
-
|
|
1018
|
+
var l, r;
|
|
1019
|
+
let t = e.target;
|
|
1020
|
+
t != null && t.shadowRoot && e.composedPath().length > 0 && (t = e.composedPath()[0]), ((l = this.srcElement) == null ? void 0 : l.contains(t)) || ((r = n(this, m)) == null ? void 0 : r.srcElement.contains(t)) || this.blurWindowHandler();
|
|
1022
1021
|
}
|
|
1023
1022
|
blurWindowHandler() {
|
|
1024
1023
|
var e;
|
|
1025
|
-
(e = n(this, p)) == null || e.blur(), a(this,
|
|
1024
|
+
(e = n(this, p)) == null || e.blur(), a(this, d, fe).call(this, !1), a(this, d, me).call(this, !1);
|
|
1026
1025
|
}
|
|
1027
1026
|
// Update direction of the list. Support appendToBody and standard mode with absolute
|
|
1028
1027
|
updateListPosition() {
|
|
@@ -1031,7 +1030,7 @@ class Ns {
|
|
|
1031
1030
|
if (!e || !t)
|
|
1032
1031
|
return;
|
|
1033
1032
|
if (this.staticList) {
|
|
1034
|
-
t.setAttribute("direction", "bottom"), a(this,
|
|
1033
|
+
t.setAttribute("direction", "bottom"), a(this, d, ue).call(this, !1, this.appendToBody);
|
|
1035
1034
|
return;
|
|
1036
1035
|
}
|
|
1037
1036
|
const { height: s } = t.getBoundingClientRect(), {
|
|
@@ -1039,34 +1038,34 @@ class Ns {
|
|
|
1039
1038
|
y: r,
|
|
1040
1039
|
height: u,
|
|
1041
1040
|
width: f
|
|
1042
|
-
} = e.getBoundingClientRect(),
|
|
1041
|
+
} = e.getBoundingClientRect(), w = window.innerHeight, k = r, E = w - r - u;
|
|
1043
1042
|
let C = k > E && k >= s && E < s;
|
|
1044
1043
|
if (this.direction !== "auto" && (C = this.direction === "top"), this.appendToBody) {
|
|
1045
1044
|
(t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px");
|
|
1046
1045
|
const N = l + window.scrollX, H = C ? r + window.scrollY - s : r + window.scrollY + u;
|
|
1047
1046
|
t.style.transform = `translate(${N}px,${H}px)`, t.style.width = `${f}px`;
|
|
1048
1047
|
}
|
|
1049
|
-
const
|
|
1050
|
-
t.getAttribute("direction") !==
|
|
1048
|
+
const v = C ? "top" : "bottom";
|
|
1049
|
+
t.getAttribute("direction") !== v && (t.setAttribute("direction", v), a(this, d, ue).call(this, C, this.appendToBody));
|
|
1051
1050
|
}
|
|
1052
1051
|
}
|
|
1053
|
-
m = new WeakMap(), p = new WeakMap(),
|
|
1052
|
+
m = new WeakMap(), p = new WeakMap(), F = new WeakMap(), q = new WeakMap(), $ = new WeakMap(), A = new WeakMap(), I = new WeakMap(), y = new WeakMap(), V = new WeakMap(), d = new WeakSet(), ce = function(e) {
|
|
1054
1053
|
var r;
|
|
1055
1054
|
this.destroy();
|
|
1056
|
-
const { container: t, list: s, input: l } = a(this,
|
|
1057
|
-
this.srcElement = t, b(this, m, s), b(this, p, l), b(this, A, this.scrollWindowHandler.bind(this)), b(this, I, this.scrollWindowHandler.bind(this)), b(this, y, this.focusWindowHandler.bind(this)), b(this,
|
|
1058
|
-
},
|
|
1055
|
+
const { container: t, list: s, input: l } = a(this, d, bt).call(this);
|
|
1056
|
+
this.srcElement = t, b(this, m, s), b(this, p, l), b(this, A, this.scrollWindowHandler.bind(this)), b(this, I, this.scrollWindowHandler.bind(this)), b(this, y, this.focusWindowHandler.bind(this)), b(this, V, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((r = n(this, p)) == null || r.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
|
|
1057
|
+
}, oe = function({
|
|
1059
1058
|
groupedNodes: e,
|
|
1060
1059
|
nodes: t,
|
|
1061
1060
|
allNodes: s
|
|
1062
1061
|
}) {
|
|
1063
1062
|
this.ungroupedValue = t ? Z(t) : [], this.groupedValue = e ? Z(e) : [], this.allValue = s ? Z(s) : [];
|
|
1064
1063
|
let l = [];
|
|
1065
|
-
this.isIndependentNodes || this.isSingleSelect ? l = this.allValue : this.isGroupedValue ? l = this.groupedValue : l = this.ungroupedValue, this.value =
|
|
1066
|
-
},
|
|
1064
|
+
this.isIndependentNodes || this.isSingleSelect ? l = this.allValue : this.isGroupedValue ? l = this.groupedValue : l = this.ungroupedValue, this.value = Ts(l, this.isSingleSelect);
|
|
1065
|
+
}, bt = function() {
|
|
1067
1066
|
const e = this.parentHtmlContainer;
|
|
1068
1067
|
e.classList.add("treeselect");
|
|
1069
|
-
const t = new
|
|
1068
|
+
const t = new xs({
|
|
1070
1069
|
value: [],
|
|
1071
1070
|
// updateValue method calls in initMount method to set actual value
|
|
1072
1071
|
options: this.options,
|
|
@@ -1083,13 +1082,13 @@ m = new WeakMap(), p = new WeakMap(), R = new WeakMap(), q = new WeakMap(), $ =
|
|
|
1083
1082
|
listClassName: this.listClassName,
|
|
1084
1083
|
isBoostedRendering: this.isBoostedRendering,
|
|
1085
1084
|
iconElements: this.iconElements,
|
|
1086
|
-
inputCallback: (l) => a(this,
|
|
1087
|
-
arrowClickCallback: (l, r) => a(this,
|
|
1085
|
+
inputCallback: (l) => a(this, d, kt).call(this, l),
|
|
1086
|
+
arrowClickCallback: (l, r) => a(this, d, Lt).call(this, l, r),
|
|
1088
1087
|
mouseupCallback: () => {
|
|
1089
1088
|
var l;
|
|
1090
1089
|
return (l = n(this, p)) == null ? void 0 : l.focus();
|
|
1091
1090
|
}
|
|
1092
|
-
}), s = new
|
|
1091
|
+
}), s = new Jt({
|
|
1093
1092
|
value: [],
|
|
1094
1093
|
// updateValue method calls in initMount method to set actual value
|
|
1095
1094
|
showTags: this.showTags,
|
|
@@ -1103,95 +1102,88 @@ m = new WeakMap(), p = new WeakMap(), R = new WeakMap(), q = new WeakMap(), $ =
|
|
|
1103
1102
|
id: this.id,
|
|
1104
1103
|
ariaLabel: this.ariaLabel,
|
|
1105
1104
|
iconElements: this.iconElements,
|
|
1106
|
-
inputCallback: (l) => a(this,
|
|
1107
|
-
searchCallback: (l) => a(this,
|
|
1108
|
-
openCallback: () => a(this,
|
|
1109
|
-
closeCallback: () => a(this,
|
|
1110
|
-
keydownCallback: (l) => a(this,
|
|
1111
|
-
focusCallback: () => a(this,
|
|
1112
|
-
|
|
1113
|
-
nameChangeCallback: (l) => a(this, h, yt).call(this, l)
|
|
1105
|
+
inputCallback: (l) => a(this, d, Ct).call(this, l),
|
|
1106
|
+
searchCallback: (l) => a(this, d, wt).call(this, l),
|
|
1107
|
+
openCallback: () => a(this, d, xt).call(this),
|
|
1108
|
+
closeCallback: () => a(this, d, de).call(this),
|
|
1109
|
+
keydownCallback: (l) => a(this, d, Et).call(this, l),
|
|
1110
|
+
focusCallback: () => a(this, d, vt).call(this),
|
|
1111
|
+
nameChangeCallback: (l) => a(this, d, St).call(this, l)
|
|
1114
1112
|
});
|
|
1115
|
-
return this.rtl && (e.setAttribute("dir", "rtl"), t.srcElement.setAttribute("dir", "rtl")), this.appendToBody && b(this,
|
|
1116
|
-
},
|
|
1113
|
+
return this.rtl && (e.setAttribute("dir", "rtl"), t.srcElement.setAttribute("dir", "rtl")), this.appendToBody && b(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(s.srcElement), { container: e, list: t, input: s };
|
|
1114
|
+
}, Ct = function(e) {
|
|
1117
1115
|
var l, r;
|
|
1118
1116
|
const t = Z(e);
|
|
1119
1117
|
(l = n(this, m)) == null || l.updateValue(t);
|
|
1120
1118
|
const s = ((r = n(this, m)) == null ? void 0 : r.selectedNodes) ?? {};
|
|
1121
|
-
a(this,
|
|
1122
|
-
},
|
|
1119
|
+
a(this, d, oe).call(this, s), a(this, d, ge).call(this);
|
|
1120
|
+
}, Et = function(e) {
|
|
1123
1121
|
var t;
|
|
1124
1122
|
this.isListOpened && ((t = n(this, m)) == null || t.callKeyAction(e));
|
|
1125
1123
|
}, wt = function(e) {
|
|
1126
1124
|
n(this, $) && clearTimeout(n(this, $)), b(this, $, window.setTimeout(() => {
|
|
1127
1125
|
var t;
|
|
1128
1126
|
(t = n(this, m)) == null || t.updateSearchValue(e), this.updateListPosition();
|
|
1129
|
-
}, 350)), a(this,
|
|
1130
|
-
},
|
|
1131
|
-
a(this,
|
|
1132
|
-
},
|
|
1133
|
-
setTimeout(() => {
|
|
1134
|
-
var s, l;
|
|
1135
|
-
const e = (s = n(this, p)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (l = n(this, m)) == null ? void 0 : l.srcElement.contains(document.activeElement);
|
|
1136
|
-
!e && !t && this.blurWindowHandler();
|
|
1137
|
-
}, 1);
|
|
1138
|
-
}, me = function(e) {
|
|
1127
|
+
}, 350)), a(this, d, Nt).call(this, e);
|
|
1128
|
+
}, vt = function() {
|
|
1129
|
+
a(this, d, me).call(this, !0), n(this, y) && n(this, y) && n(this, V) && (document.addEventListener("mousedown", n(this, y), !0), document.addEventListener("focus", n(this, y), !0), window.addEventListener("blur", n(this, V), { capture: !1 }));
|
|
1130
|
+
}, he = function(e) {
|
|
1139
1131
|
var s;
|
|
1140
1132
|
if (!e)
|
|
1141
1133
|
return;
|
|
1142
1134
|
let t = [];
|
|
1143
|
-
this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, p)) == null || s.updateValue(t), a(this,
|
|
1144
|
-
},
|
|
1135
|
+
this.isIndependentNodes || this.isSingleSelect ? t = e.allNodes : this.grouped ? t = e.groupedNodes : t = e.nodes, (s = n(this, p)) == null || s.updateValue(t), a(this, d, oe).call(this, e);
|
|
1136
|
+
}, kt = function(e) {
|
|
1145
1137
|
var t, s, l;
|
|
1146
|
-
a(this,
|
|
1147
|
-
},
|
|
1138
|
+
a(this, d, he).call(this, e), this.isSingleSelect && !this.alwaysOpen && ((t = n(this, p)) == null || t.openClose(), (s = n(this, p)) == null || s.clearSearch()), (l = n(this, p)) == null || l.focus(), a(this, d, ge).call(this);
|
|
1139
|
+
}, Lt = function(e, t) {
|
|
1148
1140
|
var s;
|
|
1149
|
-
(s = n(this, p)) == null || s.focus(), this.updateListPosition(), a(this,
|
|
1150
|
-
},
|
|
1151
|
-
this.selectedName !== e && (this.selectedName = e, a(this,
|
|
1152
|
-
},
|
|
1141
|
+
(s = n(this, p)) == null || s.focus(), this.updateListPosition(), a(this, d, _t).call(this, e, t);
|
|
1142
|
+
}, St = function(e) {
|
|
1143
|
+
this.selectedName !== e && (this.selectedName = e, a(this, d, Tt).call(this));
|
|
1144
|
+
}, xt = function() {
|
|
1153
1145
|
var e;
|
|
1154
|
-
this.isListOpened = !0, n(this, A) && n(this, I) && (window.addEventListener("scroll", n(this, A), !0), window.addEventListener("resize", n(this, I))), !(!n(this, m) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, m).srcElement), (e = n(this,
|
|
1155
|
-
},
|
|
1146
|
+
this.isListOpened = !0, n(this, A) && n(this, I) && (window.addEventListener("scroll", n(this, A), !0), window.addEventListener("resize", n(this, I))), !(!n(this, m) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, m).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, m).srcElement), this.updateListPosition(), a(this, d, pe).call(this, !0), a(this, d, yt).call(this), a(this, d, At).call(this));
|
|
1147
|
+
}, de = function() {
|
|
1156
1148
|
var t;
|
|
1157
|
-
this.alwaysOpen || (this.isListOpened = !1, n(this, A) && n(this, I) && (window.removeEventListener("scroll", n(this, A), !0), window.removeEventListener("resize", n(this, I))), !n(this, m) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, m).srcElement) : this.srcElement.contains(n(this, m).srcElement)) || (b(this, q, n(this, m).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, m).srcElement), (t = n(this,
|
|
1158
|
-
},
|
|
1149
|
+
this.alwaysOpen || (this.isListOpened = !1, n(this, A) && n(this, I) && (window.removeEventListener("scroll", n(this, A), !0), window.removeEventListener("resize", n(this, I))), !n(this, m) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, m).srcElement) : this.srcElement.contains(n(this, m).srcElement)) || (b(this, q, n(this, m).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, m).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, m).srcElement), a(this, d, pe).call(this, !1), a(this, d, It).call(this));
|
|
1150
|
+
}, ue = function(e, t) {
|
|
1159
1151
|
if (!n(this, m) || !n(this, p))
|
|
1160
1152
|
return;
|
|
1161
1153
|
const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", l = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom";
|
|
1162
1154
|
e ? (n(this, m).srcElement.classList.add(s), n(this, m).srcElement.classList.remove(l), n(this, p).srcElement.classList.add("treeselect-input--top"), n(this, p).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, m).srcElement.classList.remove(s), n(this, m).srcElement.classList.add(l), n(this, p).srcElement.classList.remove("treeselect-input--top"), n(this, p).srcElement.classList.add("treeselect-input--bottom"));
|
|
1163
|
-
},
|
|
1155
|
+
}, me = function(e) {
|
|
1164
1156
|
!n(this, p) || !n(this, m) || (e ? (n(this, p).srcElement.classList.add("treeselect-input--focused"), n(this, m).srcElement.classList.add("treeselect-list--focused")) : (n(this, p).srcElement.classList.remove("treeselect-input--focused"), n(this, m).srcElement.classList.remove("treeselect-list--focused")));
|
|
1165
|
-
},
|
|
1157
|
+
}, pe = function(e) {
|
|
1166
1158
|
var t, s, l, r;
|
|
1167
1159
|
e ? (t = n(this, p)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, p)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (l = n(this, m)) == null || l.srcElement.classList.add("treeselect-list--static") : (r = n(this, m)) == null || r.srcElement.classList.remove("treeselect-list--static");
|
|
1168
|
-
},
|
|
1169
|
-
!n(this, A) || !n(this, I) || !n(this, y) || !n(this,
|
|
1170
|
-
},
|
|
1160
|
+
}, fe = function(e) {
|
|
1161
|
+
!n(this, A) || !n(this, I) || !n(this, y) || !n(this, V) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, A), !0), window.removeEventListener("resize", n(this, I))), document.removeEventListener("mousedown", n(this, y), !0), document.removeEventListener("focus", n(this, y), !0), window.removeEventListener("blur", n(this, V), { capture: !1 }));
|
|
1162
|
+
}, yt = function() {
|
|
1171
1163
|
var t, s, l;
|
|
1172
1164
|
const e = (t = n(this, m)) == null ? void 0 : t.isLastFocusedElementExist();
|
|
1173
1165
|
this.saveScrollPosition && e ? (s = n(this, m)) == null || s.srcElement.scroll(0, n(this, q)) : (l = n(this, m)) == null || l.focusFirstListElement();
|
|
1174
1166
|
}, // Emits
|
|
1175
|
-
|
|
1167
|
+
ge = function() {
|
|
1176
1168
|
var e;
|
|
1177
1169
|
(e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value);
|
|
1178
|
-
},
|
|
1170
|
+
}, Tt = function() {
|
|
1179
1171
|
var e;
|
|
1180
1172
|
(e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName);
|
|
1181
|
-
},
|
|
1173
|
+
}, At = function() {
|
|
1182
1174
|
var e;
|
|
1183
1175
|
this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value));
|
|
1184
|
-
},
|
|
1176
|
+
}, It = function() {
|
|
1185
1177
|
var e;
|
|
1186
1178
|
this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value));
|
|
1187
|
-
},
|
|
1179
|
+
}, Nt = function(e) {
|
|
1188
1180
|
var s;
|
|
1189
1181
|
const t = (e == null ? void 0 : e.trim()) ?? "";
|
|
1190
1182
|
(s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("search", { detail: t })), this.searchCallback && this.searchCallback(t);
|
|
1191
|
-
},
|
|
1183
|
+
}, _t = function(e, t) {
|
|
1192
1184
|
var s;
|
|
1193
1185
|
(s = this.srcElement) == null || s.dispatchEvent(new CustomEvent("open-close-group", { detail: { groupId: e, isClosed: t } })), this.openCloseGroupCallback && this.openCloseGroupCallback(e, t);
|
|
1194
1186
|
};
|
|
1195
1187
|
export {
|
|
1196
|
-
|
|
1188
|
+
Is as default
|
|
1197
1189
|
};
|