@esfaenza/es-table 11.2.52 → 11.2.53

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.
@@ -3839,7 +3839,7 @@
3839
3839
  EsTableComponent.prototype.writeValue = function (obj) {
3840
3840
  var _a;
3841
3841
  return __awaiter(this, void 0, void 0, function () {
3842
- var firstItemGroupOrNoGrouping, prefs, prefs;
3842
+ var firstItemGroupOrNoGrouping, prefs, cols, updatedPrefs, i, prefs, cols, updatedPrefs, i;
3843
3843
  return __generator(this, function (_t) {
3844
3844
  switch (_t.label) {
3845
3845
  case 0:
@@ -3895,8 +3895,20 @@
3895
3895
  // In casi la gente si metta a spammare refresh con ngif strani sull'estable creandola e distruggendola N volte al secondo nel tempo che ci mette
3896
3896
  // a tirare su le preference da qui sopra la View potrebbe essere cambiata
3897
3897
  if (this.View) {
3898
- this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3899
- this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3898
+ cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3899
+ updatedPrefs = true;
3900
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3901
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3902
+ for (i = 0; i < this.View.columns.length; i++) {
3903
+ if (!cols.indexOf(this.View.columns[i])) {
3904
+ updatedPrefs = false;
3905
+ break;
3906
+ }
3907
+ }
3908
+ if (updatedPrefs) {
3909
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3910
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3911
+ }
3900
3912
  }
3901
3913
  _t.label = 5;
3902
3914
  case 5:
@@ -3923,6 +3935,16 @@
3923
3935
  case 8: return [4 /*yield*/, this.prefService.getItem(this.ngControl.name).toPromise()];
3924
3936
  case 9:
3925
3937
  prefs = _t.sent();
3938
+ cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3939
+ updatedPrefs = true;
3940
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3941
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3942
+ for (i = 0; i < this.arrayColumns.length; i++) {
3943
+ if (!cols.indexOf(this.arrayColumns[i])) {
3944
+ updatedPrefs = false;
3945
+ break;
3946
+ }
3947
+ }
3926
3948
  this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3927
3949
  this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3928
3950
  _t.label = 10;