Skip to content

Commit

Permalink
UI: fix formly form styles (#2962)
Browse files Browse the repository at this point in the history
fixing styles permanently for component-update and component-install and all other components, which are using the default formlyfield type input
  • Loading branch information
lukasrgr authored Jan 13, 2025
1 parent 86c43a2 commit 49bccb8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
5 changes: 0 additions & 5 deletions ui/src/app/shared/components/formly/form-field.wrapper.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<ion-item [lines]="to.itemLines" [disabled]="props.readonly">
<ion-label [position]="to.labelPosition" style="max-width:none">
<span>{{ to.label }}</span>
<span *ngIf="to.required && to.hideRequiredMarker !== true">*</span>
<span *ngIf="to.description"><br /><small> {{ to.description }} </small></span>
</ion-label>
<ng-template #fieldComponent></ng-template>
</ion-item>
<ion-item lines="none" *ngIf="showError">
Expand Down
7 changes: 7 additions & 0 deletions ui/src/app/shared/components/formly/form-field.wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ import { FieldWrapper } from "@ngx-formly/core";
templateUrl: "./form-field.wrapper.html",
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
styles: [`
:host {
formly-field-ion-toggle, formly-field-ion-checkbox{
width: 100%;
}
}
`],
})
export class FormlyWrapperFormFieldComponent extends FieldWrapper { }
13 changes: 10 additions & 3 deletions ui/src/app/shared/components/formly/input.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<ion-input *ngIf="props.type === 'number'; else noNumberInput" placeholder="{{props.placeholder}}"
style="width:100%; float:right; text-align: right" [type]="props.type || 'text'" [formControl]="formControl"
[min]="props.min">
[min]="props.min" [label]="props.label">
</ion-input>
<ng-template #noNumberInput>
<ion-input placeholder="{{props.placeholder}}" style="width:100%; float:right; text-align: right"
[type]="props.type || 'text'" [formControl]="formControl">
<ion-input placeholder="{{props.placeholder}}" [type]="props.type || 'text'" [formControl]="formControl"
style="text-align: right" labelPlacement="start" justify="space-between">
<div style="text-align: left;">
<ion-label [position]="to.labelPosition">
<span>{{ to.label }}</span>
<span *ngIf="to.required && to.hideRequiredMarker !== true">*</span>
<span *ngIf="to.description"><br /><small>{{ to.description }}</small></span>
</ion-label>
</div>
</ion-input>
</ng-template>
30 changes: 30 additions & 0 deletions ui/src/app/shared/components/formly/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,35 @@ import { FieldType } from "@ngx-formly/core";
selector: "formly-input-section",
templateUrl: "./input.html",
standalone: false,
styles: [`
:host {
min-width: fit-content;
.label-text-wrapper{
.label-text{
overflow: visible;
}
}
.native-wrapper{
max-width: max-content !important;
width: max-content;
min-width: 20%;
@media (width <= 576px) {
text-align: right;
}
}
ion-label{
text-align: left;
}
ion-label>span,
ion-label>span>small {
white-space: initial;
}
}
`],
})
export class InputTypeComponent extends FieldType { }
3 changes: 1 addition & 2 deletions ui/src/app/user/user.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@
</ion-item>
</div>
<ion-item lines="none">
<ion-checkbox (ionChange)="toggleDebugMode($event)" [(ngModel)]="environment.debugMode"
label="Debug-Mode" justify="space-between">Debug-Mode
<ion-checkbox (ionChange)="toggleDebugMode($event)" [(ngModel)]="environment.debugMode">Debug-Mode
</ion-checkbox>
</ion-item>
<ion-note class="ion-padding" *ngIf="environment.backend === 'OpenEMS Edge'">
Expand Down

0 comments on commit 49bccb8

Please sign in to comment.