diff --git a/projects/common/element-components/dropdown.component.ts b/projects/common/element-components/dropdown.component.ts index 7774b74a059a64a4847c4ebd32d83ed6dcd41c07..0a7e2127e1addee5ab57dc74983515bc08a6f09d 100644 --- a/projects/common/element-components/dropdown.component.ts +++ b/projects/common/element-components/dropdown.component.ts @@ -18,6 +18,7 @@ import { FormElementComponent } from '../form-element-component.directive'; {{$any(elementModel).label}} </mat-label> <mat-select [formControl]="elementFormControl"> + <mat-option *ngIf="elementModel.allowUnset" value=""></mat-option> <mat-option *ngFor="let option of elementModel.options" [value]="option"> {{option}} </mat-option> diff --git a/projects/common/unit.ts b/projects/common/unit.ts index 6714723b4415c58c145cc63ff265ed7e43bff26c..284a53f629787e99e423a7051a3b98649b46720d 100644 --- a/projects/common/unit.ts +++ b/projects/common/unit.ts @@ -100,6 +100,7 @@ export interface DropdownElement extends InputUIElement, TextUIElement, SurfaceU label: string; options: string[]; value: string | undefined; + allowUnset: boolean; } export interface RadioButtonGroupElement extends InputUIElement, TextUIElement, SurfaceUIElement { diff --git a/projects/editor/src/app/UnitFactory.ts b/projects/editor/src/app/UnitFactory.ts index 37ca23a7b6474d87d7496e736dd58df7150bcd41..a6d0dc6aebb71af7827f31be0ce52fbecaf3078a 100644 --- a/projects/editor/src/app/UnitFactory.ts +++ b/projects/editor/src/app/UnitFactory.ts @@ -143,6 +143,7 @@ export function createCheckboxElement(): CheckboxElement { export function createDropdownElement(): DropdownElement { return <DropdownElement><unknown>{ options: [], + allowUnset: false, ...createUnitUIElement('dropdown'), ...createInputUIElement('Label Dropdown', undefined), ...createTextUIElement(), diff --git a/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.ts b/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.ts index deee93a5157d857beb681943e49e1543793ece28..61933b7bd3d5e616e61fccfa2f491a7c37ee8e8e 100644 --- a/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.ts +++ b/projects/editor/src/app/components/unit-view/page-view/properties/element-properties.component.ts @@ -65,6 +65,12 @@ import { SelectionService } from '../../../../selection.service'; </mat-select> </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-checkbox *ngIf="combinedProperties.hasOwnProperty('required')"