@ascentgl/ads-ui 21.54.0 → 21.55.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.
@@ -7944,12 +7944,15 @@ class AdsTableComponent {
7944
7944
  /** @ignore */
7945
7945
  onColumnSortChanged(event) {
7946
7946
  const newStates = new Map(this.columnSortStates());
7947
+ const isMultiSort = this.gridOptions?.alwaysMultiSort === true;
7947
7948
  if (event.direction === null) {
7948
7949
  newStates.delete(event.field);
7949
7950
  }
7950
7951
  else {
7951
- // Clear other sorts if not multi-sort (single column sort)
7952
- newStates.clear();
7952
+ // Only clear other sorts if not multi-sort mode
7953
+ if (!isMultiSort) {
7954
+ newStates.clear();
7955
+ }
7953
7956
  newStates.set(event.field, event.direction);
7954
7957
  }
7955
7958
  this.columnSortStates.set(newStates);
@@ -7961,10 +7964,20 @@ class AdsTableComponent {
7961
7964
  });
7962
7965
  }
7963
7966
  else {
7964
- this.gridApi.applyColumnState({
7965
- state: [{ colId: event.field, sort: event.direction }],
7966
- defaultState: { sort: null },
7967
- });
7967
+ if (isMultiSort) {
7968
+ // For multi-sort, only update the specific column without clearing others
7969
+ const currentState = this.gridApi.getColumnState();
7970
+ const maxSortIndex = currentState.reduce((max, col) => col.sortIndex !== null && col.sortIndex !== undefined ? Math.max(max, col.sortIndex) : max, -1);
7971
+ this.gridApi.applyColumnState({
7972
+ state: [{ colId: event.field, sort: event.direction, sortIndex: maxSortIndex + 1 }],
7973
+ });
7974
+ }
7975
+ else {
7976
+ this.gridApi.applyColumnState({
7977
+ state: [{ colId: event.field, sort: event.direction }],
7978
+ defaultState: { sort: null },
7979
+ });
7980
+ }
7968
7981
  }
7969
7982
  this.updateSortingState();
7970
7983
  }
@@ -8248,6 +8261,22 @@ class AdsTableComponent {
8248
8261
  this.columnSortStates.set(newSortStates);
8249
8262
  }
8250
8263
  }
8264
+ /**
8265
+ * Sets the filter states for columns programmatically.
8266
+ * Call this method to apply saved filter preferences.
8267
+ * @param filterStates - A map or object where keys are field names and values are arrays of selected filter values
8268
+ */
8269
+ setColumnFilterStates(filterStates) {
8270
+ const newStates = filterStates instanceof Map
8271
+ ? new Map(filterStates)
8272
+ : new Map(Object.entries(filterStates));
8273
+ this.columnFilterStates.set(newStates);
8274
+ // Apply external filter to grid
8275
+ if (this.gridApi) {
8276
+ this.gridApi.onFilterChanged();
8277
+ this.updateFilteringState();
8278
+ }
8279
+ }
8251
8280
  /** @ignore */
8252
8281
  ngOnDestroy() {
8253
8282
  // Clean up the observer when the component is destroyed