selectyc 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/selectyc.js +36 -35
- package/dist/selectyc.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/selectyc.js
CHANGED
|
@@ -57,10 +57,11 @@ class h {
|
|
|
57
57
|
#i;
|
|
58
58
|
#a;
|
|
59
59
|
#u;
|
|
60
|
+
#g;
|
|
60
61
|
#n = !1;
|
|
61
|
-
#
|
|
62
|
+
#y = !1;
|
|
62
63
|
#p = !1;
|
|
63
|
-
#
|
|
64
|
+
#b = "";
|
|
64
65
|
#S = '<svg class="w-5 h-5 text-gray-900 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>';
|
|
65
66
|
constructor(t) {
|
|
66
67
|
if (window.selects === void 0 && (window.selects = []), window.selects[t] !== void 0)
|
|
@@ -125,10 +126,10 @@ class h {
|
|
|
125
126
|
const t = this.#t;
|
|
126
127
|
this.#t = [], this.#r(t);
|
|
127
128
|
}
|
|
128
|
-
#
|
|
129
|
-
this.#
|
|
129
|
+
#E() {
|
|
130
|
+
this.#D(), this.#s.addEventListener("click", (t) => {
|
|
130
131
|
if (t.target.classList.contains("remove-tag")) {
|
|
131
|
-
this.#
|
|
132
|
+
this.#B(t.target.getAttribute("data-value")), this.onUnselect !== void 0 && this.onUnselect(t.target.getAttribute("data-value"), this), this.#n && this.#h(), this.#v();
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
135
|
this.#n ? this.#h() : this.#v();
|
|
@@ -136,48 +137,48 @@ class h {
|
|
|
136
137
|
!this.#d.contains(t.target) && !this.#e.contains(t.target) && !t.target.classList.contains("remove-tag") && this.#h();
|
|
137
138
|
}), window.onresize = () => {
|
|
138
139
|
this.#h();
|
|
139
|
-
}, this.isMultiple && this.#
|
|
140
|
+
}, this.isMultiple && this.#C();
|
|
140
141
|
}
|
|
141
142
|
// Draw functions
|
|
142
|
-
#
|
|
143
|
-
this.#
|
|
143
|
+
#D() {
|
|
144
|
+
this.#M();
|
|
144
145
|
const t = document.createElement("div");
|
|
145
146
|
t.className = "main-div-selectyc", t.style.width = this.width, t.id = `selectyc_main_div_${this.id}`;
|
|
146
147
|
const e = document.createElement("div");
|
|
147
148
|
e.className = "custom-multiselect";
|
|
148
149
|
let s = document.createElement("div");
|
|
149
|
-
s.className = "selected-items round" + this.bodyRound, s.tabIndex = 0, s.classList.add(this.boxOverflow === "horizontal" ? "horizontal-overflow" : "vertical-overflow"), this.isMultiple || (s = this.#
|
|
150
|
+
s.className = "selected-items round" + this.bodyRound, s.tabIndex = 0, s.classList.add(this.boxOverflow === "horizontal" ? "horizontal-overflow" : "vertical-overflow"), this.isMultiple || (s = this.#L(s)), e.appendChild(s), e.appendChild(this.#O()), t.appendChild(e);
|
|
150
151
|
const i = document.getElementById(this.id), a = document.createElement("input");
|
|
151
152
|
a.name = i.name, a.setAttribute("data-id", i.id), this.rootClassName !== "" && (a.className = i.className), a.style.display = "none";
|
|
152
153
|
let n = i.parentNode;
|
|
153
154
|
t.appendChild(a), n.replaceChild(t, i), this.#c = a, this.#m = s, this.#d = e, this.#s = this.#d.querySelector(".selected-items"), !this.isMultiple && this.#t.length > 0 && (this.#c.value = this.#t[0].value);
|
|
154
155
|
}
|
|
155
|
-
#
|
|
156
|
+
#L(t) {
|
|
156
157
|
const e = document.createElement("input");
|
|
157
158
|
e.className = "custom-single-select", e.id = `selectyc_text_box_${this.id}`, e.placeholder = this.singleLabel, e.value = this.#t.length === 0 ? null : this.#t[0].text, e.readOnly = !0;
|
|
158
159
|
const s = document.createElement("div");
|
|
159
|
-
return s.innerHTML = this.#S, t.appendChild(this.#
|
|
160
|
+
return s.innerHTML = this.#S, t.appendChild(this.#N()), t.appendChild(e), t.appendChild(s), this.#a = e, t;
|
|
160
161
|
}
|
|
161
|
-
#
|
|
162
|
+
#N() {
|
|
162
163
|
const t = document.createElement("input");
|
|
163
|
-
return t.type = "text", t.required = this.#
|
|
164
|
+
return t.type = "text", t.required = this.#y, t.tabIndex = -1, t.style.position = "absolute", t.style.opacity = "0", t.style.pointerEvents = "none", t.style.height = "0", t.style.width = "0", t.style.left = "50%", t.value = this.#t.length === 0 ? "" : this.#t[0].text, this.#u = t, t;
|
|
164
165
|
}
|
|
165
|
-
#
|
|
166
|
+
#O() {
|
|
166
167
|
const t = document.createElement("div");
|
|
167
168
|
t.setAttribute("style", "position:fixed; z-index:999;");
|
|
168
169
|
const e = document.createElement("div");
|
|
169
|
-
e.className = "global-dropdown", this.searchInputActive && t.appendChild(this.#
|
|
170
|
+
e.className = "global-dropdown", this.searchInputActive && t.appendChild(this.#I());
|
|
170
171
|
let s;
|
|
171
172
|
return e.addEventListener("scroll", (i) => {
|
|
172
173
|
s && clearTimeout(s), s = setTimeout(() => {
|
|
173
|
-
this.#
|
|
174
|
+
this.#k(i);
|
|
174
175
|
}, 70);
|
|
175
176
|
}), t.appendChild(e), this.#e = e, t;
|
|
176
177
|
}
|
|
177
|
-
#
|
|
178
|
+
#I() {
|
|
178
179
|
const t = document.createElement("input");
|
|
179
180
|
return t.type = "text", t.id = "selectyc_search_input", t.className = "search-input", t.placeholder = "Buscar...", t.addEventListener("input", () => {
|
|
180
|
-
this.filter = t.value, this.#e.innerHTML = "", this.filter = t.value, this.#
|
|
181
|
+
this.filter = t.value, this.#e.innerHTML = "", this.filter = t.value, this.#x();
|
|
181
182
|
}), this.#i = t, t;
|
|
182
183
|
}
|
|
183
184
|
#l(t) {
|
|
@@ -187,9 +188,9 @@ class h {
|
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
// Functions
|
|
190
|
-
#
|
|
191
|
+
#M() {
|
|
191
192
|
const t = document.getElementById(this.id);
|
|
192
|
-
this.name = t.name, this.#
|
|
193
|
+
this.name = t.name, this.#y = t.required, this.rootClassName = t.className, this.#g = t.getBoundingClientRect(), Array.from(t.options).forEach((e) => {
|
|
193
194
|
if (e.outerHTML.includes("selected")) {
|
|
194
195
|
const s = e.text, i = this.#o(e.value);
|
|
195
196
|
this.isMultiple ? this.#t.push({ value: i, text: s }) : this.#t[0] = { value: i, text: s };
|
|
@@ -198,16 +199,16 @@ class h {
|
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
#v() {
|
|
201
|
-
if (this.#n)
|
|
202
|
+
if (this.filter = null, this.#n)
|
|
202
203
|
return;
|
|
203
204
|
this.#s.classList.remove(`round${this.bodyRound}`), this.#s.classList.add(`round${this.bodyRound}t`);
|
|
204
|
-
const t = this.#d.getBoundingClientRect();
|
|
205
|
+
const t = this.#d.getBoundingClientRect(), e = t.x - this.#g.x;
|
|
205
206
|
if (this.searchInputActive) {
|
|
206
207
|
this.#i.style.display = "block", this.#i.style.width = t.width + "px";
|
|
207
|
-
const
|
|
208
|
-
this.#e.style.top = e + "px";
|
|
208
|
+
const s = this.#i.offsetHeight;
|
|
209
|
+
this.#e.style.top = s + "px", e < 0 ? this.#i.style.left = e + "px" : e > 0 && (this.#i.style.right = e * -1 + "px");
|
|
209
210
|
}
|
|
210
|
-
this.#e.style.width = t.width + "px", this.#e.innerHTML = "", this.#e.style.display = "block", this.searchInputActive && this.#i.focus(), this.#
|
|
211
|
+
this.#e.style.width = t.width + "px", this.#e.style.x = t.x + "px", this.#e.innerHTML = "", this.#e.style.display = "block", e < 0 ? this.#e.style.left = e + "px" : e > 0 && (this.#e.style.right = e * -1 + "px"), this.searchInputActive && this.#i.focus(), this.#x(), this.#n = !0;
|
|
211
212
|
}
|
|
212
213
|
#h() {
|
|
213
214
|
this.#n && (this.#e.innerHTML = "", this.#e.style.display = "none", this.searchInputActive && (this.#i.style.display = "none"), this.#s.classList.add(`round${this.bodyRound}`), this.#n = !1);
|
|
@@ -223,15 +224,15 @@ class h {
|
|
|
223
224
|
const e = await l.make(this.RS).addData(t).setMethod("POST").go(), s = Array.isArray(e) ? e : e.data;
|
|
224
225
|
return this.data = Array.from(new Map([...this.#f, ...s].map((i) => [i.id, i])).values()), this.data;
|
|
225
226
|
}
|
|
226
|
-
async #
|
|
227
|
+
async #x() {
|
|
227
228
|
this.#l({ id: "loading", text: "cargando ..." }), this.records = 10 + this.#t.length, this.#p = !1;
|
|
228
229
|
let t = await this.#w();
|
|
229
230
|
const e = this.#t.map((s) => s.value);
|
|
230
231
|
this.#e.lastChild.dataset.value === "loading" && this.#e.removeChild(this.#e.lastChild), t.forEach((s) => {
|
|
231
|
-
s.text.toLowerCase().includes(this.#
|
|
232
|
+
s.text.toLowerCase().includes(this.#b.toLowerCase()) && !e.includes(s.id) && this.#l(s);
|
|
232
233
|
}), this.#e.hasChildNodes() || this.#l({ id: "sin_resultados", text: "sin resultados ..." });
|
|
233
234
|
}
|
|
234
|
-
async #
|
|
235
|
+
async #R() {
|
|
235
236
|
const t = this.#t.map((n) => n.value);
|
|
236
237
|
let e = this.filter === null ? "" : this.filter, s = this.data.map((n) => n.id);
|
|
237
238
|
this.records = this.records + 10 + this.#t.length;
|
|
@@ -246,9 +247,9 @@ class h {
|
|
|
246
247
|
this.#t.find((i) => i.value === e) || (this.isMultiple || (this.#t = []), this.#t.push({ text: t, value: e })), this.#r(e);
|
|
247
248
|
}
|
|
248
249
|
#r(t) {
|
|
249
|
-
this.onChange !== void 0 && this.onChange(t, this), this.isMultiple ? this.#
|
|
250
|
+
this.onChange !== void 0 && this.onChange(t, this), this.isMultiple ? this.#C() : this.#A();
|
|
250
251
|
}
|
|
251
|
-
#
|
|
252
|
+
#A() {
|
|
252
253
|
this.#a.value = null, this.#u.value = null, this.#a.value = this.#t.length > 0 ? this.#t[0].text : null, this.#u.value = this.#t.length > 0 ? this.#t[0].text : null, this.#a.placeholder = this.singleLabel, this.#c.value = this.#t.length > 0 ? this.#t[0].value : null;
|
|
253
254
|
const t = this.#a.parentNode, e = t.firstChild;
|
|
254
255
|
if (e.className === "remove-tag" && e.remove(), !this.clearButton || this.#t.length <= 0)
|
|
@@ -256,7 +257,7 @@ class h {
|
|
|
256
257
|
const s = document.createElement("span");
|
|
257
258
|
s.dataset.value = this.#t[0].value, s.innerHTML = "x", s.className = "remove-tag", t.insertBefore(s, t.firstChild);
|
|
258
259
|
}
|
|
259
|
-
#
|
|
260
|
+
#C() {
|
|
260
261
|
if (this.#s.innerHTML = "", this.#t.length <= 0) {
|
|
261
262
|
this.#s.appendChild(document.createElement("div"));
|
|
262
263
|
return;
|
|
@@ -266,19 +267,19 @@ class h {
|
|
|
266
267
|
s.className = "selected-tag", s.innerHTML = `${t} <span class="remove-tag" data-value="${e}">x</span>`, this.#s.appendChild(s);
|
|
267
268
|
});
|
|
268
269
|
}
|
|
269
|
-
#
|
|
270
|
+
#B(t) {
|
|
270
271
|
this.#t = this.#t.filter((e) => this.#o(e.value) !== this.#o(t)), this.#r(t);
|
|
271
272
|
}
|
|
272
|
-
#
|
|
273
|
+
#k(t) {
|
|
273
274
|
const { scrollTop: e, scrollHeight: s, clientHeight: i } = this.#e;
|
|
274
|
-
t.target.lastChild !== null && (t.target.lastChild.dataset.value === "loading" || this.#p || e + (i + 1) >= s && (this.#l({ id: "loading", text: "cargando ..." }), this.#
|
|
275
|
+
t.target.lastChild !== null && (t.target.lastChild.dataset.value === "loading" || this.#p || e + (i + 1) >= s && (this.#l({ id: "loading", text: "cargando ..." }), this.#R()));
|
|
275
276
|
}
|
|
276
277
|
#o(t) {
|
|
277
278
|
return !isNaN(t) && !isNaN(parseFloat(t)) ? parseInt(t) : t;
|
|
278
279
|
}
|
|
279
280
|
async render() {
|
|
280
281
|
const t = document.getElementById(this.id), e = t === null ? !1 : t.outerHTML.includes("<select");
|
|
281
|
-
this.#m === void 0 || e ? this.#
|
|
282
|
+
this.#m === void 0 || e ? this.#E() : this.#r();
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
export {
|
package/dist/selectyc.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,
|
|
1
|
+
(function(h,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(h=typeof globalThis<"u"?globalThis:h||self,a(h.selectyc={}))})(this,function(h){"use strict";class a{constructor(t){this.route=t}static make(t){return new a(t)}setMethod(t){return this.method=t,this}getMethod(){return this.method===void 0?"POST":this.method}setData(t){return this.data=t,this}addData(t){if(this.data===void 0)return this.setData(t);for(const e in t)this.data[e]=t[e];return this}setFun(t){return this.fun=t,this}async go(){try{const t={method:this.getMethod(),headers:{"X-CSRF-TOKEN":window.CSRF_TOKEN,Accept:"application/json"}};this.data!==void 0&&(t.body=this.data,Object.prototype.toString.call(this.data)!=="[object FormData]"&&(t.body=JSON.stringify(this.data),t.headers["Content-Type"]="application/json"));const e=await fetch(this.route,t);if(!e.ok){const s=await e.json();throw new Error(s.message)}return this.fun===void 0?await e.json():await this.fun(e)}catch(t){window.toastNotification.setType(!1).show(t.message)}}}class r{#t=[];#c;#f=[];#d;#m;#s;#e;#i;#l;#u;#g;#n=!1;#y=!1;#p=!1;#C="";#S='<svg class="w-5 h-5 text-gray-900 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 9-7 7-7-7"/></svg>';constructor(t){if(window.selects===void 0&&(window.selects=[]),window.selects[t]!==void 0)return window.selects[t];this.id=t,this.name,this.data=[],this.isMultiple=!1,this.clearButton=!1,this.singleLabel=" ",this.records=10,this.filter=null,this.bodyRound="",this.width="100%",this.searchInputActive=!0,this.bodyData=null,this.boxOverflow="horizontal",window.selects[t]=this}static set(t){return new r(t)}setData(t){return this.data=t,this}setMultiple(t="horizontal"){return this.isMultiple=!0,this.boxOverflow=t,this}setClearButton(){return this.clearButton=!0,this}setSelectedOptions(t){this.#t=t,this.#r(t)}getSelectedOptions(){return this.#t}getSelectedOption(){return this.#t[0]}getOptions(){return this.data}setSingleLabel(t){return this.singleLabel=t,this}setBodyRound(t){return this.bodyRound=`-${t}`,this}setRS(t){return this.RS=t,this}setBodyData(t){return this.bodyData=t,this}desactiveSearchInput(){return this.searchInputActive=!1,this}addOption(t){this.data.push(t)}setWidth(t){return this.width=t,this}setOnSelect(t){return this.onSelect=t,this}setOnUnselect(t){return this.onUnselect=t,this}setOnChange(t){return this.onChange=t,this}cleanSelection(){const t=this.#t;this.#t=[],this.#r(t)}#E(){this.#D(),this.#s.addEventListener("click",t=>{if(t.target.classList.contains("remove-tag")){this.#B(t.target.getAttribute("data-value")),this.onUnselect!==void 0&&this.onUnselect(t.target.getAttribute("data-value"),this),this.#n&&this.#h(),this.#v();return}this.#n?this.#h():this.#v()}),document.addEventListener("click",t=>{!this.#d.contains(t.target)&&!this.#e.contains(t.target)&&!t.target.classList.contains("remove-tag")&&this.#h()}),window.onresize=()=>{this.#h()},this.isMultiple&&this.#b()}#D(){this.#M();const t=document.createElement("div");t.className="main-div-selectyc",t.style.width=this.width,t.id=`selectyc_main_div_${this.id}`;const e=document.createElement("div");e.className="custom-multiselect";let s=document.createElement("div");s.className="selected-items round"+this.bodyRound,s.tabIndex=0,s.classList.add(this.boxOverflow==="horizontal"?"horizontal-overflow":"vertical-overflow"),this.isMultiple||(s=this.#L(s)),e.appendChild(s),e.appendChild(this.#O()),t.appendChild(e);const i=document.getElementById(this.id),l=document.createElement("input");l.name=i.name,l.setAttribute("data-id",i.id),this.rootClassName!==""&&(l.className=i.className),l.style.display="none";let n=i.parentNode;t.appendChild(l),n.replaceChild(t,i),this.#c=l,this.#m=s,this.#d=e,this.#s=this.#d.querySelector(".selected-items"),!this.isMultiple&&this.#t.length>0&&(this.#c.value=this.#t[0].value)}#L(t){const e=document.createElement("input");e.className="custom-single-select",e.id=`selectyc_text_box_${this.id}`,e.placeholder=this.singleLabel,e.value=this.#t.length===0?null:this.#t[0].text,e.readOnly=!0;const s=document.createElement("div");return s.innerHTML=this.#S,t.appendChild(this.#N()),t.appendChild(e),t.appendChild(s),this.#l=e,t}#N(){const t=document.createElement("input");return t.type="text",t.required=this.#y,t.tabIndex=-1,t.style.position="absolute",t.style.opacity="0",t.style.pointerEvents="none",t.style.height="0",t.style.width="0",t.style.left="50%",t.value=this.#t.length===0?"":this.#t[0].text,this.#u=t,t}#O(){const t=document.createElement("div");t.setAttribute("style","position:fixed; z-index:999;");const e=document.createElement("div");e.className="global-dropdown",this.searchInputActive&&t.appendChild(this.#I());let s;return e.addEventListener("scroll",i=>{s&&clearTimeout(s),s=setTimeout(()=>{this.#k(i)},70)}),t.appendChild(e),this.#e=e,t}#I(){const t=document.createElement("input");return t.type="text",t.id="selectyc_search_input",t.className="search-input",t.placeholder="Buscar...",t.addEventListener("input",()=>{this.filter=t.value,this.#e.innerHTML="",this.filter=t.value,this.#x()}),this.#i=t,t}#a(t){const e=document.createElement("div");e.className="select-option",e.setAttribute("data-value",t.id),e.textContent=t.text,this.#e.appendChild(e),e.addEventListener("click",()=>{t.id!=="sin_resultados"&&(this.#R(t.text,t.id),this.onSelect!==void 0&&this.onSelect(t.id,this),this.#h())})}#M(){const t=document.getElementById(this.id);this.name=t.name,this.#y=t.required,this.rootClassName=t.className,this.#g=t.getBoundingClientRect(),Array.from(t.options).forEach(e=>{if(e.outerHTML.includes("selected")){const s=e.text,i=this.#o(e.value);this.isMultiple?this.#t.push({value:i,text:s}):this.#t[0]={value:i,text:s}}this.#f.push({id:this.#o(e.value),text:e.text})})}#v(){if(this.filter=null,this.#n)return;this.#s.classList.remove(`round${this.bodyRound}`),this.#s.classList.add(`round${this.bodyRound}t`);const t=this.#d.getBoundingClientRect(),e=t.x-this.#g.x;if(this.searchInputActive){this.#i.style.display="block",this.#i.style.width=t.width+"px";const s=this.#i.offsetHeight;this.#e.style.top=s+"px",e<0?this.#i.style.left=e+"px":e>0&&(this.#i.style.right=e*-1+"px")}this.#e.style.width=t.width+"px",this.#e.style.x=t.x+"px",this.#e.innerHTML="",this.#e.style.display="block",e<0?this.#e.style.left=e+"px":e>0&&(this.#e.style.right=e*-1+"px"),this.searchInputActive&&this.#i.focus(),this.#x(),this.#n=!0}#h(){this.#n&&(this.#e.innerHTML="",this.#e.style.display="none",this.searchInputActive&&(this.#i.style.display="none"),this.#s.classList.add(`round${this.bodyRound}`),this.#n=!1)}async#w(){if(this.RS===void 0)return this.data;let t={records:this.records,filter:this.filter};if(typeof this.bodyData=="function"){const i=this.bodyData();t={...t,...i}}else this.bodyData!==null&&(t={...t,...this.bodyData});const e=await a.make(this.RS).addData(t).setMethod("POST").go(),s=Array.isArray(e)?e:e.data;return this.data=Array.from(new Map([...this.#f,...s].map(i=>[i.id,i])).values()),this.data}async#x(){this.#a({id:"loading",text:"cargando ..."}),this.records=10+this.#t.length,this.#p=!1;let t=await this.#w();const e=this.#t.map(s=>s.value);this.#e.lastChild.dataset.value==="loading"&&this.#e.removeChild(this.#e.lastChild),t.forEach(s=>{s.text.toLowerCase().includes(this.#C.toLowerCase())&&!e.includes(s.id)&&this.#a(s)}),this.#e.hasChildNodes()||this.#a({id:"sin_resultados",text:"sin resultados ..."})}async#T(){const t=this.#t.map(n=>n.value);let e=this.filter===null?"":this.filter,s=this.data.map(n=>n.id);this.records=this.records+10+this.#t.length;let i=await this.#w();this.#e.lastChild.dataset.value==="loading"&&this.#e.removeChild(this.#e.lastChild);const l=this.#e.lastChild.dataset.value;i.forEach(n=>{n.text.toLowerCase().includes(e.toLowerCase())&&!t.includes(n.id)&&!s.includes(n.id)&&this.#a(n)}),this.#p=l===this.#e.lastChild.dataset.value}#R(t,e){this.#t.find(i=>i.value===e)||(this.isMultiple||(this.#t=[]),this.#t.push({text:t,value:e})),this.#r(e)}#r(t){this.onChange!==void 0&&this.onChange(t,this),this.isMultiple?this.#b():this.#A()}#A(){this.#l.value=null,this.#u.value=null,this.#l.value=this.#t.length>0?this.#t[0].text:null,this.#u.value=this.#t.length>0?this.#t[0].text:null,this.#l.placeholder=this.singleLabel,this.#c.value=this.#t.length>0?this.#t[0].value:null;const t=this.#l.parentNode,e=t.firstChild;if(e.className==="remove-tag"&&e.remove(),!this.clearButton||this.#t.length<=0)return;const s=document.createElement("span");s.dataset.value=this.#t[0].value,s.innerHTML="x",s.className="remove-tag",t.insertBefore(s,t.firstChild)}#b(){if(this.#s.innerHTML="",this.#t.length<=0){this.#s.appendChild(document.createElement("div"));return}this.#t.forEach(({text:t,value:e})=>{const s=document.createElement("div");s.className="selected-tag",s.innerHTML=`${t} <span class="remove-tag" data-value="${e}">x</span>`,this.#s.appendChild(s)})}#B(t){this.#t=this.#t.filter(e=>this.#o(e.value)!==this.#o(t)),this.#r(t)}#k(t){const{scrollTop:e,scrollHeight:s,clientHeight:i}=this.#e;t.target.lastChild!==null&&(t.target.lastChild.dataset.value==="loading"||this.#p||e+(i+1)>=s&&(this.#a({id:"loading",text:"cargando ..."}),this.#T()))}#o(t){return!isNaN(t)&&!isNaN(parseFloat(t))?parseInt(t):t}async render(){const t=document.getElementById(this.id),e=t===null?!1:t.outerHTML.includes("<select");this.#m===void 0||e?this.#E():this.#r()}}h.selectyc=r,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|