@esfaenza/es-table 11.2.146 → 11.2.148

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.
@@ -4488,11 +4488,8 @@
4488
4488
  firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
4489
4489
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
4490
4490
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
4491
- if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
4492
- this.selection_H.clearSelectionCaches();
4493
- this.View.selection = new ItemsSelection([]);
4494
- this.onSelectionChanged.emit(this.View.selection);
4495
- }
4491
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache)
4492
+ this.resetSelection(true);
4496
4493
  this.View.internalsearchrequest = false;
4497
4494
  if (!this.SavePreferences) return [3 /*break*/, 4];
4498
4495
  if (!!this.ngControl.name) return [3 /*break*/, 1];
@@ -4556,11 +4553,8 @@
4556
4553
  case 5:
4557
4554
  if (!(this.View && (this.View.length != null && this.View.length != undefined))) return [3 /*break*/, 10];
4558
4555
  this.setMode('array');
4559
- if (!this.UseSelectionCache || !this.arraymodeSelection) {
4560
- this.selection_H.clearSelectionCaches();
4561
- this.arraymodeSelection = new ItemsSelection([]);
4562
- this.onSelectionChanged.emit(this.arraymodeSelection);
4563
- }
4556
+ if (!this.UseSelectionCache || !this.arraymodeSelection)
4557
+ this.resetSelection(true);
4564
4558
  if (!this.SavePreferences) return [3 /*break*/, 9];
4565
4559
  if (!!this.ngControl.name) return [3 /*break*/, 6];
4566
4560
  console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
@@ -4837,7 +4831,8 @@
4837
4831
  * @param {any[]} items Oggetti da selezionare o deselezionare
4838
4832
  * @param {boolean} select **true** per selezionarli, **false** per non toccarli
4839
4833
  */
4840
- EsTableComponent.prototype.setSelectionStatus = function (items, all, select) {
4834
+ EsTableComponent.prototype.setSelectionStatus = function (items, all, select, emit) {
4835
+ if (emit === void 0) { emit = false; }
4841
4836
  var _a;
4842
4837
  if (all) {
4843
4838
  if (!this.SelectAll) {
@@ -4852,6 +4847,26 @@
4852
4847
  else
4853
4848
  this.selection_H.handleItemsSelection(items, select);
4854
4849
  this.cdr.markForCheck();
4850
+ if (emit)
4851
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4852
+ };
4853
+ /**
4854
+ * Effettua un hard reset della selezione
4855
+ */
4856
+ EsTableComponent.prototype.resetSelection = function (emit) {
4857
+ if (emit === void 0) { emit = false; }
4858
+ var _a;
4859
+ this.selection_H.clearSelectionCaches();
4860
+ if ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) {
4861
+ this.View.selection = new ItemsSelection([]);
4862
+ if (emit)
4863
+ this.onSelectionChanged.emit(this.View.selection);
4864
+ }
4865
+ else if (this.arraymodeSelection) {
4866
+ this.arraymodeSelection = new ItemsSelection([]);
4867
+ if (emit)
4868
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4869
+ }
4855
4870
  };
4856
4871
  /**
4857
4872
  * Metodo che gestisce il cambio di Ordinamento di una colonna