@esfaenza/es-table 15.2.7 → 15.2.9

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.
@@ -4406,11 +4406,8 @@ class EsTableComponent {
4406
4406
  let firstItemGroupOrNoGrouping = (this.View.requestedgroups?.length || 0) == 0;
4407
4407
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
4408
4408
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
4409
- if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
4410
- this.selection_H.clearSelectionCaches();
4411
- this.View.selection = new ItemsSelection([]);
4412
- this.onSelectionChanged.emit(this.View.selection);
4413
- }
4409
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache)
4410
+ this.resetSelection(true);
4414
4411
  this.View.internalsearchrequest = false;
4415
4412
  // Recupero Preference
4416
4413
  if (this.SavePreferences) {
@@ -4470,11 +4467,8 @@ class EsTableComponent {
4470
4467
  }
4471
4468
  else if (this.View && (this.View.length != null && this.View.length != undefined)) {
4472
4469
  this.setMode('array');
4473
- if (!this.UseSelectionCache || !this.arraymodeSelection) {
4474
- this.selection_H.clearSelectionCaches();
4475
- this.arraymodeSelection = new ItemsSelection([]);
4476
- this.onSelectionChanged.emit(this.arraymodeSelection);
4477
- }
4470
+ if (!this.UseSelectionCache || !this.arraymodeSelection)
4471
+ this.resetSelection(true);
4478
4472
  // Recupero Preference
4479
4473
  if (this.SavePreferences) {
4480
4474
  if (!this.ngControl.name)
@@ -4740,7 +4734,7 @@ class EsTableComponent {
4740
4734
  * @param {any[]} items Oggetti da selezionare o deselezionare
4741
4735
  * @param {boolean} select **true** per selezionarli, **false** per non toccarli
4742
4736
  */
4743
- setSelectionStatus(items, all, select) {
4737
+ setSelectionStatus(items, all, select, emit = false) {
4744
4738
  if (all) {
4745
4739
  if (!this.SelectAll) {
4746
4740
  console.error("Impossibile impostare la selezione con l'all selection quando l'Input SelectAll è false");
@@ -4754,6 +4748,24 @@ class EsTableComponent {
4754
4748
  else
4755
4749
  this.selection_H.handleItemsSelection(items, select);
4756
4750
  this.cdr.markForCheck();
4751
+ if (emit)
4752
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4753
+ }
4754
+ /**
4755
+ * Effettua un hard reset della selezione
4756
+ */
4757
+ resetSelection(emit = false) {
4758
+ this.selection_H.clearSelectionCaches();
4759
+ if (this.viewMode && this.View) {
4760
+ this.View.selection = new ItemsSelection([]);
4761
+ if (emit)
4762
+ this.onSelectionChanged.emit(this.View.selection);
4763
+ }
4764
+ else if (this.arrayMode) {
4765
+ this.arraymodeSelection = new ItemsSelection([]);
4766
+ if (emit)
4767
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4768
+ }
4757
4769
  }
4758
4770
  /**
4759
4771
  * Metodo che gestisce il cambio di Ordinamento di una colonna