@esfaenza/es-table 13.1.20 → 13.1.21

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.
@@ -3685,8 +3685,20 @@ class EsTableComponent {
3685
3685
  // 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
3686
3686
  // a tirare su le preference da qui sopra la View potrebbe essere cambiata
3687
3687
  if (this.View) {
3688
- this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3689
- this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3688
+ let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3689
+ let updatedPrefs = true;
3690
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3691
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3692
+ for (let i = 0; i < this.View.columns.length; i++) {
3693
+ if (!cols.indexOf(this.View.columns[i])) {
3694
+ updatedPrefs = false;
3695
+ break;
3696
+ }
3697
+ }
3698
+ if (updatedPrefs) {
3699
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3700
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3701
+ }
3690
3702
  }
3691
3703
  }
3692
3704
  }
@@ -3709,6 +3721,16 @@ class EsTableComponent {
3709
3721
  console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3710
3722
  else {
3711
3723
  var prefs = yield this.prefService.getItem(this.ngControl.name).toPromise();
3724
+ let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3725
+ let updatedPrefs = true;
3726
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3727
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3728
+ for (let i = 0; i < this.arrayColumns.length; i++) {
3729
+ if (!cols.indexOf(this.arrayColumns[i])) {
3730
+ updatedPrefs = false;
3731
+ break;
3732
+ }
3733
+ }
3712
3734
  this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3713
3735
  this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3714
3736
  }