angular-slickgrid 5.3.0 → 5.4.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.
@@ -7,10 +7,10 @@ import { TranslateModule } from '@ngx-translate/core';
7
7
  import { SlickRowDetailView as SlickRowDetailView$1 } from '@slickgrid-universal/row-detail-view-plugin';
8
8
  import { Observable } from 'rxjs';
9
9
  import * as DOMPurify from 'dompurify';
10
- import 'slickgrid/dist/slick.core.min';
11
- import 'slickgrid/dist/slick.interactions.min';
12
- import 'slickgrid/dist/slick.grid.min';
13
- import 'slickgrid/dist/slick.dataview.min';
10
+ import 'slickgrid/slick.core';
11
+ import 'slickgrid/slick.interactions';
12
+ import 'slickgrid/slick.grid';
13
+ import 'slickgrid/slick.dataview';
14
14
  import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
15
15
  import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
16
16
  import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
@@ -512,7 +512,11 @@ const GlobalGridOptions = {
512
512
  }
513
513
  },
514
514
  dataView: {
515
- syncGridSelection: true,
515
+ // when enabled, this will preserve the row selection even after filtering/sorting/grouping
516
+ syncGridSelection: {
517
+ preserveHidden: false,
518
+ preserveHiddenOnSelectionChange: true
519
+ },
516
520
  syncGridSelectionWithBackendService: false, // but disable it when using backend services
517
521
  },
518
522
  datasetIdPropertyName: 'id',
@@ -1234,11 +1238,11 @@ class AngularSlickgridComponent {
1234
1238
  }
1235
1239
  /**
1236
1240
  * On a Pagination changed, we will trigger a Grid State changed with the new pagination info
1237
- * Also if we use Row Selection or the Checkbox Selector, we need to reset any selection
1241
+ * Also if we use Row Selection or the Checkbox Selector with a Backend Service (Odata, GraphQL), we need to reset any selection
1238
1242
  */
1239
1243
  paginationChanged(pagination) {
1240
1244
  const isSyncGridSelectionEnabled = this.gridStateService?.needToPreserveRowSelection() ?? false;
1241
- if (!isSyncGridSelectionEnabled && (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {
1245
+ if (this.slickGrid && !isSyncGridSelectionEnabled && this.gridOptions?.backendServiceApi && (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {
1242
1246
  this.slickGrid.setSelectedRows([]);
1243
1247
  }
1244
1248
  const { pageNumber, pageSize } = pagination;
@@ -1695,15 +1699,13 @@ class AngularSlickgridComponent {
1695
1699
  else if (Array.isArray(gridRowIndexes) && gridRowIndexes.length > 0) {
1696
1700
  dataContextIds = this.dataView.mapRowsToIds(gridRowIndexes) || [];
1697
1701
  }
1698
- this.gridStateService.selectedRowDataContextIds = dataContextIds;
1699
- // change the selected rows except UNLESS it's a Local Grid with Pagination
1700
- // local Pagination uses the DataView and that also trigger a change/refresh
1701
- // and we don't want to trigger 2 Grid State changes just 1
1702
- if ((this._isLocalGrid && !this.gridOptions.enablePagination) || !this._isLocalGrid) {
1703
- setTimeout(() => {
1704
- if (this.slickGrid && Array.isArray(gridRowIndexes)) {
1705
- this.slickGrid.setSelectedRows(gridRowIndexes);
1706
- }
1702
+ // apply row selection when defined as grid presets
1703
+ if (this.slickGrid && Array.isArray(gridRowIndexes)) {
1704
+ this.slickGrid.setSelectedRows(gridRowIndexes);
1705
+ this.dataView.setSelectedIds(dataContextIds || [], {
1706
+ isRowBeingAdded: true,
1707
+ shouldTriggerEvent: false,
1708
+ applyRowSelectionToGrid: true
1707
1709
  });
1708
1710
  }
1709
1711
  }