@ekzo-dev/bootstrap-addons 5.2.11 → 5.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ekzo-dev/bootstrap-addons",
3
3
  "description": "Aurelia Bootstrap additional component",
4
- "version": "5.2.11",
4
+ "version": "5.2.12",
5
5
  "homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,16 +27,16 @@
27
27
  <input
28
28
  class="form-select ${bsSize ? `form-select-${bsSize}` : ''} ${valid ? 'is-valid' : valid === false ? 'is-invalid' : ''}"
29
29
  bs-dropdown-toggle="arrow.bind: false"
30
- value="${selectedOption?.group ? selectedOption.group + ' / ' : ''}${selectedOption?.text}"
30
+ value="${selectedOption?.group ? selectedOption.group + ' / ' : ''}${selectedOption?.text ?? ''}"
31
31
  disabled.bind="disabled"
32
32
  required.bind="required"
33
- readonly
33
+ keydown.trigger="$event.preventDefault()"
34
34
  />
35
35
  <bs-dropdown-menu>
36
- <div bs-dropdown-item="text" if.bind="options.length > 10">
36
+ <div bs-dropdown-item="text" if.bind="optionsCount > 10">
37
37
  <input class="form-control" placeholder="Filter options" type="search" value.bind="filter & debounce:250" />
38
38
  </div>
39
- <hr bs-dropdown-item="divider" if.bind="options.length > 10" />
39
+ <hr bs-dropdown-item="divider" if.bind="optionsCount > 10" />
40
40
  <button
41
41
  type="button"
42
42
  repeat.for="option of ungroupedOptions | filter:filter"
@@ -33,6 +33,8 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
33
33
 
34
34
  filter: string = '';
35
35
 
36
+ optionsCount: number = 0;
37
+
36
38
  attached() {
37
39
  if (this.multiple) {
38
40
  this.#setHeight();
@@ -89,8 +91,11 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
89
91
  options = Object.entries(options);
90
92
  }
91
93
 
94
+ this.optionsCount = (options as []).length;
95
+
96
+ const isEntries = Array.isArray(options[0]);
92
97
  const option = (options as Array<ISelectOption | readonly [unknown, string]>).find((option) => {
93
- const val: unknown = Array.isArray(option) ? option[0] : (option as ISelectOption).value;
98
+ const val: unknown = isEntries ? option[0] : (option as ISelectOption).value;
94
99
 
95
100
  return matcher ? matcher(value, val) : value === val;
96
101
  });
@@ -101,6 +106,6 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
101
106
  void Promise.resolve().then(() => (this.value = undefined));
102
107
  }
103
108
 
104
- return Array.isArray(option) ? { value: option[0], text: option[1] } : (option as ISelectOption);
109
+ return isEntries ? { value: option[0], text: option[1] } : (option as ISelectOption);
105
110
  }
106
111
  }