@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.
@@ -3356,11 +3356,21 @@ class EsTableComponent {
3356
3356
  if (this.View) {
3357
3357
  let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3358
3358
  let updatedPrefs = true;
3359
- // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3360
- // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3361
- let columns = this.View.report_columns ? this.View.report_columns.map(t => t.id) : this.View.columns;
3362
- for (let i = 0; i < columns.length; i++) {
3363
- if (!cols.indexOf(columns[i])) {
3359
+ let repository;
3360
+ let source;
3361
+ if (this.View.report_columns) {
3362
+ repository = this.View.report_columns.map(t => t.id);
3363
+ source = cols;
3364
+ }
3365
+ else {
3366
+ repository = cols;
3367
+ source = this.View.columns;
3368
+ }
3369
+ // In modalità report devo controllare che tutte le colonne salvate facciano parte della vista
3370
+ // In modalità normale invece se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3371
+ // sto facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3372
+ for (let i = 0; i < source.length; i++) {
3373
+ if (!repository.indexOf(source[i])) {
3364
3374
  updatedPrefs = false;
3365
3375
  break;
3366
3376
  }
@@ -3393,16 +3403,29 @@ class EsTableComponent {
3393
3403
  var prefs = yield this.prefService.getItem(this.ngControl.name).toPromise();
3394
3404
  let cols = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3395
3405
  let updatedPrefs = true;
3396
- // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3397
- // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3398
- for (let i = 0; i < this.arrayColumns.length; i++) {
3399
- if (!cols.indexOf(this.arrayColumns[i])) {
3406
+ let repository;
3407
+ let source;
3408
+ if (this.View.report_columns) {
3409
+ repository = this.View.report_columns.map(t => t.id);
3410
+ source = cols;
3411
+ }
3412
+ else {
3413
+ repository = cols;
3414
+ source = this.View.columns;
3415
+ }
3416
+ // In modalità report devo controllare che tutte le colonne salvate facciano parte della vista
3417
+ // In modalità normale invece se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3418
+ // sto facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3419
+ for (let i = 0; i < source.length; i++) {
3420
+ if (!repository.indexOf(source[i])) {
3400
3421
  updatedPrefs = false;
3401
3422
  break;
3402
3423
  }
3403
3424
  }
3404
- this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3405
- this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3425
+ if (updatedPrefs) {
3426
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3427
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3428
+ }
3406
3429
  }
3407
3430
  }
3408
3431
  if (this.SearchView)