12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <ng-container *ngFor="let rowName of dynaFormRows">
- <ng-container *ngTemplateOutlet="template ? template : default; context: getTemplateContext(rowName)"></ng-container>
- </ng-container>
- <!-- Default template for form field
- used when a TemplateRef is NOT supplied to component -->
- <ng-template let-control="control" let-meta="meta" #default>
- <ng-container *ngIf="meta.type !== 'Hidden'">
- <ng-container *ngIf="!meta.noLabel; else fullWidth">
- <div class="form-group row" *ngIf="isField(meta); else recursiveDynaform" [ngClass]="getRowClass(control, meta)">
- <label class="col-sm-4" [ngClass]="meta.class" [for]="meta.name" title="">
- {{ meta.rowLabel ? meta.rowLabel : meta.label }}
- <span *ngIf="control && control.touched && control.invalid" class="fas fa-exclamation-triangle"
- [ngbTooltip]="getValidationFailureMessage(control, meta)"
- ></span>
- </label>
- <div class="col-sm-8">
- <ng-container dynafield
- [control]="control"
- [meta]="meta"
- (call)="handleCallback($event)"
- ></ng-container>
- </div>
- </div>
- </ng-container>
- <ng-template #recursiveDynaform>
- <ng-container *ngIf="isRepeatingContainer(meta); else container">
- <div *ngIf="meta.display === 'SINGLE'" class="row dyna-repeating-container-selector">
- <div class="col-sm-4 text-right">
- <b>FOCUS ></b>
- </div>
- <div class="col-sm-8">
- <a *ngFor="let container of meta.meta; let i = index"
- class="btn btn-sm"
- [ngClass]="container.focussed ? 'btn-primary' : 'btn-outline-primary'"
- (click)="focusContainer(meta.name, i)">
- {{ getRCLabel(meta.name, i) }}
- </a>
- <a *ngIf="meta.showAddControl"
- class="btn btn-sm btn-outline-success"
- (click)="addRCMember(meta.name)">
- + Add New
- </a>
- </div>
- </div>
- <div *ngFor="let container of meta.meta; let i = index" class="dyna-rc-container" [ngClass]="{ 'dyna-rc-display-all': meta.display === 'ALL' }">
- <ng-container *ngTemplateOutlet="dynaform; context: getRCTemplateContext(meta.name, i)"></ng-container>
- </div>
- <div *ngIf="meta.showAddControl && meta.display === 'ALL'" class="row">
- <div class="col-sm-12">
- <a class="btn btn-sm btn-outline-success" (click)="addRCMember(meta.name)">
- + Add New
- </a>
- </div>
- </div>
- </ng-container>
- </ng-template>
- <ng-template #container>
- <ng-container *ngTemplateOutlet="dynaform; context: { control: control, meta: meta }"></ng-container>
- </ng-template>
- <ng-template #fullWidth>
- <div class="row" [ngClass]="getRowClass(control, meta.type)">
- <ng-container dynafield [control]="control" [meta]="meta" (call)="handleCallback($event)"></ng-container>
- </div>
- </ng-template>
- </ng-container>
- </ng-template>
- <ng-template let-control="control" let-meta="meta" #dynaform>
- <div *ngIf="meta.label" class="row">
- <h3 class="col-sm-12 h-dyna" [ngClass]="'h-dyna-' + (path.length + 2)">{{ meta.label }}</h3>
- </div>
- <app-dynaform [formGroup]="control" [meta]="meta.meta" [template]="template" [ngClass]="{ 'dyna-hidden': !meta.focussed }" (call)="handleCallback($event)"></app-dynaform>
- </ng-template>
- <!-- Display validation status if debugging and not nested -->
- <div *ngIf="debug && path.length === 0">
- <pre [ngClass]="{
- 'alert-success' : formGroup.valid && formGroup.dirty,
- 'alert-danger' : !formGroup.valid && formGroup.dirty,
- 'alert-secondary' : !formGroup.dirty
- }"
- class="alert __debug mt-4"
- role="alert">{{ formGroup.pristine ? 'Untouched' : getValidationErrors() | json }}</pre>
- </div>
|