@datorama/core 22.8.1-rc.1 → 22.8.2-rc.1

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.
@@ -10092,7 +10092,7 @@ let GridQuery = class GridQuery extends Query {
10092
10092
  const storeSettings = this.getValue().settings;
10093
10093
  const settings = {
10094
10094
  gridAlignment: storeSettings.gridAlignment,
10095
- sort: this.getSort(),
10095
+ sort: this.getGridOptions().sortByStore ? this.getSort() : this.getSortModel(),
10096
10096
  hiddenColumns,
10097
10097
  groupedColumns: groupedColumns.map(toColId),
10098
10098
  filter: this.getFilter(),
@@ -10106,31 +10106,29 @@ let GridQuery = class GridQuery extends Query {
10106
10106
  }
10107
10107
  return settings;
10108
10108
  }
10109
- getSort() {
10109
+ getSortModel() {
10110
10110
  return this.api.grid.getSortModel().pop();
10111
10111
  }
10112
+ getSort() {
10113
+ return this.getValue().settings.sort || this.getSortModel();
10114
+ }
10112
10115
  getExternalSort() {
10113
- const { sort, colId } = this.getSort() || {};
10116
+ const { sort, colId, sortIndex: savedSortIndex } = this.getSort() || {};
10114
10117
  const column = this.api.columns.getColumn(colId);
10115
10118
  const allColumns = this.api.columns.getAllGridColumns();
10116
10119
  if (column) {
10117
- return { colId, sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
10120
+ const field = getColField(column.getColDef());
10121
+ return { colId, sort, field };
10118
10122
  }
10119
10123
  else {
10120
10124
  const secondaryColumn = this.getSecondaryColumn(colId);
10121
10125
  if (secondaryColumn) {
10122
- return {
10123
- colId,
10124
- sort,
10125
- field: getColField(secondaryColumn.getColDef()),
10126
- sortIndex: allColumns.indexOf(secondaryColumn)
10127
- };
10126
+ const sortIndex = savedSortIndex || allColumns.indexOf(secondaryColumn);
10127
+ const field = getColField(secondaryColumn.getColDef());
10128
+ return { colId, sort, field, sortIndex };
10128
10129
  }
10129
10130
  }
10130
10131
  }
10131
- selectSort() {
10132
- return this.select(state => state.settings.sort);
10133
- }
10134
10132
  /* @internal */
10135
10133
  _setApi(api, gridRef) {
10136
10134
  this.api = api;
@@ -12716,7 +12714,7 @@ let GridService = class GridService {
12716
12714
  }
12717
12715
  }
12718
12716
  setGridSort(gridSort) {
12719
- if (this.api && gridSort) {
12717
+ if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
12720
12718
  const { colId, sort, sortIndex } = gridSort;
12721
12719
  let sortToApply = gridSort;
12722
12720
  if (!isNil(sortIndex)) {
@@ -12728,10 +12726,11 @@ let GridService = class GridService {
12728
12726
  if (isPivotColId || valueColumn) {
12729
12727
  /** Column is pivot value column, sort by index */
12730
12728
  const columnByIndex = gridColumns[sortIndex];
12731
- const valueColumnId = columnByIndex && columnByIndex.getColDef().pivotValueColumn.getColId();
12732
- if (valueColumnId === colId) {
12733
- sortToApply = { colId: columnByIndex.getColId(), sort };
12734
- }
12729
+ // const pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
12730
+ // const pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
12731
+ // if (pivotValueColumnId === colId) {
12732
+ sortToApply = { colId: columnByIndex.getColId(), sort, sortIndex };
12733
+ // }
12735
12734
  }
12736
12735
  else {
12737
12736
  /** Sort by column id */
@@ -13822,6 +13821,7 @@ let DatoGridControllerComponent = class DatoGridControllerComponent {
13822
13821
  type,
13823
13822
  data
13824
13823
  });
13824
+ triggerWindowResize();
13825
13825
  });
13826
13826
  }
13827
13827
  listenToStoreSettingsChanges() {
@@ -22714,7 +22714,7 @@ function fixNgLeaks() {
22714
22714
  };
22715
22715
  }
22716
22716
 
22717
- window.coreVersion = '22.8.1-rc.';
22717
+ window.coreVersion = '22.8.2-rc.';
22718
22718
 
22719
22719
  /**
22720
22720
  * @license