@esfaenza/es-table 11.2.29 → 11.2.30

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