@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.
@@ -11382,7 +11382,7 @@ var GridQuery = /** @class */ (function (_super) {
11382
11382
  var storeSettings = this.getValue().settings;
11383
11383
  var settings = {
11384
11384
  gridAlignment: storeSettings.gridAlignment,
11385
- sort: this.getSort(),
11385
+ sort: this.getGridOptions().sortByStore ? this.getSort() : this.getSortModel(),
11386
11386
  hiddenColumns: hiddenColumns,
11387
11387
  groupedColumns: groupedColumns.map(toColId),
11388
11388
  filter: this.getFilter(),
@@ -11396,31 +11396,29 @@ var GridQuery = /** @class */ (function (_super) {
11396
11396
  }
11397
11397
  return settings;
11398
11398
  };
11399
- GridQuery.prototype.getSort = function () {
11399
+ GridQuery.prototype.getSortModel = function () {
11400
11400
  return this.api.grid.getSortModel().pop();
11401
11401
  };
11402
+ GridQuery.prototype.getSort = function () {
11403
+ return this.getValue().settings.sort || this.getSortModel();
11404
+ };
11402
11405
  GridQuery.prototype.getExternalSort = function () {
11403
- var _a = this.getSort() || {}, sort = _a.sort, colId = _a.colId;
11406
+ var _a = this.getSort() || {}, sort = _a.sort, colId = _a.colId, savedSortIndex = _a.sortIndex;
11404
11407
  var column = this.api.columns.getColumn(colId);
11405
11408
  var allColumns = this.api.columns.getAllGridColumns();
11406
11409
  if (column) {
11407
- return { colId: colId, sort: sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
11410
+ var field = getColField(column.getColDef());
11411
+ return { colId: colId, sort: sort, field: field };
11408
11412
  }
11409
11413
  else {
11410
11414
  var secondaryColumn = this.getSecondaryColumn(colId);
11411
11415
  if (secondaryColumn) {
11412
- return {
11413
- colId: colId,
11414
- sort: sort,
11415
- field: getColField(secondaryColumn.getColDef()),
11416
- sortIndex: allColumns.indexOf(secondaryColumn)
11417
- };
11416
+ var sortIndex = savedSortIndex || allColumns.indexOf(secondaryColumn);
11417
+ var field = getColField(secondaryColumn.getColDef());
11418
+ return { colId: colId, sort: sort, field: field, sortIndex: sortIndex };
11418
11419
  }
11419
11420
  }
11420
11421
  };
11421
- GridQuery.prototype.selectSort = function () {
11422
- return this.select(function (state) { return state.settings.sort; });
11423
- };
11424
11422
  /* @internal */
11425
11423
  GridQuery.prototype._setApi = function (api, gridRef) {
11426
11424
  this.api = api;
@@ -14261,7 +14259,7 @@ var GridService = /** @class */ (function () {
14261
14259
  }
14262
14260
  };
14263
14261
  GridService.prototype.setGridSort = function (gridSort) {
14264
- if (this.api && gridSort) {
14262
+ if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
14265
14263
  var colId_1 = gridSort.colId, sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14266
14264
  var sortToApply = gridSort;
14267
14265
  if (!isNil(sortIndex)) {
@@ -14273,10 +14271,11 @@ var GridService = /** @class */ (function () {
14273
14271
  if (isPivotColId || valueColumn) {
14274
14272
  /** Column is pivot value column, sort by index */
14275
14273
  var columnByIndex = gridColumns[sortIndex];
14276
- var valueColumnId = columnByIndex && columnByIndex.getColDef().pivotValueColumn.getColId();
14277
- if (valueColumnId === colId_1) {
14278
- sortToApply = { colId: columnByIndex.getColId(), sort: sort };
14279
- }
14274
+ // const pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
14275
+ // const pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
14276
+ // if (pivotValueColumnId === colId) {
14277
+ sortToApply = { colId: columnByIndex.getColId(), sort: sort, sortIndex: sortIndex };
14278
+ // }
14280
14279
  }
14281
14280
  else {
14282
14281
  /** Sort by column id */
@@ -15475,6 +15474,7 @@ var DatoGridControllerComponent = /** @class */ (function () {
15475
15474
  type: type,
15476
15475
  data: data
15477
15476
  });
15477
+ triggerWindowResize();
15478
15478
  });
15479
15479
  };
15480
15480
  DatoGridControllerComponent.prototype.listenToStoreSettingsChanges = function () {
@@ -25267,7 +25267,7 @@ function fixNgLeaks() {
25267
25267
  };
25268
25268
  }
25269
25269
 
25270
- window.coreVersion = '22.8.1-rc.';
25270
+ window.coreVersion = '22.8.2-rc.';
25271
25271
 
25272
25272
  /**
25273
25273
  * @license