UI: Fixed stepper for device and device profile dialog

This commit is contained in:
Artem Dzhereleiko 2023-03-16 11:05:23 +02:00
parent da4d0f93a3
commit e96e355a31
4 changed files with 301 additions and 283 deletions

View File

@ -15,8 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<div> <mat-toolbar color="primary">
<mat-toolbar color="primary">
<h2 translate>device-profile.add</h2> <h2 translate>device-profile.add</h2>
<span fxFlex></span> <span fxFlex></span>
<div [tb-help]="'deviceProfiles'"></div> <div [tb-help]="'deviceProfiles'"></div>
@ -25,11 +24,11 @@
type="button"> type="button">
<mat-icon class="material-icons">close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
</mat-progress-bar> </mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content> <div mat-dialog-content>
<mat-horizontal-stepper [linear]="true" #addDeviceProfileStepper (selectionChange)="changeStep($event)"> <mat-horizontal-stepper [linear]="true" #addDeviceProfileStepper (selectionChange)="changeStep($event)">
<mat-step [stepControl]="deviceProfileDetailsFormGroup"> <mat-step [stepControl]="deviceProfileDetailsFormGroup">
<form [formGroup]="deviceProfileDetailsFormGroup" style="padding-bottom: 16px;"> <form [formGroup]="deviceProfileDetailsFormGroup" style="padding-bottom: 16px;">
@ -131,8 +130,9 @@
</form> </form>
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>
</div> </div>
<div mat-dialog-actions fxLayout="row"> <div mat-dialog-actions style="padding: 0">
<div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutAlign="end center">
<button mat-stroked-button *ngIf="selectedIndex > 0" <button mat-stroked-button *ngIf="selectedIndex > 0"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button> (click)="previousStep()">{{ 'action.back' | translate }}</button>
@ -143,8 +143,8 @@
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button> (click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button>
</div> </div>
<mat-divider></mat-divider> <mat-divider style="width: 100%"></mat-divider>
<div mat-dialog-actions fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end"> <div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end center">
<button mat-button <button mat-button
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button> (click)="cancel()">{{ 'action.cancel' | translate }}</button>

View File

@ -15,6 +15,15 @@
*/ */
@import "../../../../../scss/constants"; @import "../../../../../scss/constants";
:host {
height: 100%;
display: grid;
.dialog-actions-row {
padding: 8px;
}
}
:host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { :host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) {
@media #{$mat-lt-sm} { @media #{$mat-lt-sm} {
.mat-mdc-dialog-content { .mat-mdc-dialog-content {

View File

@ -15,8 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<div> <mat-toolbar color="primary">
<mat-toolbar color="primary">
<h2 translate>device.add-device-text</h2> <h2 translate>device.add-device-text</h2>
<span fxFlex></span> <span fxFlex></span>
<div [tb-help]="'devices'"></div> <div [tb-help]="'devices'"></div>
@ -25,11 +24,11 @@
type="button"> type="button">
<mat-icon class="material-icons">close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
</mat-progress-bar> </mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content> <div mat-dialog-content>
<mat-horizontal-stepper [linear]="true" [labelPosition]="labelPosition" #addDeviceWizardStepper (selectionChange)="changeStep($event)"> <mat-horizontal-stepper [linear]="true" [labelPosition]="labelPosition" #addDeviceWizardStepper (selectionChange)="changeStep($event)">
<ng-template matStepperIcon="edit"> <ng-template matStepperIcon="edit">
<mat-icon>check</mat-icon> <mat-icon>check</mat-icon>
@ -179,8 +178,9 @@
</form> </form>
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>
</div> </div>
<div mat-dialog-actions fxLayout="row"> <div mat-dialog-actions style="padding: 0">
<div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutAlign="end center">
<button mat-stroked-button *ngIf="selectedIndex > 0" <button mat-stroked-button *ngIf="selectedIndex > 0"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button> (click)="previousStep()">{{ 'action.back' | translate }}</button>
@ -191,8 +191,8 @@
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button> (click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button>
</div> </div>
<mat-divider></mat-divider> <mat-divider style="width: 100%"></mat-divider>
<div mat-dialog-actions fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end"> <div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end center">
<button mat-button <button mat-button
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button> (click)="cancel()">{{ 'action.cancel' | translate }}</button>

View File

@ -15,6 +15,15 @@
*/ */
@import "../../../../../scss/constants"; @import "../../../../../scss/constants";
:host {
height: 100%;
display: grid;
.dialog-actions-row {
padding: 8px;
}
}
:host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { :host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) {
@media #{$mat-lt-sm} { @media #{$mat-lt-sm} {
.mat-mdc-dialog-content { .mat-mdc-dialog-content {