@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.
@@ -3958,93 +3958,103 @@
3958
3958
  EsTableComponent.prototype.changed = function () { this.propagateChange(this.View); };
3959
3959
  /** @ignore */
3960
3960
  EsTableComponent.prototype.writeValue = function (obj) {
3961
- var _this = this;
3962
3961
  var _a;
3963
- this.View = obj ? obj : null;
3964
- // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
3965
- this.researchInProgress = false;
3966
- if (!this.View && !this.SearchView) {
3967
- // Su view nulla evito di fare pressoché qualsiasi cosa. Se arriva un null devo anche assicurarmi di non mostrare nulla
3968
- this.boundSource = this.TMPBoundSource || [];
3969
- // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
3970
- this.cdr.markForCheck();
3971
- return;
3972
- }
3973
- // Se per sbaglio l'oggetto che mi arriva non è tipizzato (instanceof AppSearch restituisce false anche se è del tipo giusto)
3974
- // lo correggo--------------------------------------------------------------------------------------------------------------
3975
- if (this.View && typeof this.View.result != 'undefined' && !(this.View instanceof ReportDefinition))
3976
- this.View.__proto__ = new ReportDefinition();
3977
- else if (this.View && typeof this.View.itemsperpageoverride != 'undefined' && !(this.View instanceof AppSearch))
3978
- this.View.__proto__ = new AppSearch();
3979
- else if (this.SearchView && typeof this.SearchView.itemsperpageoverride != 'undefined' && !(this.SearchView instanceof AppSearch))
3980
- this.SearchView.__proto__ = new AppSearch();
3981
- // -------------------------------------------------------------------------------------------------------------------------
3982
- if (this.View && this.View instanceof ReportDefinition) {
3983
- // Se mi arriva una report definition vuol dire che potrei avere dei risultati da visualizzare
3984
- this.setMode('report');
3985
- this.ReportValues = this.View.result;
3986
- if (this.ReportValues)
3987
- this.reportMode_H.reviewReportBindings();
3988
- }
3989
- else if (this.View && this.View instanceof AppSearch) {
3990
- // Se cambia l'oggetto intero significa che ho rimandato la ricerca
3991
- this.setMode('view');
3992
- var firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
3993
- // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
3994
- // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
3995
- if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
3996
- this.selection_H.clearSelectionCaches();
3997
- this.View.selection = new ItemsSelection([]);
3998
- this.onSelectionChanged.emit(this.View.selection);
3999
- }
4000
- this.View.internalsearchrequest = false;
4001
- // Recupero Preference
4002
- if (this.SavePreferences) {
4003
- if (!this.ngControl.name)
4004
- console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
4005
- else if (!this.prefService)
4006
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
4007
- else {
4008
- this.prefService.retrieve(this.ngControl.name).subscribe(function (prefs) {
4009
- if (prefs) {
4010
- _this.View.columns = prefs.columns;
4011
- _this.View.column_ordering = prefs.column_ordering;
3962
+ return __awaiter(this, void 0, void 0, function () {
3963
+ var firstItemGroupOrNoGrouping, prefs, prefs;
3964
+ return __generator(this, function (_s) {
3965
+ switch (_s.label) {
3966
+ case 0:
3967
+ this.View = obj ? obj : null;
3968
+ // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
3969
+ this.researchInProgress = false;
3970
+ if (!this.View && !this.SearchView) {
3971
+ // Su view nulla evito di fare pressoché qualsiasi cosa. Se arriva un null devo anche assicurarmi di non mostrare nulla
3972
+ this.boundSource = this.TMPBoundSource || [];
3973
+ // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
3974
+ this.cdr.markForCheck();
3975
+ return [2 /*return*/];
4012
3976
  }
4013
- });
4014
- }
4015
- }
4016
- // 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)
4017
- if (firstItemGroupOrNoGrouping)
4018
- this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, this.View.items.length, this.View.itemsperpageoverride);
4019
- }
4020
- else if (this.View && (this.View.length != null && this.View.length != undefined)) {
4021
- this.setMode('array');
4022
- if (!this.UseSelectionCache || !this.arraymodeSelection) {
4023
- this.selection_H.clearSelectionCaches();
4024
- this.arraymodeSelection = new ItemsSelection([]);
4025
- this.onSelectionChanged.emit(this.arraymodeSelection);
4026
- }
4027
- // Recupero Preference
4028
- if (this.SavePreferences) {
4029
- if (!this.ngControl.name)
4030
- console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
4031
- else if (!this.prefService)
4032
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
4033
- else {
4034
- this.prefService.retrieve(this.ngControl.name).subscribe(function (prefs) {
4035
- if (prefs) {
4036
- _this.arrayColumns = prefs.columns;
4037
- _this.arrayColumnOrdering = prefs.column_ordering;
3977
+ // Se per sbaglio l'oggetto che mi arriva non è tipizzato (instanceof AppSearch restituisce false anche se è del tipo giusto)
3978
+ // lo correggo--------------------------------------------------------------------------------------------------------------
3979
+ if (this.View && typeof this.View.result != 'undefined' && !(this.View instanceof ReportDefinition))
3980
+ this.View.__proto__ = new ReportDefinition();
3981
+ else if (this.View && typeof this.View.itemsperpageoverride != 'undefined' && !(this.View instanceof AppSearch))
3982
+ this.View.__proto__ = new AppSearch();
3983
+ else if (this.SearchView && typeof this.SearchView.itemsperpageoverride != 'undefined' && !(this.SearchView instanceof AppSearch))
3984
+ this.SearchView.__proto__ = new AppSearch();
3985
+ if (!(this.View && this.View instanceof ReportDefinition)) return [3 /*break*/, 1];
3986
+ // Se mi arriva una report definition vuol dire che potrei avere dei risultati da visualizzare
3987
+ this.setMode('report');
3988
+ this.ReportValues = this.View.result;
3989
+ if (this.ReportValues)
3990
+ this.reportMode_H.reviewReportBindings();
3991
+ return [3 /*break*/, 11];
3992
+ case 1:
3993
+ if (!(this.View && this.View instanceof AppSearch)) return [3 /*break*/, 6];
3994
+ // Se cambia l'oggetto intero significa che ho rimandato la ricerca
3995
+ this.setMode('view');
3996
+ firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
3997
+ // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
3998
+ // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
3999
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
4000
+ this.selection_H.clearSelectionCaches();
4001
+ this.View.selection = new ItemsSelection([]);
4002
+ this.onSelectionChanged.emit(this.View.selection);
4038
4003
  }
4039
- });
4004
+ this.View.internalsearchrequest = false;
4005
+ if (!this.SavePreferences) return [3 /*break*/, 5];
4006
+ if (!!this.ngControl.name) return [3 /*break*/, 2];
4007
+ console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
4008
+ return [3 /*break*/, 5];
4009
+ case 2:
4010
+ if (!!this.prefService) return [3 /*break*/, 3];
4011
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
4012
+ return [3 /*break*/, 5];
4013
+ case 3: return [4 /*yield*/, this.prefService.retrieve(this.ngControl.name).toPromise()];
4014
+ case 4:
4015
+ prefs = _s.sent();
4016
+ this.View.columns = prefs.columns;
4017
+ this.View.column_ordering = prefs.column_ordering;
4018
+ _s.label = 5;
4019
+ case 5:
4020
+ // 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)
4021
+ if (firstItemGroupOrNoGrouping)
4022
+ this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, this.View.items.length, this.View.itemsperpageoverride);
4023
+ return [3 /*break*/, 11];
4024
+ case 6:
4025
+ if (!(this.View && (this.View.length != null && this.View.length != undefined))) return [3 /*break*/, 11];
4026
+ this.setMode('array');
4027
+ if (!this.UseSelectionCache || !this.arraymodeSelection) {
4028
+ this.selection_H.clearSelectionCaches();
4029
+ this.arraymodeSelection = new ItemsSelection([]);
4030
+ this.onSelectionChanged.emit(this.arraymodeSelection);
4031
+ }
4032
+ if (!this.SavePreferences) return [3 /*break*/, 10];
4033
+ if (!!this.ngControl.name) return [3 /*break*/, 7];
4034
+ console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
4035
+ return [3 /*break*/, 10];
4036
+ case 7:
4037
+ if (!!this.prefService) return [3 /*break*/, 8];
4038
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
4039
+ return [3 /*break*/, 10];
4040
+ case 8: return [4 /*yield*/, this.prefService.retrieve(this.ngControl.name).toPromise()];
4041
+ case 9:
4042
+ prefs = _s.sent();
4043
+ this.arrayColumns = prefs.columns;
4044
+ this.arrayColumnOrdering = prefs.column_ordering;
4045
+ _s.label = 10;
4046
+ case 10:
4047
+ if (this.SearchView)
4048
+ this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1, this.SearchView.items.length, this.SearchView.itemsperpageoverride);
4049
+ _s.label = 11;
4050
+ case 11:
4051
+ if (this.View && !(this.View instanceof ReportDefinition))
4052
+ this.finalizeContext();
4053
+ this.postBoundSourceCalculation();
4054
+ return [2 /*return*/];
4040
4055
  }
4041
- }
4042
- if (this.SearchView)
4043
- this.arrayPulsanti = this.utilities_H.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1, this.SearchView.items.length, this.SearchView.itemsperpageoverride);
4044
- }
4045
- if (this.View && !(this.View instanceof ReportDefinition))
4046
- this.finalizeContext();
4047
- this.postBoundSourceCalculation();
4056
+ });
4057
+ });
4048
4058
  };
4049
4059
  /**
4050
4060
  * Successivamente al bind del nuovo input questa funzione si occupa di finalizzare tutti i parametri di funzionamento dell'es-table