@ni/nimble-angular 17.1.17 → 17.1.18

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.
@@ -1240,6 +1240,7 @@ class NimbleComboboxControlValueAccessorDirective {
1240
1240
  this._renderer = _renderer;
1241
1241
  this._elementRef = _elementRef;
1242
1242
  this._optionMap = new Map();
1243
+ this._optionUpdateQueue = [];
1243
1244
  this._compareWith = Object.is;
1244
1245
  }
1245
1246
  /**
@@ -1253,6 +1254,12 @@ class NimbleComboboxControlValueAccessorDirective {
1253
1254
  }
1254
1255
  this._compareWith = fn;
1255
1256
  }
1257
+ ngAfterViewChecked() {
1258
+ for (const updateValue of this._optionUpdateQueue) {
1259
+ this.addOption(updateValue.listOption.text, updateValue.modelValue);
1260
+ }
1261
+ this._optionUpdateQueue = [];
1262
+ }
1256
1263
  /**
1257
1264
  * Updates the underlying nimble-combobox value with the expected display string.
1258
1265
  * @param value The ngValue set on the nimble-combobox
@@ -1302,6 +1309,10 @@ class NimbleComboboxControlValueAccessorDirective {
1302
1309
  removeOption(displayValue) {
1303
1310
  this._optionMap.delete(displayValue);
1304
1311
  }
1312
+ queueOptionUpdate(listOption, modelValue) {
1313
+ this.removeOption(listOption.text);
1314
+ this._optionUpdateQueue.push({ listOption, modelValue });
1315
+ }
1305
1316
  updateDisplayValue() {
1306
1317
  const valueAsString = this.getValueStringFromValue(this._modelValue);
1307
1318
  this.setProperty('value', valueAsString ?? '');
@@ -6491,10 +6502,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
6491
6502
  * Directive to provide Angular integration for the list option when used with a combobox.
6492
6503
  */
6493
6504
  class NimbleComboboxListOptionDirective {
6494
- constructor(elementRef, renderer, changeDetector, combobox) {
6505
+ constructor(elementRef, renderer, combobox) {
6495
6506
  this.elementRef = elementRef;
6496
6507
  this.renderer = renderer;
6497
- this.changeDetector = changeDetector;
6498
6508
  this.combobox = combobox;
6499
6509
  this._modelValue = undefined;
6500
6510
  }
@@ -6526,20 +6536,17 @@ class NimbleComboboxListOptionDirective {
6526
6536
  }
6527
6537
  }
6528
6538
  updateComboboxValue(value) {
6529
- this.combobox.removeOption(this._currentTextContent);
6530
- this.changeDetector.detectChanges();
6531
- this._currentTextContent = this.elementRef.nativeElement.text;
6532
- this.combobox.addOption(this._currentTextContent, value);
6539
+ this.combobox.queueOptionUpdate(this.elementRef.nativeElement, value);
6533
6540
  }
6534
6541
  }
6535
- NimbleComboboxListOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NimbleComboboxListOptionDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: NimbleComboboxControlValueAccessorDirective, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6542
+ NimbleComboboxListOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NimbleComboboxListOptionDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: NimbleComboboxControlValueAccessorDirective, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6536
6543
  NimbleComboboxListOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: NimbleComboboxListOptionDirective, selector: "nimble-list-option", inputs: { disabled: "disabled", ngValue: "ngValue" }, ngImport: i0 });
6537
6544
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NimbleComboboxListOptionDirective, decorators: [{
6538
6545
  type: Directive,
6539
6546
  args: [{
6540
6547
  selector: 'nimble-list-option'
6541
6548
  }]
6542
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: NimbleComboboxControlValueAccessorDirective, decorators: [{
6549
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: NimbleComboboxControlValueAccessorDirective, decorators: [{
6543
6550
  type: Inject,
6544
6551
  args: [NimbleComboboxControlValueAccessorDirective]
6545
6552
  }, {