@esfaenza/es-table 15.2.7 → 15.2.8

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.
@@ -4430,11 +4430,8 @@ class EsTableComponent {
4430
4430
  let firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
4431
4431
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
4432
4432
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
4433
- if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
4434
- this.selection_H.clearSelectionCaches();
4435
- this.View.selection = new ItemsSelection([]);
4436
- this.onSelectionChanged.emit(this.View.selection);
4437
- }
4433
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache)
4434
+ this.resetSelection(true);
4438
4435
  this.View.internalsearchrequest = false;
4439
4436
  // Recupero Preference
4440
4437
  if (this.SavePreferences) {
@@ -4494,11 +4491,8 @@ class EsTableComponent {
4494
4491
  }
4495
4492
  else if (this.View && (this.View.length != null && this.View.length != undefined)) {
4496
4493
  this.setMode('array');
4497
- if (!this.UseSelectionCache || !this.arraymodeSelection) {
4498
- this.selection_H.clearSelectionCaches();
4499
- this.arraymodeSelection = new ItemsSelection([]);
4500
- this.onSelectionChanged.emit(this.arraymodeSelection);
4501
- }
4494
+ if (!this.UseSelectionCache || !this.arraymodeSelection)
4495
+ this.resetSelection(true);
4502
4496
  // Recupero Preference
4503
4497
  if (this.SavePreferences) {
4504
4498
  if (!this.ngControl.name)
@@ -4768,7 +4762,7 @@ class EsTableComponent {
4768
4762
  * @param {any[]} items Oggetti da selezionare o deselezionare
4769
4763
  * @param {boolean} select **true** per selezionarli, **false** per non toccarli
4770
4764
  */
4771
- setSelectionStatus(items, all, select) {
4765
+ setSelectionStatus(items, all, select, emit = false) {
4772
4766
  var _a;
4773
4767
  if (all) {
4774
4768
  if (!this.SelectAll) {
@@ -4783,6 +4777,25 @@ class EsTableComponent {
4783
4777
  else
4784
4778
  this.selection_H.handleItemsSelection(items, select);
4785
4779
  this.cdr.markForCheck();
4780
+ if (emit)
4781
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4782
+ }
4783
+ /**
4784
+ * Effettua un hard reset della selezione
4785
+ */
4786
+ resetSelection(emit = false) {
4787
+ var _a;
4788
+ this.selection_H.clearSelectionCaches();
4789
+ if ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) {
4790
+ this.View.selection = new ItemsSelection([]);
4791
+ if (emit)
4792
+ this.onSelectionChanged.emit(this.View.selection);
4793
+ }
4794
+ else if (this.arraymodeSelection) {
4795
+ this.arraymodeSelection = new ItemsSelection([]);
4796
+ if (emit)
4797
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4798
+ }
4786
4799
  }
4787
4800
  /**
4788
4801
  * Metodo che gestisce il cambio di Ordinamento di una colonna