@datorama/core 22.0.6 → 22.2.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.
@@ -10099,20 +10099,17 @@ let GridQuery = class GridQuery extends Query {
10099
10099
  if (this.gridRef.gridOptions.pivotMode) {
10100
10100
  const { sort, colId } = this.api.grid.getSortModel().pop() || {};
10101
10101
  const column = this.api.columns.getColumn(colId);
10102
- const pivotedColumn = this.getSecondaryColumn(colId);
10103
- if (pivotedColumn) {
10104
- const uniquePivotParents = uniq(this.api.columns.getSecondaryColumns().map(column => column.getParent()));
10105
- const secondaryColumn = this.getSecondaryColumn(pivotedColumn.getColId());
10106
- const pivotColIndex = uniquePivotParents.indexOf(secondaryColumn.getParent());
10107
- return { colId, sort, pivotColIndex, colField: getColField(pivotedColumn.getColDef()) };
10108
- }
10109
- else if (column) {
10102
+ if (column) {
10110
10103
  return { colId, sort, colField: getColField(column.getColDef()) };
10111
10104
  }
10105
+ else {
10106
+ const secondaryColumn = this.getSecondaryColumn(colId);
10107
+ if (secondaryColumn) {
10108
+ return { colId, sort, colField: getColField(secondaryColumn.getColDef()) };
10109
+ }
10110
+ }
10112
10111
  }
10113
- else {
10114
- return this.api.grid.getSortModel().pop();
10115
- }
10112
+ return this.api.grid.getSortModel().pop();
10116
10113
  }
10117
10114
  selectSort() {
10118
10115
  return this.select(state => state.settings.sort);
@@ -10209,7 +10206,10 @@ let GridQuery = class GridQuery extends Query {
10209
10206
  }
10210
10207
  getSecondaryColumn(colId) {
10211
10208
  const secondaryColumns = this.api.columns.getSecondaryColumns();
10212
- return secondaryColumns && secondaryColumns.find(col => col.getColId() === colId);
10209
+ if (secondaryColumns) {
10210
+ return secondaryColumns.find(col => col.getColId() === colId);
10211
+ }
10212
+ return null;
10213
10213
  }
10214
10214
  filterCheckboxSelectionColumn(columns) {
10215
10215
  return columns.filter((column) => !column.getUserProvidedColDef() || !column.getUserProvidedColDef().checkboxSelection);
@@ -12678,14 +12678,31 @@ let GridService = class GridService {
12678
12678
  for (const { filter } of filters) {
12679
12679
  const column = this.api.columns.getColumn(filter.colId);
12680
12680
  if (column) {
12681
- this.setColumnFilter(column, filter);
12681
+ this.setColumnFilter(column, filter, false);
12682
12682
  }
12683
12683
  else {
12684
- const pivotColumn = this.gridQuery.getSecondaryColumn(filter.colId);
12685
- this.setColumnFilter(pivotColumn, filter);
12684
+ const secondaryColumn = this.gridQuery.getSecondaryColumn(filter.colId);
12685
+ if (secondaryColumn) {
12686
+ this.setColumnFilter(secondaryColumn, filter, false);
12687
+ }
12686
12688
  }
12687
12689
  }
12688
- this.notifyFilterUpdate();
12690
+ this.api.grid.onFilterChanged();
12691
+ }
12692
+ }
12693
+ setGridSort({ colId, sort }) {
12694
+ if (this.api) {
12695
+ const column = this.api.columns.getColumn(colId);
12696
+ if (column) {
12697
+ column.setSort(sort);
12698
+ }
12699
+ else {
12700
+ const secondaryColumn = this.gridQuery.getSecondaryColumn(colId);
12701
+ if (secondaryColumn) {
12702
+ secondaryColumn.setSort(sort);
12703
+ }
12704
+ }
12705
+ this.api.grid.onSortChanged();
12689
12706
  }
12690
12707
  }
12691
12708
  updateFilter(column, filter) {
@@ -13702,6 +13719,9 @@ let DatoGridControllerComponent = class DatoGridControllerComponent {
13702
13719
  setGridFilters(filters) {
13703
13720
  this.gridService.setGridFilters(filters);
13704
13721
  }
13722
+ setGridSort(sort) {
13723
+ this.gridService.setGridSort(sort);
13724
+ }
13705
13725
  onFilterChanged() {
13706
13726
  return this.gridQuery.filterChanged();
13707
13727
  }
@@ -22625,7 +22645,7 @@ function fixNgLeaks() {
22625
22645
  };
22626
22646
  }
22627
22647
 
22628
- window.coreVersion = '22.0.6';
22648
+ window.coreVersion = '22.2.0';
22629
22649
 
22630
22650
  /**
22631
22651
  * @license