Added ability to display right layout first in mobile view
This commit is contained in:
parent
bf3bcb4928
commit
acc2b068f5
@ -296,7 +296,7 @@
|
||||
[(opened)]="rightLayoutOpened">
|
||||
<tb-dashboard-layout style="height: 100%;"
|
||||
[dashboardCheatSheet]="cheatSheetComponent"
|
||||
[layoutCtx]="layouts.right.layoutCtx"
|
||||
[layoutCtx]="mobileDisplayRightLayoutFirst ? layouts.main.layoutCtx : layouts.right.layoutCtx"
|
||||
[dashboardCtx]="dashboardCtx"
|
||||
[isEdit]="isEdit"
|
||||
[isEditingWidget]="isEditingWidget"
|
||||
@ -312,7 +312,7 @@
|
||||
height: mainLayoutSize.height}">
|
||||
<tb-dashboard-layout
|
||||
[dashboardCheatSheet]="cheatSheetComponent"
|
||||
[layoutCtx]="layouts.main.layoutCtx"
|
||||
[layoutCtx]="mobileDisplayRightLayoutFirst ? layouts.right.layoutCtx : layouts.main.layoutCtx"
|
||||
[dashboardCtx]="dashboardCtx"
|
||||
[isEdit]="isEdit"
|
||||
[isEditingWidget]="isEditingWidget"
|
||||
|
||||
@ -319,6 +319,13 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
set rightLayoutOpened(rightLayoutOpened: boolean) {
|
||||
}
|
||||
|
||||
get mobileDisplayRightLayoutFirst(): boolean {
|
||||
return this.isMobile && this.layouts.right.layoutCtx.gridSettings?.mobileDisplayLayoutFirst;
|
||||
}
|
||||
|
||||
set mobileDisplayRightLayoutFirst(mobileDisplayRightLayoutFirst: boolean) {
|
||||
}
|
||||
|
||||
@ViewChild('tbEditWidget') editWidgetComponent: EditWidgetComponent;
|
||||
|
||||
@ViewChild('dashboardWidgetSelect') dashboardWidgetSelectComponent: DashboardWidgetSelectComponent;
|
||||
|
||||
@ -159,8 +159,12 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</fieldset>
|
||||
<fieldset class="fields-group" fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign.gt-sm="start center" fxLayoutGap="8px">
|
||||
<fieldset class="fields-group" fxLayout="column" fxLayoutGap="8px">
|
||||
<legend class="group-title" translate>dashboard.mobile-layout</legend>
|
||||
<mat-slide-toggle *ngIf="isRightLayout" fxFlex formControlName="mobileDisplayLayoutFirst" style="display: block;">
|
||||
{{ 'dashboard.display-first-in-mobile-view' | translate }}
|
||||
</mat-slide-toggle>
|
||||
<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign.gt-sm="start center" fxLayoutGap="8px" >
|
||||
<mat-slide-toggle fxFlex formControlName="mobileAutoFillHeight">
|
||||
{{ 'dashboard.autofill-height' | translate }}
|
||||
</mat-slide-toggle>
|
||||
@ -178,6 +182,7 @@
|
||||
{{ 'dashboard.max-mobile-row-height-message' | translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@ -32,6 +32,7 @@ import { StatesControllerService } from './states/states-controller.service';
|
||||
export interface DashboardSettingsDialogData {
|
||||
settings?: DashboardSettings;
|
||||
gridSettings?: GridSettings;
|
||||
isRightLayout?: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -45,6 +46,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
|
||||
|
||||
settings: DashboardSettings;
|
||||
gridSettings: GridSettings;
|
||||
isRightLayout = false;
|
||||
|
||||
settingsFormGroup: UntypedFormGroup;
|
||||
gridSettingsFormGroup: UntypedFormGroup;
|
||||
@ -69,6 +71,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
|
||||
|
||||
this.settings = this.data.settings;
|
||||
this.gridSettings = this.data.gridSettings;
|
||||
this.isRightLayout = this.data.isRightLayout;
|
||||
|
||||
if (this.settings) {
|
||||
const showTitle = isUndefined(this.settings.showTitle) ? true : this.settings.showTitle;
|
||||
@ -165,6 +168,10 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
|
||||
mobileRowHeight: [{ value: isUndefined(this.gridSettings.mobileRowHeight) ? 70 : this.gridSettings.mobileRowHeight,
|
||||
disabled: mobileAutoFillHeight}, [Validators.required, Validators.min(5), Validators.max(200)]]
|
||||
});
|
||||
if (this.isRightLayout) {
|
||||
const mobileDisplayLayoutFirst = isUndefined(this.gridSettings.mobileDisplayLayoutFirst) ? false : this.gridSettings.mobileDisplayLayoutFirst;
|
||||
this.gridSettingsFormGroup.addControl('mobileDisplayLayoutFirst', this.fb.control(mobileDisplayLayoutFirst, []));
|
||||
}
|
||||
this.gridSettingsFormGroup.get('mobileAutoFillHeight').valueChanges.subscribe(
|
||||
(mobileAutoFillHeightValue: boolean) => {
|
||||
if (mobileAutoFillHeightValue) {
|
||||
|
||||
@ -217,7 +217,8 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent<Manag
|
||||
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
|
||||
data: {
|
||||
settings: null,
|
||||
gridSettings
|
||||
gridSettings,
|
||||
isRightLayout: this.layoutsFormGroup.get('right').value && layoutId === 'right'
|
||||
}
|
||||
}).afterClosed().subscribe((data) => {
|
||||
if (data && data.gridSettings) {
|
||||
|
||||
@ -58,6 +58,7 @@ export interface GridSettings {
|
||||
autoFillHeight?: boolean;
|
||||
mobileAutoFillHeight?: boolean;
|
||||
mobileRowHeight?: number;
|
||||
mobileDisplayLayoutFirst?: boolean;
|
||||
layoutDimension?: LayoutDimension;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@ -1113,6 +1113,7 @@
|
||||
"mobile-row-height-required": "Mobile row height value is required.",
|
||||
"min-mobile-row-height-message": "Only 5 pixels is allowed as minimum mobile row height value.",
|
||||
"max-mobile-row-height-message": "Only 200 pixels is allowed as maximum mobile row height value.",
|
||||
"display-first-in-mobile-view": "Display first in mobile view",
|
||||
"title-settings": "Title settings",
|
||||
"display-title": "Display dashboard title",
|
||||
"title-color": "Title color",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user