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