@ascentgl/ads-ui 21.90.0 → 21.91.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.
@@ -8605,8 +8605,16 @@ class AdsTableComponent {
8605
8605
  }
8606
8606
  /** @ignore */
8607
8607
  ngOnChanges(changes) {
8608
- if (changes['defaultViewMode'] && changes['defaultViewMode'].isFirstChange()) {
8609
- this.isListView.set(this.defaultViewMode === 'list');
8608
+ if (changes['defaultViewMode']) {
8609
+ const newViewMode = changes['defaultViewMode'].currentValue;
8610
+ const isListMode = newViewMode === 'list';
8611
+ if (this.isListView() !== isListMode) {
8612
+ this.isListView.set(isListMode);
8613
+ if (isListMode) {
8614
+ // Refresh list view when switching to list mode
8615
+ Promise.resolve().then(() => this.refreshListView());
8616
+ }
8617
+ }
8610
8618
  }
8611
8619
  // When rowData changes (e.g., async load), refresh the column definitions
8612
8620
  // so that filterOptions are recalculated from the new data
@@ -8641,8 +8649,8 @@ class AdsTableComponent {
8641
8649
  const tableElement = this.elementRef.nativeElement.querySelector('ag-grid-angular');
8642
8650
  if (tableElement) {
8643
8651
  this.resizeObserver = new ResizeObserver(() => {
8644
- // Skip resize handling when the grid is hidden (list view mode)
8645
- if (this.isListView()) {
8652
+ // Skip resize handling when the grid is hidden (list view mode) or has zero width
8653
+ if (this.isListView() || tableElement.clientWidth === 0) {
8646
8654
  return;
8647
8655
  }
8648
8656
  this.updateColumnDefs(tableElement.clientWidth);
@@ -8944,8 +8952,13 @@ class AdsTableComponent {
8944
8952
  else {
8945
8953
  this.listSentinelObserver?.disconnect();
8946
8954
  this.listSentinelObserver = undefined;
8947
- // Re-fit columns after the grid becomes visible again
8948
- Promise.resolve().then(() => this.gridApi?.sizeColumnsToFit());
8955
+ // Re-fit columns after the grid becomes visible again (use setTimeout to ensure the grid is rendered)
8956
+ setTimeout(() => {
8957
+ const tableEl = this.elementRef.nativeElement.querySelector('ag-grid-angular');
8958
+ if (tableEl && tableEl.clientWidth > 0) {
8959
+ this.gridApi?.sizeColumnsToFit();
8960
+ }
8961
+ });
8949
8962
  }
8950
8963
  this.viewChanged.emit(this.isListView() ? 'list' : 'grid');
8951
8964
  }
@@ -9480,9 +9493,11 @@ class AdsTableComponent {
9480
9493
  // Update internal state tracking
9481
9494
  this.updateSortingState();
9482
9495
  this.updateFilteringState();
9483
- // Fit columns to grid width after visibility changes
9496
+ // Fit columns to grid width after visibility changes (only when grid is visible)
9484
9497
  setTimeout(() => {
9485
- this.gridApi?.sizeColumnsToFit();
9498
+ if (!this.isListView()) {
9499
+ this.gridApi?.sizeColumnsToFit();
9500
+ }
9486
9501
  }, 0);
9487
9502
  }
9488
9503
  /** @ignore */
@@ -9500,7 +9515,10 @@ class AdsTableComponent {
9500
9515
  }
9501
9516
  /** @ignore */
9502
9517
  onFirstDataRendered(params) {
9503
- params.api.sizeColumnsToFit();
9518
+ // Only size columns if the grid is visible (not in list view)
9519
+ if (!this.isListView()) {
9520
+ params.api.sizeColumnsToFit();
9521
+ }
9504
9522
  // Re-evaluate filtering state now that data is available
9505
9523
  // This ensures filter button shows correct state when filters were applied before data loaded
9506
9524
  this.updateFilteringState();