@open-rlb/ng-bootstrap 3.0.2 → 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,7 +7254,9 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7240
7254
|
update(ev) {
|
|
7241
7255
|
const t = ev;
|
|
7242
7256
|
const inputValue = t?.value || '';
|
|
7243
|
-
const valueToPropagate = inputValue === ''
|
|
7257
|
+
const valueToPropagate = inputValue === ''
|
|
7258
|
+
? { text: '', value: '' }
|
|
7259
|
+
: { text: inputValue, value: inputValue };
|
|
7244
7260
|
this.setValue(valueToPropagate);
|
|
7245
7261
|
if (this.control && this.control.control) {
|
|
7246
7262
|
this.control.control.markAsDirty();
|
|
@@ -7302,12 +7318,14 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7302
7318
|
this.setActiveItem(newIndex);
|
|
7303
7319
|
}
|
|
7304
7320
|
setActiveItem(index) {
|
|
7305
|
-
if (this.activeIndex !== -1 &&
|
|
7321
|
+
if (this.activeIndex !== -1 &&
|
|
7322
|
+
this.dropdown.nativeElement.children[this.activeIndex]) {
|
|
7306
7323
|
const oldItem = this.dropdown.nativeElement.children[this.activeIndex];
|
|
7307
7324
|
this.renderer.removeClass(oldItem, 'active');
|
|
7308
7325
|
}
|
|
7309
7326
|
this.activeIndex = index;
|
|
7310
|
-
if (this.activeIndex !== -1 &&
|
|
7327
|
+
if (this.activeIndex !== -1 &&
|
|
7328
|
+
this.dropdown.nativeElement.children[this.activeIndex]) {
|
|
7311
7329
|
const newItem = this.dropdown.nativeElement.children[this.activeIndex];
|
|
7312
7330
|
this.renderer.addClass(newItem, 'active');
|
|
7313
7331
|
newItem.scrollIntoView({ block: 'nearest' });
|
|
@@ -7370,7 +7388,9 @@ class AbstractAutocompleteComponent extends AbstractComponent {
|
|
|
7370
7388
|
this.clearDropdown();
|
|
7371
7389
|
this.suggestionsList = [];
|
|
7372
7390
|
this.activeIndex = -1;
|
|
7373
|
-
const normalizedSuggestions = suggestions.map(suggestion => typeof suggestion === 'string'
|
|
7391
|
+
const normalizedSuggestions = suggestions.map((suggestion) => typeof suggestion === 'string'
|
|
7392
|
+
? { text: suggestion, value: suggestion }
|
|
7393
|
+
: suggestion);
|
|
7374
7394
|
this.suggestionsList = normalizedSuggestions;
|
|
7375
7395
|
if (!this.suggestionsList || this.suggestionsList.length === 0) {
|
|
7376
7396
|
const el = this.renderer.createElement('a');
|
|
@@ -7416,7 +7436,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
7416
7436
|
type: Component,
|
|
7417
7437
|
args: [{
|
|
7418
7438
|
template: '',
|
|
7419
|
-
standalone: false
|
|
7439
|
+
standalone: false,
|
|
7420
7440
|
}]
|
|
7421
7441
|
}], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.Renderer2 }, { type: i2$2.NgControl }], propDecorators: { disabled: [{
|
|
7422
7442
|
type: Input,
|