Skip to content
Snippets Groups Projects
Commit 9401b633 authored by rhenck's avatar rhenck
Browse files

Add option to allow deselection of drowdown value

parent e348a7e2
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ import { FormElementComponent } from '../form-element-component.directive'; ...@@ -18,6 +18,7 @@ import { FormElementComponent } from '../form-element-component.directive';
{{$any(elementModel).label}} {{$any(elementModel).label}}
</mat-label> </mat-label>
<mat-select [formControl]="elementFormControl"> <mat-select [formControl]="elementFormControl">
<mat-option *ngIf="elementModel.allowUnset" value=""></mat-option>
<mat-option *ngFor="let option of elementModel.options" [value]="option"> <mat-option *ngFor="let option of elementModel.options" [value]="option">
{{option}} {{option}}
</mat-option> </mat-option>
......
...@@ -100,6 +100,7 @@ export interface DropdownElement extends InputUIElement, TextUIElement, SurfaceU ...@@ -100,6 +100,7 @@ export interface DropdownElement extends InputUIElement, TextUIElement, SurfaceU
label: string; label: string;
options: string[]; options: string[];
value: string | undefined; value: string | undefined;
allowUnset: boolean;
} }
export interface RadioButtonGroupElement extends InputUIElement, TextUIElement, SurfaceUIElement { export interface RadioButtonGroupElement extends InputUIElement, TextUIElement, SurfaceUIElement {
......
...@@ -143,6 +143,7 @@ export function createCheckboxElement(): CheckboxElement { ...@@ -143,6 +143,7 @@ export function createCheckboxElement(): CheckboxElement {
export function createDropdownElement(): DropdownElement { export function createDropdownElement(): DropdownElement {
return <DropdownElement><unknown>{ return <DropdownElement><unknown>{
options: [], options: [],
allowUnset: false,
...createUnitUIElement('dropdown'), ...createUnitUIElement('dropdown'),
...createInputUIElement('Label Dropdown', undefined), ...createInputUIElement('Label Dropdown', undefined),
...createTextUIElement(), ...createTextUIElement(),
......
...@@ -65,6 +65,12 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -65,6 +65,12 @@ import { SelectionService } from '../../../../selection.service';
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-checkbox *ngIf="combinedProperties.hasOwnProperty('allowUnset')"
[checked]="$any(combinedProperties.allowUnset)"
(change)="updateModel('allowUnset', $event.checked)">
Deselektion erlauben
</mat-checkbox>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-checkbox *ngIf="combinedProperties.hasOwnProperty('required')" <mat-checkbox *ngIf="combinedProperties.hasOwnProperty('required')"
......
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