@esfaenza/es-table 11.2.75 → 11.2.78

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.
@@ -162,6 +162,8 @@ class AppSearch {
162
162
  /**
163
163
  * Permette di resettare un AppSearch ai valori di default.
164
164
  * Reso statico perché fra una deserializzazione e l'altra si potrebbe perdere il prototype del costruttore
165
+ *
166
+ * @param {AppSearch<any>} aps AppSearch da resettare
165
167
  */
166
168
  static reset(aps) {
167
169
  aps.pages = 1;
@@ -175,6 +177,21 @@ class AppSearch {
175
177
  aps.columns = [];
176
178
  aps.column_ordering = [];
177
179
  aps.savedstate = false;
180
+ aps.selfsearch = false;
181
+ }
182
+ /**
183
+ * Permette di ottenere un nuovo riferimento all'AppSearch passata come parametro.
184
+ * Internamente utilizza il JSON.parse(JSON.stringify(X)) con la differenza che prima stacca il riferimento agli items per evitare di
185
+ * reserializzare potenzialmente centinaia di elementi. Il riferimento viene poi ricollegato alla nuova appsearch generata
186
+ *
187
+ * @param {AppSearch<any>} aps AppSearch di cui estrarre un nuovo riferimento equivalente
188
+ */
189
+ static newref(aps) {
190
+ var items = aps.items;
191
+ aps.items = [];
192
+ var newref = JSON.parse(JSON.stringify(aps));
193
+ newref.items = items;
194
+ return newref;
178
195
  }
179
196
  }
180
197
 
@@ -639,7 +656,12 @@ class ColumnMetadataHandler {
639
656
  }
640
657
  let columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
641
658
  let columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
642
- var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
659
+ let columnOrders = this.est.arrayMode ? [] : castedView.orders;
660
+ var toStore = {
661
+ columns: JSON.parse(JSON.stringify(columns)),
662
+ column_ordering: JSON.parse(JSON.stringify(columnsOrderings)),
663
+ orders: JSON.parse(JSON.stringify(columnOrders))
664
+ };
643
665
  this.prefService.setItem(this.est.ngControl.name, toStore, 'preference').subscribe();
644
666
  }
645
667
  /**
@@ -3335,6 +3357,8 @@ class EsTableComponent {
3335
3357
  this.ColumnsPinnable = null;
3336
3358
  /** Indica se dev'essere disponibile il sistema di aggiornamento automatico */
3337
3359
  this.AutoUpdate = null;
3360
+ /** Indica se dev'essere l'estable a gestire la ricerca, anche la prima */
3361
+ this.EsTableHandledSearch = false;
3338
3362
  /**
3339
3363
  * Decide se utilizzare o meno le CustomCells. Impostandolo a **true** l'es-table diventa in grado di gestire nativamente:
3340
3364
  *
@@ -3692,6 +3716,7 @@ class EsTableComponent {
3692
3716
  if (updatedPrefs) {
3693
3717
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3694
3718
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3719
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
3695
3720
  }
3696
3721
  }
3697
3722
  }
@@ -3739,6 +3764,7 @@ class EsTableComponent {
3739
3764
  if (updatedPrefs) {
3740
3765
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3741
3766
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3767
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
3742
3768
  }
3743
3769
  }
3744
3770
  }
@@ -3747,6 +3773,15 @@ class EsTableComponent {
3747
3773
  }
3748
3774
  this.finalizeContext();
3749
3775
  this.postBoundSourceCalculation();
3776
+ if (this.View && !this.View.selfsearch && this.EsTableHandledSearch) {
3777
+ this.View.selfsearch = true;
3778
+ this.changed();
3779
+ this.onSearchRequest.emit(false);
3780
+ }
3781
+ else if (this.View && this.View.selfsearch && this.EsTableHandledSearch) {
3782
+ this.View.selfsearch = false;
3783
+ this.changed();
3784
+ }
3750
3785
  });
3751
3786
  }
3752
3787
  /**
@@ -4583,6 +4618,7 @@ EsTableComponent.propDecorators = {
4583
4618
  ColumnsResizable: [{ type: Input }],
4584
4619
  ColumnsPinnable: [{ type: Input }],
4585
4620
  AutoUpdate: [{ type: Input }],
4621
+ EsTableHandledSearch: [{ type: Input }],
4586
4622
  UseCustomCells: [{ type: Input }],
4587
4623
  MaxHeight: [{ type: Input }],
4588
4624
  ContainerClass: [{ type: Input }],