Skip to content
Snippets Groups Projects
Commit 99f696db authored by rhenck's avatar rhenck
Browse files

[editor] Fix sizing properties panel

- Fix conditions for showing inputs. As all the properties are mandatory 
and have to be available, so no contionals are need here.
- Move CSS into the component (from parent properties component)
parent 78761b10
No related branches found
No related tags found
No related merge requests found
::ng-deep app-element-properties .margin-properties .mat-form-field-infix {
width: 55px;
}
::ng-deep app-element-properties .small-input .mat-form-field-infix {
width: 95px;
margin: 0 5px;
}
.list-items { .list-items {
padding: 5px 10px; padding: 5px 10px;
border-bottom: solid 1px #ccc; border-bottom: solid 1px #ccc;
}
.list-items {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
...@@ -23,19 +11,6 @@ ...@@ -23,19 +11,6 @@
margin-top: 10px margin-top: 10px
} }
.input-group {
background-color: rgba(0,0,0,.04);
margin-bottom: 10px;
}
.centered-form-field {
margin-left: 25%;
}
.right-form-field {
margin-left: 15%;
}
::ng-deep app-element-properties .mat-tab-label { ::ng-deep app-element-properties .mat-tab-label {
min-width: 0 !important; min-width: 0 !important;
} }
...@@ -49,13 +24,10 @@ ...@@ -49,13 +24,10 @@
max-height: 500px; max-height: 500px;
overflow: auto; overflow: auto;
margin-bottom: 10px; margin-bottom: 10px;
}
.text-text {
background-color: rgba(0,0,0,.04); background-color: rgba(0,0,0,.04);
} }
::ng-deep app-element-properties p { ::ng-deep app-element-properties>p {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
} }
...@@ -9,20 +9,20 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -9,20 +9,20 @@ import { SelectionService } from '../../../../selection.service';
template: ` template: `
<div fxLayout="column"> <div fxLayout="column">
<ng-container *ngIf="!combinedProperties.dynamicPositioning; else elseBlock"> <ng-container *ngIf="!combinedProperties.dynamicPositioning; else elseBlock">
<mat-form-field *ngIf="combinedProperties.width" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Breite</mat-label> <mat-label>Breite</mat-label>
<input matInput type="number" #width="ngModel" min="0" <input matInput type="number" #width="ngModel" min="0"
[ngModel]="combinedProperties.width" [ngModel]="combinedProperties.width"
(ngModelChange)="updateModel.emit({ property: 'width', value: $event, isInputValid: width.valid })"> (ngModelChange)="updateModel.emit({ property: 'width', value: $event, isInputValid: width.valid })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.height" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Hoehe</mat-label> <mat-label>Hoehe</mat-label>
<input matInput type="number" #height="ngModel" min="0" <input matInput type="number" #height="ngModel" min="0"
[ngModel]="combinedProperties.height" [ngModel]="combinedProperties.height"
(ngModelChange)="updateModel.emit({ property: 'height', value: $event, isInputValid: height.valid })"> (ngModelChange)="updateModel.emit({ property: 'height', value: $event, isInputValid: height.valid })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.xPosition" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>X Position</mat-label> <mat-label>X Position</mat-label>
<input matInput type="number" #xPosition="ngModel" min="0" <input matInput type="number" #xPosition="ngModel" min="0"
[ngModel]="combinedProperties.xPosition" [ngModel]="combinedProperties.xPosition"
...@@ -30,7 +30,7 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -30,7 +30,7 @@ import { SelectionService } from '../../../../selection.service';
{ property: 'xPosition', value: $event, isInputValid: xPosition.valid })"> { property: 'xPosition', value: $event, isInputValid: xPosition.valid })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.yPosition" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Y Position</mat-label> <mat-label>Y Position</mat-label>
<input matInput type="number" #yPosition="ngModel" min="0" <input matInput type="number" #yPosition="ngModel" min="0"
[ngModel]="combinedProperties.yPosition" [ngModel]="combinedProperties.yPosition"
...@@ -39,39 +39,40 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -39,39 +39,40 @@ import { SelectionService } from '../../../../selection.service';
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
<ng-template #elseBlock> <ng-template #elseBlock>
<mat-form-field *ngIf="combinedProperties.width" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Mindestbreite</mat-label> <mat-label>Mindestbreite</mat-label>
<input matInput type="number" #width="ngModel" min="0" <input matInput type="number" #width="ngModel" min="0"
[ngModel]="combinedProperties.width" [ngModel]="combinedProperties.width"
(ngModelChange)="updateModel.emit({ property: 'width', value: $event, isInputValid: width.valid })"> (ngModelChange)="updateModel.emit({ property: 'width', value: $event, isInputValid: width.valid })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.height" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Mindesthöhe</mat-label> <mat-label>Mindesthöhe</mat-label>
<input matInput type="number" #height="ngModel" min="0" <input matInput type="number" #height="ngModel" min="0"
[ngModel]="combinedProperties.height" [ngModel]="combinedProperties.height"
(ngModelChange)="updateModel.emit({ property: 'height', value: $event, isInputValid: height.valid })"> (ngModelChange)="updateModel.emit({ property: 'height', value: $event, isInputValid: height.valid })">
</mat-form-field> </mat-form-field>
Grid Grid
<div class="input-group"> <div class="input-group">
<div fxLayoutAlign="row"> <div fxLayoutAlign="row">
<mat-form-field *ngIf="combinedProperties.gridColumnStart" class="small-input"> <mat-form-field class="small-input">
<mat-label>Start-Spalte</mat-label> <mat-label>Start-Spalte</mat-label>
<input matInput type="number" [ngModel]="combinedProperties.gridColumnStart" <input matInput type="number" [ngModel]="combinedProperties.gridColumnStart"
(ngModelChange)="updateModel.emit({ property: 'gridColumnStart', value: $event })"> (ngModelChange)="updateModel.emit({ property: 'gridColumnStart', value: $event })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.gridColumnEnd" class="small-input"> <mat-form-field class="small-input">
<mat-label>End-Spalte</mat-label> <mat-label>End-Spalte</mat-label>
<input matInput type="number" [ngModel]="combinedProperties.gridColumnEnd" <input matInput type="number" [ngModel]="combinedProperties.gridColumnEnd"
(ngModelChange)="updateModel.emit({ property: 'gridColumnEnd', value: $event })"> (ngModelChange)="updateModel.emit({ property: 'gridColumnEnd', value: $event })">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayoutAlign="row"> <div fxLayoutAlign="row">
<mat-form-field *ngIf="combinedProperties.gridRowStart" class="small-input"> <mat-form-field class="small-input">
<mat-label>Start-Zeile</mat-label> <mat-label>Start-Zeile</mat-label>
<input matInput type="number" [ngModel]="combinedProperties.gridRowStart" <input matInput type="number" [ngModel]="combinedProperties.gridRowStart"
(ngModelChange)="updateModel.emit({ property: 'gridRowStart', value: $event })"> (ngModelChange)="updateModel.emit({ property: 'gridRowStart', value: $event })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.gridRowEnd" class="small-input"> <mat-form-field class="small-input">
<mat-label>End-Zeile</mat-label> <mat-label>End-Zeile</mat-label>
<input matInput type="number" [ngModel]="combinedProperties.gridRowEnd" <input matInput type="number" [ngModel]="combinedProperties.gridRowEnd"
(ngModelChange)="updateModel.emit({ property: 'gridRowEnd', value: $event })"> (ngModelChange)="updateModel.emit({ property: 'gridRowEnd', value: $event })">
...@@ -81,8 +82,7 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -81,8 +82,7 @@ import { SelectionService } from '../../../../selection.service';
Abstand Abstand
<div class="input-group"> <div class="input-group">
<mat-form-field *ngIf="combinedProperties.marginTop" <mat-form-field class="centered-form-field small-input">
class="centered-form-field">
<mat-label>oben</mat-label> <mat-label>oben</mat-label>
<input matInput type="number" #marginTop="ngModel" min="0" <input matInput type="number" #marginTop="ngModel" min="0"
[ngModel]="combinedProperties.marginTop" [ngModel]="combinedProperties.marginTop"
...@@ -90,15 +90,14 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -90,15 +90,14 @@ import { SelectionService } from '../../../../selection.service';
{ property: 'marginTop', value: $event, isInputValid: marginTop.valid })"> { property: 'marginTop', value: $event, isInputValid: marginTop.valid })">
</mat-form-field> </mat-form-field>
<div fxLayoutAlign="row"> <div fxLayoutAlign="row">
<mat-form-field *ngIf="combinedProperties.marginLeft"> <mat-form-field class="small-input">
<mat-label>links</mat-label> <mat-label>links</mat-label>
<input matInput type="number" #marginLeft="ngModel" min="0" <input matInput type="number" #marginLeft="ngModel" min="0"
[ngModel]="combinedProperties.marginLeft" [ngModel]="combinedProperties.marginLeft"
(ngModelChange)="updateModel.emit( (ngModelChange)="updateModel.emit(
{ property: 'marginLeft', value: $event, isInputValid: marginLeft.valid })"> { property: 'marginLeft', value: $event, isInputValid: marginLeft.valid })">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.marginRight" <mat-form-field class="right-form-field small-input">
class="right-form-field">
<mat-label>rechts</mat-label> <mat-label>rechts</mat-label>
<input matInput type="number" #marginRight="ngModel" min="0" <input matInput type="number" #marginRight="ngModel" min="0"
[ngModel]="combinedProperties.marginRight" [ngModel]="combinedProperties.marginRight"
...@@ -106,8 +105,7 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -106,8 +105,7 @@ import { SelectionService } from '../../../../selection.service';
{ property: 'marginRight', value: $event, isInputValid: marginRight.valid })"> { property: 'marginRight', value: $event, isInputValid: marginRight.valid })">
</mat-form-field> </mat-form-field>
</div> </div>
<mat-form-field *ngIf="combinedProperties.marginBottom" <mat-form-field class="centered-form-field small-input">
class="centered-form-field">
<mat-label>unten</mat-label> <mat-label>unten</mat-label>
<input matInput type="number" #marginBottom="ngModel" min="0" <input matInput type="number" #marginBottom="ngModel" min="0"
[ngModel]="combinedProperties.marginBottom" [ngModel]="combinedProperties.marginBottom"
...@@ -117,7 +115,7 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -117,7 +115,7 @@ import { SelectionService } from '../../../../selection.service';
</div> </div>
</ng-template> </ng-template>
<mat-form-field *ngIf="combinedProperties.zIndex" appearance="fill"> <mat-form-field appearance="fill">
<mat-label>Z-Index</mat-label> <mat-label>Z-Index</mat-label>
<input matInput type="number" #zIndex="ngModel" min="0" <input matInput type="number" #zIndex="ngModel" min="0"
[ngModel]="combinedProperties.zIndex" [ngModel]="combinedProperties.zIndex"
...@@ -142,7 +140,13 @@ import { SelectionService } from '../../../../selection.service'; ...@@ -142,7 +140,13 @@ import { SelectionService } from '../../../../selection.service';
</div> </div>
</ng-container> </ng-container>
</div> </div>
` `,
styles: [
'.centered-form-field {margin-left: 25%}',
'.right-form-field {margin-left: 15%}',
'.input-group {background-color: rgba(0,0,0,.04); margin-bottom: 10px;}',
'::ng-deep app-element-properties .small-input .mat-form-field-infix {width: 95px; margin: 0 5px;}'
]
}) })
export class ElementSizingPropertiesComponent { export class ElementSizingPropertiesComponent {
@Input() combinedProperties: Record<string, string | number | boolean | string[] | undefined> = {}; @Input() combinedProperties: Record<string, string | number | boolean | string[] | undefined> = {};
......
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