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">
|
[(opened)]="rightLayoutOpened">
|
||||||
<tb-dashboard-layout style="height: 100%;"
|
<tb-dashboard-layout style="height: 100%;"
|
||||||
[dashboardCheatSheet]="cheatSheetComponent"
|
[dashboardCheatSheet]="cheatSheetComponent"
|
||||||
[layoutCtx]="layouts.right.layoutCtx"
|
[layoutCtx]="mobileDisplayRightLayoutFirst ? layouts.main.layoutCtx : layouts.right.layoutCtx"
|
||||||
[dashboardCtx]="dashboardCtx"
|
[dashboardCtx]="dashboardCtx"
|
||||||
[isEdit]="isEdit"
|
[isEdit]="isEdit"
|
||||||
[isEditingWidget]="isEditingWidget"
|
[isEditingWidget]="isEditingWidget"
|
||||||
@ -312,7 +312,7 @@
|
|||||||
height: mainLayoutSize.height}">
|
height: mainLayoutSize.height}">
|
||||||
<tb-dashboard-layout
|
<tb-dashboard-layout
|
||||||
[dashboardCheatSheet]="cheatSheetComponent"
|
[dashboardCheatSheet]="cheatSheetComponent"
|
||||||
[layoutCtx]="layouts.main.layoutCtx"
|
[layoutCtx]="mobileDisplayRightLayoutFirst ? layouts.right.layoutCtx : layouts.main.layoutCtx"
|
||||||
[dashboardCtx]="dashboardCtx"
|
[dashboardCtx]="dashboardCtx"
|
||||||
[isEdit]="isEdit"
|
[isEdit]="isEdit"
|
||||||
[isEditingWidget]="isEditingWidget"
|
[isEditingWidget]="isEditingWidget"
|
||||||
|
|||||||
@ -319,6 +319,13 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
|||||||
set rightLayoutOpened(rightLayoutOpened: boolean) {
|
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('tbEditWidget') editWidgetComponent: EditWidgetComponent;
|
||||||
|
|
||||||
@ViewChild('dashboardWidgetSelect') dashboardWidgetSelectComponent: DashboardWidgetSelectComponent;
|
@ViewChild('dashboardWidgetSelect') dashboardWidgetSelectComponent: DashboardWidgetSelectComponent;
|
||||||
|
|||||||
@ -159,8 +159,12 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</fieldset>
|
</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>
|
<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">
|
<mat-slide-toggle fxFlex formControlName="mobileAutoFillHeight">
|
||||||
{{ 'dashboard.autofill-height' | translate }}
|
{{ 'dashboard.autofill-height' | translate }}
|
||||||
</mat-slide-toggle>
|
</mat-slide-toggle>
|
||||||
@ -178,6 +182,7 @@
|
|||||||
{{ 'dashboard.max-mobile-row-height-message' | translate }}
|
{{ 'dashboard.max-mobile-row-height-message' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import { StatesControllerService } from './states/states-controller.service';
|
|||||||
export interface DashboardSettingsDialogData {
|
export interface DashboardSettingsDialogData {
|
||||||
settings?: DashboardSettings;
|
settings?: DashboardSettings;
|
||||||
gridSettings?: GridSettings;
|
gridSettings?: GridSettings;
|
||||||
|
isRightLayout?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -45,6 +46,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
|
|||||||
|
|
||||||
settings: DashboardSettings;
|
settings: DashboardSettings;
|
||||||
gridSettings: GridSettings;
|
gridSettings: GridSettings;
|
||||||
|
isRightLayout = false;
|
||||||
|
|
||||||
settingsFormGroup: UntypedFormGroup;
|
settingsFormGroup: UntypedFormGroup;
|
||||||
gridSettingsFormGroup: UntypedFormGroup;
|
gridSettingsFormGroup: UntypedFormGroup;
|
||||||
@ -69,6 +71,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
|
|||||||
|
|
||||||
this.settings = this.data.settings;
|
this.settings = this.data.settings;
|
||||||
this.gridSettings = this.data.gridSettings;
|
this.gridSettings = this.data.gridSettings;
|
||||||
|
this.isRightLayout = this.data.isRightLayout;
|
||||||
|
|
||||||
if (this.settings) {
|
if (this.settings) {
|
||||||
const showTitle = isUndefined(this.settings.showTitle) ? true : this.settings.showTitle;
|
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,
|
mobileRowHeight: [{ value: isUndefined(this.gridSettings.mobileRowHeight) ? 70 : this.gridSettings.mobileRowHeight,
|
||||||
disabled: mobileAutoFillHeight}, [Validators.required, Validators.min(5), Validators.max(200)]]
|
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(
|
this.gridSettingsFormGroup.get('mobileAutoFillHeight').valueChanges.subscribe(
|
||||||
(mobileAutoFillHeightValue: boolean) => {
|
(mobileAutoFillHeightValue: boolean) => {
|
||||||
if (mobileAutoFillHeightValue) {
|
if (mobileAutoFillHeightValue) {
|
||||||
|
|||||||
@ -217,7 +217,8 @@ export class ManageDashboardLayoutsDialogComponent extends DialogComponent<Manag
|
|||||||
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
|
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
|
||||||
data: {
|
data: {
|
||||||
settings: null,
|
settings: null,
|
||||||
gridSettings
|
gridSettings,
|
||||||
|
isRightLayout: this.layoutsFormGroup.get('right').value && layoutId === 'right'
|
||||||
}
|
}
|
||||||
}).afterClosed().subscribe((data) => {
|
}).afterClosed().subscribe((data) => {
|
||||||
if (data && data.gridSettings) {
|
if (data && data.gridSettings) {
|
||||||
|
|||||||
@ -58,6 +58,7 @@ export interface GridSettings {
|
|||||||
autoFillHeight?: boolean;
|
autoFillHeight?: boolean;
|
||||||
mobileAutoFillHeight?: boolean;
|
mobileAutoFillHeight?: boolean;
|
||||||
mobileRowHeight?: number;
|
mobileRowHeight?: number;
|
||||||
|
mobileDisplayLayoutFirst?: boolean;
|
||||||
layoutDimension?: LayoutDimension;
|
layoutDimension?: LayoutDimension;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1113,6 +1113,7 @@
|
|||||||
"mobile-row-height-required": "Mobile row height value is required.",
|
"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.",
|
"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.",
|
"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",
|
"title-settings": "Title settings",
|
||||||
"display-title": "Display dashboard title",
|
"display-title": "Display dashboard title",
|
||||||
"title-color": "Title color",
|
"title-color": "Title color",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user