@ekzo-dev/bootstrap-addons 5.3.5 → 5.3.6
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 +1 -1
- package/src/forms/select/select.ts +12 -17
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.3.
|
|
4
|
+
"version": "5.3.6",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -33,27 +33,18 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
33
33
|
|
|
34
34
|
filter: string = '';
|
|
35
35
|
|
|
36
|
-
optionsCount: number = 0;
|
|
37
|
-
|
|
38
|
-
deactivating: boolean = false;
|
|
39
|
-
|
|
40
36
|
emptyOption?: ISelectOption;
|
|
41
37
|
|
|
42
38
|
popperConfig: Partial<Options> | Tooltip.PopperConfigFunction | null = null;
|
|
43
39
|
|
|
44
40
|
binding() {
|
|
45
41
|
super.binding();
|
|
46
|
-
this.deactivating = false;
|
|
47
42
|
|
|
48
43
|
if (this.multiple && !Array.isArray(this.value)) {
|
|
49
44
|
this.value = [];
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
unbinding() {
|
|
54
|
-
this.deactivating = true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
48
|
attached() {
|
|
58
49
|
this.setPopperConfig();
|
|
59
50
|
}
|
|
@@ -100,6 +91,8 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
100
91
|
}
|
|
101
92
|
|
|
102
93
|
get showClear(): boolean {
|
|
94
|
+
console.warn(`BsSelect #${this.id}: get showClear`);
|
|
95
|
+
|
|
103
96
|
return (
|
|
104
97
|
!this.disabled &&
|
|
105
98
|
((this.emptyOption && this.selectedOption?.value !== this.emptyOption.value) ||
|
|
@@ -119,14 +112,18 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
119
112
|
this.control.dispatchEvent(change);
|
|
120
113
|
}
|
|
121
114
|
|
|
122
|
-
get
|
|
123
|
-
const
|
|
115
|
+
get optionsCount(): number {
|
|
116
|
+
const { options } = this;
|
|
117
|
+
const isObj = options instanceof Object && options.constructor === Object;
|
|
124
118
|
|
|
125
|
-
|
|
119
|
+
return isObj ? Object.keys(options).length : (options as []).length;
|
|
120
|
+
}
|
|
126
121
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
get selectedOption(): ISelectOption | undefined {
|
|
123
|
+
console.warn(`BsSelect #${this.id}: get selectedOption`);
|
|
124
|
+
if (this.multiple) return;
|
|
125
|
+
|
|
126
|
+
const { value, emptyValue, matcher } = this;
|
|
130
127
|
let { options } = this;
|
|
131
128
|
let emptyOption: ISelectOption;
|
|
132
129
|
|
|
@@ -134,8 +131,6 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
134
131
|
options = Object.entries(options);
|
|
135
132
|
}
|
|
136
133
|
|
|
137
|
-
this.optionsCount = (options as []).length;
|
|
138
|
-
|
|
139
134
|
const isEntries = Array.isArray(options[0]);
|
|
140
135
|
let option = (options as Array<ISelectOption | readonly [unknown, string]>).find((option) => {
|
|
141
136
|
const optionValue: unknown = isEntries ? option[0] : (option as ISelectOption).value;
|