Denys Vuika a8dfbeb572 [ADF-1090] support custom dynamic table row validation (#2308)
* support custom dynamic table row validation

* test fixes

* export missing models
2017-09-08 08:46:29 +02:00

67 lines
2.6 KiB
HTML

<div class="{{field.className}}"
[class.adf-invalid]="!isValid()" *ngIf="field?.isVisible">
<div class="adf-label">{{content.name}}<span *ngIf="isRequired()">*</span></div>
<div *ngIf="!editMode">
<div class="adf-table-container">
<table class="full-width adf-dynamic-table" id="dynamic-table-{{content.id}}">
<thead>
<tr>
<th *ngFor="let column of content.visibleColumns">
{{column.name}}
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let row of content.rows; let idx = index" tabindex="0" id="{{content.id}}-row-{{idx}}"
[class.adf-dynamic-table-widget__row-selected]="row.selected" (keyup)="onKeyPressed($event, row)">
<td *ngFor="let column of content.visibleColumns"
(click)="onRowClicked(row)">
{{ getCellValue(row, column) }}
</td>
</tr>
</tbody>
</table>
</div>
<div *ngIf="!readOnly">
<button md-button
[disabled]="!hasSelection()"
(click)="moveSelectionUp()">
<md-icon>arrow_upward</md-icon>
</button>
<button md-button
[disabled]="!hasSelection()"
(click)="moveSelectionDown()">
<md-icon>arrow_downward</md-icon>
</button>
<button md-button
[disabled]="field.readOnly"
id="{{content.id}}-add-row"
(click)="addNewRow()">
<md-icon>add_circle_outline</md-icon>
</button>
<button md-button
[disabled]="!hasSelection()"
(click)="deleteSelection()">
<md-icon>remove_circle_outline</md-icon>
</button>
<button md-button
[disabled]="!hasSelection()"
(click)="editSelection()">
<md-icon>edit</md-icon>
</button>
</div>
</div>
<row-editor *ngIf="editMode"
[table]="content"
[row]="editRow"
[column]="column"
(save)="onSaveChanges()"
(cancel)="onCancelChanges()">
</row-editor>
<error-widget [error]="field.validationSummary" ></error-widget>
<error-widget *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
</div>