@cas-smartdesign/combo-box 7.4.2 → 7.5.1

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.
@@ -1,34 +1,34 @@
1
- import { css as g, unsafeCSS as x, html as b } from "lit";
2
- import { property as r } from "lit/decorators/property.js";
1
+ import { unsafeCSS as g, css as x, html as b } from "lit";
2
+ import { property as a } from "lit/decorators/property.js";
3
3
  import { createPopper as v } from "@popperjs/core";
4
4
  import _ from "@cas-smartdesign/lit-input";
5
5
  import p, { ListDataProvider as y, SelectionType as u } from "@cas-smartdesign/virtual-list";
6
6
  import { generator as w } from "@cas-smartdesign/list-item";
7
7
  import I from "@cas-smartdesign/image-tools";
8
- const V = ":host{display:inline-flex;position:relative;cursor:text;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;font-size:16px;color:#111;contain:layout style;flex-direction:column}:host([hidden]),:host([type=hidden]){display:none!important}:host([effective-disabled]){opacity:.6;cursor:default;filter:grayscale(100%)}:host([effective-disabled]) .unfocused-line,:host([effective-disabled]) .focused-line{border-bottom-style:dashed}:host(:not([effective-disabled]):focus) .focused-line,:host(:not([effective-disabled])[focused]) .focused-line{transform:none;transition:transform .25s}:host(:not([effective-disabled]):focus) .label.float,:host(:not([effective-disabled])[focused]) .label.float{color:var(--sd-input-focused-color, #1467ba)}:host([inactive]) .input{pointer-events:none}:host([effective-disabled]:focus),:host([effective-disabled][focused]){box-shadow:0 0 0 1px #111}:host(:not([effective-disabled])[validationlevel]) .focused-line,:host(:not([effective-disabled]):invalid) .focused-line{transform:none;transition:transform .25s}:host([validationlevel=warn i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #555555)}:host([validationlevel=warn i]) .label,:host([validationlevel=warn i]) .validation-message{color:var(--sd-input-validation-color, #555555)!important}:host([validationlevel=suggest i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #bf8800)}:host([validationlevel=suggest i]) .label,:host([validationlevel=suggest i]) .validation-message{color:var(--sd-input-validation-color, #bf8800)!important}:host([validationlevel=error i]) .focused-line,:host(:not([validationlevel]):invalid) .focused-line{border-bottom-color:var(--sd-input-validation-color, #cc0017)}:host([validationlevel=error i]) .label,:host([validationlevel=error i]) .validation-message,:host(:not([validationlevel]):invalid) .label,:host(:not([validationlevel]):invalid) .validation-message{color:var(--sd-input-validation-color, #cc0017)!important}.validation-message-wrapper{min-height:var(--sd-input-validation-message-minheight, 0px);position:relative;font-size:0}.validation-message{position:relative;position:var(--sd-input-validation-message-minheight, absolute);left:0;right:0}.label.float{transform:translateY(-75%) scale(.75);width:133%}.label:not(.float){max-width:100%}.floated-label-placeholder{height:20px;width:100%}.label{position:absolute;top:0;left:0;line-height:24px;pointer-events:none;color:var(--sd-input-color, #767676);transition:transform .25s,width .25s;transform-origin:left top}.input-wrapper{position:relative;display:flex;flex-direction:row;align-items:center;background-color:var(--input-wrapper-background-color)}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-wrapper{flex-direction:column;align-items:baseline}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-container{width:100%}:host([extended-prefix]:not(:focus-within)) .input-container,:host([extended-prefix][effective-disabled]) .input-container{width:0px}.input-container{line-height:var(--sd-input-line-height, 24px);flex:1 1 auto}.input{width:100%;background:var(--sd-input-background, transparent);font-family:inherit;font-size:inherit;text-align:inherit;color:inherit;border:none;outline:none;resize:none;padding-left:0;padding-right:0}.input:-webkit-autofill{animation-name:onautofillstart}.input:not(:-webkit-autofill){animation-name:onautofillcancel}@keyframes onautofillstart{0%{outline:none}}@keyframes onautofillcancel{0%{outline:none}}.label,input.input{text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.validation-message{text-overflow:ellipsis;overflow-x:hidden;white-space:normal;white-space:var(--sd-input-validation-message-minheight, nowrap)}.input::placeholder{color:var(--sd-input-color, #767676)}.underline{height:2px;width:100%;position:relative}.unfocused-line,.focused-line{position:absolute;top:0;right:0;bottom:0;left:0}.unfocused-line{border-bottom:1px solid var(--sd-input-underline-color, #959595)}.focused-line{border-bottom:2px solid var(--sd-input-focused-color, #1467ba);transform-origin:center center;transform:scale3d(0,1,1)}.prefix,.suffix{display:flex;flex-wrap:nowrap;max-width:100%}.prefix ::slotted(*),.suffix ::slotted(*){display:flex}:host(:focus){outline:none}.suffix ::slotted(.clear-button),.suffix ::slotted(.toggle-button){cursor:pointer;width:16px;height:32px;padding:0 8px;margin-top:-8px;margin-bottom:-8px;fill:#666;outline:none;flex-shrink:0}.suffix ::slotted(.toggle-button){transition:transform .2s}:host([opened]) .suffix ::slotted(.toggle-button){transform:rotate(180deg)}:host([disabled]) .suffix ::slotted(.clear-button),:host([disabled]) .suffix ::slotted(.toggle-button){display:none!important}.prefix ::slotted(.icon-wrapper){width:32px;height:32px;padding-right:4px;margin-top:-8px;margin-bottom:-8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}:host(:not([has-value])) .suffix ::slotted(.clear-button),:host([null-setting-disallowed]) .suffix ::slotted(.clear-button){display:none!important}:host(:not([allow-custom-value]):not([trigger-only])) .input{caret-color:transparent}:host(:not([allow-custom-value]):not([disabled])) .input{cursor:pointer}#default-slot{display:none}", C = `<svg xmlns="http://www.w3.org/2000/svg" class="toggle-button" slot="suffix" viewBox="0 0 16 16">\r
8
+ const V = ":host{display:inline-flex;position:relative;cursor:text;font-family:Segoe UI,Lucida Sans,Arial,sans-serif;font-size:16px;color:#111;contain:layout style;flex-direction:column}:host([hidden]),:host([type=hidden]){display:none!important}:host([effective-disabled]){opacity:.6;cursor:default;filter:grayscale(100%)}:host([effective-disabled]) .unfocused-line,:host([effective-disabled]) .focused-line{border-bottom-style:dashed}:host(:not([effective-disabled]):focus) .focused-line,:host(:not([effective-disabled])[focused]) .focused-line{transform:none;transition:transform .25s}:host(:not([effective-disabled]):focus) .label.float,:host(:not([effective-disabled])[focused]) .label.float{color:var(--sd-input-focused-color, #1467ba)}:host([inactive]) .input{pointer-events:none}:host([effective-disabled]:focus),:host([effective-disabled][focused]){box-shadow:0 0 0 1px #111}:host(:not([effective-disabled])[validationlevel]) .focused-line,:host(:not([effective-disabled]):invalid) .focused-line{transform:none;transition:transform .25s}:host([validationlevel=warn i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #555555)}:host([validationlevel=warn i]) .label,:host([validationlevel=warn i]) .validation-message{color:var(--sd-input-validation-color, #555555)!important}:host([validationlevel=suggest i]) .focused-line{border-bottom-color:var(--sd-input-validation-color, #bf8800)}:host([validationlevel=suggest i]) .label,:host([validationlevel=suggest i]) .validation-message{color:var(--sd-input-validation-color, #bf8800)!important}:host([validationlevel=error i]) .focused-line,:host(:not([validationlevel]):invalid) .focused-line{border-bottom-color:var(--sd-input-validation-color, #cc0017)}:host([validationlevel=error i]) .label,:host([validationlevel=error i]) .validation-message,:host(:not([validationlevel]):invalid) .label,:host(:not([validationlevel]):invalid) .validation-message{color:var(--sd-input-validation-color, #cc0017)!important}.validation-message-wrapper{min-height:var(--sd-input-validation-message-minheight, 0px);position:relative;font-size:0}.validation-message{position:relative;position:var(--sd-input-validation-message-minheight, absolute);left:0;right:0}.label.float{transform:translateY(-75%) scale(.75);width:133%}.label:not(.float){max-width:100%}.floated-label-placeholder{height:20px;width:100%}.label{position:absolute;top:0;left:0;line-height:24px;pointer-events:none;color:var(--sd-input-color, #767676);transition:transform .25s,width .25s;transform-origin:left top}.input-wrapper{position:relative;display:flex;flex-direction:row;align-items:center;background-color:var(--input-wrapper-background-color)}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-wrapper{flex-direction:column;align-items:baseline}:host([extended-prefix]:focus-within:not([effective-disabled])) .input-container{width:100%}:host([extended-prefix]:not(:focus-within)) .input-container,:host([extended-prefix][effective-disabled]) .input-container{width:0px}.input-container{line-height:var(--sd-input-line-height, 24px);flex:1 1 auto}.input{width:100%;background:var(--sd-input-background, transparent);font-family:inherit;font-size:inherit;text-align:inherit;color:inherit;border:none;outline:none;resize:none;padding-left:0;padding-right:0}.input:-webkit-autofill{animation-name:onautofillstart}.input:not(:-webkit-autofill){animation-name:onautofillcancel}@keyframes onautofillstart{0%{outline:none}}@keyframes onautofillcancel{0%{outline:none}}.label,input.input{text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.validation-message{text-overflow:ellipsis;overflow-x:hidden;white-space:normal;white-space:var(--sd-input-validation-message-minheight, nowrap)}.input::placeholder{color:var(--sd-input-color, #767676)}.underline{height:2px;width:100%;position:relative}.unfocused-line,.focused-line{position:absolute;inset:0}.unfocused-line{border-bottom:1px solid var(--sd-input-underline-color, #959595)}.focused-line{border-bottom:2px solid var(--sd-input-focused-color, #1467ba);transform-origin:center center;transform:scale3d(0,1,1)}.prefix,.suffix{display:flex;flex-wrap:nowrap;max-width:100%}.prefix ::slotted(*),.suffix ::slotted(*){display:flex}:host(:focus){outline:none}.suffix ::slotted(.clear-button),.suffix ::slotted(.toggle-button){cursor:pointer;width:16px;height:32px;padding:0 8px;margin-top:-8px;margin-bottom:-8px;fill:#666;outline:none;flex-shrink:0}.suffix ::slotted(.toggle-button){transition:transform .2s}:host([opened]) .suffix ::slotted(.toggle-button){transform:rotate(180deg)}:host([disabled]) .suffix ::slotted(.clear-button),:host([disabled]) .suffix ::slotted(.toggle-button){display:none!important}.prefix ::slotted(.icon-wrapper){width:32px;height:32px;padding-right:4px;margin-top:-8px;margin-bottom:-8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}:host(:not([has-value])) .suffix ::slotted(.clear-button),:host([null-setting-disallowed]) .suffix ::slotted(.clear-button){display:none!important}:host(:not([allow-custom-value]):not([trigger-only])) .input{caret-color:transparent}:host(:not([allow-custom-value]):not([disabled])) .input{cursor:pointer}#default-slot{display:none}", C = `<svg xmlns="http://www.w3.org/2000/svg" class="toggle-button" slot="suffix" viewBox="0 0 16 16">\r
9
9
  <path d="M13 4v2l-5 5-5-5v-2l5 5z"/>\r
