@esfaenza/es-table 19.2.22 → 19.2.24

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.
@@ -9,7 +9,7 @@ import * as i1 from '@angular/forms';
9
9
  import { FormsModule } from '@angular/forms';
10
10
  import * as i5$1 from 'primeng/select';
11
11
  import { SelectModule } from 'primeng/select';
12
- import { Subject, forkJoin, fromEvent, takeUntil } from 'rxjs';
12
+ import { ReplaySubject, Subject, forkJoin, fromEvent, takeUntil } from 'rxjs';
13
13
  import * as i13 from '@angular/cdk/drag-drop';
14
14
  import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
15
15
  import * as i2$1 from '@esfaenza/preferences';
@@ -474,7 +474,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
474
474
 
475
475
  class ThTdProvider {
476
476
  constructor() {
477
- this.LoadedSignal = new Subject();
477
+ this.LoadedSignal = new ReplaySubject();
478
478
  }
479
479
  setLoaded() {
480
480
  requestAnimationFrame(() => {
@@ -4036,7 +4036,7 @@ class EsTableComponent {
4036
4036
  /** Diminuisce gli spazi fra una cella e l'altra, e internamente il padding del font in modo da presentare molti più dati in un'unica pagina */
4037
4037
  this.HighCellDensity = input(null);
4038
4038
  /** Abilita o meno la possibilità di selezionare oggetti */
4039
- this._Selection = input(null, { alias: "Selection" });
4039
+ this._Selection = input(null, { alias: "Selection", transform: this.setUnderlyingSignal.bind(this, "Selection") });
4040
4040
  this.Selection = signal(null);
4041
4041
  /** Mostra o meno un messaggio di Loading al primo caricamento della tabella */
4042
4042
  this.ShowLoadingOnBootstrap = input(null);
@@ -4296,6 +4296,9 @@ class EsTableComponent {
4296
4296
  if (ngControl)
4297
4297
  ngControl.valueAccessor = this;
4298
4298
  }
4299
+ setUnderlyingSignal(signalName, value) {
4300
+ this[signalName].set(value);
4301
+ }
4299
4302
  /** @ignore */
4300
4303
  ngOnInit() {
4301
4304
  // click destro su una riga con selezione attiva: Tiro fuori il context menu e selezione l'elemento corrente
@@ -4404,6 +4407,11 @@ class EsTableComponent {
4404
4407
  /** @ignore */
4405
4408
  async writeValue(obj, throttle = true) {
4406
4409
  this.View = obj ? obj : null;
4410
+ // Qui il concetto è "devo aspettare che l'afterViewInit venga eseguito prima di eseguire questo"
4411
+ // E dato che entrambi aspettano sui provider li faccio così
4412
+ let thsTdsProviders = [...(this.EsThTdProvider ? [this.EsThTdProvider] : []), ...(this.ThTdProvider || [])];
4413
+ if (thsTdsProviders?.length > 0)
4414
+ await forkJoin(thsTdsProviders.map(t => t.LoadedSignal)).toPromise();
4407
4415
  if (this.EsTableHandledSearch() && throttle) {
4408
4416
  if (this.callTimeout)
4409
4417
  clearTimeout(this.callTimeout);
@@ -4637,12 +4645,10 @@ class EsTableComponent {
4637
4645
  let arrayMode = this.arrayMode();
4638
4646
  let isp = this.ItemSourceProperty();
4639
4647
  let customCells = this.UseCustomCells();
4640
- let dynColDefs = this.DynamicRowColumnsDefinition();
4641
- let thsTdsProviders = [...(this.EsThTdProvider ? [this.EsThTdProvider] : []), ...this.ThTdProvider];
4642
- if (thsTdsProviders?.length > 0)
4643
- await forkJoin(thsTdsProviders.map(t => t.LoadedSignal)).toPromise();
4644
4648
  // Se non ho colonne dinamiche ma sono in modalità dinamica (lo capisco perché c'è una view piena di genericitem) metto il default delle colonne
4645
4649
  this.dynamicMode_H.eventuallyReviewDynamicColumns();
4650
+ // Assolutamente da fare dopo il eventuallyReviewDynamicColumns()
4651
+ let dynColDefs = this.DynamicRowColumnsDefinition();
4646
4652
  // Gestisce la richiesta per gruppi o per singoli oggetti
4647
4653
  this.bindDisplayToLoadedItemsOrGroups(View);
4648
4654
  // Questo dev'essere per forza lanciato dopo **bindDisplayToLoadedItemsOrGroups** dato che è lì che alcune cose vengono valorizzate
@@ -5278,9 +5284,9 @@ class EsTableComponent {
5278
5284
  * Helper per effettuare chiamate interne di allineamento alla funzione **writeValue**,
5279
5285
  * impostando prima **internalWriteCall** in modo da non effettuare operazioni inutili
5280
5286
  */
5281
- internalWriteValue() {
5287
+ async internalWriteValue() {
5282
5288
  this.internalWriteCall = true;
5283
- this.writeValue(this.View);
5289
+ await this.writeValue(this.View);
5284
5290
  this.internalWriteCall = false;
5285
5291
  }
5286
5292
  /** Metodo eventualmente richiamabile anche dal componente esterno che permette di forzare un refresh della tabella */