|
|
@ -23,174 +23,164 @@ |
|
|
<fieldset *ngFor="let source of sources" [ngClass]="{'fields-group': settings.showGroupTitle}"> |
|
|
<fieldset *ngFor="let source of sources" [ngClass]="{'fields-group': settings.showGroupTitle}"> |
|
|
<legend class="group-title" *ngIf="settings.showGroupTitle">{{ getGroupTitle(source.datasource) }} |
|
|
<legend class="group-title" *ngIf="settings.showGroupTitle">{{ getGroupTitle(source.datasource) }} |
|
|
</legend> |
|
|
</legend> |
|
|
<div class="tb-multiple-input-layout layout-wrap" |
|
|
<div class="tb-multiple-input-layout" |
|
|
[ngClass]="{'vertical-alignment': isVerticalAlignment || changeAlignment}"> |
|
|
[style]="{'grid-template-columns': 'repeat(' + columns + ', 1fr)', 'column-gap': settings.columnGap + 'px', 'row-gap': settings.rowGap + 'px'}"> |
|
|
<div *ngFor="let key of visibleKeys(source)" |
|
|
<ng-container *ngFor="let key of visibleKeys(source)"> |
|
|
[ngStyle]="{width: (isVerticalAlignment || changeAlignment) ? '100%' : inputWidthSettings}"> |
|
|
<mat-form-field *ngIf="key.settings.dataKeyValueType === 'string'" |
|
|
<div class="input-field" *ngIf="key.settings.dataKeyValueType === 'string'"> |
|
|
[appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing"> |
|
|
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic"> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
<input matInput |
|
|
<input matInput |
|
|
formControlName="{{key.formId}}" |
|
|
formControlName="{{key.formId}}" |
|
|
[required]="key.settings.required" |
|
|
[required]="key.settings.required" |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
type="text" |
|
|
type="text" |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)"> |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)"> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matIconPrefix> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matPrefix> |
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
</ng-container> |
|
|
<ng-template #customToggleIcon> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
</ng-template> |
|
|
</mat-error> |
|
|
</ng-container> |
|
|
</mat-form-field> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
<mat-form-field *ngIf="['double', 'integer'].includes(key.settings.dataKeyValueType)" |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
[appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing"> |
|
|
</mat-error> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
</mat-form-field> |
|
|
<input matInput |
|
|
</div> |
|
|
formControlName="{{key.formId}}" |
|
|
<div class="input-field" *ngIf="key.settings.dataKeyValueType === 'double' || |
|
|
[required]="key.settings.required" |
|
|
key.settings.dataKeyValueType === 'integer'"> |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic"> |
|
|
type="number" |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
step="{{key.settings.step}}" |
|
|
<input matInput |
|
|
min="{{key.settings.minValue}}" |
|
|
formControlName="{{key.formId}}" |
|
|
max="{{key.settings.maxValue}}" |
|
|
[required]="key.settings.required" |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)"> |
|
|
type="number" |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matIconPrefix> |
|
|
step="{{key.settings.step}}" |
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
min="{{key.settings.minValue}}" |
|
|
</ng-container> |
|
|
max="{{key.settings.maxValue}}" |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
{{ getErrorMessageText(key.settings,'required') }} |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)"> |
|
|
</mat-error> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matPrefix> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('min')"> |
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
{{ getErrorMessageText(key.settings,'min') }} |
|
|
<ng-template #customToggleIcon> |
|
|
</mat-error> |
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('max')"> |
|
|
</ng-template> |
|
|
{{ getErrorMessageText(key.settings,'max') }} |
|
|
</ng-container> |
|
|
</mat-error> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
</mat-form-field> |
|
|
{{ getErrorMessageText(key.settings,'required') }} |
|
|
<mat-form-field *ngIf="key.settings.dataKeyValueType === 'JSON'" |
|
|
</mat-error> |
|
|
[appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing"> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('min')"> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
{{ getErrorMessageText(key.settings,'min') }} |
|
|
<input |
|
|
</mat-error> |
|
|
matInput |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('max')"> |
|
|
type="text" |
|
|
{{ getErrorMessageText(key.settings,'max') }} |
|
|
formControlName="{{key.formId}}" |
|
|
</mat-error> |
|
|
tb-json-to-string |
|
|
</mat-form-field> |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
</div> |
|
|
[required]="key.settings.required" |
|
|
<div class="input-field mat-block" *ngIf="key.settings.dataKeyValueType === 'booleanCheckbox'"> |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
<mat-checkbox formControlName="{{key.formId}}" |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)" |
|
|
(change)="inputChanged(source, key)"> |
|
|
/> |
|
|
<span class="label-wrapper">{{key.label}}</span> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matIconPrefix> |
|
|
</mat-checkbox> |
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
</div> |
|
|
</ng-container> |
|
|
<div class="input-field" *ngIf="key.settings.dataKeyValueType === 'JSON'"> |
|
|
<button [disabled]="key.settings.isEditable === 'disabled' || key.settings.isEditable === 'readonly'" |
|
|
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic"> |
|
|
type="button" |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
matSuffix mat-icon-button |
|
|
<input |
|
|
(click)="openEditJSONDialog($event, key, source)"> |
|
|
matInput |
|
|
<mat-icon>open_in_new</mat-icon> |
|
|
type="text" |
|
|
</button> |
|
|
formControlName="{{key.formId}}" |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
tb-json-to-string |
|
|
{{ getErrorMessageText(key.settings,'required') }} |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
</mat-error> |
|
|
[required]="key.settings.required" |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('invalidJSON')"> |
|
|
(focus)="key.isFocused = true; focusInputElement($event)" |
|
|
{{ getErrorMessageText(key.settings,'invalidJSON') | translate }} |
|
|
(blur)="key.isFocused = false; inputChanged(source, key)" |
|
|
</mat-error> |
|
|
/> |
|
|
</mat-form-field> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matPrefix> |
|
|
<mat-form-field *ngIf="['dateTime','date', 'time'].includes(key.settings.dataKeyValueType)" |
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
[appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing"> |
|
|
<ng-template #customToggleIcon> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
<mat-datetimepicker-toggle [for]="datePicker" matPrefix></mat-datetimepicker-toggle> |
|
|
</ng-template> |
|
|
<mat-datetimepicker #datePicker type="{{datePickerType(key.settings.dataKeyValueType)}}" |
|
|
</ng-container> |
|
|
openOnFocus="true"></mat-datetimepicker> |
|
|
<button [disabled]="key.settings.isEditable === 'disabled' || key.settings.isEditable === 'readonly'" |
|
|
<input matInput formControlName="{{key.formId}}" |
|
|
type="button" |
|
|
[required]="key.settings.required" |
|
|
matSuffix mat-icon-button |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
(click)="openEditJSONDialog($event, key, source)"> |
|
|
[matDatetimepicker]="datePicker" |
|
|
<mat-icon>open_in_new</mat-icon> |
|
|
(focus)="key.isFocused = true;" |
|
|
</button> |
|
|
(blur)="key.isFocused = false;" |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
(dateChange)="inputChanged(source, key)"> |
|
|
{{ getErrorMessageText(key.settings,'required') }} |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
</mat-error> |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('invalidJSON')"> |
|
|
</mat-error> |
|
|
{{ getErrorMessageText(key.settings,'invalidJSON') | translate }} |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('matDatepickerParse')"> |
|
|
</mat-error> |
|
|
{{ getErrorMessageText(key.settings, 'invalidDate') }} |
|
|
</mat-form-field> |
|
|
</mat-error> |
|
|
</div> |
|
|
</mat-form-field> |
|
|
<div class="input-field mat-block" *ngIf="key.settings.dataKeyValueType === 'booleanSwitch'"> |
|
|
<mat-form-field *ngIf="key.settings.dataKeyValueType === 'select'" |
|
|
<mat-slide-toggle formControlName="{{key.formId}}" |
|
|
[appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing"> |
|
|
[labelPosition]="key.settings.slideToggleLabelPosition" |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
(change)="inputChanged(source, key)"> |
|
|
<mat-select formControlName="{{key.formId}}" |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon"> |
|
|
[required]="key.settings.required" |
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
(focus)="key.isFocused = true;" |
|
|
<ng-template #customToggleIcon> |
|
|
(selectionChange)="key.isFocused = false; inputChanged(source, key)"> |
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
<mat-option *ngFor="let option of key.settings.selectOptions" |
|
|
</ng-template> |
|
|
[value]="option.value" |
|
|
</ng-container> |
|
|
[disabled]="key.settings.isEditable === 'readonly'"> |
|
|
<span class="label-wrapper">{{key.label}}</span> |
|
|
{{ getCustomTranslationText(option.label ? option.label : option.value) }} |
|
|
</mat-slide-toggle> |
|
|
</mat-option> |
|
|
</div> |
|
|
</mat-select> |
|
|
<div class="input-field mat-block date-time-input" *ngIf="(key.settings.dataKeyValueType === 'dateTime') || |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matIconPrefix> |
|
|
(key.settings.dataKeyValueType === 'date') || |
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
(key.settings.dataKeyValueType === 'time')" fxLayout="column"> |
|
|
</ng-container> |
|
|
<mat-form-field appearance="outline" subscriptSizing="dynamic"> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
<mat-datetimepicker-toggle [for]="datePicker" matPrefix></mat-datetimepicker-toggle> |
|
|
</mat-error> |
|
|
<mat-datetimepicker #datePicker type="{{datePickerType(key.settings.dataKeyValueType)}}" |
|
|
</mat-form-field> |
|
|
openOnFocus="true"></mat-datetimepicker> |
|
|
<mat-form-field *ngIf="key.settings.dataKeyValueType === 'color'" |
|
|
<input matInput formControlName="{{key.formId}}" |
|
|
class="color-input" [appearance]="key.settings.appearance" [subscriptSizing]="key.settings.subscriptSizing" |
|
|
[required]="key.settings.required" |
|
|
(click)="colorInput.openColorPickerPopup($event)"> |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
[matDatetimepicker]="datePicker" |
|
|
<input matInput |
|
|
(focus)="key.isFocused = true;" |
|
|
formControlName="{{key.formId}}" |
|
|
(blur)="key.isFocused = false;" |
|
|
[required]="key.settings.required" |
|
|
(dateChange)="inputChanged(source, key)"> |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
type="text" |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
(keydown)="$event.preventDefault();"> |
|
|
</mat-error> |
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon" matIconPrefix> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('matDatepickerParse')"> |
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
{{ getErrorMessageText(key.settings, 'invalidDate') }} |
|
|
</ng-container> |
|
|
</mat-error> |
|
|
<tb-color-input #colorInput asBoxInput matSuffix |
|
|
</mat-form-field> |
|
|
colorClearButton |
|
|
</div> |
|
|
[disabled]="multipleInputFormGroup.get(key.formId).disabled" |
|
|
<div class="input-field" *ngIf="key.settings.dataKeyValueType === 'select'"> |
|
|
[readonly]="key.settings.isEditable === 'readonly'" |
|
|
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic"> |
|
|
[ngModel]="multipleInputFormGroup.get(key.formId).value" |
|
|
<mat-label>{{key.label}}</mat-label> |
|
|
(ngModelChange)="colorChanged(source, key, $event)" |
|
|
<mat-select formControlName="{{key.formId}}" |
|
|
[ngModelOptions]="{ standalone: true }"> |
|
|
[required]="key.settings.required" |
|
|
|
|
|
(focus)="key.isFocused = true;" |
|
|
|
|
|
(selectionChange)="key.isFocused = false; inputChanged(source, key)"> |
|
|
|
|
|
<mat-option *ngFor="let option of key.settings.selectOptions" |
|
|
|
|
|
[value]="option.value" |
|
|
|
|
|
[disabled]="key.settings.isEditable === 'readonly'"> |
|
|
|
|
|
{{ getCustomTranslationText(option.label ? option.label : option.value) }} |
|
|
|
|
|
</mat-option> |
|
|
|
|
|
</mat-select> |
|
|
|
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
|
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
|
|
|
</mat-error> |
|
|
|
|
|
</mat-form-field> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="tb-form-row space-between color-picker-input" *ngIf="key.settings.dataKeyValueType === 'color'"> |
|
|
|
|
|
<div class="label-container"> |
|
|
|
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon"> |
|
|
|
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
|
|
|
<ng-template #customToggleIcon> |
|
|
|
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
|
|
|
</ng-template> |
|
|
|
|
|
</ng-container> |
|
|
|
|
|
{{key.label}} |
|
|
|
|
|
</div> |
|
|
|
|
|
<tb-color-input asBoxInput |
|
|
|
|
|
[required]="key.settings.required" |
|
|
|
|
|
[requiredText]="getErrorMessageText(key.settings, 'required')" |
|
|
|
|
|
openOnInput |
|
|
|
|
|
formControlName="{{key.formId}}"> |
|
|
|
|
|
</tb-color-input> |
|
|
</tb-color-input> |
|
|
</div> |
|
|
<mat-error *ngIf="multipleInputFormGroup.get(key.formId).hasError('required')"> |
|
|
</div> |
|
|
{{ getErrorMessageText(key.settings, 'required') }} |
|
|
|
|
|
</mat-error> |
|
|
|
|
|
</mat-form-field> |
|
|
|
|
|
<mat-checkbox *ngIf="key.settings.dataKeyValueType === 'booleanCheckbox'" |
|
|
|
|
|
formControlName="{{key.formId}}" |
|
|
|
|
|
(change)="inputChanged(source, key)"> |
|
|
|
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon"> |
|
|
|
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
|
|
|
</ng-container> |
|
|
|
|
|
<span class="label-wrapper">{{key.label}}</span> |
|
|
|
|
|
</mat-checkbox> |
|
|
|
|
|
<mat-slide-toggle *ngIf="key.settings.dataKeyValueType === 'booleanSwitch'" |
|
|
|
|
|
formControlName="{{key.formId}}" |
|
|
|
|
|
[labelPosition]="key.settings.slideToggleLabelPosition" |
|
|
|
|
|
(change)="inputChanged(source, key)"> |
|
|
|
|
|
<ng-container *ngIf="key.settings.icon || key.settings.safeCustomIcon"> |
|
|
|
|
|
<ng-container *ngTemplateOutlet="iconPrefix; context: {key: key}"></ng-container> |
|
|
|
|
|
</ng-container> |
|
|
|
|
|
<span class="label-wrapper">{{key.label}}</span> |
|
|
|
|
|
</mat-slide-toggle> |
|
|
|
|
|
</ng-container> |
|
|
</div> |
|
|
</div> |
|
|
</fieldset> |
|
|
</fieldset> |
|
|
</div> |
|
|
</div> |
|
|
@ -216,3 +206,9 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
</form> |
|
|
|
|
|
<ng-template #iconPrefix let-key="key"> |
|
|
|
|
|
<tb-icon *ngIf="!key.settings.safeCustomIcon; else customToggleIcon">{{key.settings.icon}}</tb-icon> |
|
|
|
|
|
<ng-template #customToggleIcon> |
|
|
|
|
|
<img class="mat-icon" [src]="key.settings.safeCustomIcon" alt="icon"> |
|
|
|
|
|
</ng-template> |
|
|
|
|
|
</ng-template> |
|
|
|