@ascentgl/ads-ui 20.30.0 → 20.31.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.
@@ -6420,7 +6420,7 @@ class AdsTableComponent {
6420
6420
  this.defaultColDef = {};
6421
6421
  /** Loading data status */
6422
6422
  this.loading = false;
6423
- /** Columns data by breakPoints */
6423
+ /** Column data by breakPoints */
6424
6424
  this.columnDefsByBreakpoint = {
6425
6425
  [TableBreakpoint.XS]: [],
6426
6426
  [TableBreakpoint.SM]: [],
@@ -6428,7 +6428,7 @@ class AdsTableComponent {
6428
6428
  [TableBreakpoint.LG]: [],
6429
6429
  [TableBreakpoint.XL]: [],
6430
6430
  };
6431
- /** Show/hide the header with column visibility button */
6431
+ /** Show/hide the header with the column visibility button */
6432
6432
  this.showHeaderActions = false;
6433
6433
  /** Event emitted when all filters are cleared */
6434
6434
  this.filtersCleared = new EventEmitter();
@@ -6492,27 +6492,23 @@ class AdsTableComponent {
6492
6492
  // Preserve existing visibility states
6493
6493
  const existingVisibilityStates = new Map();
6494
6494
  const currentList = this.columnVisibilityList();
6495
- currentList.forEach(item => {
6495
+ currentList.forEach((item) => {
6496
6496
  existingVisibilityStates.set(item.field, item.control.value);
6497
6497
  });
6498
6498
  const columns = this.getActiveColumnDefs();
6499
- const visibilityList = columns.map(col => {
6499
+ const visibilityList = columns.map((col) => {
6500
6500
  const fieldName = col.field || '';
6501
6501
  // Use existing state if available, otherwise use column definition
6502
- const isVisible = existingVisibilityStates.has(fieldName)
6503
- ? existingVisibilityStates.get(fieldName)
6504
- : !col.hide;
6502
+ const isVisible = existingVisibilityStates.get(fieldName) ?? !col.hide;
6505
6503
  const control = new FormControl(isVisible, { nonNullable: true });
6506
6504
  // Subscribe to value changes
6507
- control.valueChanges
6508
- .pipe(takeUntil$1(this.destroy$))
6509
- .subscribe(() => {
6505
+ control.valueChanges.pipe(takeUntil$1(this.destroy$)).subscribe(() => {
6510
6506
  this.updateGridColumns();
6511
6507
  });
6512
6508
  return {
6513
6509
  field: fieldName,
6514
6510
  headerName: col.headerName || col.field || '',
6515
- control: control
6511
+ control: control,
6516
6512
  };
6517
6513
  });
6518
6514
  this.columnVisibilityList.set(visibilityList);
@@ -6527,7 +6523,8 @@ class AdsTableComponent {
6527
6523
  if (this.columnDefs?.length) {
6528
6524
  return this.columnDefs;
6529
6525
  }
6530
- const currentBreakpoint = this.currentBreakpoint || this.getBreakpoint(this.elementRef.nativeElement.querySelector('ag-grid-angular')?.clientWidth || 1000);
6526
+ const currentBreakpoint = this.currentBreakpoint ||
6527
+ this.getBreakpoint(this.elementRef.nativeElement.querySelector('ag-grid-angular')?.clientWidth || 1000);
6531
6528
  let columns = this.columnDefsByBreakpoint[currentBreakpoint] ?? [];
6532
6529
  if (columns.length === 0) {
6533
6530
  columns = this.getFallbackColumnDefs(currentBreakpoint);
@@ -6536,7 +6533,7 @@ class AdsTableComponent {
6536
6533
  }
6537
6534
  /** @ignore */
6538
6535
  openColumnVisibilityMenu() {
6539
- // Simple approach: update truncation states after a short delay when menu opens
6536
+ // Simple approach: update truncation states after a short delay when a menu opens
6540
6537
  setTimeout(() => {
6541
6538
  this.updateTruncationStates();
6542
6539
  }, 150);
@@ -6544,28 +6541,28 @@ class AdsTableComponent {
6544
6541
  /** @ignore */
6545
6542
  hideAllColumns() {
6546
6543
  const currentList = this.columnVisibilityList();
6547
- currentList.forEach(item => {
6544
+ currentList.forEach((item) => {
6548
6545
  item.control.setValue(false);
6549
6546
  });
6550
6547
  }
6551
6548
  /** @ignore */
6552
6549
  showAllColumns() {
6553
6550
  const currentList = this.columnVisibilityList();
6554
- currentList.forEach(item => {
6551
+ currentList.forEach((item) => {
6555
6552
  item.control.setValue(true);
6556
6553
  });
6557
6554
  }
6558
6555
  /** @ignore */
6559
6556
  get allColumnsVisible() {
6560
- return this.columnVisibilityList().every(item => item.control.value);
6557
+ return this.columnVisibilityList().every((item) => item.control.value);
6561
6558
  }
6562
6559
  /** @ignore */
6563
6560
  get allColumnsHidden() {
6564
- return this.columnVisibilityList().every(item => !item.control.value);
6561
+ return this.columnVisibilityList().every((item) => !item.control.value);
6565
6562
  }
6566
6563
  /** @ignore */
6567
6564
  get hiddenColumnsCount() {
6568
- return this.columnVisibilityList().filter(item => !item.control.value).length;
6565
+ return this.columnVisibilityList().filter((item) => !item.control.value).length;
6569
6566
  }
6570
6567
  /** @ignore */
6571
6568
  get hideColumnButtonLabel() {
@@ -6583,7 +6580,7 @@ class AdsTableComponent {
6583
6580
  /** @ignore */
6584
6581
  get sortButtonLabel() {
6585
6582
  if (this.isSortedTable) {
6586
- const column = this.getActiveColumnDefs().find(col => col.field === this.currentSortField);
6583
+ const column = this.getActiveColumnDefs().find((col) => col.field === this.currentSortField);
6587
6584
  const columnName = column?.headerName || column?.field || this.currentSortField;
6588
6585
  return `Sorted by ${columnName}`;
6589
6586
  }
@@ -6595,13 +6592,13 @@ class AdsTableComponent {
6595
6592
  return 'Filter';
6596
6593
  }
6597
6594
  else if (this.filteredColumns.length === 1) {
6598
- const column = this.getActiveColumnDefs().find(col => col.field === this.filteredColumns[0]);
6595
+ const column = this.getActiveColumnDefs().find((col) => col.field === this.filteredColumns[0]);
6599
6596
  const columnName = column?.headerName || column?.field || this.filteredColumns[0];
6600
6597
  return `Filtered by ${columnName}`;
6601
6598
  }
6602
6599
  else {
6603
- const columnNames = this.filteredColumns.map(fieldName => {
6604
- const column = this.getActiveColumnDefs().find(col => col.field === fieldName);
6600
+ const columnNames = this.filteredColumns.map((fieldName) => {
6601
+ const column = this.getActiveColumnDefs().find((col) => col.field === fieldName);
6605
6602
  return column?.headerName || column?.field || fieldName;
6606
6603
  });
6607
6604
  return `Filtered by ${columnNames.join(', ')}`;
@@ -6619,7 +6616,7 @@ class AdsTableComponent {
6619
6616
  updateSortingState() {
6620
6617
  if (this.gridApi) {
6621
6618
  const sortModel = this.gridApi.getColumnState();
6622
- const sortedColumn = sortModel.find(col => col.sort !== null);
6619
+ const sortedColumn = sortModel.find((col) => col.sort !== null);
6623
6620
  if (sortedColumn && sortedColumn.sort) {
6624
6621
  this.currentSortField = sortedColumn.colId;
6625
6622
  this.currentSortDirection = sortedColumn.sort;
@@ -6647,18 +6644,20 @@ class AdsTableComponent {
6647
6644
  }
6648
6645
  /** @ignore */
6649
6646
  sortChanged($event) {
6650
- return this.gridOptions?.onSortChanged ? this.gridOptions.onSortChanged($event) : this.onSortChanged();
6647
+ this.onSortChanged();
6648
+ this.gridOptions?.onSortChanged?.($event);
6651
6649
  }
6652
6650
  /** @ignore */
6653
6651
  filterChanged($event) {
6654
- return this.gridOptions?.onFilterChanged ? this.gridOptions.onFilterChanged($event) : this.onFilterChanged();
6652
+ this.onFilterChanged();
6653
+ this.gridOptions?.onFilterChanged?.($event);
6655
6654
  }
6656
6655
  /** @ignore */
6657
6656
  clearAllFilters() {
6658
6657
  if (this.gridApi) {
6659
6658
  this.gridApi.setFilterModel(null);
6660
6659
  this.updateFilteringState();
6661
- // Emit event to notify header template that filters were cleared
6660
+ // Emit event to notify the header template that filters were cleared
6662
6661
  this.filtersCleared.emit();
6663
6662
  }
6664
6663
  }
@@ -6666,7 +6665,7 @@ class AdsTableComponent {
6666
6665
  clearAllSorting() {
6667
6666
  if (this.gridApi) {
6668
6667
  this.gridApi.applyColumnState({
6669
- defaultState: { sort: null }
6668
+ defaultState: { sort: null },
6670
6669
  });
6671
6670
  this.updateSortingState();
6672
6671
  }
@@ -6674,13 +6673,13 @@ class AdsTableComponent {
6674
6673
  /** @ignore */
6675
6674
  updateGridColumns() {
6676
6675
  const visibilityMap = new Map();
6677
- this.columnVisibilityList().forEach(item => {
6676
+ this.columnVisibilityList().forEach((item) => {
6678
6677
  visibilityMap.set(item.field, item.control.value);
6679
6678
  });
6680
6679
  const currentColumns = this.getActiveColumnDefs();
6681
- const updatedColumns = currentColumns.map(col => ({
6680
+ const updatedColumns = currentColumns.map((col) => ({
6682
6681
  ...col,
6683
- hide: !visibilityMap.get(col.field || '')
6682
+ hide: !visibilityMap.get(col.field || ''),
6684
6683
  }));
6685
6684
  this.tableColumnDefs.set(updatedColumns);
6686
6685
  // Fit columns to grid width after visibility changes
@@ -6724,13 +6723,13 @@ class AdsTableComponent {
6724
6723
  }
6725
6724
  /** @ignore */
6726
6725
  gridReady($event) {
6727
- return this.gridOptions?.onGridReady ? this.gridOptions.onGridReady($event) : this.onGridReady($event);
6726
+ this.onGridReady($event);
6727
+ this.gridOptions?.onGridReady?.($event);
6728
6728
  }
6729
6729
  /** @ignore */
6730
6730
  firstDataRendered($event) {
6731
- return this.gridOptions?.onFirstDataRendered
6732
- ? this.gridOptions.onFirstDataRendered($event)
6733
- : this.onFirstDataRendered($event);
6731
+ this.onFirstDataRendered($event);
6732
+ this.gridOptions?.onFirstDataRendered?.($event);
6734
6733
  }
6735
6734
  /** @ignore */
6736
6735
  updateColumnDefs(tableWidth) {
@@ -6774,7 +6773,7 @@ class AdsTableComponent {
6774
6773
  updateTruncationStates() {
6775
6774
  // Clear previous states
6776
6775
  this.truncationStates.clear();
6777
- // Search for menu overlay in document body (Material creates overlays there)
6776
+ // Search for menu overlay in the document body (Material creates overlays there)
6778
6777
  const overlayPanes = document.querySelectorAll('.cdk-overlay-pane');
6779
6778
  let menuPanel = null;
6780
6779
  // Find the overlay that contains our menu content