@esfaenza/es-table 11.2.59 → 11.2.60

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.
@@ -3803,7 +3803,7 @@
3803
3803
  EsTableComponent.prototype.writeValue = function (obj) {
3804
3804
  var _a;
3805
3805
  return __awaiter(this, void 0, void 0, function () {
3806
- var firstItemGroupOrNoGrouping, prefs, cols, updatedPrefs, columns, i, prefs, cols, updatedPrefs, i;
3806
+ var firstItemGroupOrNoGrouping, prefs, cols, updatedPrefs, repository, source, i, prefs, cols, updatedPrefs, repository, source, i;
3807
3807
  return __generator(this, function (_t) {
3808
3808
  switch (_t.label) {
3809
3809
  case 0:
@@ -3851,9 +3851,21 @@
3851
3851
  if (this.View) {
3852
3852
  cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3853
3853
  updatedPrefs = true;
3854
- columns = this.View.report_columns ? this.View.report_columns.map(function (t) { return t.id; }) : this.View.columns;
3855
- for (i = 0; i < columns.length; i++) {
3856
- if (!cols.indexOf(columns[i])) {
3854
+ repository = void 0;
3855
+ source = void 0;
3856
+ if (this.View.report_columns) {
3857
+ repository = this.View.report_columns.map(function (t) { return t.id; });
3858
+ source = cols;
3859
+ }
3860
+ else {
3861
+ repository = cols;
3862
+ source = this.View.columns;
3863
+ }
3864
+ // In modalità report devo controllare che tutte le colonne salvate facciano parte della vista
3865
+ // In modalità normale invece se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3866
+ // sto facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3867
+ for (i = 0; i < source.length; i++) {
3868
+ if (!repository.indexOf(source[i])) {
3857
3869
  updatedPrefs = false;
3858
3870
  break;
3859
3871
  }
@@ -3890,16 +3902,29 @@
3890
3902
  prefs = _t.sent();
3891
3903
  cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3892
3904
  updatedPrefs = true;
3893
- // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3894
- // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3895
- for (i = 0; i < this.arrayColumns.length; i++) {
3896
- if (!cols.indexOf(this.arrayColumns[i])) {
3905
+ repository = void 0;
3906
+ source = void 0;
3907
+ if (this.View.report_columns) {
3908
+ repository = this.View.report_columns.map(function (t) { return t.id; });
3909
+ source = cols;
3910
+ }
3911
+ else {
3912
+ repository = cols;
3913
+ source = this.View.columns;
3914
+ }
3915
+ // In modalità report devo controllare che tutte le colonne salvate facciano parte della vista
3916
+ // In modalità normale invece se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3917
+ // sto facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3918
+ for (i = 0; i < source.length; i++) {
3919
+ if (!repository.indexOf(source[i])) {
3897
3920
  updatedPrefs = false;
3898
3921
  break;
3899
3922
  }
3900
3923
  }
3901
- this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3902
- this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3924
+ if (updatedPrefs) {
3925
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3926
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3927
+ }
3903
3928
  _t.label = 9;
3904
3929
  case 9:
3905
3930
  if (this.SearchView)