10
10
  </svg>\r
11
11
  `, B = `<svg xmlns="http://www.w3.org/2000/svg" class="clear-button" slot="suffix" viewBox="0 0 16 16">\r
12
12
  <path d="M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z"/>\r
13
13
  </svg>\r
14
14
  `;
15
- var P = Object.defineProperty, S = Object.getOwnPropertyDescriptor, d = (h, t, e, i) => {
16
- for (var s = i > 1 ? void 0 : i ? S(t, e) : t, n = h.length - 1, a; n >= 0; n--)
17
- (a = h[n]) && (s = (i ? a(t, e, s) : a(s)) || s);
18
- return i && s && P(t, e, s), s;
15
+ var P = Object.defineProperty, r = (h, t, e, i) => {
16
+ for (var s = void 0, l = h.length - 1, d; l >= 0; l--)
17
+ (d = h[l]) && (s = d(t, e, s) || s);
18
+ return s && P(t, e, s), s;
19
19
  };
20
- const D = "sd-combo-box";
20
+ const S = "sd-combo-box";
21
21
  function f(h, t) {
22
22
  let e;
23
23
  return function(...i) {
24
24
  e != null && clearTimeout(e), e = window.setTimeout(() => h(...i), t);
25
25
  };
26
26
  }
27
- let L = 0;
27
+ let D = 0;
28
28
  var o;
29
- const l = (o = class extends _ {
29
+ const n = (o = class extends _ {
30
30
  constructor() {
31
- super(), this.opened = !1, this.itemHeight = 50, this.displayValuePath = "caption", this.id = o.ID + "_" + L++, this.inMemoryFilter = (t, e) => {
31
+ super(), this.opened = !1, this.itemHeight = 50, this.displayValuePath = "caption", this.id = o.ID + "_" + D++, this.inMemoryFilter = (t, e) => {
32
32
  if (!t)
33
33
  return !0;
34
34
  const i = t.toLowerCase();
@@ -120,8 +120,8 @@ const l = (o = class extends _ {
120
120
  }
121
121
  static get styles() {
122
122
  return [
123
- g`
124
- ${x(V)}
123
+ x`
124
+ ${g(V)}
125
125
  `
126
126
  ];
127
127
  }
@@ -177,16 +177,14 @@ const l = (o = class extends _ {
177
177
  t.style.backgroundRepeat = "no-repeat", t.style.backgroundPosition = "center", t.style.backgroundSize = "cover", t.style.height = "24px", t.style.width = "24px", this._icon.appendChild(t), this._icon.slot = "prefix", this.appendChild(this._icon), this.updateIconFromCurrentValue();
178
178
  }
179
179
  updateIconFromCurrentValue() {
180
- var t;
181
- this.isCustomValue(this.comboBoxValue) ? this.updateIcon(null) : this.updateIcon((t = this.comboBoxValue) == null ? void 0 : t.item);
180
+ this.isCustomValue(this.comboBoxValue) ? this.updateIcon(null) : this.updateIcon(this.comboBoxValue?.item);
182
181
  }
183
182
  updateIcon(t) {
184
183
  if (this._icon)
185
184
  if (t && (t.icon || t.iconPlaceholder)) {
186
185
  const e = t;
187
186
  e.attributes == null ? (this._icon.title = "", this._icon.ariaLabel = "") : (this._icon.title = e.attributes["icon-attr-title"] ?? "", this._icon.ariaLabel = e.attributes["icon-attr-aria-label"] ?? ""), this._icon.style.backgroundColor = e.iconBackgroundColor, this._icon.style.display = "", I.showImage(this._icon.querySelector("div"), t.icon, t.iconPlaceholder);
188
- } else
189
- this._icon && (this._icon.style.display = "none");
187
+ } else this._icon && (this._icon.style.display = "none");
190
188
  }
