@datorama/core 22.2.2 → 22.2.4

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.
@@ -11583,13 +11583,19 @@
11583
11583
  if (this.gridRef.gridOptions.pivotMode) {
11584
11584
  var _a = this.api.grid.getSortModel().pop() || {}, sort = _a.sort, colId = _a.colId;
11585
11585
  var column = this.api.columns.getColumn(colId);
11586
+ var allColumns = this.api.columns.getAllGridColumns();
11586
11587
  if (column) {
11587
- return { colId: colId, sort: sort, colField: getColField(column.getColDef()) };
11588
+ return { colId: colId, sort: sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
11588
11589
  }
11589
11590
  else {
11590
11591
  var secondaryColumn = this.getSecondaryColumn(colId);
11591
11592
  if (secondaryColumn) {
11592
- return { colId: colId, sort: sort, colField: getColField(secondaryColumn.getColDef()) };
11593
+ return {
11594
+ colId: colId,
11595
+ sort: sort,
11596
+ field: getColField(secondaryColumn.getColDef()),
11597
+ sortIndex: allColumns.indexOf(secondaryColumn)
11598
+ };
11593
11599
  }
11594
11600
  }
11595
11601
  }
@@ -14398,21 +14404,13 @@
14398
14404
  }
14399
14405
  };
14400
14406
  GridService.prototype.setGridFilters = function (filters) {
14401
- var e_2, _a;
14407
+ var e_2, _a, _b;
14402
14408
  if (this.api && filters) {
14409
+ var appliedFilter = {};
14403
14410
  try {
14404
14411
  for (var filters_1 = __values(filters), filters_1_1 = filters_1.next(); !filters_1_1.done; filters_1_1 = filters_1.next()) {
14405
- var filter = filters_1_1.value.filter;
14406
- var column = this.api.columns.getColumn(filter.colId);
14407
- if (column) {
14408
- this.setColumnFilter(column, filter, false);
14409
- }
14410
- else {
14411
- var secondaryColumn = this.gridQuery.getSecondaryColumn(filter.colId);
14412
- if (secondaryColumn) {
14413
- this.setColumnFilter(secondaryColumn, filter, false);
14414
- }
14415
- }
14412
+ var _c = filters_1_1.value, filter = _c.filter, field = _c.field;
14413
+ appliedFilter = __assign(__assign({}, appliedFilter), (_b = {}, _b[field] = filter, _b));
14416
14414
  }
14417
14415
  }
14418
14416
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -14422,23 +14420,28 @@
14422
14420
  }
14423
14421
  finally { if (e_2) throw e_2.error; }
14424
14422
  }
14423
+ this.updateSettings({ filter: appliedFilter });
14425
14424
  this.api.grid.onFilterChanged();
14426
14425
  }
14427
14426
  };
14428
14427
  GridService.prototype.setGridSort = function (gridSort) {
14429
14428
  if (this.api && gridSort) {
14430
- var colId = gridSort.colId, sort = gridSort.sort;
14431
- var column = this.api.columns.getColumn(colId);
14432
- if (column) {
14433
- column.setSort(sort);
14429
+ var sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14430
+ if (!isNil(sortIndex)) {
14431
+ var columns = this.api.columns.getAllGridColumns();
14432
+ if (columns) {
14433
+ var column = columns[sortIndex];
14434
+ if (column) {
14435
+ var sortToApply = { colId: column.getColId(), sort: sort };
14436
+ this.updateSettings({ sort: sortToApply });
14437
+ this.api.grid.setSortModel([sortToApply]);
14438
+ }
14439
+ }
14434
14440
  }
14435
14441
  else {
14436
- var secondaryColumn = this.gridQuery.getSecondaryColumn(colId);
14437
- if (secondaryColumn) {
14438
- secondaryColumn.setSort(sort);
14439
- }
14442
+ this.updateSettings({ sort: gridSort });
14443
+ this.api.grid.setSortModel([gridSort]);
14440
14444
  }
14441
- this.api.grid.onSortChanged();
14442
14445
  }
14443
14446
  };
14444
14447
  GridService.prototype.updateFilter = function (column, filter) {
@@ -15556,12 +15559,6 @@
15556
15559
  DatoGridControllerComponent.prototype.setGridSort = function (sort) {
15557
15560
  this.gridService.setGridSort(sort);
15558
15561
  };
15559
- DatoGridControllerComponent.prototype.onFilterChanged = function () {
15560
- return this.gridQuery.filterChanged();
15561
- };
15562
- DatoGridControllerComponent.prototype.onSortChanged = function () {
15563
- return this.gridQuery.selectSort();
15564
- };
15565
15562
  DatoGridControllerComponent.prototype.getGridIcons = function () {
15566
15563
  var moveColumnIcon = "<span class=\"da-grid-icon pointer d-flex column-move\">" + this.iconRegistry.getSvg('move-column') + "</span>";
15567
15564
  return {
@@ -15609,8 +15606,8 @@
15609
15606
  };
15610
15607
  DatoGridControllerComponent.prototype.listenToGridEvents = function (agGrid) {
15611
15608
  var _this = this;
15612
- var columnVisible = agGrid.columnVisible, sortChanged = agGrid.sortChanged, columnRowGroupChanged = agGrid.columnRowGroupChanged, columnPinned = agGrid.columnPinned, dragStopped = agGrid.dragStopped;
15613
- rxjs.merge(columnVisible, sortChanged, columnRowGroupChanged, columnPinned, dragStopped)
15609
+ var columnVisible = agGrid.columnVisible, sortChanged = agGrid.sortChanged, columnRowGroupChanged = agGrid.columnRowGroupChanged, columnPinned = agGrid.columnPinned, dragStopped = agGrid.dragStopped, filterChanged = agGrid.filterChanged;
15610
+ rxjs.merge(columnVisible, sortChanged, columnRowGroupChanged, columnPinned, dragStopped, filterChanged)
15614
15611
  .pipe(
15615
15612
  /* Skip the initial sorting event fired by the grid when adding rows */
15616
15613
  operators.skip(1), ngxTakeUntilDestroy.untilDestroyed(this))
@@ -15619,10 +15616,8 @@
15619
15616
  var settingsDiff = _this.gridService.getSettingsDiff();
15620
15617
  _this.gridService.updateSettings(settingsDiff);
15621
15618
  var data = _this.getGridData();
15622
- _this.onGridChange.emit({
15623
- type: type,
15624
- data: data
15625
- });
15619
+ _this.onGridChange.emit(__assign(__assign({}, settingsDiff), { type: type,
15620
+ data: data }));
15626
15621
  });
15627
15622
  };
15628
15623
  DatoGridControllerComponent.prototype.listenToStoreSettingsChanges = function () {
@@ -25385,7 +25380,7 @@
25385
25380
  };
25386
25381
  }
25387
25382
 
25388
- window.coreVersion = '22.2.2';
25383
+ window.coreVersion = '22.2.4';
25389
25384
 
25390
25385
  exports.APP_TRANSLATE = APP_TRANSLATE;
25391
25386
  exports.AceService = AceService;