@acorex/components 20.8.16 → 20.8.20
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.
|
@@ -11,7 +11,7 @@ import * as i0 from '@angular/core';
|
|
|
11
11
|
import { input, inject, signal, linkedSignal, afterNextRender, forwardRef, HostListener, ViewChild, ContentChild, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
12
12
|
import * as i1 from '@angular/forms';
|
|
13
13
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
14
|
-
import { isEqual, last, findLastIndex,
|
|
14
|
+
import { isEqual, get, last, findLastIndex, nth } from 'lodash-es';
|
|
15
15
|
import { classes } from 'polytype';
|
|
16
16
|
import { AXBadgeModule } from '@acorex/components/badge';
|
|
17
17
|
import { AXCheckBoxModule } from '@acorex/components/check-box';
|
|
@@ -166,16 +166,26 @@ class AXSelectBoxComponent extends classes(MXDropdownBoxBaseComponent, MXSelecti
|
|
|
166
166
|
* @param {any} key
|
|
167
167
|
*/
|
|
168
168
|
getItemByKey(key) {
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
// Static array data sources resolve synchronously to avoid a false loading state
|
|
170
|
+
// for primitive values (e.g. color format "hex" / "rgba").
|
|
171
|
+
if (Array.isArray(this._originalDataSource)) {
|
|
172
|
+
for (const candidate of this._originalDataSource) {
|
|
173
|
+
if (candidate != null && typeof candidate === 'object') {
|
|
174
|
+
if (get(candidate, this.valueField) == key || get(candidate, this.textField) == key) {
|
|
175
|
+
return candidate;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (candidate == key) {
|
|
179
|
+
return { [this.valueField]: candidate, [this.textField]: String(candidate ?? '') };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
172
183
|
}
|
|
173
|
-
// Fallback to find method if byKey is not available
|
|
174
184
|
if (this._listDataSource && typeof this._listDataSource.find === 'function') {
|
|
175
185
|
return this._listDataSource.find(key);
|
|
176
186
|
}
|
|
177
187
|
// If neither method is available, return null
|
|
178
|
-
console.warn('No
|
|
188
|
+
console.warn('No find method available on data source');
|
|
179
189
|
return null;
|
|
180
190
|
}
|
|
181
191
|
/** @ignore */
|