Skip to content
Snippets Groups Projects
Commit 6b2cfb41 authored by rhenck's avatar rhenck
Browse files

Add clearable property to textfields

This makes a small (suffix) button appear which clears all the input of 
that field.
parent 5b99354a
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@ export class TextFieldElement extends InputElement implements FontElement, Surfa
inputAssistance: boolean = false;
inputAssistancePreset: 'french' | 'numbers' | 'numbersAndOperators' | null = null;
clearable: boolean = false;
fontColor: string = 'black';
font: string = 'Roboto';
fontSize: number = 18;
......
......@@ -23,6 +23,10 @@ import { TextFieldElement } from '../classes/textFieldElement';
autocomplete="off"
[formControl]="elementFormControl"
placeholder="{{elementModel.label}}">
<button *ngIf="elementModel.clearable" matSuffix mat-icon-button aria-label="Clear"
(click)="elementFormControl.setValue('')">
<mat-icon>close</mat-icon>
</button>
<mat-error *ngIf="elementFormControl.errors">
{{elementFormControl.errors | errorTransform: elementModel}}
</mat-error>
......
......@@ -206,6 +206,12 @@
(input)="updateModel('patternWarnMessage', $any($event.target).value)">
</mat-form-field>
<mat-checkbox *ngIf="combinedProperties.clearable !== undefined"
[checked]="$any(combinedProperties.clearable)"
(change)="updateModel('clearable', $event.checked)">
Knopf zum Leeren anzeigen
</mat-checkbox>
<mat-checkbox *ngIf="combinedProperties.inputAssistance !== undefined"
[checked]="$any(combinedProperties.inputAssistance)"
(change)="updateModel('inputAssistance', $event.checked)">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment