Overview

DataRepeater

wuic-data-repeater e il renderer archetype-driven: riceve un datasource e disegna list/edit/dialog/map/chart/tree/scheduler/carousel in base all'action.

Descrizione

  • Converte action in archetype runtime (list, edit, detail, map, scheduler, spreadsheet, tree, chart, carousel).
  • Costruisce dinamicamente il componente figlio da renderizzare.
  • Propaga al figlio gli input necessari (datasource, record, field, hideToolbar, ...).
  • Emette evento quando il template e pronto.

API

Selector:

  • wuic-data-repeater

Input:

  • datasource: BehaviorSubject<DataSourceComponent>
  • hardcodedDatasource: DataSourceComponent
  • action: BehaviorSubject<string>
  • hardcodedAction: string
  • field: MetadatiColonna
  • record: any
  • rowCustomSelect: (rowData, $event, dt) => void
  • hideToolbar: boolean
  • isEditForm: boolean
  • fillHeight: boolean (default false)

Output:

  • templateReady: EventEmitter<string>
  • archetypeInstanceReady: EventEmitter<{ archetype, instance }>
  • archetypeEvent: EventEmitter<{ archetype, eventName, payload, instance }>
  • archetypeDataBound: EventEmitter<{ archetype, eventName, payload, instance }>

Proprieta pubbliche:

  • renderedArchetypeInstance: IDataBoundHostComponent | null
  • renderedArchetypeViewChild: any (getter)
  • getRenderedArchetypeViewChild<T>(): T | null

Note operative:

  • Se hardcodedAction e valorizzato, ha priorita rispetto a action.
  • In contesto edit route, isEditForm viene forzato anche quando non passato esplicitamente.
  • Il repeater espone il viewchild logico del figlio via renderedArchetypeViewChild e getRenderedArchetypeViewChild<T>().
  • fillHeight e un flag opt-in: quando true, il repeater forza la catena flex/min-height per riempire verticalmente il contenitore padre (utile nelle pagine custom con layout full-height).

Eventi comuni + accesso all'istanza archetype

Eventi relay aggiunti:

  • archetypeInstanceReady: emesso quando l'istanza del componente archetype e disponibile dopo il render.
  • archetypeEvent: relay generico di tutti gli @Output dell'archetype figlio.
  • archetypeDataBound: sottoinsieme comune di archetypeEvent, emesso quando il nome evento contiene DataBound.

Esempio host-side:

Snippet 1ts
@ViewChild(DataRepeaterComponent) repeater?: DataRepeaterComponent;
private readonly subs = new Subscription();

ngAfterViewInit(): void {
  if (!this.repeater) return;

  this.subs.add(this.repeater.archetypeInstanceReady.subscribe((e) => {

Esempi fillHeight

Uso standard (comportamento invariato):

Snippet 2HTML
<wuic-data-repeater
  [hardcodedDatasource]="citiesDs"
  [action]="action$">
</wuic-data-repeater>

Uso in pagina custom full-height (log/pannelli sotto la grid):

Snippet 3HTML
<div class="repeater-shell">
  <wuic-data-repeater
    [hardcodedDatasource]="citiesDs"
    [action]="action$"
    [fillHeight]="true">
  </wuic-data-repeater>
</div>
Snippet 4CSS
.repeater-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}