slim-select 3.1.4 → 3.2.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/dist/vue/index.js CHANGED
@@ -78,10 +78,10 @@ function M(h, e) {
78
78
  function O(h, e = 50, t = !1) {
79
79
  let s;
80
80
  return function(...i) {
81
- const l = self, a = () => {
81
+ const l = self, n = () => {
82
82
  s = null, t || h.apply(l, i);
83
- }, n = t && !s;
84
- clearTimeout(s), s = setTimeout(a, e), n && h.apply(l, i);
83
+ }, a = t && !s;
84
+ clearTimeout(s), s = setTimeout(n, e), a && h.apply(l, i);
85
85
  };
86
86
  }
87
87
  function y(h, e) {
@@ -109,7 +109,7 @@ class p {
109
109
  this.id = !e.id || e.id === "" ? C() : e.id, this.value = e.value === void 0 ? e.text || "" : e.value || "", this.text = e.text || "", this.html = e.html || "", this.defaultSelected = e.defaultSelected !== void 0 ? e.defaultSelected : !1, this.selected = e.selected !== void 0 ? e.selected : !1, this.display = e.display !== void 0 ? e.display : !0, this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.mandatory = e.mandatory !== void 0 ? e.mandatory : !1, this.placeholder = e.placeholder !== void 0 ? e.placeholder : !1, this.class = e.class || "", this.style = e.style || "", this.data = e.data || {};
110
110
  }
111
111
  }
112
- class g {
112
+ class m {
113
113
  id;
114
114
  label;
115
115
  selectAll;
@@ -136,7 +136,7 @@ class V {
136
136
  return new Error("Data must be an array");
137
137
  for (let t of e)
138
138
  if (t)
139
- if (t instanceof g || "label" in t) {
139
+ if (t instanceof m || "label" in t) {
140
140
  if (!("label" in t))
141
141
  return new Error("Optgroup must have a label");
142
142
  if ("options" in t && t.options)
@@ -161,11 +161,11 @@ class V {
161
161
  let t = [];
162
162
  return e.forEach((s) => {
163
163
  if (s) {
164
- if (s instanceof g || "label" in s) {
164
+ if (s instanceof m || "label" in s) {
165
165
  let i = [];
166
166
  "options" in s && s.options && s.options.forEach((l) => {
167
167
  i.push(new p(l));
168
- }), i.length > 0 && t.push(new g(s));
168
+ }), i.length > 0 && t.push(new m(s));
169
169
  }
170
170
  (s instanceof p || "text" in s) && t.push(new p(s));
171
171
  }
@@ -175,22 +175,22 @@ class V {
175
175
  const s = this.partialToFullData(e);
176
176
  if (t) {
177
177
  const i = this.getSelectedOptions(), l = [];
178
- i.forEach((a) => {
179
- let n = !1;
178
+ i.forEach((n) => {
179
+ let a = !1;
180
180
  for (const o of s) {
181
- if (o instanceof p && o.id === a.id) {
182
- n = !0;
181
+ if (o instanceof p && o.id === n.id) {
182
+ a = !0;
183
183
  break;
184
184
  }
185
- if (o instanceof g) {
185
+ if (o instanceof m) {
186
186
  for (const c of o.options)
187
- if (c.id === a.id) {
188
- n = !0;
187
+ if (c.id === n.id) {
188
+ a = !0;
189
189
  break;
190
190
  }
191
191
  }
192
192
  }
193
- n || l.push(a);
193
+ a || l.push(n);
194
194
  }), this.data = [...l, ...s];
195
195
  } else
196
196
  this.data = s;
@@ -218,18 +218,18 @@ class V {
218
218
  setSelectedBy(e, t) {
219
219
  let s = null, i = !1;
220
220
  const l = [];
221
- for (let n of this.data) {
222
- if (n instanceof g)
223
- for (let o of n.options) {
221
+ for (let a of this.data) {
222
+ if (a instanceof m)
223
+ for (let o of a.options) {
224
224
  s || (s = o);
225
225
  let c = o[e] || "";
226
226
  o.selected = i ? !1 : t.includes(c), o.selected && (l.push(o), this.selectType === "single" && (i = !0));
227
227
  }
228
- n instanceof p && (s || (s = n), n.selected = i ? !1 : t.includes(n[e]), n.selected && (l.push(n), this.selectType === "single" && (i = !0)));
228
+ a instanceof p && (s || (s = a), a.selected = i ? !1 : t.includes(a[e]), a.selected && (l.push(a), this.selectType === "single" && (i = !0)));
229
229
  }
230
230
  this.selectType === "single" && s && !i && (s.selected = !0, l.push(s));
231
- const a = t.map((n) => l.find((o) => o[e] === n)?.id || "");
232
- this.selectedOrder = a;
231
+ const n = t.map((a) => l.find((o) => o[e] === a)?.id || "");
232
+ this.selectedOrder = n;
233
233
  }
234
234
  getSelected() {
235
235
  return this.getSelectedOptions().map((e) => e.id);
@@ -242,7 +242,7 @@ class V {
242
242
  }
243
243
  getOptgroupByID(e) {
244
244
  for (let t of this.data)
245
- if (t instanceof g && t.id === e)
245
+ if (t instanceof m && t.id === e)
246
246
  return t;
247
247
  return null;
248
248
  }
@@ -256,7 +256,7 @@ class V {
256
256
  getFirstOption() {
257
257
  let e = null;
258
258
  for (let t of this.data)
259
- if (t instanceof g ? e = t.options[0] : t instanceof p && (e = t), e)
259
+ if (t instanceof m ? e = t.options[0] : t instanceof p && (e = t), e)
260
260
  break;
261
261
  return e;
262
262
  }
@@ -269,13 +269,13 @@ class V {
269
269
  filter(e, t) {
270
270
  const s = [];
271
271
  return this.data.forEach((i) => {
272
- if (i instanceof g) {
272
+ if (i instanceof m) {
273
273
  let l = [];
274
- if (i.options.forEach((n) => {
275
- (!e || e(n)) && (t ? l.push(new p(n)) : s.push(new p(n)));
274
+ if (i.options.forEach((a) => {
275
+ (!e || e(a)) && (t ? l.push(new p(a)) : s.push(new p(a)));
276
276
  }), l.length > 0) {
277
- let n = new g(i);
278
- n.options = l, s.push(n);
277
+ let a = new m(i);
278
+ a.options = l, s.push(a);
279
279
  }
280
280
  }
281
281
  i instanceof p && (!e || e(i)) && s.push(new p(i));
@@ -331,9 +331,21 @@ class B {
331
331
  }
332
332
  }
333
333
  close() {
334
- this.main.main.setAttribute("aria-expanded", "false"), this.main.arrow.path.setAttribute("d", this.classes.arrowClose), this.content.main.classList.remove(this.classes.contentOpen), this.content.search.input.setAttribute("aria-hidden", "true"), this.main.main.removeAttribute("aria-activedescendant"), setTimeout(() => {
334
+ this.main.main.setAttribute("aria-expanded", "false"), this.main.arrow.path.setAttribute("d", this.classes.arrowClose), this.content.main.classList.remove(this.classes.contentOpen), this.content.search.input.setAttribute("aria-hidden", "true"), this.main.main.removeAttribute("aria-activedescendant");
335
+ const e = this.getAnimationTiming();
336
+ setTimeout(() => {
335
337
  this.main.main.classList.remove(this.classes.dirAbove, this.classes.dirBelow), this.content.main.classList.remove(this.classes.dirAbove, this.classes.dirBelow);
336
- }, 100);
338
+ }, e);
339
+ }
340
+ getAnimationTiming() {
341
+ const t = getComputedStyle(this.content.main).getPropertyValue("--ss-animation-timing").trim();
342
+ if (t) {
343
+ if (t.endsWith("ms"))
344
+ return parseFloat(t);
345
+ if (t.endsWith("s"))
346
+ return parseFloat(t) * 1e3;
347
+ }
348
+ return 200;
337
349
  }
338
350
  updateClassStyles() {
339
351
  if (this.main.main.className = "", this.main.main.removeAttribute("style"), this.content.main.className = "", this.content.main.removeAttribute("style"), this.main.main.classList.add(this.classes.main), this.content.main.classList.add(this.classes.content), this.settings.style !== "" && (this.main.main.style.cssText = this.settings.style, this.content.main.style.cssText = this.settings.style), this.settings.class.length)
@@ -381,29 +393,29 @@ class B {
381
393
  if (this.settings.isMultiple)
382
394
  this.callbacks.setSelected([], !1), this.updateDeselectAll();
383
395
  else {
384
- const u = this.store.getFirstOption(), m = u ? u.id : "";
385
- this.callbacks.setSelected(m, !1);
396
+ const u = this.store.getFirstOption(), g = u ? u.id : "";
397
+ this.callbacks.setSelected(g, !1);
386
398
  }
387
399
  this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(this.store.getSelectedOptions());
388
400
  }
389
401
  };
390
402
  const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
391
403
  l.setAttribute("viewBox", "0 0 100 100");
392
- const a = document.createElementNS("http://www.w3.org/2000/svg", "path");
393
- a.setAttribute("d", this.classes.deselectPath), l.appendChild(a), s.appendChild(l), e.appendChild(s);
394
- const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
395
- n.classList.add(this.classes.arrow), n.setAttribute("viewBox", "0 0 100 100");
404
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
405
+ n.setAttribute("d", this.classes.deselectPath), l.appendChild(n), s.appendChild(l), e.appendChild(s);
406
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
407
+ a.classList.add(this.classes.arrow), a.setAttribute("viewBox", "0 0 100 100");
396
408
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
397
- return o.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && n.classList.add(this.classes.hide), n.appendChild(o), e.appendChild(n), {
409
+ return o.setAttribute("d", this.classes.arrowClose), this.settings.alwaysOpen && a.classList.add(this.classes.hide), a.appendChild(o), e.appendChild(a), {
398
410
  main: e,
399
411
  values: t,
400
412
  deselect: {
401
413
  main: s,
402
414
  svg: l,
403
- path: a
415
+ path: n
404
416
  },
405
417
  arrow: {
406
- main: n,
418
+ main: a,
407
419
  path: o
408
420
  }
409
421
  };
@@ -457,8 +469,8 @@ class B {
457
469
  this.settings.keepOrder && (t = this.store.selectedOrderOptions(t));
458
470
  let s = [];
459
471
  for (let i = 0; i < e.length; i++) {
460
- const l = e[i], a = l.getAttribute("data-id");
461
- a && (t.filter((o) => o.id === a, !1).length || s.push(l));
472
+ const l = e[i], n = l.getAttribute("data-id");
473
+ n && (t.filter((o) => o.id === n, !1).length || s.push(l));
462
474
  }
463
475
  for (const i of s)
464
476
  i.classList.add(this.classes.valueOut), setTimeout(() => {
@@ -467,8 +479,8 @@ class B {
467
479
  e = this.main.values.childNodes;
468
480
  for (let i = 0; i < t.length; i++) {
469
481
  let l = !0;
470
- for (let a = 0; a < e.length; a++)
471
- t[i].id === String(e[a].dataset.id) && (l = !1);
482
+ for (let n = 0; n < e.length; n++)
483
+ t[i].id === String(e[n].dataset.id) && (l = !1);
472
484
  l && (this.settings.keepOrder ? this.main.values.appendChild(this.multipleValue(t[i])) : e.length === 0 ? this.main.values.appendChild(this.multipleValue(t[i])) : i === 0 ? this.main.values.insertBefore(this.multipleValue(t[i]), e[i]) : e[i - 1].insertAdjacentElement("afterend", this.multipleValue(t[i])));
473
485
  }
474
486
  }
@@ -478,15 +490,15 @@ class B {
478
490
  const s = document.createElement("div");
479
491
  if (s.classList.add(this.classes.valueText), s.textContent = e.text, t.appendChild(s), !e.mandatory) {
480
492
  const i = document.createElement("div");
481
- i.classList.add(this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (n) => {
482
- if (n.preventDefault(), n.stopPropagation(), this.settings.disabled)
493
+ i.classList.add(this.classes.valueDelete), i.setAttribute("tabindex", "0"), i.onclick = (a) => {
494
+ if (a.preventDefault(), a.stopPropagation(), this.settings.disabled)
483
495
  return;
484
496
  let o = !0;
485
497
  const c = this.store.getSelectedOptions(), r = c.filter((d) => d.selected && d.id !== e.id, !0);
486
498
  if (!(this.settings.minSelected && r.length < this.settings.minSelected) && (this.callbacks.beforeChange && (o = this.callbacks.beforeChange(r, c) === !0), o)) {
487
499
  let d = [];
488
500
  for (const f of r) {
489
- if (f instanceof g)
501
+ if (f instanceof m)
490
502
  for (const u of f.options)
491
503
  u.id && d.push(u.id);
492
504
  f instanceof p && d.push(f.id);
@@ -496,9 +508,9 @@ class B {
496
508
  };
497
509
  const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
498
510
  l.setAttribute("viewBox", "0 0 100 100");
499
- const a = document.createElementNS("http://www.w3.org/2000/svg", "path");
500
- a.setAttribute("d", this.classes.optionDelete), l.appendChild(a), i.appendChild(l), t.appendChild(i), i.onkeydown = (n) => {
501
- n.key === "Enter" && i.click();
511
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
512
+ n.setAttribute("d", this.classes.optionDelete), l.appendChild(n), i.appendChild(l), t.appendChild(i), i.onkeydown = (a) => {
513
+ a.key === "Enter" && i.click();
502
514
  };
503
515
  }
504
516
  return t;
@@ -549,20 +561,20 @@ class B {
549
561
  case "Escape":
550
562
  return this.callbacks.close(), !1;
551
563
  case " ":
552
- const a = this.content.list.querySelector("." + this.classes.highlighted);
553
- return a ? (a.click(), !1) : !0;
554
- case "Enter":
555
564
  const n = this.content.list.querySelector("." + this.classes.highlighted);
556
- return n ? (n.click(), !1) : this.callbacks.addable ? (s.click(), !1) : !0;
565
+ return n ? (n.click(), !1) : !0;
566
+ case "Enter":
567
+ const a = this.content.list.querySelector("." + this.classes.highlighted);
568
+ return a ? (a.click(), !1) : this.callbacks.addable ? (s.click(), !1) : !0;
557
569
  }
558
570
  return !0;
559
571
  }, e.appendChild(t), this.callbacks.addable) {
560
572
  s.classList.add(this.classes.addable);
561
573
  const l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
562
574
  l.setAttribute("viewBox", "0 0 100 100");
563
- const a = document.createElementNS("http://www.w3.org/2000/svg", "path");
564
- a.setAttribute("d", this.classes.addablePath), l.appendChild(a), s.appendChild(l), s.onclick = (n) => {
565
- if (n.preventDefault(), n.stopPropagation(), !this.callbacks.addable)
575
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
576
+ n.setAttribute("d", this.classes.addablePath), l.appendChild(n), s.appendChild(l), s.onclick = (a) => {
577
+ if (a.preventDefault(), a.stopPropagation(), !this.callbacks.addable)
566
578
  return;
567
579
  const o = this.content.search.input.value.trim();
568
580
  if (o === "") {
@@ -592,13 +604,13 @@ class B {
592
604
  }, e.appendChild(s), i.addable = {
593
605
  main: s,
594
606
  svg: l,
595
- path: a
607
+ path: n
596
608
  };
597
609
  }
598
610
  return i;
599
611
  }
600
612
  searchFocus() {
601
- this.content.search.input.focus();
613
+ this.content.search.input.focus({ preventScroll: !0 });
602
614
  }
603
615
  getOptions(e = !1, t = !1, s = !1) {
604
616
  let i = "." + this.classes.option;
@@ -625,11 +637,11 @@ class B {
625
637
  }
626
638
  for (let l = 0; l < t.length; l++)
627
639
  if (t[l].classList.contains(this.classes.highlighted)) {
628
- const a = t[l];
629
- a.classList.remove(this.classes.highlighted);
630
- const n = a.parentElement;
631
- if (n && n.classList.contains(this.classes.mainOpen)) {
632
- const r = n.querySelector("." + this.classes.optgroupLabel);
640
+ const n = t[l];
641
+ n.classList.remove(this.classes.highlighted);
642
+ const a = n.parentElement;
643
+ if (a && a.classList.contains(this.classes.mainOpen)) {
644
+ const r = a.querySelector("." + this.classes.optgroupLabel);
633
645
  r && r.click();
634
646
  }
635
647
  let o = t[e === "down" ? l + 1 < t.length ? l + 1 : 0 : l - 1 >= 0 ? l - 1 : t.length - 1];
@@ -679,20 +691,20 @@ class B {
679
691
  ));
680
692
  const t = document.createDocumentFragment();
681
693
  for (const s of e) {
682
- if (s instanceof g) {
694
+ if (s instanceof m) {
683
695
  const i = document.createElement("div");
684
696
  i.classList.add(this.classes.optgroup);
685
697
  const l = document.createElement("div");
686
698
  l.classList.add(this.classes.optgroupLabel), i.appendChild(l);
687
- const a = document.createElement("div");
688
- a.classList.add(this.classes.optgroupLabelText), a.textContent = s.label, l.appendChild(a);
689
699
  const n = document.createElement("div");
690
- if (n.classList.add(this.classes.optgroupActions), l.appendChild(n), this.settings.isMultiple && s.selectAll) {
700
+ n.classList.add(this.classes.optgroupLabelText), n.textContent = s.label, l.appendChild(n);
701
+ const a = document.createElement("div");
702
+ if (a.classList.add(this.classes.optgroupActions), l.appendChild(a), this.settings.isMultiple && s.selectAll) {
691
703
  const o = document.createElement("div");
692
704
  o.classList.add(this.classes.optgroupSelectAll);
693
705
  let c = !0;
694
- for (const m of s.options)
695
- if (!m.selected) {
706
+ for (const g of s.options)
707
+ if (!g.selected) {
696
708
  c = !1;
697
709
  break;
698
710
  }
@@ -704,8 +716,8 @@ class B {
704
716
  const f = document.createElementNS("http://www.w3.org/2000/svg", "path");
705
717
  f.setAttribute("d", this.classes.optgroupSelectAllBox), d.appendChild(f);
706
718
  const u = document.createElementNS("http://www.w3.org/2000/svg", "path");
707
- u.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(u), o.addEventListener("click", (m) => {
708
- m.preventDefault(), m.stopPropagation();
719
+ u.setAttribute("d", this.classes.optgroupSelectAllCheck), d.appendChild(u), o.addEventListener("click", (g) => {
720
+ g.preventDefault(), g.stopPropagation();
709
721
  const v = this.store.getSelected();
710
722
  if (c) {
711
723
  const w = v.filter((S) => {
@@ -724,7 +736,7 @@ class B {
724
736
  this.callbacks.setSelected(S, !0);
725
737
  return;
726
738
  }
727
- }), n.appendChild(o);
739
+ }), a.appendChild(o);
728
740
  }
729
741
  if (s.closable !== "off") {
730
742
  const o = document.createElement("div");
@@ -734,7 +746,7 @@ class B {
734
746
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
735
747
  c.appendChild(r), s.options.some((d) => d.selected) || this.content.search.input.value.trim() !== "" ? (o.classList.add(this.classes.mainOpen), r.setAttribute("d", this.classes.arrowOpen)) : s.closable === "open" ? (i.classList.add(this.classes.mainOpen), r.setAttribute("d", this.classes.arrowOpen)) : s.closable === "close" && (i.classList.add(this.classes.close), r.setAttribute("d", this.classes.arrowClose)), l.addEventListener("click", (d) => {
736
748
  d.preventDefault(), d.stopPropagation(), i.classList.contains(this.classes.close) ? (i.classList.remove(this.classes.close), i.classList.add(this.classes.mainOpen), r.setAttribute("d", this.classes.arrowOpen)) : (i.classList.remove(this.classes.mainOpen), i.classList.add(this.classes.close), r.setAttribute("d", this.classes.arrowClose));
737
- }), n.appendChild(o);
749
+ }), a.appendChild(o);
738
750
  }
739
751
  i.appendChild(l);
740
752
  for (const o of s.options)
@@ -759,25 +771,25 @@ class B {
759
771
  this.classes.searchHighlighter
760
772
  ) : e.html !== "" ? t.innerHTML = e.html : t.textContent = e.text, this.settings.showOptionTooltips && t.textContent && t.setAttribute("title", t.textContent), e.display || t.classList.add(this.classes.hide), e.disabled && t.classList.add(this.classes.disabled), e.selected && this.settings.hideSelected && t.classList.add(this.classes.hide), e.selected ? (t.classList.add(this.classes.selected), t.setAttribute("aria-selected", "true"), this.main.main.setAttribute("aria-activedescendant", t.id)) : (t.classList.remove(this.classes.selected), t.setAttribute("aria-selected", "false")), t.addEventListener("click", (s) => {
761
773
  s.preventDefault(), s.stopPropagation();
762
- const i = this.store.getSelected(), l = s.currentTarget, a = String(l.dataset.id), n = s.ctrlKey || s.metaKey;
763
- if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !n)
774
+ const i = this.store.getSelected(), l = s.currentTarget, n = String(l.dataset.id), a = s.ctrlKey || s.metaKey;
775
+ if (e.disabled || !this.settings.isMultiple && e.selected && !this.settings.allowDeselect || e.selected && e.mandatory || this.settings.isMultiple && this.settings.maxSelected <= i.length && !e.selected || this.settings.isMultiple && this.settings.minSelected >= i.length && e.selected && !a)
764
776
  return;
765
777
  let o = !1;
766
778
  const c = this.store.getSelectedOptions();
767
779
  let r = [];
768
780
  if (this.settings.isMultiple) {
769
- const d = c.some((u) => u.id === a);
781
+ const d = c.some((u) => u.id === n);
770
782
  if (s.shiftKey && this.lastSelectedOption) {
771
- const u = this.store.getDataOptions(), m = u.findIndex((w) => w.id === this.lastSelectedOption.id), v = u.findIndex((w) => w.id === e.id);
772
- if (m >= 0 && v >= 0) {
773
- const w = Math.min(m, v), S = Math.max(m, v), L = u.slice(w, S + 1).filter((A) => !c.find((x) => x.id === A.id));
783
+ const u = this.store.getDataOptions(), g = u.findIndex((w) => w.id === this.lastSelectedOption.id), v = u.findIndex((w) => w.id === e.id);
784
+ if (g >= 0 && v >= 0) {
785
+ const w = Math.min(g, v), S = Math.max(g, v), L = u.slice(w, S + 1).filter((A) => !c.find((x) => x.id === A.id));
774
786
  c.length + L.length <= this.settings.maxSelected ? r = c.concat(L) : r = c;
775
787
  } else
776
788
  r = c;
777
- } else n ? (d ? r = c.filter((u) => u.id !== a) : r = c.concat(e), this.lastSelectedOption = e) : (d ? r = c.filter((u) => u.id !== a) : r = c.concat(e), this.lastSelectedOption = e);
789
+ } else a ? (d ? r = c.filter((u) => u.id !== n) : r = c.concat(e), this.lastSelectedOption = e) : (d ? r = c.filter((u) => u.id !== n) : r = c.concat(e), this.lastSelectedOption = e);
778
790
  }
779
791
  if (this.settings.isMultiple || (e.selected ? r = [] : r = [e]), this.callbacks.beforeChange || (o = !0), this.callbacks.beforeChange && (this.callbacks.beforeChange(r, c) === !1 ? o = !1 : o = !0), o) {
780
- this.store.getOptionByID(a) || this.callbacks.addOption(e), this.callbacks.setSelected(
792
+ this.store.getOptionByID(n) || this.callbacks.addOption(e), this.callbacks.setSelected(
781
793
  r.map((u) => u.id),
782
794
  !1
783
795
  );
@@ -793,23 +805,23 @@ class B {
793
805
  const i = t.trim();
794
806
  if (i === "")
795
807
  return e;
796
- const l = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = document.createElement("div");
797
- a.innerHTML = e;
798
- const n = (o) => {
808
+ const l = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), n = document.createElement("div");
809
+ n.innerHTML = e;
810
+ const a = (o) => {
799
811
  if (o.nodeType === Node.TEXT_NODE) {
800
812
  const c = o.textContent || "", r = new RegExp("(" + l + ")", "i");
801
813
  if (r.test(c)) {
802
814
  const d = document.createElement("span");
803
- c.split(r).forEach((u, m) => {
815
+ c.split(r).forEach((u, g) => {
804
816
  if (u && r.test(u)) {
805
817
  const v = document.createElement("mark");
806
818
  v.className = s, v.textContent = u, d.appendChild(v);
807
819
  } else u && d.appendChild(document.createTextNode(u));
808
820
  }), o.parentNode?.replaceChild(d, o);
809
821
  }
810
- } else o.nodeType === Node.ELEMENT_NODE && Array.from(o.childNodes).forEach((c) => n(c));
822
+ } else o.nodeType === Node.ELEMENT_NODE && Array.from(o.childNodes).forEach((c) => a(c));
811
823
  };
812
- return Array.from(a.childNodes).forEach((o) => n(o)), a.innerHTML;
824
+ return Array.from(n.childNodes).forEach((o) => a(o)), n.innerHTML;
813
825
  }
814
826
  moveContentAbove() {
815
827
  const e = this.main.main.offsetHeight, t = this.content.main.offsetHeight;
@@ -823,8 +835,8 @@ class B {
823
835
  this.content.main.style.margin = "-1px 0px 0px 0px", this.settings.contentPosition !== "relative" && (this.content.main.style.top = e.top + e.height + (this.settings.contentPosition === "fixed" ? 0 : window.scrollY) + "px", this.content.main.style.left = e.left + (this.settings.contentPosition === "fixed" ? 0 : window.scrollX) + "px", this.content.main.style.width = e.width + "px");
824
836
  }
825
837
  ensureElementInView(e, t) {
826
- const s = e.scrollTop + e.offsetTop, i = s + e.clientHeight, l = t.offsetTop, a = l + t.clientHeight;
827
- l < s ? e.scrollTop -= s - l : a > i && (e.scrollTop += a - i);
838
+ const s = e.scrollTop + e.offsetTop, i = s + e.clientHeight, l = t.offsetTop, n = l + t.clientHeight;
839
+ l < s ? e.scrollTop -= s - l : n > i && (e.scrollTop += n - i);
828
840
  }
829
841
  putContent() {
830
842
  const e = this.main.main.offsetHeight, t = this.main.main.getBoundingClientRect(), s = this.content.main.offsetHeight;
@@ -834,8 +846,8 @@ class B {
834
846
  updateDeselectAll() {
835
847
  if (!this.store || !this.settings)
836
848
  return;
837
- const e = this.store.getSelectedOptions(), t = e && e.length > 0, s = this.settings.isMultiple, i = this.settings.allowDeselect, l = this.main.deselect.main, a = this.classes.hide;
838
- i && !(s && !t) ? l.classList.remove(a) : l.classList.add(a);
849
+ const e = this.store.getSelectedOptions(), t = e && e.length > 0, s = this.settings.isMultiple, i = this.settings.allowDeselect, l = this.main.deselect.main, n = this.classes.hide;
850
+ i && !(s && !t) ? l.classList.remove(n) : l.classList.add(n);
839
851
  }
840
852
  }
841
853
  class I {
@@ -897,28 +909,30 @@ class I {
897
909
  observeCall(e) {
898
910
  if (!this.listen)
899
911
  return;
900
- let t = !1, s = !1, i = !1;
901
- for (const l of e) {
902
- if (l.target === this.select && (l.attributeName === "disabled" && (s = !0), l.attributeName === "class" && (t = !0), l.type === "childList")) {
903
- for (const a of Array.from(l.addedNodes))
912
+ let t = !1, s = !1, i = !1, l = !1;
913
+ for (const n of e) {
914
+ if (n.target === this.select && (n.attributeName === "disabled" && (s = !0), n.attributeName === "class" && (t = !0), n.type === "childList")) {
915
+ for (const a of Array.from(n.addedNodes))
904
916
  if (a.nodeName === "OPTION" && a.value === this.select.value) {
905
- this.select.dispatchEvent(new Event("change"));
917
+ l = !0;
906
918
  break;
907
919
  }
908
920
  i = !0;
909
921
  }
910
- (l.target.nodeName === "OPTGROUP" || l.target.nodeName === "OPTION") && (i = !0);
922
+ (n.target.nodeName === "OPTGROUP" || n.target.nodeName === "OPTION") && (i = !0);
911
923
  }
912
924
  if (t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), s && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)), i && this.onOptionsChange) {
913
925
  if (this.isUpdating) {
914
926
  if (this.select.options.length > 0) {
915
- const l = this.getData();
916
- l.length > 0 && (this.pendingOptionsChange = l);
927
+ const n = this.getData();
928
+ n.length > 0 && (this.pendingOptionsChange = n);
917
929
  }
930
+ l && this.select.dispatchEvent(new Event("change"));
918
931
  return;
919
932
  }
920
933
  this.changeListen(!1), this.onOptionsChange(this.getData()), this.changeListen(!0);
921
934
  }
935
+ l && this.select.dispatchEvent(new Event("change"));
922
936
  }
923
937
  // From the select element pull optgroup and options into data
924
938
  getData() {
@@ -968,8 +982,8 @@ class I {
968
982
  const i = s.childNodes;
969
983
  for (const l of i)
970
984
  if (l.nodeName === "OPTION") {
971
- const a = l;
972
- a.selected && e.push(this.getDataFromOption(a));
985
+ const n = l;
986
+ n.selected && e.push(this.getDataFromOption(n));
973
987
  }
974
988
  }
975
989
  if (s.nodeName === "OPTION") {
@@ -988,10 +1002,10 @@ class I {
988
1002
  for (const s of t) {
989
1003
  if (s.nodeName === "OPTGROUP") {
990
1004
  const l = s.childNodes;
991
- for (const a of l)
992
- if (a.nodeName === "OPTION") {
993
- const n = a;
994
- n.selected = e.includes(n.id);
1005
+ for (const n of l)
1006
+ if (n.nodeName === "OPTION") {
1007
+ const a = n;
1008
+ a.selected = e.includes(a.id);
995
1009
  }
996
1010
  }
997
1011
  if (s.nodeName === "OPTION") {
@@ -1011,10 +1025,10 @@ class I {
1011
1025
  for (const s of t) {
1012
1026
  if (s.nodeName === "OPTGROUP") {
1013
1027
  const l = s.childNodes;
1014
- for (const a of l)
1015
- if (a.nodeName === "OPTION") {
1016
- const n = a;
1017
- n.selected = e.includes(n.value);
1028
+ for (const n of l)
1029
+ if (n.nodeName === "OPTION") {
1030
+ const a = n;
1031
+ a.selected = e.includes(a.value);
1018
1032
  }
1019
1033
  }
1020
1034
  if (s.nodeName === "OPTION") {
@@ -1033,7 +1047,7 @@ class I {
1033
1047
  if (!(!e || e.length === 0)) {
1034
1048
  this.isUpdating = !0, this.pendingOptionsChange = null, this.changeListen(!1), this.select.innerHTML = "";
1035
1049
  for (const t of e)
1036
- t instanceof g && this.select.appendChild(this.createOptgroup(t)), t instanceof p && this.select.appendChild(this.createOption(t));
1050
+ t instanceof m && this.select.appendChild(this.createOptgroup(t)), t instanceof p && this.select.appendChild(this.createOption(t));
1037
1051
  if (this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0), this.isUpdating = !1, this.pendingOptionsChange !== null) {
1038
1052
  const t = this.pendingOptionsChange;
1039
1053
  t.length > 0 && this.onOptionsChange ? (this.pendingOptionsChange = null, this.changeListen(!1), this.onOptionsChange(t), this.changeListen(!0)) : this.pendingOptionsChange = null;
@@ -1058,7 +1072,7 @@ class I {
1058
1072
  // Find and handle labels associated with this select
1059
1073
  setupLabelHandlers() {
1060
1074
  const e = [], t = this.select.id;
1061
- t && document.querySelectorAll(`label[for="${t}"]`).forEach((a) => e.push(a));
1075
+ t && document.querySelectorAll(`label[for="${t}"]`).forEach((n) => e.push(n));
1062
1076
  let s = this.select.parentElement;
1063
1077
  for (; s && s !== document.body; ) {
1064
1078
  if (s.tagName === "LABEL") {
@@ -1070,16 +1084,17 @@ class I {
1070
1084
  Array.from(new Set(e)).forEach((l) => {
1071
1085
  if (l.__slimSelectLabelHandler)
1072
1086
  return;
1073
- const a = (n) => {
1074
- n.target === l && (n.preventDefault(), this.onLabelClick && this.onLabelClick());
1087
+ const n = (a) => {
1088
+ const o = a.target;
1089
+ a.preventDefault(), o === l && this.onLabelClick && this.onLabelClick();
1075
1090
  };
1076
- l.__slimSelectLabelHandler = a, l.addEventListener("click", a, { capture: !0, passive: !1 });
1091
+ l.__slimSelectLabelHandler = n, l.addEventListener("click", n, { capture: !0, passive: !1 });
1077
1092
  });
1078
1093
  }
1079
1094
  // Remove label handlers
1080
1095
  removeLabelHandlers() {
1081
1096
  const e = [], t = this.select.id;
1082
- t && document.querySelectorAll(`label[for="${t}"]`).forEach((a) => e.push(a));
1097
+ t && document.querySelectorAll(`label[for="${t}"]`).forEach((n) => e.push(n));
1083
1098
  let s = this.select.parentElement;
1084
1099
  for (; s && s !== document.body; ) {
1085
1100
  if (s.tagName === "LABEL") {
@@ -1089,8 +1104,8 @@ class I {
1089
1104
  s = s.parentElement;
1090
1105
  }
1091
1106
  Array.from(new Set(e)).forEach((l) => {
1092
- const a = l.__slimSelectLabelHandler;
1093
- a && (l.removeEventListener("click", a, { capture: !0 }), delete l.__slimSelectLabelHandler);
1107
+ const n = l.__slimSelectLabelHandler;
1108
+ n && (l.removeEventListener("click", n, { capture: !0 }), delete l.__slimSelectLabelHandler);
1094
1109
  });
1095
1110
  }
1096
1111
  destroy() {
@@ -1114,6 +1129,7 @@ class H {
1114
1129
  alwaysOpen;
1115
1130
  showSearch;
1116
1131
  focusSearch;
1132
+ keepSearch;
1117
1133
  ariaLabel;
1118
1134
  searchPlaceholder;
1119
1135
  searchText;
@@ -1135,7 +1151,7 @@ class H {
1135
1151
  maxValuesMessage;
1136
1152
  addableText;
1137
1153
  constructor(e) {
1138
- e || (e = {}), this.id = "ss-" + C(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.alwaysOpen = e.alwaysOpen !== void 0 ? e.alwaysOpen : !1, this.showSearch = e.showSearch !== void 0 ? e.showSearch : !0, this.focusSearch = e.focusSearch !== void 0 ? e.focusSearch : !0, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.searchHighlight = e.searchHighlight !== void 0 ? e.searchHighlight : !1, this.closeOnSelect = e.closeOnSelect !== void 0 ? e.closeOnSelect : !0, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText !== void 0 ? e.placeholderText : "Select Value", this.allowDeselect = e.allowDeselect !== void 0 ? e.allowDeselect : !1, this.hideSelected = e.hideSelected !== void 0 ? e.hideSelected : !1, this.keepOrder = e.keepOrder !== void 0 ? e.keepOrder : !1, this.showOptionTooltips = e.showOptionTooltips !== void 0 ? e.showOptionTooltips : !1, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || 'Press "Enter" to add {value}';
1154
+ e || (e = {}), this.id = "ss-" + C(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled !== void 0 ? e.disabled : !1, this.alwaysOpen = e.alwaysOpen !== void 0 ? e.alwaysOpen : !1, this.showSearch = e.showSearch !== void 0 ? e.showSearch : !0, this.focusSearch = e.focusSearch !== void 0 ? e.focusSearch : !0, this.keepSearch = e.keepSearch !== void 0 ? e.keepSearch : !1, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.searchHighlight = e.searchHighlight !== void 0 ? e.searchHighlight : !1, this.closeOnSelect = e.closeOnSelect !== void 0 ? e.closeOnSelect : !0, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText !== void 0 ? e.placeholderText : "Select Value", this.allowDeselect = e.allowDeselect !== void 0 ? e.allowDeselect : !1, this.hideSelected = e.hideSelected !== void 0 ? e.hideSelected : !1, this.keepOrder = e.keepOrder !== void 0 ? e.keepOrder : !1, this.showOptionTooltips = e.showOptionTooltips !== void 0 ? e.showOptionTooltips : !1, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || 'Press "Enter" to add {value}';
1139
1155
  }
1140
1156
  }
1141
1157
  let F = class {
@@ -1172,16 +1188,16 @@ let F = class {
1172
1188
  }
1173
1189
  this.selectEl.dataset.ssid && this.destroy(), this.settings = new H(e.settings), this.cssClasses = new N(e.cssClasses);
1174
1190
  const t = ["beforeOpen", "afterOpen", "beforeClose", "afterClose"];
1175
- for (const n in e.events)
1176
- e.events.hasOwnProperty(n) && (t.indexOf(n) !== -1 ? this.events[n] = O(e.events[n], 100) : this.events[n] = e.events[n]);
1177
- this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new I(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (n) => {
1178
- this.setSelected(n.map((o) => o.id));
1179
- }, this.select.onClassChange = (n) => {
1180
- this.settings.class = n, this.render.updateClassStyles();
1181
- }, this.select.onDisabledChange = (n) => {
1182
- n ? this.disable() : this.enable();
1183
- }, this.select.onOptionsChange = (n) => {
1184
- this.setData(n || []);
1191
+ for (const a in e.events)
1192
+ e.events.hasOwnProperty(a) && (t.indexOf(a) !== -1 ? this.events[a] = O(e.events[a], 100) : this.events[a] = e.events[a]);
1193
+ this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new I(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onValueChange = (a) => {
1194
+ this.setSelected(a.map((o) => o.id));
1195
+ }, this.select.onClassChange = (a) => {
1196
+ this.settings.class = a, this.render.updateClassStyles();
1197
+ }, this.select.onDisabledChange = (a) => {
1198
+ a ? this.disable() : this.enable();
1199
+ }, this.select.onOptionsChange = (a) => {
1200
+ this.setData(a || []);
1185
1201
  }, this.select.onLabelClick = () => {
1186
1202
  this.settings.disabled || (this.settings.isOpen ? this.close() : this.open());
1187
1203
  };
@@ -1198,8 +1214,8 @@ let F = class {
1198
1214
  afterChange: this.events.afterChange
1199
1215
  };
1200
1216
  this.render = new B(this.settings, this.cssClasses, this.store, i), this.render.renderValues(), this.render.renderOptions(this.store.getData());
1201
- const l = this.selectEl.getAttribute("aria-label"), a = this.selectEl.getAttribute("aria-labelledby");
1202
- l ? this.render.main.main.setAttribute("aria-label", l) : a && this.render.main.main.setAttribute("aria-labelledby", a), this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), window.addEventListener("resize", this.windowResize, !1), this.settings.openPosition === "auto" && window.addEventListener("scroll", this.windowScroll, !1), document.addEventListener("visibilitychange", this.windowVisibilityChange), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
1217
+ const l = this.selectEl.getAttribute("aria-label"), n = this.selectEl.getAttribute("aria-labelledby");
1218
+ l ? this.render.main.main.setAttribute("aria-label", l) : n && this.render.main.main.setAttribute("aria-labelledby", n), this.selectEl.parentNode && this.selectEl.parentNode.insertBefore(this.render.main.main, this.selectEl.nextSibling), window.addEventListener("resize", this.windowResize, !1), this.settings.openPosition === "auto" && window.addEventListener("scroll", this.windowScroll, !1), document.addEventListener("visibilitychange", this.windowVisibilityChange), this.settings.disabled && this.disable(), this.settings.alwaysOpen && this.open(), this.select.setupLabelHandlers(), this.selectEl.slim = this;
1203
1219
  }
1204
1220
  // Set to enabled and remove disabled classes
1205
1221
  enable() {
@@ -1231,17 +1247,17 @@ let F = class {
1231
1247
  const s = this.store.getSelected(), i = this.store.getDataOptions();
1232
1248
  e = Array.isArray(e) ? e : [e];
1233
1249
  const l = [];
1234
- for (const n of e) {
1235
- if (i.find((o) => o.id == n)) {
1236
- l.push(n);
1250
+ for (const a of e) {
1251
+ if (i.find((o) => o.id == a)) {
1252
+ l.push(a);
1237
1253
  continue;
1238
1254
  }
1239
- for (const o of i.filter((c) => c.value == n))
1255
+ for (const o of i.filter((c) => c.value == a))
1240
1256
  l.push(o.id);
1241
1257
  }
1242
1258
  this.store.setSelectedBy("id", l);
1243
- const a = this.store.getData();
1244
- this.select.updateOptions(a), this.render.renderValues(), this.render.content.search.input.value !== "" ? this.search(this.render.content.search.input.value) : this.render.renderOptions(a), t && this.events.afterChange && !y(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1259
+ const n = this.store.getData();
1260
+ this.select.updateOptions(n), this.render.renderValues(), this.render.content.search.input.value !== "" ? this.search(this.render.content.search.input.value) : this.render.renderOptions(n), t && this.events.afterChange && !y(s, this.store.getSelected()) && this.events.afterChange(this.store.getSelectedOptions());
1245
1261
  }
1246
1262
  addOption(e) {
1247
1263
  const t = this.store.getSelected();
@@ -1255,7 +1271,7 @@ let F = class {
1255
1271
  }, this.settings.timeoutDelay), this.settings.contentPosition === "absolute" && (this.settings.intervalMove && clearInterval(this.settings.intervalMove), this.settings.intervalMove = setInterval(this.render.moveContent.bind(this.render), 500)));
1256
1272
  }
1257
1273
  close(e = null) {
1258
- !this.settings.isOpen || this.settings.alwaysOpen || (this.events.beforeClose && this.events.beforeClose(), this.render.close(), this.render.content.search.input.value !== "" && this.search(""), this.render.mainFocus(e), this.settings.isOpen = !1, this.settings.isFullOpen = !1, this.closeTimeout = setTimeout(() => {
1274
+ !this.settings.isOpen || this.settings.alwaysOpen || (this.events.beforeClose && this.events.beforeClose(), this.render.close(), !this.settings.keepSearch && this.render.content.search.input.value !== "" && this.search(""), this.render.mainFocus(e), this.settings.isOpen = !1, this.settings.isFullOpen = !1, this.closeTimeout = setTimeout(() => {
1259
1275
  this.events.afterClose && this.events.afterClose(), document.removeEventListener("click", this.documentClick);
1260
1276
  }, this.settings.timeoutDelay), this.settings.intervalMove && clearInterval(this.settings.intervalMove));
1261
1277
  }
@@ -1382,8 +1398,8 @@ const R = E({
1382
1398
  },
1383
1399
  handleAfterChange(h, e) {
1384
1400
  if (!this.slim) return;
1385
- const t = this.multiple ? h.map((o) => o.value) : h.length > 0 ? h[0].value : "", s = this.getCleanValue(this.$props.modelValue), i = this.slim.store.getDataOptions(), l = Array.isArray(s) ? s.length > 0 && s.every((o) => i.some((c) => c.value === o)) : s !== "" && i.some((o) => o.value === s), a = Array.isArray(t) ? t.length > 0 && t.every((o) => i.some((c) => c.value === o)) : t !== "" && i.some((o) => o.value === t);
1386
- (Array.isArray(t) && Array.isArray(this.value) ? JSON.stringify(t.sort()) !== JSON.stringify(this.value.sort()) : this.value !== t) && (l || a) && (this.value = t), e && e(h);
1401
+ const t = this.multiple ? h.map((o) => o.value) : h.length > 0 ? h[0].value : "", s = this.getCleanValue(this.$props.modelValue), i = this.slim.store.getDataOptions(), l = Array.isArray(s) ? s.length > 0 && s.every((o) => i.some((c) => c.value === o)) : s !== "" && i.some((o) => o.value === s), n = Array.isArray(t) ? t.length > 0 && t.every((o) => i.some((c) => c.value === o)) : t !== "" && i.some((o) => o.value === t);
1402
+ (Array.isArray(t) && Array.isArray(this.value) ? JSON.stringify(t.sort()) !== JSON.stringify(this.value.sort()) : this.value !== t) && (l || n) && (this.value = t), e && e(h);
1387
1403
  },
1388
1404
  getCleanValue(h) {
1389
1405
  const e = this.$props.multiple;
@@ -1393,13 +1409,13 @@ const R = E({
1393
1409
  if (!this.slim || this.$props.modelValue === void 0)
1394
1410
  return;
1395
1411
  const e = this.getCleanValue(this.$props.modelValue), s = this.slim.getData().flatMap((l) => "label" in l ? l.options : [l]);
1396
- if (!(Array.isArray(e) ? e.length > 0 && e.every((l) => s.some((a) => a.value === l)) : e !== "" && s.some((l) => l.value === e)) && !Array.isArray(e) && !s.some((a) => a.placeholder)) {
1397
- const a = this.slim.getData(), n = {
1412
+ if (!(Array.isArray(e) ? e.length > 0 && e.every((l) => s.some((n) => n.value === l)) : e !== "" && s.some((l) => l.value === e)) && !Array.isArray(e) && !s.some((n) => n.placeholder)) {
1413
+ const n = this.slim.getData(), a = {
1398
1414
  value: "",
1399
1415
  text: "",
1400
1416
  placeholder: !0
1401
1417
  };
1402
- this.slim.setData([n].concat(a));
1418
+ this.slim.setData([a].concat(n));
1403
1419
  }
1404
1420
  this.slim.setSelected(e, h);
1405
1421
  }
@@ -1420,7 +1436,7 @@ function q(h, e, t, s, i, l) {
1420
1436
  }
1421
1437
  const z = /* @__PURE__ */ _(R, [["render", q]]);
1422
1438
  export {
1423
- g as Optgroup,
1439
+ m as Optgroup,
1424
1440
  p as Option,
1425
1441
  H as Settings,
1426
1442
  z as default