@esfaenza/es-table 15.2.27 → 15.2.29

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.
@@ -4316,8 +4316,12 @@ class EsTableComponent {
4316
4316
  registerOnTouched(fn) { }
4317
4317
  /** @ignore */
4318
4318
  changed(clearItems = false) {
4319
- if (clearItems && this.viewMode)
4320
- this.View.items = [];
4319
+ if (clearItems && this.viewMode) {
4320
+ if (!this.ItemSourceProperty)
4321
+ this.View.items = [];
4322
+ else
4323
+ this.View[this.ItemSourceProperty] = [];
4324
+ }
4321
4325
  this.propagateChange(this.View);
4322
4326
  }
4323
4327
  /** @ignore */
@@ -4349,6 +4353,9 @@ class EsTableComponent {
4349
4353
  // Se cambia l'oggetto intero significa che ho rimandato la ricerca
4350
4354
  this.setMode('view');
4351
4355
  let firstItemGroupOrNoGrouping = (this.View.requestedgroups?.length || 0) == 0;
4356
+ // Queste sono item source custom. Le valorizzo al default se non esistono
4357
+ if (this.ItemSourceProperty && !this.View[this.ItemSourceProperty])
4358
+ this.View[this.ItemSourceProperty] = [];
4352
4359
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
4353
4360
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
4354
4361
  if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache)
@@ -4408,7 +4415,7 @@ class EsTableComponent {
4408
4415
  }
4409
4416
  // La paginazione devo farla solamente quando richiedo o un gruppo principale (se sono in row grouping) o se non richiedo gruppi (in tutti lgi altri casi)
4410
4417
  if (firstItemGroupOrNoGrouping)
4411
- this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, this.View.items.length, this.View.itemsperpageoverride);
4418
+ this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, (this.ItemSourceProperty ? this.View[this.ItemSourceProperty] : this.View.items).length, this.View.itemsperpageoverride);
4412
4419
  }
4413
4420
  else if (this.View && (this.View.length != null && this.View.length != undefined)) {
4414
4421
  this.setMode('array');
@@ -4560,7 +4567,7 @@ class EsTableComponent {
4560
4567
  // Molte cose sono ovviamente disponibili solo in modalità View
4561
4568
  if ((this.viewMode || this.arrayMode) && this.UseCustomCells) {
4562
4569
  let view = this.viewMode ? View : null;
4563
- let itemsAndGroups = this.viewMode ? [...(view.items || []), ...(view.groups || [])] : View;
4570
+ let itemsAndGroups = this.viewMode ? [...((this.ItemSourceProperty ? view[this.ItemSourceProperty] : view.items) || []), ...(view.groups || [])] : View;
4564
4571
  let si = this.viewMode ? view.selection : this.arraymodeSelection;
4565
4572
  // N.B: Rispettare l'ordine di queste 3 macrocategorie è VITALE
4566
4573
  // ************************************* Sistemazioni di TH, TD, e visibilità varie *************************************
@@ -4617,7 +4624,7 @@ class EsTableComponent {
4617
4624
  }
4618
4625
  else if ((this.viewMode || this.arrayMode) && !this.UseCustomCells) {
4619
4626
  // Riallineo le info di selezione degli elementi della View
4620
- let items = this.viewMode ? View.items : View;
4627
+ let items = this.viewMode ? (this.ItemSourceProperty ? View[this.ItemSourceProperty] : View.items) : View;
4621
4628
  let si = this.viewMode ? View.selection : this.arraymodeSelection;
4622
4629
  this.selection_H.evaluateSelection(items, si);
4623
4630
  }