@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.
@@ -11581,7 +11581,7 @@
11581
11581
  var storeSettings = this.getValue().settings;
11582
11582
  var settings = {
11583
11583
  gridAlignment: storeSettings.gridAlignment,
11584
- sort: this.getSort(),
11584
+ sort: this.getGridOptions().sortByStore ? this.getSort() : this.getSortModel(),
11585
11585
  hiddenColumns: hiddenColumns,
11586
11586
  groupedColumns: groupedColumns.map(toColId),
11587
11587
  filter: this.getFilter(),
@@ -11595,31 +11595,29 @@
11595
11595
  }
11596
11596
  return settings;
11597
11597
  };
11598
- GridQuery.prototype.getSort = function () {
11598
+ GridQuery.prototype.getSortModel = function () {
11599
11599
  return this.api.grid.getSortModel().pop();
11600
11600
  };
11601
+ GridQuery.prototype.getSort = function () {
11602
+ return this.getValue().settings.sort || this.getSortModel();
11603
+ };
11601
11604
  GridQuery.prototype.getExternalSort = function () {
11602
- var _a = this.getSort() || {}, sort = _a.sort, colId = _a.colId;
11605
+ var _a = this.getSort() || {}, sort = _a.sort, colId = _a.colId, savedSortIndex = _a.sortIndex;
11603
11606
  var column = this.api.columns.getColumn(colId);
11604
11607
  var allColumns = this.api.columns.getAllGridColumns();
11605
11608
  if (column) {
11606
- return { colId: colId, sort: sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
11609
+ var field = getColField(column.getColDef());
11610
+ return { colId: colId, sort: sort, field: field };
11607
11611
  }
11608
11612
  else {
11609
11613
  var secondaryColumn = this.getSecondaryColumn(colId);
11610
11614
  if (secondaryColumn) {
11611
- return {
11612
- colId: colId,
11613
- sort: sort,
11614
- field: getColField(secondaryColumn.getColDef()),
11615
- sortIndex: allColumns.indexOf(secondaryColumn)
11616
- };
11615
+ var sortIndex = savedSortIndex || allColumns.indexOf(secondaryColumn);
11616
+ var field = getColField(secondaryColumn.getColDef());
11617
+ return { colId: colId, sort: sort, field: field, sortIndex: sortIndex };
11617
11618
  }
11618
11619
  }
11619
11620
  };
11620
- GridQuery.prototype.selectSort = function () {
11621
- return this.select(function (state) { return state.settings.sort; });
11622
- };
11623
11621
  /* @internal */
11624
11622
  GridQuery.prototype._setApi = function (api, gridRef) {
11625
11623
  this.api = api;
@@ -14460,7 +14458,7 @@
14460
14458
  }
14461
14459
  };
14462
14460
  GridService.prototype.setGridSort = function (gridSort) {
14463
- if (this.api && gridSort) {
14461
+ if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
14464
14462
  var colId_1 = gridSort.colId, sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14465
14463
  var sortToApply = gridSort;
14466
14464
  if (!isNil(sortIndex)) {
@@ -14472,10 +14470,11 @@
14472
14470
  if (isPivotColId || valueColumn) {
14473
14471
  /** Column is pivot value column, sort by index */
14474
14472
  var columnByIndex = gridColumns[sortIndex];
14475
- var valueColumnId = columnByIndex && columnByIndex.getColDef().pivotValueColumn.getColId();
14476
- if (valueColumnId === colId_1) {
14477
- sortToApply = { colId: columnByIndex.getColId(), sort: sort };
14478
- }
14473
+ // const pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
14474
+ // const pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
14475
+ // if (pivotValueColumnId === colId) {
14476
+ sortToApply = { colId: columnByIndex.getColId(), sort: sort, sortIndex: sortIndex };
14477
+ // }
14479
14478
  }
14480
14479
  else {
14481
14480
  /** Sort by column id */
@@ -15674,6 +15673,7 @@
15674
15673
  type: type,
15675
15674
  data: data
15676
15675
  });
15676
+ triggerWindowResize();
15677
15677
  });
15678
15678
  };
15679
15679
  DatoGridControllerComponent.prototype.listenToStoreSettingsChanges = function () {
@@ -25466,7 +25466,7 @@
25466
25466
  };
25467
25467
  }
25468
25468
 
25469
- window.coreVersion = '22.8.1-rc.';
25469
+ window.coreVersion = '22.8.2-rc.';
25470
25470
 
25471
25471
  exports.APP_TRANSLATE = APP_TRANSLATE;
25472
25472
  exports.AceService = AceService;