@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.
@@ -3393,8 +3393,20 @@ class EsTableComponent {
3393
3393
  // 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
3394
3394
  // a tirare su le preference da qui sopra la View potrebbe essere cambiata
3395
3395
  if (this.View) {
3396
- this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3397
- this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3396
+ let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3397
+ let updatedPrefs = true;
3398
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3399
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3400
+ for (let i = 0; i < this.View.columns.length; i++) {
3401
+ if (!cols.indexOf(this.View.columns[i])) {
3402
+ updatedPrefs = false;
3403
+ break;
3404
+ }
3405
+ }
3406
+ if (updatedPrefs) {
3407
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3408
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3409
+ }
3398
3410
  }
3399
3411
  }
3400
3412
  }
@@ -3417,6 +3429,16 @@ class EsTableComponent {
3417
3429
  console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3418
3430
  else {
3419
3431
  var prefs = yield this.prefService.getItem(this.ngControl.name).toPromise();
3432
+ let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3433
+ let updatedPrefs = true;
3434
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3435
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3436
+ for (let i = 0; i < this.arrayColumns.length; i++) {
3437
+ if (!cols.indexOf(this.arrayColumns[i])) {
3438
+ updatedPrefs = false;
3439
+ break;
3440
+ }
3441
+ }
3420
3442
  this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3421
3443
  this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3422
3444
  }