@ekzo-dev/bootstrap-addons 5.2.12 → 5.2.13
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.
|
|
4
|
+
"version": "5.2.13",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -25,11 +25,16 @@
|
|
|
25
25
|
</fieldset>
|
|
26
26
|
<template else>
|
|
27
27
|
<input
|
|
28
|
+
id.bind="id"
|
|
28
29
|
class="form-select ${bsSize ? `form-select-${bsSize}` : ''} ${valid ? 'is-valid' : valid === false ? 'is-invalid' : ''}"
|
|
29
30
|
bs-dropdown-toggle="arrow.bind: false"
|
|
30
31
|
value="${selectedOption?.group ? selectedOption.group + ' / ' : ''}${selectedOption?.text ?? ''}"
|
|
31
32
|
disabled.bind="disabled"
|
|
32
33
|
required.bind="required"
|
|
34
|
+
form.bind="form & attr"
|
|
35
|
+
name.bind="name & attr"
|
|
36
|
+
title.bind="title & attr"
|
|
37
|
+
autocomplete.bind="autocomplete & attr"
|
|
33
38
|
keydown.trigger="$event.preventDefault()"
|
|
34
39
|
/>
|
|
35
40
|
<bs-dropdown-menu>
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
BsSelect as BaseBsSelect,
|
|
11
11
|
ISelectOption,
|
|
12
12
|
} from '@ekzo-dev/bootstrap';
|
|
13
|
-
import {
|
|
14
|
-
import { bindable, customElement, ICustomElementViewModel } from 'aurelia';
|
|
13
|
+
import { customElement, ICustomElementViewModel } from 'aurelia';
|
|
15
14
|
|
|
16
15
|
import { Filter } from './filter';
|
|
17
16
|
|
|
@@ -26,9 +25,6 @@ const BS_SIZE_MULTIPLIER = {
|
|
|
26
25
|
dependencies: [BsDropdown, BsDropdownMenu, BsDropdownToggle, BsDropdownItem, Filter],
|
|
27
26
|
})
|
|
28
27
|
export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
29
|
-
@bindable(coerceBoolean)
|
|
30
|
-
resetUnknownValue: boolean = true;
|
|
31
|
-
|
|
32
28
|
control!: HTMLFieldSetElement;
|
|
33
29
|
|
|
34
30
|
filter: string = '';
|
|
@@ -94,18 +90,22 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
94
90
|
this.optionsCount = (options as []).length;
|
|
95
91
|
|
|
96
92
|
const isEntries = Array.isArray(options[0]);
|
|
97
|
-
|
|
98
|
-
const
|
|
93
|
+
let option = (options as Array<ISelectOption | readonly [unknown, string]>).find((option) => {
|
|
94
|
+
const currentValue: unknown = isEntries ? option[0] : (option as ISelectOption).value;
|
|
99
95
|
|
|
100
|
-
return matcher ? matcher(value,
|
|
96
|
+
return matcher ? matcher(value, currentValue) : value === currentValue;
|
|
101
97
|
});
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
option = isEntries && option !== undefined ? { value: option[0], text: option[1] } : (option as ISelectOption);
|
|
100
|
+
|
|
101
|
+
// update value next tick if it differs from current
|
|
102
|
+
const foundValue = option?.value;
|
|
103
|
+
|
|
104
|
+
if (foundValue !== value) {
|
|
105
|
+
console.info(`[bootstrap-addons] updating <bs-select> [id=${this.id}] value to`, foundValue);
|
|
106
|
+
void Promise.resolve().then(() => (this.value = foundValue));
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
return
|
|
109
|
+
return option;
|
|
110
110
|
}
|
|
111
111
|
}
|