191
189
  updateHasValue() {
192
190
  this.currentText || this.comboBoxValue != null && this.comboBoxValue != "" ? (this.setAttribute("has-value", ""), this._clearButton && (this._clearButton.style.display = "")) : this.removeAttribute("has-value");
@@ -258,15 +256,12 @@ const l = (o = class extends _ {
258
256
  {
259
257
  name: "offset",
260
258
  options: {
261
- offset: ({ placement: e }) => {
262
- var i;
263
- return e.indexOf("top") > -1 ? [0, -parseInt(getComputedStyle(t).paddingTop, 10)] : e.indexOf("bottom") > -1 ? [
264
- 0,
265
- -parseInt(getComputedStyle(t).paddingBottom, 10) - (((i = this.shadowRoot.querySelector(
266
- ".validation-message-wrapper"
267
- )) == null ? void 0 : i.offsetHeight) ?? 0)
268
- ] : [0, 0];
269
- }
259
+ offset: ({ placement: e }) => e.indexOf("top") > -1 ? [0, -parseInt(getComputedStyle(t).paddingTop, 10)] : e.indexOf("bottom") > -1 ? [
260
+ 0,
261
+ -parseInt(getComputedStyle(t).paddingBottom, 10) - (this.shadowRoot.querySelector(
262
+ ".validation-message-wrapper"
263
+ )?.offsetHeight ?? 0)
264
+ ] : [0, 0]
270
265
  }
271
266
  },
272
267
  {
@@ -303,37 +298,36 @@ const l = (o = class extends _ {
303
298
  await this._list.updateComplete, this._popper && await this._popper.update, this.ownerDocument.body.removeChild(this._list), window.removeEventListener("pointerdown", this.handleWindowPointerDown), this.updateValueOnClose(), this.clearFilter(), this.setSelectionRange(0, 0), this.inputElement.removeAttribute("aria-activedescendant"), this._popper && (this._popper.destroy(), this._popper = null);
304
299
  }
305
300
  updateValueOnClose() {
306
- var e;
307
301
  const t = this.comboBoxValue ?? "";
308
302
  if (this.nullSettingDisallowed && !this.value && this.comboBoxValue)
309
303
  this.restorePreviousSelection();
310
304
  else if (this.value !== (this.convertToDisplayValue(null) ?? "")) {
311
- const i = this._dataProvider.items[this._list.focusIndex];
312
- if (i && (i[this.displayValuePath] ?? "") === this.value) {
313
- if (i.disabled) {
305
+ const e = this._dataProvider.items[this._list.focusIndex];
306
+ if (e && (e[this.displayValuePath] ?? "") === this.value) {
307
+ if (e.disabled) {
314
308
  this.restorePreviousSelection();
315
309
  return;
316
310
  }
317
- this.comboBoxValue = { index: this._itemCache.indexOf(i), item: i };
311
+ this.comboBoxValue = { index: this._itemCache.indexOf(e), item: e };
318
312
  } else if (this.allowCustomValue || !this.value)
319
313
  this.comboBoxValue = this.value;
320
314
  else {
321
- const s = this._itemCache.findIndex(
322
- (n) => (n[this.displayValuePath] ?? "") === this.value && !n.disabled
315
+ const i = this._itemCache.findIndex(
316
+ (s) => (s[this.displayValuePath] ?? "") === this.value && !s.disabled
323
317
  );
324
- s > -1 ? this.comboBoxValue = { index: s, item: this._itemCache[s] } : this.restorePreviousSelection();
318
+ i > -1 ? this.comboBoxValue = { index: i, item: this._itemCache[i] } : this.restorePreviousSelection();
325
319
  }
326
320
  } else {
327
- const i = this._dataProvider.items[this._list.focusIndex];
328
- if (i && i.id != null) {
329
- if (i.disabled) {
321
+ const e = this._dataProvider.items[this._list.focusIndex];
322
+ if (e && e.id != null) {
323
+ if (e.disabled) {
330
324
  this.restorePreviousSelection();
331
325
  return;
332
326
  }
333
- (!this.comboBoxValue || this.isCustomValue(this.comboBoxValue) || this.comboBoxValue.item.id != i.id) && (this.comboBoxValue = { index: this._itemCache.indexOf(i), item: i });
327
+ (!this.comboBoxValue || this.isCustomValue(this.comboBoxValue) || this.comboBoxValue.item.id != e.id) && (this.comboBoxValue = { index: this._itemCache.indexOf(e), item: e });
334
328
  }
335
329
  }
336
- t !== (this.comboBoxValue ?? "") && this.dispatchSelectionChangeEvent(), this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : (e = this.comboBoxValue) == null ? void 0 : e.item);
330
+ t !== (this.comboBoxValue ?? "") && this.dispatchSelectionChangeEvent(), this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);
337
331
  }
338
332
  restorePreviousSelection() {
339
333
  this.updateInputValue(null);
@@ -396,7 +390,6 @@ const l = (o = class extends _ {
396
390
  }
397
391
  dispatchSelectionChangeEvent() {
398
392
  this.updateComplete.then(() => {
399
- var t;
400
393
  if (this.dispatchEvent(
401
394
  new CustomEvent("selection-change", {
402
395
  detail: {
@@ -407,8 +400,8 @@ const l = (o = class extends _ {
407
400
  ), this.triggerOnly)
408
401
  this.comboBoxValue = null;
409
402
  else {
410
- const e = this.comboBoxValue;
411
- this.isCustomValue(e) ? this.setFormValue(e) : this.setFormValue((t = e == null ? void 0 : e.item) == null ? void 0 : t.caption);
403
+ const t = this.comboBoxValue;
404
+ this.isCustomValue(t) ? this.setFormValue(t) : this.setFormValue(t?.item?.caption);
412
405
  }
413
406
  }).catch((t) => {
414
407
  console.error("Could not dispatch selection change event due to:", t);
@@ -434,20 +427,20 @@ const l = (o = class extends _ {
434
427
  if (this._lastRequestedPage == t && !e)
435
428
  return;
436
429
  this._pendingDataRequest && this._pendingDataRequest.cancel(o.DATA_REQUEST_CANCELLED);
437
- const i = new Promise((s, n) => {
438
- this._pendingDataRequest = { cancel: n };
430
+ const i = new Promise((s, l) => {
431
+ this._pendingDataRequest = { cancel: l };
439
432
  });
440
433
  this._lastRequestedPage = t, this._lastRequestedFilterText = this.filterText, this.setAttribute("loading", ""), Promise.race([i, this._onDataRequest(this._lastRequestedFilterText, t)]).then((s) => {
441
434
  if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == t && (this._dataProvider.finalSizeIsKnown = s.finalSizeIsKnown, e ? (this._dataProvider.items = s.items, this._itemCache = s.items) : (this._dataProvider.addItems(s.items), this._itemCache = this._dataProvider.items), this._list && (this._list.itemCount = this._dataProvider.items.length), this._popper && this.opened)) {
442
435
  if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {
443
- const n = this.comboBoxValue.item;
444
- if (this._list.selectedIndices.length == 0 || this.items[this._list.selectedIndices[0]] != n) {
445
- let a = this.items.indexOf(n);
446
- if (a == -1) {
447
- const c = n.id;
448
- c != null && (a = this.items.findIndex((m) => m.id == c));
436
+ const l = this.comboBoxValue.item;
437
+ if (this._list.selectedIndices.length == 0 || this.items[this._list.selectedIndices[0]] != l) {
438
+ let d = this.items.indexOf(l);
439
+ if (d == -1) {
440
+ const c = l.id;
441
+ c != null && (d = this.items.findIndex((m) => m.id == c));
449
442
  }
450
- this.comboBoxValue.index = a, this._list.selectedIndices = a == -1 ? [] : [a];
443
+ this.comboBoxValue.index = d, this._list.selectedIndices = d == -1 ? [] : [d];
451
444
  }
452
445
  }
453
446
  this.updateDropdownSizes(), this._popper.update();
@@ -473,39 +466,39 @@ ${s}`
473
466
  return this.displayValuePath != "caption" && this.displayValuePath != "description" && (e[this.displayValuePath] = t[this.displayValuePath] || t.getAttribute(this.displayValuePath)), e;
474
467
  }));
475
468
  }
476
- }, o.ID = D, o.ensureDefined = () => {
469
+ }, o.ID = S, o.ensureDefined = () => {
477
470
  p.ensureDefined(), customElements.get(o.ID) || customElements.define(o.ID, o);
478
471
  }, o.formAssociated = !0, o.DATA_REQUEST_CANCELLED = "cancel_data_request", o);
479
- d([
480
- r({ type: Boolean, reflect: !0 })
481
- ], l.prototype, "opened", 2);
482
- d([
483
- r({ type: Number, attribute: "item-height" })
484
- ], l.prototype, "itemHeight", 2);
485
- d([
486
- r({ type: Boolean, attribute: "allow-custom-value", reflect: !0 })
487
- ], l.prototype, "allowCustomValue", 2);
488
- d([
489
- r({ type: Boolean, attribute: "trigger-only", reflect: !0 })
490
- ], l.prototype, "triggerOnly", 2);
491
- d([
492
- r({ type: Boolean, attribute: "null-setting-disallowed", reflect: !0 })
493
- ], l.prototype, "nullSettingDisallowed", 2);
494
- d([
495
- r({ type: Boolean, attribute: "show-icon", reflect: !0 })
496
- ], l.prototype, "showIcon", 2);
497
- d([
498
- r({ type: String, attribute: "display-value-path", noAccessor: !0 })
499
- ], l.prototype, "displayValuePath", 2);
500
- d([
501
- r({ type: String, attribute: "filter-property", noAccessor: !0 })
502
- ], l.prototype, "filterProperty", 2);
503
- d([
504
- r({ type: String, attribute: !0, reflect: !0 })
505
- ], l.prototype, "id", 2);
506
- let E = l;
507
- E.ensureDefined();
472
+ r([
473
+ a({ type: Boolean, reflect: !0 })
474
+ ], n.prototype, "opened");
475
+ r([
476
+ a({ type: Number, attribute: "item-height" })
477
+ ], n.prototype, "itemHeight");
478
+ r([
479
+ a({ type: Boolean, attribute: "allow-custom-value", reflect: !0 })
480
+ ], n.prototype, "allowCustomValue");
481
+ r([
482
+ a({ type: Boolean, attribute: "trigger-only", reflect: !0 })
483
+ ], n.prototype, "triggerOnly");
484
+ r([
485
+ a({ type: Boolean, attribute: "null-setting-disallowed", reflect: !0 })
486
+ ], n.prototype, "nullSettingDisallowed");
487
+ r([
488
+ a({ type: Boolean, attribute: "show-icon", reflect: !0 })
489
+ ], n.prototype, "showIcon");
490
+ r([
491
+ a({ type: String, attribute: "display-value-path", noAccessor: !0 })
492
+ ], n.prototype, "displayValuePath");
493
+ r([
494
+ a({ type: String, attribute: "filter-property", noAccessor: !0 })
495
+ ], n.prototype, "filterProperty");
496
+ r([
497
+ a({ type: String, attribute: !0, reflect: !0 })
498
+ ], n.prototype, "id");
499
+ let L = n;
500
+ L.ensureDefined();
508
501
  export {
509
- E as default
502
+ L as default
510
503
  };
511
504
  //# sourceMappingURL=combo-box.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [\n 0,\n -parseInt(getComputedStyle(comboBox).paddingBottom, 10) -\n ((\n this.shadowRoot.querySelector(\n \".validation-message-wrapper\",\n ) as HTMLElement\n )?.offsetHeight ?? 0),\n ];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;moKAAeA,IAAA;AAAA;AAAA;AAAA,GCAAC,IAAA;AAAA;AAAA;AAAA;;;;;;ACQf,MAAMC,IAAW;AAEjB,SAASC,EAAYC,GAAiCC,GAA4B;AAC1E,MAAAC;AACJ,SAAO,YAAaC,GAAW;AAC3B,IAAID,KAAW,QACX,aAAaA,CAAO,GAExBA,IAAU,OAAO,WAAW,MAAMF,EAAK,GAAGG,CAAI,GAAGF,CAAK;AAAA,EAAA;AAE9D;AAuBA,IAAIG,IAAY;;AAuChB,MAAqBC,KAArBC,IAAA,cAAsCC,EAAQ;AAAA,EAgE1C,cAAc;AACJ,aApDV,KAAO,SAAS,IAEhB,KAAO,aAAa,IAUpB,KAAO,mBAAmB,WAInB,KAAA,KAAaD,EAAS,KAAK,MAAMF,KAEjC,KAAA,iBAAiC,CAACI,GAAYC,MAAS;AAC1D,UAAI,CAACD;AACM,eAAA;AAEL,YAAAE,IAAkBF,EAAW;AAI/B,aAHA,UAAOC,EAAK,WAAW,YAAYA,EAAK,QAAQ,YAAY,EAAE,SAASC,C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,IAAqBuD,IAArBvD;AAo9BAuD,EAAS,cAAc;"}
1
+ {"version":3,"file":"combo-box.mjs","sources":["../toggle.svg?raw","../clear.svg?raw","../combo-box.ts"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"toggle-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M13 4v2l-5 5-5-5v-2l5 5z\\\"/>\\r\\n</svg>\\r\\n\"","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" class=\\\"clear-button\\\" slot=\\\"suffix\\\" viewBox=\\\"0 0 16 16\\\">\\r\\n <path d=\\\"M12.96 4.46l-1.42-1.42-3.54 3.55-3.54-3.55-1.42 1.42 3.55 3.54-3.55 3.54 1.42 1.42 3.54-3.55 3.54 3.55 1.42-1.42-3.55-3.54 3.55-3.54z\\\"/>\\r\\n</svg>\\r\\n\"","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { unsafeCSS, PropertyValues, css, TemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { createPopper, Instance as Popper } from \"@popperjs/core\";\nimport SDInput, { CustomEventMap as InputCustomEventMap } from \"@cas-smartdesign/lit-input\";\nimport VirtualList, { SelectionType, ItemGenerator, ListDataProvider } from \"@cas-smartdesign/virtual-list\";\nimport { ItemData, generator } from \"@cas-smartdesign/list-item\";\n\nconst TAG_NAME = \"sd-combo-box\";\n\nfunction debounce<T>(func: (...args: T[]) => unknown, delay: number): typeof func {\n let timeout: number;\n return function (...args: T[]) {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n timeout = window.setTimeout(() => func(...args), delay);\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [TAG_NAME]: ComboBox;\n }\n}\n\nimport style from \"./style.scss?inline\";\nimport toggleSvg from \"./toggle.svg?raw\";\nimport clearSvg from \"./clear.svg?raw\";\nimport ImageTools from \"@cas-smartdesign/image-tools\";\n\nexport type ComboBoxValue = {\n index: number;\n item: ItemData | any;\n};\nexport type InMemoryFilter = (filterText: string, item: any) => boolean;\nexport type DataResponse = {\n items: any[];\n finalSizeIsKnown: boolean;\n};\n\nlet idCounter = 0;\n\nexport interface ISelectionEvent {\n selection: ComboBoxValue | string;\n isCustomValue: boolean;\n}\nexport interface IFilterChangeEvent {\n value: string;\n}\n\nexport interface CustomEventMap extends InputCustomEventMap {\n \"selection-change\": CustomEvent<ISelectionEvent>;\n \"filter-change\": CustomEvent<IFilterChangeEvent>;\n}\n\nexport default interface ComboBox {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\n\nexport default class ComboBox extends SDInput {\n public static readonly ID: string = TAG_NAME;\n public static ensureDefined = (): void => {\n VirtualList.ensureDefined();\n if (!customElements.get(ComboBox.ID)) {\n customElements.define(ComboBox.ID, ComboBox);\n }\n };\n static formAssociated = true;\n\n private static readonly DATA_REQUEST_CANCELLED: string = \"cancel_data_request\";\n\n @property({ type: Boolean, reflect: true })\n public opened = false;\n @property({ type: Number, attribute: \"item-height\" })\n public itemHeight = 50;\n @property({ type: Boolean, attribute: \"allow-custom-value\", reflect: true })\n public allowCustomValue: boolean;\n @property({ type: Boolean, attribute: \"trigger-only\", reflect: true })\n public triggerOnly: boolean;\n @property({ type: Boolean, attribute: \"null-setting-disallowed\", reflect: true })\n public nullSettingDisallowed: boolean;\n @property({ type: Boolean, attribute: \"show-icon\", reflect: true })\n public showIcon: boolean;\n @property({ type: String, attribute: \"display-value-path\", noAccessor: true })\n public displayValuePath = \"caption\";\n @property({ type: String, attribute: \"filter-property\", noAccessor: true })\n public filterProperty: string;\n @property({ type: String, attribute: true, reflect: true })\n public id: string = ComboBox.ID + \"_\" + idCounter++;\n\n public inMemoryFilter: InMemoryFilter = (filterText, item) => {\n if (!filterText) {\n return true;\n }\n const lowerCaseFilter = filterText.toLowerCase();\n if (typeof item.caption == \"string\" && item.caption.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n if (typeof item.description == \"string\" && item.description.toLowerCase().includes(lowerCaseFilter)) {\n return true;\n }\n return false;\n };\n\n public filterText: string;\n public minimumOverlayWidth = 250;\n\n private _comboBoxValue: ComboBoxValue | string;\n private _clearButton: SVGElement;\n private _toggleButton: SVGElement;\n private _popper: Popper;\n private _list: VirtualList;\n private _dataProvider: ListDataProvider;\n private _itemGenerator: ItemGenerator = generator;\n private _itemCache: any[] = [];\n private _declarativeItems: HTMLElement[];\n private _onDataRequest: (filterText: string, page: number) => Promise<DataResponse>;\n private _pendingDataRequest: { cancel: (reason?: any) => void };\n private _openedByFilterTextChange: boolean;\n private _lastRequestedPage: number;\n private _lastRequestedFilterText: string;\n private _icon: HTMLElement;\n\n constructor() {\n super();\n this._dataProvider = new ListDataProvider();\n this._dataProvider.finalSizeIsKnown = true;\n }\n\n public get clearFilterOnLazyLoadedSelection(): boolean {\n return this.triggerOnly;\n }\n\n /**\n * @deprecated The method should not be used.\n * Use {@link ComboBox#triggerOnly} instead.\n * @param {boolean} value\n */\n public set clearFilterOnLazyLoadedSelection(value: boolean) {\n console.warn(\n \"Using clearFilterOnLazyLoadedSelection setting on a combo-box is deprecated. Use triggerOnly instead.\",\n );\n this.triggerOnly = value;\n }\n\n public get itemGenerator(): ItemGenerator {\n return this._itemGenerator;\n }\n\n public set itemGenerator(value: ItemGenerator) {\n this._itemGenerator = value;\n if (this._list) {\n this._list.itemGenerator = this._itemGenerator;\n }\n }\n\n public get items(): any[] {\n return this._itemCache;\n }\n\n public set items(items: any[]) {\n this._itemCache = items;\n if (this.isLazyLoadConfigured) {\n this._dataProvider.items = items;\n this._lastRequestedPage = null;\n }\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n this.filterItemsInMemory();\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n public get finalSizeIsKnown(): boolean {\n return this._dataProvider.finalSizeIsKnown;\n }\n\n public set finalSizeIsKnown(value: boolean) {\n this._dataProvider.finalSizeIsKnown = value;\n }\n\n public configureLazyLoad(onDataRequest: (filterText: string, page: number) => Promise<DataResponse>): void {\n if (!onDataRequest) {\n throw new Error(\"It is not possible to configure lazy load without a given onDataRequest calback.\");\n }\n this._dataProvider.finalSizeIsKnown = false;\n this._onDataRequest = onDataRequest;\n this._dataProvider.onDataRequest = (page: number) => {\n this.requestData(page, false);\n };\n }\n\n public get comboBoxValue(): ComboBoxValue | string {\n return this._comboBoxValue;\n }\n\n public set comboBoxValue(value: ComboBoxValue | string) {\n this._comboBoxValue = value;\n this.updateInputValue(null);\n this.updateHasValue();\n }\n\n public get selectedIndex(): number {\n if (this.isCustomValue(this.comboBoxValue) || !this.comboBoxValue) {\n return -1;\n }\n return this.comboBoxValue.index;\n }\n\n public get displayValue(): string {\n return this.value;\n }\n\n public open(): void {\n this.opened = true;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n\n public render(): TemplateResult {\n return html`\n ${super.render()}\n <slot @slotchange=${this.onDefaultSlotChange} id=\"default-slot\"></slot>\n `;\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue !== newValue) {\n switch (name) {\n case \"opened\": {\n this.handleOpenedStateChange();\n break;\n }\n case \"item-height\": {\n if (this._list) {\n this._list.itemHeight = this.itemHeight;\n }\n break;\n }\n case \"id\": {\n this.updateListId();\n break;\n }\n }\n }\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n\n if (this.value && !this.comboBoxValue) {\n this.updateComboBoxValueFromValue();\n }\n window.requestAnimationFrame(() => {\n this.initClearButtton();\n this.initToggleButtton();\n this.updateHasValue();\n\n this.addEventListener(\"click\", () => {\n if (!this.disabled) {\n this.opened = !this.opened;\n }\n });\n this.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n if (!this.disabled) {\n this.handleKeyDown(event);\n }\n });\n });\n this.inputElement.setAttribute(\"role\", \"combobox\");\n this.inputElement.setAttribute(\"aria-autocomplete\", \"list\");\n }\n\n private updateComboBoxValueFromValue() {\n if (this.value) {\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value,\n );\n if (selectedIndex > -1) {\n this._comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else if (this.allowCustomValue) {\n this._comboBoxValue = this.value;\n } else {\n this._comboBoxValue = null;\n }\n this.updateHasValue();\n this.updateIconFromCurrentValue();\n }\n }\n\n public updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has(\"showIcon\")) {\n if (this.showIcon) {\n if (this._icon == null) {\n this.initIconWrapper();\n }\n } else if (this._icon != null) {\n this._icon.remove();\n this._icon = null;\n }\n }\n if (changedProperties.has(\"currentText\")) {\n this.updateHasValue();\n }\n if (changedProperties.has(\"triggerOnly\") && this._list) {\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n }\n }\n\n private initIconWrapper() {\n this._icon = document.createElement(\"div\");\n this._icon.className = \"icon-wrapper\";\n this._icon.role = \"img\";\n const iconEl = document.createElement(\"div\");\n iconEl.style.backgroundRepeat = \"no-repeat\";\n iconEl.style.backgroundPosition = \"center\";\n iconEl.style.backgroundSize = \"cover\";\n iconEl.style.height = \"24px\";\n iconEl.style.width = \"24px\";\n this._icon.appendChild(iconEl);\n this._icon.slot = \"prefix\";\n this.appendChild(this._icon);\n this.updateIconFromCurrentValue();\n }\n\n private updateIconFromCurrentValue() {\n if (this.isCustomValue(this.comboBoxValue)) {\n this.updateIcon(null);\n } else {\n this.updateIcon(this.comboBoxValue?.item);\n }\n }\n\n private updateIcon(item) {\n if (this._icon) {\n if (item && (item.icon || item.iconPlaceholder)) {\n const selectedItem = item as {\n iconBackgroundColor?: string;\n attributes?: Record<string, string>;\n };\n if (selectedItem.attributes == null) {\n this._icon.title = \"\";\n this._icon.ariaLabel = \"\";\n } else {\n this._icon.title = selectedItem.attributes[\"icon-attr-title\"] ?? \"\";\n this._icon.ariaLabel = selectedItem.attributes[\"icon-attr-aria-label\"] ?? \"\";\n }\n this._icon.style.backgroundColor = selectedItem.iconBackgroundColor;\n this._icon.style.display = \"\";\n ImageTools.showImage(this._icon.querySelector(\"div\"), item.icon, item.iconPlaceholder);\n } else if (this._icon) {\n this._icon.style.display = \"none\";\n }\n }\n }\n\n private updateHasValue() {\n if (this.currentText || (this.comboBoxValue != null && this.comboBoxValue != \"\")) {\n this.setAttribute(\"has-value\", \"\");\n if (this._clearButton) {\n this._clearButton.style.display = \"\";\n }\n } else {\n this.removeAttribute(\"has-value\");\n }\n }\n\n protected shouldFloat() {\n return super.shouldFloat() || (this.comboBoxValue != null && this.comboBoxValue != \"\");\n }\n\n private initClearButtton(): void {\n const clearButtonTemplate = document.createElement(\"template\");\n clearButtonTemplate.innerHTML = clearSvg;\n this._clearButton = clearButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._clearButton);\n\n this._clearButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n this.clearValue();\n });\n }\n\n private initToggleButtton(): void {\n const toggleButtonTemplate = document.createElement(\"template\");\n toggleButtonTemplate.innerHTML = toggleSvg;\n this._toggleButton = toggleButtonTemplate.content.firstChild as SVGElement;\n this.appendChild(this._toggleButton);\n\n this._toggleButton.addEventListener(\"click\", (event) => {\n event.preventDefault();\n event.stopPropagation();\n this.opened = !this.opened;\n this.select();\n });\n }\n\n private debouncedFilterItemsInMemory = debounce(this.filterItemsInMemory.bind(this), 200);\n private filterItemsInMemory(): void {\n if (this.isLazyLoadConfigured) {\n return;\n }\n let filteredInMemory = false;\n if (this.filterText) {\n if (this.filterProperty) {\n this._dataProvider.items = this._itemCache.filter((item) => {\n return item[this.filterProperty] && String(item[this.filterProperty]).indexOf(this.filterText) > -1;\n });\n filteredInMemory = true;\n } else if (this.inMemoryFilter) {\n this._dataProvider.items = this._itemCache.filter((item) => this.inMemoryFilter(this.filterText, item));\n filteredInMemory = true;\n }\n }\n if (!filteredInMemory) {\n this._dataProvider.items = this._itemCache;\n if (this._list) {\n this.updateFocusAndSelectedIndexFromValue();\n }\n } else if (this._list) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n let index = this._dataProvider.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this._dataProvider.items.findIndex((item: any) => item.id == selectedId);\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = null;\n }\n }\n if (this.opened && this._popper) {\n this._popper.update();\n }\n }\n\n private ensureListAndPopperInitialized(): void {\n if (!this._list) {\n this._list = document.createElement(VirtualList.ID) as VirtualList;\n this.updateListId();\n this._list.classList.add(\"combo-box-dropdown\");\n this._list.itemHeight = this.itemHeight;\n this._list.itemGenerator = this.itemGenerator;\n this._list.selectionType = this.triggerOnly ? SelectionType.TriggerOnly : SelectionType.Single;\n this._list.setAttribute(\"focus-target\", \"\");\n Object.assign(this._list.style, {\n zIndex: \"21000\",\n boxShadow: `rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,\n rgba(0, 0, 0, 0.12) 0px 1px 5px 0px,\n rgba(0, 0, 0, 0.2) 0px 3px 1px -2px`,\n background: \"white\",\n overflowY: \"auto\",\n });\n this._list.addEventListener(\"selection\", this.handleSelection);\n this._dataProvider.connectList(this._list);\n }\n if (!this._popper) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const comboBox = this;\n this._popper = createPopper(this, this._list, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"computeStyles\",\n options: {\n gpuAcceleration: true,\n },\n },\n {\n name: \"hide\",\n enabled: false,\n },\n {\n name: \"closeIfReferenceHidden\",\n enabled: true,\n phase: \"afterWrite\",\n fn({ state }) {\n const comboBox = state.elements.reference as ComboBox;\n comboBox.closeIfNotVisible();\n },\n },\n {\n name: \"offset\",\n options: {\n offset: ({ placement }) => {\n if (placement.indexOf(\"top\") > -1) {\n return [0, -parseInt(getComputedStyle(comboBox).paddingTop, 10)];\n }\n if (placement.indexOf(\"bottom\") > -1) {\n return [\n 0,\n -parseInt(getComputedStyle(comboBox).paddingBottom, 10) -\n ((\n this.shadowRoot.querySelector(\n \".validation-message-wrapper\",\n ) as HTMLElement\n )?.offsetHeight ?? 0),\n ];\n }\n return [0, 0];\n },\n },\n },\n {\n name: \"adjustWidthIfNeeded\",\n enabled: true,\n phase: \"read\",\n fn({ state }) {\n const list = state.elements.popper as VirtualList;\n list.increaseWidthOnNextRenderIfNeeded();\n },\n },\n ],\n });\n }\n }\n\n private closeIfNotVisible(): void {\n const elementFromPoint = this.elementFromMiddleOfComboBox();\n // elementFromPoint might be the list itself in Safari, thus it needs to be checked as well (Fixes: 244485)\n if (\n !this.contains(elementFromPoint) &&\n !this.shadowRoot.contains(elementFromPoint) &&\n elementFromPoint !== this._list\n ) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n }\n\n private elementFromMiddleOfComboBox(): Element {\n const rect = this.getBoundingClientRect();\n return document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);\n }\n\n private handleSelection = (event: CustomEvent) => {\n const selectedItem = this._dataProvider.items[event.detail.index];\n if (!event.detail.selected) {\n // null selection is not allowed via clicking inside the dropdown\n this._list.selectedIndices = [event.detail.index];\n }\n this.comboBoxValue = { index: this._itemCache.indexOf(selectedItem), item: selectedItem };\n this.dispatchSelectionChangeEvent();\n this.opened = false;\n };\n\n private async handleOpenedStateChange(): Promise<void> {\n this.inputElement.setAttribute(\"aria-expanded\", String(this.opened));\n if (this.opened) {\n if (!this.disabled) {\n this.ensureListAndPopperInitialized();\n\n const filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n if (this.isLazyLoadConfigured && (this.items.length == 0 || filterChanged)) {\n this.requestData(0, filterChanged);\n }\n\n this.updateDropdownSizes();\n this.ownerDocument.body.appendChild(this._list);\n this.updateFocusAndSelectedIndexFromValue();\n\n window.requestAnimationFrame(() => {\n if (this._popper) {\n this._popper.update();\n }\n });\n\n window.addEventListener(\"pointerdown\", this.handleWindowPointerDown);\n\n if (!this.allowCustomValue && !this._openedByFilterTextChange) {\n this.select();\n }\n }\n this._openedByFilterTextChange = false;\n } else {\n await this._list.updateComplete;\n if (this._popper) {\n await this._popper.update;\n }\n this.ownerDocument.body.removeChild(this._list);\n window.removeEventListener(\"pointerdown\", this.handleWindowPointerDown);\n this.updateValueOnClose();\n this.clearFilter();\n this.setSelectionRange(0, 0);\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n\n if (this._popper) {\n this._popper.destroy();\n this._popper = null;\n }\n }\n }\n\n private updateValueOnClose(): void {\n const oldValue = this.comboBoxValue ?? \"\";\n if (this.nullSettingDisallowed && !this.value && this.comboBoxValue) {\n this.restorePreviousSelection();\n } else if (this.value !== (this.convertToDisplayValue(null) ?? \"\")) {\n // value change only if needed\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n disabled?: boolean;\n };\n if (focusedItem && (focusedItem[this.displayValuePath] ?? \"\") === this.value) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n // 1. select focused item if the input's value is the same\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n } else if (this.allowCustomValue || !this.value) {\n // 2. set as a custom or empty value\n this.comboBoxValue = this.value;\n } else {\n // 3. try to search for an identical item\n const selectedIndex = this._itemCache.findIndex(\n (item) => (item[this.displayValuePath] ?? \"\") === this.value && !item.disabled,\n );\n if (selectedIndex > -1) {\n this.comboBoxValue = { index: selectedIndex, item: this._itemCache[selectedIndex] };\n } else {\n this.restorePreviousSelection(); // Fixes C1XRTYID\n }\n }\n } else {\n // Allow selecting another item with same caption but different id\n const focusedItem = this._dataProvider.items[this._list.focusIndex] as {\n id?: string;\n disabled?: boolean;\n };\n if (focusedItem && focusedItem.id != null) {\n if (focusedItem.disabled) {\n this.restorePreviousSelection();\n return;\n }\n if (\n !this.comboBoxValue ||\n this.isCustomValue(this.comboBoxValue) ||\n this.comboBoxValue.item.id != focusedItem.id\n ) {\n this.comboBoxValue = { index: this._itemCache.indexOf(focusedItem), item: focusedItem };\n }\n }\n }\n if (oldValue !== (this.comboBoxValue ?? \"\")) {\n this.dispatchSelectionChangeEvent();\n }\n this.updateIcon(this.isCustomValue(this.comboBoxValue) ? null : this.comboBoxValue?.item);\n }\n\n private restorePreviousSelection() {\n this.updateInputValue(null);\n }\n\n private updateFocusAndSelectedIndexFromValue(): void {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue) && !this._openedByFilterTextChange) {\n let index = this.comboBoxValue.index;\n if (index == -1 || this.isLazyLoadConfigured) {\n index = this.items.indexOf(this.comboBoxValue.item);\n if (index == -1) {\n const selectedId = this.comboBoxValue.item.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n }\n this._list.focusIndex = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n } else {\n this._list.focusIndex = -1;\n this._list.selectedIndices = [];\n }\n this.updateActiveDescendant();\n }\n\n private handleWindowPointerDown = (event: PointerEvent) => {\n const contains = event.target instanceof Node && this.contains(event.target);\n if (!contains && this.opened && event.composedPath().indexOf(this._list) === -1) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"Down\":\n case \"ArrowDown\": {\n event.preventDefault();\n this.navigateInList(+1);\n break;\n }\n case \"Up\":\n case \"ArrowUp\": {\n event.preventDefault();\n this.navigateInList(-1);\n break;\n }\n case \"Enter\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n this.opened = false;\n }\n break;\n }\n case \"Escape\": {\n if (this.opened) {\n event.preventDefault();\n event.stopPropagation();\n if (\n this._list.selectedIndices.indexOf(this._list.focusIndex) > -1 &&\n this._dataProvider.items.length > this._list.focusIndex\n ) {\n this.opened = false;\n } else {\n this.clearFilter();\n this.updateInputValue(null);\n this.updateFocusAndSelectedIndexFromValue();\n if (!this._list.selectedIndices.includes(this._list.focusIndex)) {\n this._list.selectedIndices.push(this._list.focusIndex);\n }\n }\n }\n break;\n }\n case \"Tab\": {\n if (this.opened) {\n if (this.triggerOnly) {\n this.value = null;\n }\n this.opened = false;\n }\n break;\n }\n }\n };\n\n private navigateInList(offset: number): void {\n if (!this.opened) {\n this.opened = true;\n } else {\n if (this._list.focusIndex == null) {\n if (offset > 0) {\n this._list.focusIndex = 0;\n } else {\n this._list.focusIndex = Math.max(0, this._dataProvider.items.length - 1);\n }\n } else {\n this._list.focusIndex = Math.max(\n 0,\n Math.min(this._dataProvider.items.length - 1, this._list.focusIndex + offset),\n );\n }\n this.updateInputValue(this._dataProvider.items[this._list.focusIndex] as ItemData | any);\n this.updateActiveDescendant();\n if (!this.allowCustomValue) {\n this.select();\n }\n }\n }\n\n private updateActiveDescendant() {\n const focusedListItem = this._list && this._list.getListItem(this._list.focusIndex);\n if (focusedListItem) {\n this.inputElement.setAttribute(\"aria-activedescendant\", focusedListItem.id);\n } else {\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n }\n }\n\n private updateInputValue(item: ItemData): void {\n this.updateComplete.then(() => {\n this.value = this.convertToDisplayValue(item);\n if (item) {\n this.updateIcon(item);\n } else {\n this.updateIconFromCurrentValue();\n }\n });\n }\n\n private convertToDisplayValue(item: ItemData): string {\n if (item) {\n return item[this.displayValuePath];\n } else if (this.comboBoxValue) {\n if (this.isCustomValue(this.comboBoxValue)) {\n return this.comboBoxValue;\n } else {\n return this.comboBoxValue.item[this.displayValuePath];\n }\n } else {\n return null;\n }\n }\n\n protected fireValueChange(immediate?: boolean): void {\n if (immediate) {\n if (this.filterText !== this.value) {\n const effectiveFilterChange = (this.filterText ?? \"\") !== this.value;\n this.filterText = this.value;\n this.updateIcon(null);\n if (!this.opened) {\n this._openedByFilterTextChange = true;\n this.opened = true;\n }\n if (effectiveFilterChange) {\n this.dispatchFilterChangeEvent();\n this.debouncedFilterItemsInMemory();\n }\n }\n }\n // consume both change events triggered from input, combo box provides a different API for that\n }\n\n private clearValue(): void {\n if (!this.nullSettingDisallowed) {\n this.value = null;\n this.inputElement.removeAttribute(\"aria-activedescendant\");\n if (this._list) {\n this._list.selectedIndices = [];\n }\n this.clearFilter();\n if (this.comboBoxValue) {\n this.comboBoxValue = null;\n this.dispatchSelectionChangeEvent();\n }\n this.requestUpdate();\n }\n }\n\n private clearFilter(): void {\n if (this.filterText != null) {\n this.filterText = undefined;\n this.filterItemsInMemory();\n this.dispatchFilterChangeEvent();\n this.updateIconFromCurrentValue();\n }\n }\n\n private updateDropdownSizes(): void {\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n const overlayMaxHeight = (viewportHeight - this.offsetHeight) * 0.5;\n Object.assign(this._list.style, {\n maxHeight: `${overlayMaxHeight}px`,\n minWidth: `${Math.max(this.offsetWidth, this.minimumOverlayWidth)}px`,\n maxWidth: `max(50vw, ${this.offsetWidth}px)`,\n });\n }\n\n private updateListId() {\n if (this.inputElement && this._list) {\n this._list.id = this.id + \"_list\";\n this.inputElement.setAttribute(\"aria-controls\", this._list.id);\n }\n }\n\n private isCustomValue(value: ComboBoxValue | string): value is string {\n return typeof value === \"string\";\n }\n\n private dispatchSelectionChangeEvent(): void {\n this.updateComplete\n .then(() => {\n this.dispatchEvent(\n new CustomEvent<ISelectionEvent>(\"selection-change\", {\n detail: {\n selection: this.comboBoxValue,\n isCustomValue: this.isCustomValue(this.comboBoxValue),\n },\n }),\n );\n if (this.triggerOnly) {\n this.comboBoxValue = null;\n } else {\n const comboBoxValue = this.comboBoxValue;\n if (this.isCustomValue(comboBoxValue)) {\n this.setFormValue(comboBoxValue);\n } else {\n this.setFormValue(comboBoxValue?.item?.caption);\n }\n }\n })\n .catch((e) => {\n console.error(\"Could not dispatch selection change event due to:\", e);\n });\n }\n\n private dispatchFilterChangeEvent(): void {\n this.dispatchEvent(\n new CustomEvent<IFilterChangeEvent>(\"filter-change\", {\n detail: { value: this.filterText },\n composed: true,\n }),\n );\n this.debouncedRequestData(0);\n }\n\n private get isLazyLoadConfigured(): boolean {\n return !!this._onDataRequest;\n }\n\n /**\n * Used only when lazy loading is configured.\n */\n private debouncedRequestData = debounce(this.requestData.bind(this), 250);\n private requestData(page: number, filterChanged?: boolean) {\n if (filterChanged == null) {\n filterChanged = (this.filterText ?? \"\") !== (this._lastRequestedFilterText ?? \"\");\n }\n if (this.isLazyLoadConfigured) {\n if (!this.opened) {\n if (filterChanged) {\n this._dataProvider.items = [];\n this._itemCache = [];\n }\n return;\n }\n if (this._lastRequestedPage == page && !filterChanged) {\n return;\n }\n if (this._pendingDataRequest) {\n this._pendingDataRequest.cancel(ComboBox.DATA_REQUEST_CANCELLED);\n }\n const cancellationPromise = new Promise<DataResponse>((_resolve, reject) => {\n this._pendingDataRequest = { cancel: reject };\n });\n this._lastRequestedPage = page;\n this._lastRequestedFilterText = this.filterText;\n this.setAttribute(\"loading\", \"\");\n Promise.race([cancellationPromise, this._onDataRequest(this._lastRequestedFilterText, page)])\n .then((dataResponse) => {\n if (this.filterText == this._lastRequestedFilterText && this._lastRequestedPage == page) {\n this._dataProvider.finalSizeIsKnown = dataResponse.finalSizeIsKnown;\n if (filterChanged) {\n this._dataProvider.items = dataResponse.items;\n this._itemCache = dataResponse.items;\n } else {\n this._dataProvider.addItems(dataResponse.items);\n this._itemCache = this._dataProvider.items;\n }\n if (this._list) {\n this._list.itemCount = this._dataProvider.items.length;\n }\n if (this._popper && this.opened) {\n if (this.comboBoxValue && !this.isCustomValue(this.comboBoxValue)) {\n const selectedItem = this.comboBoxValue.item;\n if (\n this._list.selectedIndices.length == 0 ||\n this.items[this._list.selectedIndices[0]] != selectedItem\n ) {\n let index = this.items.indexOf(selectedItem);\n if (index == -1) {\n const selectedId = selectedItem.id;\n if (selectedId != null) {\n index = this.items.findIndex((item) => item.id == selectedId);\n }\n }\n this.comboBoxValue.index = index;\n this._list.selectedIndices = index == -1 ? [] : [index];\n }\n }\n this.updateDropdownSizes();\n this._popper.update();\n }\n }\n this._pendingDataRequest = null;\n this.removeAttribute(\"loading\");\n })\n .catch((e) => {\n if (e !== ComboBox.DATA_REQUEST_CANCELLED) {\n console.error(\n `Data could not be loaded for filter \"${this._lastRequestedFilterText}\" and page number \"${page}\" due to the following error:\\n${e}`,\n );\n this._dataProvider.finalSizeIsKnown = true;\n\n if (this.items.length == 0) {\n this.opened = false;\n } else if (this._list) {\n this._list.itemCount = this.items.length;\n }\n this.removeAttribute(\"loading\");\n }\n this._pendingDataRequest = null;\n });\n }\n }\n\n private get defaultSlot(): HTMLSlotElement {\n return this.shadowRoot.querySelector(\"#default-slot\");\n }\n\n private onDefaultSlotChange(): void {\n this._declarativeItems = this.defaultSlot.assignedElements() as HTMLElement[];\n if (this._declarativeItems.length > 0) {\n this.finalSizeIsKnown = true;\n this.itemGenerator = (_data, index) => {\n return this._declarativeItems[index].cloneNode(true) as HTMLElement;\n };\n this.items = this._declarativeItems.map((item) => {\n const data = {\n caption: item.getAttribute(\"caption\"),\n description: item.getAttribute(\"description\"),\n };\n if (\"caption\" != this.displayValuePath && \"description\" != this.displayValuePath) {\n data[this.displayValuePath] =\n item[this.displayValuePath] || item.getAttribute(this.displayValuePath);\n }\n return data;\n });\n }\n }\n}\n\nComboBox.ensureDefined();\n"],"names":["toggleSvg","clearSvg","TAG_NAME","debounce","func","delay","timeout","args","idCounter","_ComboBox","_a","SDInput","filterText","item","lowerCaseFilter","generator","event","selectedItem","ListDataProvider","value","items","onDataRequest","page","css","unsafeCSS","style","html","name","oldValue","newValue","changedProperties","selectedIndex","SelectionType","iconEl","ImageTools","clearButtonTemplate","toggleButtonTemplate","filteredInMemory","index","selectedId","VirtualList","comboBox","createPopper","state","placement","elementFromPoint","rect","filterChanged","focusedItem","offset","focusedListItem","immediate","effectiveFilterChange","overlayMaxHeight","comboBoxValue","e","cancellationPromise","_resolve","reject","dataResponse","_data","data","__decorateClass","property","ComboBox"],"mappings":";;;;;;;6mKAAAA,IAAe;AAAA;AAAA;AAAA,GCAfC,IAAe;AAAA;AAAA;AAAA;;;;;;ACQf,MAAMC,IAAW;AAEjB,SAASC,EAAYC,GAAiCC,GAA4B;AAC9E,MAAIC;AACJ,SAAO,YAAaC,GAAW;AAC3B,IAAID,KAAW,QACX,aAAaA,CAAO,GAExBA,IAAU,OAAO,WAAW,MAAMF,EAAK,GAAGG,CAAI,GAAGF,CAAK;AAAA,EAC1D;AACJ;AAuBA,IAAIG,IAAY;;AAuChB,MAAqBC,KAArBC,IAAA,cAAsCC,EAAQ;AAAA,EAgE1C,cAAc;AACV,UAAA,GApDJ,KAAO,SAAS,IAEhB,KAAO,aAAa,IAUpB,KAAO,mBAAmB,WAI1B,KAAO,KAAaD,EAAS,KAAK,MAAMF,KAExC,KAAO,iBAAiC,CAACI,GAAYC,MAAS;AAC1D,UAAI,CAACD;AACD,eAAO;AAEX,YAAME,IAAkBF,EAAW,YAAA;AAInC,aAHI,UAAOC,EAAK,WAAW,YAAYA,EAAK,QAAQ,YAAA,EAAc,SAASC,CAAe,KAGtF,OAAOD,EAAK,eAAe,YAAYA,EAAK,YAAY,YAAA,EAAc,SAASC,CAAe;AAAA,IAItG,GAGA,K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A,EAAwB,yBAAiC,uBAV7DA;AAaWoD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAZzBtD,EAaV,WAAA,QAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,eAAe;AAAA,GAdnCtD,EAeV,WAAA,YAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,WAAW,sBAAsB,SAAS,IAAM;AAAA,GAhB1DtD,EAiBV,WAAA,kBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,WAAW,gBAAgB,SAAS,IAAM;AAAA,GAlBpDtD,EAmBV,WAAA,aAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,WAAW,2BAA2B,SAAS,IAAM;AAAA,GApB/DtD,EAqBV,WAAA,uBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,SAAS,WAAW,aAAa,SAAS,IAAM;AAAA,GAtBjDtD,EAuBV,WAAA,UAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,YAAY,IAAM;AAAA,GAxB5DtD,EAyBV,WAAA,kBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,mBAAmB,YAAY,IAAM;AAAA,GA1BzDtD,EA2BV,WAAA,gBAAA;AAEAqD,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ,WAAW,IAAM,SAAS,IAAM;AAAA,GA5BzCtD,EA6BV,WAAA,IAAA;AA7BX,IAAqBuD,IAArBvD;AAo9BAuD,EAAS,cAAA;"}
@@ -1 +1 @@
1
- import"./doc.mjs";const n="monkey.svg",a="placeholder.svg",t=[];t.push({caption:"Item A",description:"This is A",icon:n,id:"1"});t.push({caption:"Item B",description:"This is B",icon:n,id:"2"});t.push({caption:"Item C",description:"This is C",icon:n,id:"3"});t.push({description:"Without caption",icon:n,id:"4"});t.push({icon:a,id:"5"});const l=document.querySelector("#basic-examples-container");l.querySelectorAll("sd-combo-box").forEach(e=>{e.items=t,e.addEventListener("selection-change",s=>{var i;console.log(`Selection change for combobox #${e.id}`);const o=(i=s.detail)==null?void 0:i.selection;o?s.detail.isCustomValue?console.log(`The entered custom value is '${o}'`):console.log(`The selected item is ${o.item.caption}`):console.log("Item is deselected")})});l.querySelectorAll(".trigger-only-example-wrapper").forEach(e=>{const s=e.querySelector("sd-combo-box[trigger-only]"),o=e.querySelector("span");s.addEventListener("selection-change",i=>{const c=i.detail.selection;if(i.detail.isCustomValue)o.textContent=c;else if(c){const r=c;o.textContent=r.item.caption}})});
1
+ import"./doc.mjs";const s="monkey.svg",a="placeholder.svg",t=[];t.push({caption:"Item A",description:"This is A",icon:s,id:"1"});t.push({caption:"Item B",description:"This is B",icon:s,id:"2"});t.push({caption:"Item C",description:"This is C",icon:s,id:"3"});t.push({description:"Without caption",icon:s,id:"4"});t.push({icon:a,id:"5"});const l=document.querySelector("#basic-examples-container");l.querySelectorAll("sd-combo-box").forEach(e=>{e.items=t,e.addEventListener("selection-change",i=>{console.log(`Selection change for combobox #${e.id}`);const o=i.detail?.selection;o?i.detail.isCustomValue?console.log(`The entered custom value is '${o}'`):console.log(`The selected item is ${o.item.caption}`):console.log("Item is deselected")})});l.querySelectorAll(".trigger-only-example-wrapper").forEach(e=>{const i=e.querySelector("sd-combo-box[trigger-only]"),o=e.querySelector("span");i.addEventListener("selection-change",c=>{const n=c.detail.selection;if(c.detail.isCustomValue)o.textContent=n;else if(n){const r=n;o.textContent=r.item.caption}})});
@@ -1 +1 @@
1
- import{h as n}from"./doc.mjs";const a="./monkey.svg",t=[];t.push({caption:"Item A",description:"This is A",icon:a});t.push({caption:"Item B",description:"This is B",icon:a});t.push({caption:"Item C",description:"This is C",icon:a});document.querySelectorAll("#validation-examples-container sd-combo-box").forEach(e=>{e.items=t,s(e),e.addEventListener("selection-change",i=>{s(e)})});function s(e){const i=e.comboBoxValue;e.hasAttribute("long-validation-message")?(e.validationMessage="This is a long validation message that might not fit into a single line.",i&&(e.validationMessage+=` Especially if '${i.item.caption}' is selected`),e.validationLevel=n.Warn):i?(e.validationMessage=null,e.validationLevel=null):(e.validationMessage="Should not be empty",e.validationLevel=n.Error)}
1
+ import{a as n}from"./doc.mjs";const a="./monkey.svg",t=[];t.push({caption:"Item A",description:"This is A",icon:a});t.push({caption:"Item B",description:"This is B",icon:a});t.push({caption:"Item C",description:"This is C",icon:a});document.querySelectorAll("#validation-examples-container sd-combo-box").forEach(e=>{e.items=t,s(e),e.addEventListener("selection-change",i=>{s(e)})});function s(e){const i=e.comboBoxValue;e.hasAttribute("long-validation-message")?(e.validationMessage="This is a long validation message that might not fit into a single line.",i&&(e.validationMessage+=` Especially if '${i.item.caption}' is selected`),e.validationLevel=n.Warn):i?(e.validationMessage=null,e.validationLevel=null):(e.validationMessage="Should not be empty",e.validationLevel=n.Error)}