@quandis/qbo4.ui 4.0.1-CI-20240425-191430 → 4.0.1-CI-20240426-215901

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.
@@ -24,8 +24,11 @@ export class QboSelect extends QboFetch
24
24
  @property({ type: String })
25
25
  defaultValue = null;
26
26
 
27
- @property({ attribute: 'qbo-class' })
28
- qboClass = null;
27
+ @property({ type: String })
28
+ emptyOptionText: String | null = '--';
29
+
30
+ @property({ type: String })
31
+ emptyOptionValue: String | null = '';
29
32
 
30
33
  @property({ type: Array })
31
34
  options: Array<{ [key: string]: string }> | null = [];
@@ -57,9 +60,9 @@ export class QboSelect extends QboFetch
57
60
  this.optionValue ??= Object.keys(this.options[0])[0];
58
61
  this.optionText ??= Object.keys(this.options[0])[1] ?? this.optionValue;
59
62
 
60
- return html`
61
- <select class=${this.qboClass}>
62
- ${this.options.map(option => html`<option value="${option[this.optionValue!]}" ?selected="${option[this.optionValue!] === this.defaultValue}">${option[this.optionText!]}</option>`)}
63
- </select>`;
63
+ return html`<select ?disabled=${this.hasAttribute('disabled')} class=${this.getAttribute('class')}>
64
+ <option value="${this.emptyOptionValue}">${this.emptyOptionText}</option>
65
+ ${this.options.map(option => html`<option value="${option[this.optionValue!]}" ?selected="${option[this.optionValue!] == this.defaultValue}">${option[this.optionText!]}</option>`)}
66
+ </select>`;
64
67
  }
65
68
  }