@clr/angular 18.0.0-beta.9 → 18.0.0

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.
@@ -3436,6 +3436,11 @@ class Selection {
3436
3436
  let newSingle;
3437
3437
  let selectionUpdated = false;
3438
3438
  updatedItems.forEach(item => {
3439
+ if (item === null || item === undefined) {
3440
+ // Virtual scroll may emit a dense array of undefined slot placeholders. Those must
3441
+ // never match the empty single-selection ref (see virtual-scroll + Single).
3442
+ return;
3443
+ }
3439
3444
  const ref = _items.identifyBy(item);
3440
3445
  // If one of the updated items is the previously selectedSingle, set it as the new one
3441
3446
  if (this.currentSelectionRefs[0] === ref) {
@@ -3460,6 +3465,9 @@ class Selection {
3460
3465
  //
3461
3466
  // The both loops below that goes over updatedItems could be combined into one.
3462
3467
  updatedItems.forEach(item => {
3468
+ if (item === null || item === undefined) {
3469
+ return;
3470
+ }
3463
3471
  const ref = _items.identifyBy(item);
3464
3472
  if (this.lockedRefs.indexOf(ref) > -1) {
3465
3473
  updateLockedRef.push(ref);
@@ -3470,6 +3478,9 @@ class Selection {
3470
3478
  // the if statement below results in broken behavior.
3471
3479
  if (leftOver.length > 0) {
3472
3480
  updatedItems.forEach(item => {
3481
+ if (item === null || item === undefined) {
3482
+ return;
3483
+ }
3473
3484
  const ref = _items.identifyBy(item);
3474
3485
  // Look in current selected refs array if item is selected, and update actual value
3475
3486
  const selectedIndex = this.currentSelectionRefs.indexOf(ref);
@@ -3840,6 +3851,13 @@ class ClrDatagridSingleSelectionValueAccessor {
3840
3851
  return value;
3841
3852
  }
3842
3853
  updateChecked() {
3854
+ // Never mark the radio as checked when there is no real selection (state is null/undefined)
3855
+ // or the row item itself is a virtual-scroll placeholder slot (value is null/undefined).
3856
+ // Otherwise keyOf(undefined) === keyOf(undefined) would falsely check the radio.
3857
+ if (this.state === null || this.state === undefined || this.value === null || this.value === undefined) {
3858
+ this.renderer.setProperty(this.elementRef.nativeElement, 'checked', false);
3859
+ return;
3860
+ }
3843
3861
  const state = this.keyOf(this.state);
3844
3862
  const value = this.keyOf(this.value);
3845
3863
  this.renderer.setProperty(this.elementRef.nativeElement, 'checked', state === value);