@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.
@@ -607,6 +607,12 @@ class ColumnMetadataHandler {
607
607
  this.est.arrayOrders = [new AppOrdering(id, order)];
608
608
  }
609
609
  }
610
+ //Salvo le preferences di questa view
611
+ //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
612
+ if (this.est.SavePreferences) {
613
+ let castedView = this.est.viewMode ? (this.est.MainGroupView || this.est.View) : null;
614
+ this.registerViewPreferences(castedView);
615
+ }
610
616
  this.est.onOrderChanged.emit({ id, order });
611
617
  if (this.est.viewMode) {
612
618
  if (this.est.groupSearchRequestsCache.length > 0)
@@ -617,6 +623,30 @@ class ColumnMetadataHandler {
617
623
  else if (this.est.arrayMode)
618
624
  this.est.internalWriteValue();
619
625
  }
626
+ /**
627
+ * Registra le preference relative alla view passata come parametro
628
+ *
629
+ * @param {any} castedView View di cui salvare colonne e ordinamento colonne
630
+ */
631
+ registerViewPreferences(castedView) {
632
+ if (!this.est.ngControl.name) {
633
+ console.error("Non posso utilizzare le preference senza avere un 'name' per la tabella");
634
+ return false;
635
+ }
636
+ if (!this.prefService) {
637
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
638
+ return false;
639
+ }
640
+ let columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
641
+ let columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
642
+ let columnOrders = this.est.arrayMode ? [] : castedView.orders;
643
+ var toStore = {
644
+ columns: JSON.parse(JSON.stringify(columns)),
645
+ column_ordering: JSON.parse(JSON.stringify(columnsOrderings)),
646
+ orders: JSON.parse(JSON.stringify(columnOrders))
647
+ };
648
+ this.prefService.setItem(this.est.ngControl.name, toStore, 'preference').subscribe();
649
+ }
620
650
  /**
621
651
  * Partendo dagli **EsThs** estrappolo la lista di **EsTableColumn** che questa tabella dovrà eventualmente gestire per Visibilità e Ordine
622
652
  *
@@ -1273,20 +1303,8 @@ class ColumnMetadataHandler {
1273
1303
  this.refreshColumnsVisibility(null, null, castedView);
1274
1304
  //Salvo le preferences di questa view
1275
1305
  //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
1276
- if (this.est.SavePreferences) {
1277
- if (!this.est.ngControl.name) {
1278
- console.error("Non posso utilizzare le preference senza avere un 'name' per la tabella");
1279
- return false;
1280
- }
1281
- if (!this.prefService) {
1282
- console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
1283
- return false;
1284
- }
1285
- let columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
1286
- let columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
1287
- var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
1288
- this.prefService.setItem(this.est.ngControl.name, toStore, 'preference').subscribe();
1289
- }
1306
+ if (this.est.SavePreferences)
1307
+ this.registerViewPreferences(castedView);
1290
1308
  // Rieseguo l'ultima ricerca bindata alla tabella
1291
1309
  // Mi assicuro di farlo dopo l'espansione del changed o rischio che la ricerca mi ridia colonne che in realtà non esistono
1292
1310
  if (this.est.viewMode)
@@ -3322,6 +3340,8 @@ class EsTableComponent {
3322
3340
  this.ColumnsPinnable = null;
3323
3341
  /** Indica se dev'essere disponibile il sistema di aggiornamento automatico */
3324
3342
  this.AutoUpdate = null;
3343
+ /** Indica se dev'essere l'estable a gestire la ricerca, anche la prima */
3344
+ this.EsTableHandledSearch = false;
3325
3345
  /**
3326
3346
  * Decide se utilizzare o meno le CustomCells. Impostandolo a **true** l'es-table diventa in grado di gestire nativamente:
3327
3347
  *
@@ -3679,6 +3699,7 @@ class EsTableComponent {
3679
3699
  if (updatedPrefs) {
3680
3700
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3681
3701
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3702
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
3682
3703
  }
3683
3704
  }
3684
3705
  }
@@ -3726,6 +3747,7 @@ class EsTableComponent {
3726
3747
  if (updatedPrefs) {
3727
3748
  this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
3728
3749
  this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
3750
+ this.View.orders = (prefs === null || prefs === void 0 ? void 0 : prefs.orders) || [];
3729
3751
  }
3730
3752
  }
3731
3753
  }
@@ -3734,6 +3756,15 @@ class EsTableComponent {
3734
3756
  }
3735
3757
  this.finalizeContext();
3736
3758
  this.postBoundSourceCalculation();
3759
+ if (this.View && !this.View.selfsearch && this.EsTableHandledSearch) {
3760
+ this.View.selfsearch = true;
3761
+ this.changed();
3762
+ this.onSearchRequest.emit(false);
3763
+ }
3764
+ else if (this.View && this.View.selfsearch && this.EsTableHandledSearch) {
3765
+ this.View.selfsearch = false;
3766
+ this.changed();
3767
+ }
3737
3768
  });
3738
3769
  }
3739
3770
  /**
@@ -4570,6 +4601,7 @@ EsTableComponent.propDecorators = {
4570
4601
  ColumnsResizable: [{ type: Input }],
4571
4602
  ColumnsPinnable: [{ type: Input }],
4572
4603
  AutoUpdate: [{ type: Input }],
4604
+ EsTableHandledSearch: [{ type: Input }],
4573
4605
  UseCustomCells: [{ type: Input }],
4574
4606
  MaxHeight: [{ type: Input }],
4575
4607
  ContainerClass: [{ type: Input }],