@esfaenza/es-table 11.2.74 → 11.2.77

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.
@@ -967,6 +967,12 @@
967
967
  this.est.arrayOrders = [new AppOrdering(id, order)];
968
968
  }
969
969
  }
970
+ //Salvo le preferences di questa view
971
+ //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
972
+ if (this.est.SavePreferences) {
973
+ var castedView = this.est.viewMode ? (this.est.MainGroupView || this.est.View) : null;
974
+ this.registerViewPreferences(castedView);
975
+ }
970
976
  this.est.onOrderChanged.emit({ id: id, order: order });
971
977
  if (this.est.viewMode) {
972
978
  if (this.est.groupSearchRequestsCache.length > 0)
@@ -977,6 +983,30 @@
977
983
  else if (this.est.arrayMode)
978
984
  this.est.internalWriteValue();
979
985
  };
986
+ /**
987
+ * Registra le preference relative alla view passata come parametro
988
+ *
989
+ * @param {any} castedView View di cui salvare colonne e ordinamento colonne
990
+ */
991
+ ColumnMetadataHandler.prototype.registerViewPreferences = function (castedView) {
992
+ if (!this.est.ngControl.name) {
993
+ console.error("Non posso utilizzare le preference senza avere un 'name' per la tabella");
994
+ return false;
995
+ }
996
+ if (!this.prefService) {
997
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
998
+ return false;
999
+ }
1000
+ var columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
1001
+ var columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
1002
+ var columnOrders = this.est.arrayMode ? [] : castedView.orders;
1003
+ var toStore = {
1004
+ columns: JSON.parse(JSON.stringify(columns)),
1005
+ column_ordering: JSON.parse(JSON.stringify(columnsOrderings)),
1006
+ orders: JSON.parse(JSON.stringify(columnOrders))
1007
+ };
1008
+ this.prefService.setItem(this.est.ngControl.name, toStore, 'preference').subscribe();
1009
+ };
980
1010
  /**
981
1011
  * Partendo dagli **EsThs** estrappolo la lista di **EsTableColumn** che questa tabella dovrà eventualmente gestire per Visibilità e Ordine
982
1012
  *
@@ -1650,20 +1680,8 @@
1650
1680
  this.refreshColumnsVisibility(null, null, castedView);
1651
1681
  //Salvo le preferences di questa view
1652
1682
  //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
1653
- if (this.est.SavePreferences) {
1654
- if (!this.est.ngControl.name) {
1655
- console.error("Non posso utilizzare le preference senza avere un 'name' per la tabella");
1656
- return false;
1657
- }
1658
- if (!this.prefService) {
1659
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
1660
- return false;
1661
- }
1662
- var columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
1663
- var columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
1664
- var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
1665
- this.prefService.setItem(this.est.ngControl.name, toStore, 'preference').subscribe();
1666
- }
1683
+ if (this.est.SavePreferences)
1684
+ this.registerViewPreferences(castedView);
1667
1685
  // Rieseguo l'ultima ricerca bindata alla tabella
1668
1686
  // Mi assicuro di farlo dopo l'espansione del changed o rischio che la ricerca mi ridia colonne che in realtà non esistono
1669
1687
  if (this.est.viewMode)
@@ -3822,6 +3840,8 @@
3822
3840
  this.ColumnsPinnable = null;
3823
3841
  /** Indica se dev'essere disponibile il sistema di aggiornamento automatico */
3824
3842
  this.AutoUpdate = null;
3843
+ /** Indica se dev'essere l'estable a gestire la ricerca, anche la prima */
3844
+ this.EsTableHandledSearch = false;
3825
3845
  /**
3826
3846
  * Decide se utilizzare o meno le CustomCells. Impostandolo a **true** l'es-table diventa in grado di gestire nativamente:
3827
3847
  *
@@ -4190,6 +4210,7 @@
4190
4210
  if (updatedPrefs) {
4191
4211
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
4192
4212
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
4213
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
4193
4214
  }
4194
4215
  }
4195
4216
  _t.label = 4;
@@ -4241,6 +4262,7 @@
4241
4262
  if (updatedPrefs) {
4242
4263
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
4243
4264
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
4265
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
4244
4266
  }
4245
4267
  _t.label = 9;
4246
4268
  case 9:
@@ -4250,6 +4272,15 @@
4250
4272
  case 10:
4251
4273
  this.finalizeContext();
4252
4274
  this.postBoundSourceCalculation();
4275
+ if (this.View && !this.View.selfsearch && this.EsTableHandledSearch) {
4276
+ this.View.selfsearch = true;
4277
+ this.changed();
4278
+ this.onSearchRequest.emit(false);
4279
+ }
4280
+ else if (this.View && this.View.selfsearch && this.EsTableHandledSearch) {
4281
+ this.View.selfsearch = false;
4282
+ this.changed();
4283
+ }
4253
4284
  return [2 /*return*/];
4254
4285
  }
4255
4286
  });
@@ -5102,6 +5133,7 @@
5102
5133
  ColumnsResizable: [{ type: i0.Input }],
5103
5134
  ColumnsPinnable: [{ type: i0.Input }],
5104
5135
  AutoUpdate: [{ type: i0.Input }],
5136
+ EsTableHandledSearch: [{ type: i0.Input }],
5105
5137
  UseCustomCells: [{ type: i0.Input }],
5106
5138
  MaxHeight: [{ type: i0.Input }],
5107
5139
  ContainerClass: [{ type: i0.Input }],