@open-rlb/ng-bootstrap 3.0.1 → 3.0.3
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.
|
@@ -7203,6 +7203,15 @@ const TABLE = [
|
|
|
7203
7203
|
];
|
|
7204
7204
|
|
|
7205
7205
|
class AbstractAutocompleteComponent extends AbstractComponent {
|
|
7206
|
+
set el(value) {
|
|
7207
|
+
this._el = value;
|
|
7208
|
+
if (this._el && this._pendingValue !== undefined) {
|
|
7209
|
+
this.applyValueToInput(this._pendingValue);
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
get el() {
|
|
7213
|
+
return this._el;
|
|
7214
|
+
}
|
|
7206
7215
|
constructor(idService, renderer, // protected, to gain access to child classes
|
|
7207
7216
|
control) {
|
|
7208
7217
|
super(idService, control);
|
|
@@ -7219,12 +7228,17 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7219
7228
|
this.placeholder = '';
|
|
7220
7229
|
this.userDefinedId = '';
|
|
7221
7230
|
this.charsToSearch = 3;
|
|
7231
|
+
this._pendingValue = undefined;
|
|
7222
7232
|
this.selected = new EventEmitter();
|
|
7223
7233
|
}
|
|
7224
7234
|
// =========================================================================
|
|
7225
7235
|
// HTML FORM LOGIC
|
|
7226
7236
|
// =========================================================================
|
|
7227
7237
|
onWrite(data) {
|
|
7238
|
+
this._pendingValue = data;
|
|
7239
|
+
this.applyValueToInput(data);
|
|
7240
|
+
}
|
|
7241
|
+
applyValueToInput(data) {
|
|
7228
7242
|
if (this.el && this.el.nativeElement) {
|
|
7229
7243
|
if (data) {
|
|
7230
7244
|
this.el.nativeElement.value = this.getItemText(data);
|
|
@@ -7240,8 +7254,9 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7240
7254
|
update(ev) {
|
|
7241
7255
|
const t = ev;
|
|
7242
7256
|
const inputValue = t?.value || '';
|
|
7243
|
-
|
|
7244
|
-
|
|
7257
|
+
const valueToPropagate = inputValue === ''
|
|
7258
|
+
? { text: '', value: '' }
|
|
7259
|
+
: { text: inputValue, value: inputValue };
|
|
7245
7260
|
this.setValue(valueToPropagate);
|
|
7246
7261
|
if (this.control && this.control.control) {
|
|
7247
7262
|
this.control.control.markAsDirty();
|
|
@@ -7252,7 +7267,7 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7252
7267
|
}
|
|
7253
7268
|
this.typingTimeout = setTimeout(() => {
|
|
7254
7269
|
if (!this.disabled) {
|
|
7255
|
-
this.getSuggestions(inputValue);
|
|
7270
|
+
this.getSuggestions(inputValue);
|
|
7256
7271
|
}
|
|
7257
7272
|
}, 500);
|
|
7258
7273
|
}
|
|
@@ -7303,12 +7318,14 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7303
7318
|
this.setActiveItem(newIndex);
|
|
7304
7319
|
}
|
|
7305
7320
|
setActiveItem(index) {
|
|
7306
|
-
if (this.activeIndex !== -1 &&
|
|
7321
|
+
if (this.activeIndex !== -1 &&
|
|
7322
|
+
this.dropdown.nativeElement.children[this.activeIndex]) {
|
|
7307
7323
|
const oldItem = this.dropdown.nativeElement.children[this.activeIndex];
|
|
7308
7324
|
this.renderer.removeClass(oldItem, 'active');
|
|
7309
7325
|
}
|
|
7310
7326
|
this.activeIndex = index;
|
|
7311
|
-
if (this.activeIndex !== -1 &&
|
|
7327
|
+
if (this.activeIndex !== -1 &&
|
|
7328
|
+
this.dropdown.nativeElement.children[this.activeIndex]) {
|
|
7312
7329
|
const newItem = this.dropdown.nativeElement.children[this.activeIndex];
|
|
7313
7330
|
this.renderer.addClass(newItem, 'active');
|
|
7314
7331
|
newItem.scrollIntoView({ block: 'nearest' });
|
|
@@ -7371,7 +7388,9 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7371
7388
|
this.clearDropdown();
|
|
7372
7389
|
this.suggestionsList = [];
|
|
7373
7390
|
this.activeIndex = -1;
|
|
7374
|
-
const normalizedSuggestions = suggestions.map(suggestion => typeof suggestion === 'string'
|
|
7391
|
+
const normalizedSuggestions = suggestions.map((suggestion) => typeof suggestion === 'string'
|
|
7392
|
+
? { text: suggestion, value: suggestion }
|
|
7393
|
+
: suggestion);
|
|
7375
7394
|
this.suggestionsList = normalizedSuggestions;
|
|
7376
7395
|
if (!this.suggestionsList || this.suggestionsList.length === 0) {
|
|
7377
7396
|
const el = this.renderer.createElement('a');
|
|
@@ -7417,7 +7436,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
7417
7436
|
type: Component,
|
|
7418
7437
|
args: [{
|
|
7419
7438
|
template: '',
|
|
7420
|
-
standalone: false
|
|
7439
|
+
standalone: false,
|
|
7421
7440
|
}]
|
|
7422
7441
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.Renderer2 }, { type: i2$2.NgControl }], propDecorators: { disabled: [{
|
|
7423
7442
|
type: Input,
|
|
@@ -8710,14 +8729,15 @@ class AutocompleteCountryDialCodeComponent extends AbstractAutocompleteComponent
|
|
|
8710
8729
|
}
|
|
8711
8730
|
}
|
|
8712
8731
|
getItemText(data) {
|
|
8732
|
+
const valueToFind = typeof data === 'object' ? data?.value : data;
|
|
8713
8733
|
const h = this.getCountries().find(c => {
|
|
8714
8734
|
if (typeof c === 'object') {
|
|
8715
8735
|
const _c = c;
|
|
8716
|
-
return _c.value ===
|
|
8736
|
+
return _c.value === valueToFind;
|
|
8717
8737
|
}
|
|
8718
8738
|
return false;
|
|
8719
8739
|
});
|
|
8720
|
-
return (typeof h === 'object' ? h.text : '');
|
|
8740
|
+
return (typeof h === 'object' ? h.text : (typeof data === 'string' ? data : ''));
|
|
8721
8741
|
}
|
|
8722
8742
|
getCountries() {
|
|
8723
8743
|
if (this.enableFlagIcons) {
|
|
@@ -9040,14 +9060,15 @@ class AutocompleteCountryComponent extends AbstractAutocompleteComponent {
|
|
|
9040
9060
|
}
|
|
9041
9061
|
}
|
|
9042
9062
|
getItemText(data) {
|
|
9063
|
+
const valueToFind = typeof data === 'object' ? data?.value : data;
|
|
9043
9064
|
const h = this.getCountries().find(c => {
|
|
9044
9065
|
if (typeof c === 'object') {
|
|
9045
9066
|
const _c = c;
|
|
9046
|
-
return _c.value ===
|
|
9067
|
+
return _c.value === valueToFind;
|
|
9047
9068
|
}
|
|
9048
9069
|
return false;
|
|
9049
9070
|
});
|
|
9050
|
-
return (typeof h === 'object' ? h.text : '');
|
|
9071
|
+
return (typeof h === 'object' ? h.text : (typeof data === 'string' ? data : ''));
|
|
9051
9072
|
}
|
|
9052
9073
|
getCountries() {
|
|
9053
9074
|
if (this.enableFlagIcons) {
|
|
@@ -9176,7 +9197,7 @@ class AutocompleteTimezonesComponent extends AbstractAutocompleteComponent {
|
|
|
9176
9197
|
return data.text || '';
|
|
9177
9198
|
}
|
|
9178
9199
|
else if (typeof data === 'string') {
|
|
9179
|
-
return data
|
|
9200
|
+
return data;
|
|
9180
9201
|
}
|
|
9181
9202
|
return '';
|
|
9182
9203
|
}
|