ngx-aur-mat-table 12.2.47 → 12.2.48

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.
@@ -561,11 +561,11 @@
561
561
 
562
562
  var SelectionProvider = /** @class */ (function (_super) {
563
563
  __extends(SelectionProvider, _super);
564
- function SelectionProvider(tableConfig, tableDataSource) {
564
+ function SelectionProvider(tableConfig, tableDataSource, initSelection) {
565
565
  var _this = _super.call(this) || this;
566
566
  _this.isEnabled = true;
567
567
  _this.config = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.selectionCfg) || EmptyValue.SELECTION_CONFIG;
568
- _this.selection = new collections.SelectionModel(_this.config.multiple, []);
568
+ _this.selection = new collections.SelectionModel(_this.config.multiple, initSelection);
569
569
  _this.tableDataSource = tableDataSource;
570
570
  return _this;
571
571
  }
@@ -620,9 +620,9 @@
620
620
  SelectionProvider.canEnable = function (tableConfig) {
621
621
  return (tableConfig.selectionCfg && tableConfig.selectionCfg.enable) || false;
622
622
  };
623
- SelectionProvider.create = function (tableConfig, tableDataSource) {
623
+ SelectionProvider.create = function (tableConfig, tableDataSource, initSelection) {
624
624
  if (SelectionProvider.canEnable(tableConfig)) {
625
- return new SelectionProvider(tableConfig, tableDataSource);
625
+ return new SelectionProvider(tableConfig, tableDataSource, initSelection);
626
626
  }
627
627
  return new SelectionProviderDummy();
628
628
  };
@@ -632,7 +632,7 @@
632
632
  var SelectionProviderDummy = /** @class */ (function (_super) {
633
633
  __extends(SelectionProviderDummy, _super);
634
634
  function SelectionProviderDummy() {
635
- var _this = _super.call(this, EmptyValue.TABLE_CONFIG, EmptyValue.MAT_TABLE_DATA_SOURCE) || this;
635
+ var _this = _super.call(this, EmptyValue.TABLE_CONFIG, EmptyValue.MAT_TABLE_DATA_SOURCE, []) || this;
636
636
  _this.isEnabled = true;
637
637
  return _this;
638
638
  }
@@ -1164,9 +1164,11 @@
1164
1164
  configurable: true
1165
1165
  });
1166
1166
  NgxAurMatTableComponent.prototype.ngOnChanges = function (changes) {
1167
+ var _a, _b, _c;
1167
1168
  if ((changes['tableData'] && this.tableData) || (changes['displayColumns'] && this._displayColumns)) {
1169
+ var selected = (_c = (_b = (_a = this.selectionProvider) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.selected) !== null && _c !== void 0 ? _c : [];
1168
1170
  this.tableData = this.tableData || [];
1169
- this.prepareTableData();
1171
+ this.prepareTableData(selected);
1170
1172
  }
1171
1173
  if (changes['highlight'] && this.highlight) {
1172
1174
  this.handleHighlightChange(this.highlight);
@@ -1238,7 +1240,8 @@
1238
1240
  }
1239
1241
  }
1240
1242
  };
1241
- NgxAurMatTableComponent.prototype.prepareTableData = function () {
1243
+ NgxAurMatTableComponent.prototype.prepareTableData = function (initSelection) {
1244
+ if (initSelection === void 0) { initSelection = []; }
1242
1245
  this.initTable();
1243
1246
  this.initCustomSortFunctionsMap();
1244
1247
  this.initPaginator();
@@ -1248,7 +1251,7 @@
1248
1251
  this.rowActionsProvider = RowActionProvider.create(this.tableConfig)
1249
1252
  .addActionColumn(this._displayColumns)
1250
1253
  .setView(this.tableDataSource.data);
1251
- this.selectionProvider = SelectionProvider.create(this.tableConfig, this.tableDataSource)
1254
+ this.selectionProvider = SelectionProvider.create(this.tableConfig, this.tableDataSource, initSelection)
1252
1255
  .addCheckboxColumn(this._displayColumns)
1253
1256
  .bindEventEmitters(this.selected, this.onSelect, this.onDeselect, this.selectionModel);
1254
1257
  this.paginationProvider = PaginationProvider.create(this.tableConfig);