@esfaenza/es-table 12.2.25 → 12.2.26

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.
@@ -3470,91 +3470,87 @@ class EsTableComponent {
3470
3470
  /** @ignore */
3471
3471
  writeValue(obj) {
3472
3472
  var _a;
3473
- this.View = obj ? obj : null;
3474
- // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
3475
- this.researchInProgress = false;
3476
- if (!this.View && !this.SearchView) {
3477
- // Su view nulla evito di fare pressoché qualsiasi cosa. Se arriva un null devo anche assicurarmi di non mostrare nulla
3478
- this.boundSource = this.TMPBoundSource || [];
3479
- // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
3480
- this.cdr.markForCheck();
3481
- return;
3482
- }
3483
- // Se per sbaglio l'oggetto che mi arriva non è tipizzato (instanceof AppSearch restituisce false anche se è del tipo giusto)
3484
- // lo correggo--------------------------------------------------------------------------------------------------------------
3485
- if (this.View && typeof this.View.result != 'undefined' && !(this.View instanceof ReportDefinition))
3486
- this.View.__proto__ = new ReportDefinition();
3487
- else if (this.View && typeof this.View.itemsperpageoverride != 'undefined' && !(this.View instanceof AppSearch))
3488
- this.View.__proto__ = new AppSearch();
3489
- else if (this.SearchView && typeof this.SearchView.itemsperpageoverride != 'undefined' && !(this.SearchView instanceof AppSearch))
3490
- this.SearchView.__proto__ = new AppSearch();
3491
- // -------------------------------------------------------------------------------------------------------------------------
3492
- if (this.View && this.View instanceof ReportDefinition) {
3493
- // Se mi arriva una report definition vuol dire che potrei avere dei risultati da visualizzare
3494
- this.setMode('report');
3495
- this.ReportValues = this.View.result;
3496
- if (this.ReportValues)
3497
- this.reportMode_H.reviewReportBindings();
3498
- }
3499
- else if (this.View && this.View instanceof AppSearch) {
3500
- // Se cambia l'oggetto intero significa che ho rimandato la ricerca
3501
- this.setMode('view');
3502
- let firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
3503
- // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
3504
- // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
3505
- if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
3506
- this.selection_H.clearSelectionCaches();
3507
- this.View.selection = new ItemsSelection([]);
3508
- this.onSelectionChanged.emit(this.View.selection);
3473
+ return __awaiter(this, void 0, void 0, function* () {
3474
+ this.View = obj ? obj : null;
3475
+ // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
3476
+ this.researchInProgress = false;
3477
+ if (!this.View && !this.SearchView) {
3478
+ // Su view nulla evito di fare pressoché qualsiasi cosa. Se arriva un null devo anche assicurarmi di non mostrare nulla
3479
+ this.boundSource = this.TMPBoundSource || [];
3480
+ // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
3481
+ this.cdr.markForCheck();
3482
+ return;
3509
3483
  }
3510
- this.View.internalsearchrequest = false;
3511
- // Recupero Preference
3512
- if (this.SavePreferences) {
3513
- if (!this.ngControl.name)
3514
- console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
3515
- else if (!this.prefService)
3516
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3517
- else {
3518
- this.prefService.retrieve(this.ngControl.name).subscribe(prefs => {
3519
- if (prefs) {
3520
- this.View.columns = prefs.columns;
3521
- this.View.column_ordering = prefs.column_ordering;
3522
- }
3523
- });
3524
- }
3484
+ // Se per sbaglio l'oggetto che mi arriva non è tipizzato (instanceof AppSearch restituisce false anche se è del tipo giusto)
3485
+ // lo correggo--------------------------------------------------------------------------------------------------------------
3486
+ if (this.View && typeof this.View.result != 'undefined' && !(this.View instanceof ReportDefinition))
3487
+ this.View.__proto__ = new ReportDefinition();
3488
+ else if (this.View && typeof this.View.itemsperpageoverride != 'undefined' && !(this.View instanceof AppSearch))
3489
+ this.View.__proto__ = new AppSearch();
3490
+ else if (this.SearchView && typeof this.SearchView.itemsperpageoverride != 'undefined' && !(this.SearchView instanceof AppSearch))
3491
+ this.SearchView.__proto__ = new AppSearch();
3492
+ // -------------------------------------------------------------------------------------------------------------------------
3493
+ if (this.View && this.View instanceof ReportDefinition) {
3494
+ // Se mi arriva una report definition vuol dire che potrei avere dei risultati da visualizzare
3495
+ this.setMode('report');
3496
+ this.ReportValues = this.View.result;
3497
+ if (this.ReportValues)
3498
+ this.reportMode_H.reviewReportBindings();
3525
3499
  }
3526
- // 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)
3527
- if (firstItemGroupOrNoGrouping)
3528
- this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, this.View.items.length, this.View.itemsperpageoverride);
3529
- }
3530
- else if (this.View && (this.View.length != null && this.View.length != undefined)) {
3531
- this.setMode('array');
3532
- if (!this.UseSelectionCache || !this.arraymodeSelection) {
3533
- this.selection_H.clearSelectionCaches();
3534
- this.arraymodeSelection = new ItemsSelection([]);
3535
- this.onSelectionChanged.emit(this.arraymodeSelection);
3500
+ else if (this.View && this.View instanceof AppSearch) {
3501
+ // Se cambia l'oggetto intero significa che ho rimandato la ricerca
3502
+ this.setMode('view');
3503
+ let firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
3504
+ // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
3505
+ // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
3506
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
3507
+ this.selection_H.clearSelectionCaches();
3508
+ this.View.selection = new ItemsSelection([]);
3509
+ this.onSelectionChanged.emit(this.View.selection);
3510
+ }
3511
+ this.View.internalsearchrequest = false;
3512
+ // Recupero Preference
3513
+ if (this.SavePreferences) {
3514
+ if (!this.ngControl.name)
3515
+ console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
3516
+ else if (!this.prefService)
3517
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3518
+ else {
3519
+ var prefs = yield this.prefService.retrieve(this.ngControl.name).toPromise();
3520
+ this.View.columns = prefs.columns;
3521
+ this.View.column_ordering = prefs.column_ordering;
3522
+ }
3523
+ }
3524
+ // 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)
3525
+ if (firstItemGroupOrNoGrouping)
3526
+ this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, this.View.items.length, this.View.itemsperpageoverride);
3536
3527
  }
3537
- // Recupero Preference
3538
- if (this.SavePreferences) {
3539
- if (!this.ngControl.name)
3540
- console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
3541
- else if (!this.prefService)
3542
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3543
- else {
3544
- this.prefService.retrieve(this.ngControl.name).subscribe(prefs => {
3545
- if (prefs) {
3546
- this.arrayColumns = prefs.columns;
3547
- this.arrayColumnOrdering = prefs.column_ordering;
3548
- }
3549
- });
3528
+ else if (this.View && (this.View.length != null && this.View.length != undefined)) {
3529
+ this.setMode('array');
3530
+ if (!this.UseSelectionCache || !this.arraymodeSelection) {
3531
+ this.selection_H.clearSelectionCaches();
3532
+ this.arraymodeSelection = new ItemsSelection([]);
3533
+ this.onSelectionChanged.emit(this.arraymodeSelection);
3550
3534
  }
3535
+ // Recupero Preference
3536
+ if (this.SavePreferences) {
3537
+ if (!this.ngControl.name)
3538
+ console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
3539
+ else if (!this.prefService)
3540
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3541
+ else {
3542
+ var prefs = yield this.prefService.retrieve(this.ngControl.name).toPromise();
3543
+ this.arrayColumns = prefs.columns;
3544
+ this.arrayColumnOrdering = prefs.column_ordering;
3545
+ }
3546
+ }
3547
+ if (this.SearchView)
3548
+ this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1, this.SearchView.items.length, this.SearchView.itemsperpageoverride);
3551
3549
  }
3552
- if (this.SearchView)
3553
- this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1, this.SearchView.items.length, this.SearchView.itemsperpageoverride);
3554
- }
3555
- if (this.View && !(this.View instanceof ReportDefinition))
3556
- this.finalizeContext();
3557
- this.postBoundSourceCalculation();
3550
+ if (this.View && !(this.View instanceof ReportDefinition))
3551
+ this.finalizeContext();
3552
+ this.postBoundSourceCalculation();
3553
+ });
3558
3554
  }
3559
3555
  /**
3560
3556
  * Successivamente al bind del nuovo input questa funzione si occupa di finalizzare tutti i parametri di funzionamento dell'es-table