2019-10-31 10:06:57 +02:00
|
|
|
///
|
2024-01-09 10:46:16 +02:00
|
|
|
/// Copyright © 2016-2024 The Thingsboard Authors
|
2019-10-31 10:06:57 +02:00
|
|
|
///
|
|
|
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
/// you may not use this file except in compliance with the License.
|
|
|
|
|
/// You may obtain a copy of the License at
|
|
|
|
|
///
|
|
|
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
///
|
|
|
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
/// See the License for the specific language governing permissions and
|
|
|
|
|
/// limitations under the License.
|
|
|
|
|
///
|
|
|
|
|
|
2024-08-16 13:42:55 +03:00
|
|
|
import { Component, Inject, OnDestroy, OnInit, SkipSelf } from '@angular/core';
|
2020-02-10 13:15:29 +02:00
|
|
|
import { ErrorStateMatcher } from '@angular/material/core';
|
|
|
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
2019-10-31 10:06:57 +02:00
|
|
|
import { Store } from '@ngrx/store';
|
|
|
|
|
import { AppState } from '@core/core.state';
|
2023-12-19 16:08:05 +02:00
|
|
|
import { FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators } from '@angular/forms';
|
2019-10-31 10:06:57 +02:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { DialogComponent } from '@app/shared/components/dialog.component';
|
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2024-06-21 12:31:40 +03:00
|
|
|
import {
|
2024-08-16 13:42:55 +03:00
|
|
|
BreakpointId,
|
2024-06-21 12:31:40 +03:00
|
|
|
DashboardSettings,
|
|
|
|
|
GridSettings,
|
|
|
|
|
LayoutType,
|
2024-08-16 13:42:55 +03:00
|
|
|
StateControllerId,
|
|
|
|
|
ViewFormatType,
|
|
|
|
|
viewFormatTypes,
|
|
|
|
|
viewFormatTypeTranslationMap
|
2024-06-21 12:31:40 +03:00
|
|
|
} from '@app/shared/models/dashboard.models';
|
2020-05-25 17:22:17 +03:00
|
|
|
import { isDefined, isUndefined } from '@core/utils';
|
2019-10-31 10:06:57 +02:00
|
|
|
import { StatesControllerService } from './states/states-controller.service';
|
2024-08-16 13:42:55 +03:00
|
|
|
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
|
|
|
|
|
import { merge, Subject } from 'rxjs';
|
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
2019-10-31 10:06:57 +02:00
|
|
|
|
|
|
|
|
export interface DashboardSettingsDialogData {
|
|
|
|
|
settings?: DashboardSettings;
|
|
|
|
|
gridSettings?: GridSettings;
|
2023-11-13 17:50:13 +02:00
|
|
|
isRightLayout?: boolean;
|
2024-08-16 13:42:55 +03:00
|
|
|
breakpointId?: BreakpointId;
|
2019-10-31 10:06:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'tb-dashboard-settings-dialog',
|
|
|
|
|
templateUrl: './dashboard-settings-dialog.component.html',
|
|
|
|
|
providers: [{provide: ErrorStateMatcher, useExisting: DashboardSettingsDialogComponent}],
|
2020-04-21 11:53:26 +03:00
|
|
|
styleUrls: ['./dashboard-settings-dialog.component.scss']
|
2019-10-31 10:06:57 +02:00
|
|
|
})
|
|
|
|
|
export class DashboardSettingsDialogComponent extends DialogComponent<DashboardSettingsDialogComponent, DashboardSettingsDialogData>
|
2024-08-16 13:42:55 +03:00
|
|
|
implements OnDestroy, ErrorStateMatcher {
|
2019-10-31 10:06:57 +02:00
|
|
|
|
2024-08-16 13:42:55 +03:00
|
|
|
viewFormatTypes = viewFormatTypes;
|
|
|
|
|
viewFormatTypeTranslationMap = viewFormatTypeTranslationMap;
|
2024-06-21 12:31:40 +03:00
|
|
|
|
2019-10-31 10:06:57 +02:00
|
|
|
settings: DashboardSettings;
|
|
|
|
|
gridSettings: GridSettings;
|
2023-11-13 17:50:13 +02:00
|
|
|
isRightLayout = false;
|
2019-10-31 10:06:57 +02:00
|
|
|
|
2023-12-19 16:08:05 +02:00
|
|
|
settingsFormGroup: FormGroup;
|
|
|
|
|
gridSettingsFormGroup: FormGroup;
|
2019-10-31 10:06:57 +02:00
|
|
|
|
|
|
|
|
stateControllerIds: string[];
|
|
|
|
|
|
2024-08-16 13:42:55 +03:00
|
|
|
layoutSettingsType: string;
|
|
|
|
|
|
2019-10-31 10:06:57 +02:00
|
|
|
submitted = false;
|
|
|
|
|
|
2024-06-14 17:59:28 +03:00
|
|
|
scadaColumns: number[] = [];
|
|
|
|
|
|
2024-08-16 13:42:55 +03:00
|
|
|
private layoutType = LayoutType.default;
|
|
|
|
|
private breakpointId: BreakpointId = 'default';
|
|
|
|
|
|
|
|
|
|
private destroy$ = new Subject<void>();
|
|
|
|
|
|
2023-12-19 16:08:05 +02:00
|
|
|
private stateControllerTranslationMap = new Map<string, string>([
|
|
|
|
|
['default', 'dashboard.state-controller-default'],
|
|
|
|
|
]);
|
|
|
|
|
|
2019-10-31 10:06:57 +02:00
|
|
|
constructor(protected store: Store<AppState>,
|
|
|
|
|
protected router: Router,
|
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data: DashboardSettingsDialogData,
|
|
|
|
|
@SkipSelf() private errorStateMatcher: ErrorStateMatcher,
|
|
|
|
|
public dialogRef: MatDialogRef<DashboardSettingsDialogComponent, DashboardSettingsDialogData>,
|
2023-12-19 16:08:05 +02:00
|
|
|
private fb: FormBuilder,
|
2019-10-31 10:06:57 +02:00
|
|
|
private translate: TranslateService,
|
2024-08-16 13:42:55 +03:00
|
|
|
private statesControllerService: StatesControllerService,
|
|
|
|
|
private dashboardUtils: DashboardUtilsService) {
|
2019-10-31 10:06:57 +02:00
|
|
|
super(store, router, dialogRef);
|
|
|
|
|
|
|
|
|
|
this.stateControllerIds = Object.keys(this.statesControllerService.getStateControllers());
|
|
|
|
|
|
|
|
|
|
this.settings = this.data.settings;
|
|
|
|
|
this.gridSettings = this.data.gridSettings;
|
2023-11-13 17:50:13 +02:00
|
|
|
this.isRightLayout = this.data.isRightLayout;
|
2024-08-16 13:42:55 +03:00
|
|
|
this.breakpointId = this.data.breakpointId;
|
2019-10-31 10:06:57 +02:00
|
|
|
|
|
|
|
|
if (this.settings) {
|
2021-06-04 19:08:01 +03:00
|
|
|
const showTitle = isUndefined(this.settings.showTitle) ? true : this.settings.showTitle;
|
|
|
|
|
const showDashboardLogo = isUndefined(this.settings.showDashboardLogo) ? false : this.settings.showDashboardLogo;
|
|
|
|
|
const hideToolbar = isUndefined(this.settings.hideToolbar) ? false : this.settings.hideToolbar;
|
2019-10-31 10:06:57 +02:00
|
|
|
this.settingsFormGroup = this.fb.group({
|
|
|
|
|
stateControllerId: [isUndefined(this.settings.stateControllerId) ? 'entity' : this.settings.stateControllerId, []],
|
2021-06-04 19:08:01 +03:00
|
|
|
showTitle: [showTitle, []],
|
|
|
|
|
titleColor: [{value: isUndefined(this.settings.titleColor) ? 'rgba(0,0,0,0.870588)' : this.settings.titleColor,
|
|
|
|
|
disabled: !showTitle}, []],
|
|
|
|
|
showDashboardLogo: [showDashboardLogo, []],
|
|
|
|
|
dashboardLogoUrl: [{value: isUndefined(this.settings.dashboardLogoUrl) ? null : this.settings.dashboardLogoUrl,
|
|
|
|
|
disabled: !showDashboardLogo}, []],
|
|
|
|
|
hideToolbar: [hideToolbar, []],
|
|
|
|
|
toolbarAlwaysOpen: [{value: isUndefined(this.settings.toolbarAlwaysOpen) ? true : this.settings.toolbarAlwaysOpen,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showDashboardsSelect: [{value: isUndefined(this.settings.showDashboardsSelect) ? true : this.settings.showDashboardsSelect,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showEntitiesSelect: [{value: isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showFilters: [{value: isUndefined(this.settings.showFilters) ? true : this.settings.showFilters,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showDashboardTimewindow: [{value: isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showDashboardExport: [{value: isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport,
|
|
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
showUpdateDashboardImage: [
|
|
|
|
|
{value: isUndefined(this.settings.showUpdateDashboardImage) ? true : this.settings.showUpdateDashboardImage,
|
2021-12-22 17:15:10 +02:00
|
|
|
disabled: hideToolbar}, []],
|
|
|
|
|
dashboardCss: [isUndefined(this.settings.dashboardCss) ? '' : this.settings.dashboardCss, []],
|
2019-10-31 10:06:57 +02:00
|
|
|
});
|
2024-08-16 13:42:55 +03:00
|
|
|
this.settingsFormGroup.get('stateControllerId').valueChanges.pipe(
|
|
|
|
|
takeUntil(this.destroy$)
|
|
|
|
|
).subscribe(
|
2019-10-31 10:06:57 +02:00
|
|
|
(stateControllerId: StateControllerId) => {
|
|
|
|
|
if (stateControllerId !== 'default') {
|
|
|
|
|
this.settingsFormGroup.get('toolbarAlwaysOpen').setValue(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-16 13:42:55 +03:00
|
|
|
this.settingsFormGroup.get('showTitle').valueChanges.pipe(
|
|
|
|
|
takeUntil(this.destroy$)
|
|
|
|
|
).subscribe(
|
2021-06-04 19:08:01 +03:00
|
|
|
(showTitleValue: boolean) => {
|
|
|
|
|
if (showTitleValue) {
|
|
|
|
|
this.settingsFormGroup.get('titleColor').enable();
|
|
|
|
|
} else {
|
|
|
|
|
this.settingsFormGroup.get('titleColor').disable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-16 13:42:55 +03:00
|
|
|
this.settingsFormGroup.get('showDashboardLogo').valueChanges.pipe(
|
|
|
|
|
takeUntil(this.destroy$)
|
|
|
|
|
).subscribe(
|
2021-06-04 19:08:01 +03:00
|
|
|
(showDashboardLogoValue: boolean) => {
|
|
|
|
|
if (showDashboardLogoValue) {
|
|
|
|
|
this.settingsFormGroup.get('dashboardLogoUrl').enable();
|
|
|
|
|
} else {
|
|
|
|
|
this.settingsFormGroup.get('dashboardLogoUrl').disable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-16 13:42:55 +03:00
|
|
|
this.settingsFormGroup.get('hideToolbar').valueChanges.pipe(
|
|
|
|
|
takeUntil(this.destroy$)
|
|
|
|
|
).subscribe(
|
2021-06-04 19:08:01 +03:00
|
|
|
(hideToolbarValue: boolean) => {
|
|
|
|
|
if (hideToolbarValue) {
|
|
|
|
|
this.settingsFormGroup.get('toolbarAlwaysOpen').disable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardsSelect').disable();
|
|
|
|
|
this.settingsFormGroup.get('showEntitiesSelect').disable();
|
|
|
|
|
this.settingsFormGroup.get('showFilters').disable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardTimewindow').disable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardExport').disable();
|
|
|
|
|
this.settingsFormGroup.get('showUpdateDashboardImage').disable();
|
|
|
|
|
} else {
|
|
|
|
|
this.settingsFormGroup.get('toolbarAlwaysOpen').enable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardsSelect').enable();
|
|
|
|
|
this.settingsFormGroup.get('showEntitiesSelect').enable();
|
|
|
|
|
this.settingsFormGroup.get('showFilters').enable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardTimewindow').enable();
|
|
|
|
|
this.settingsFormGroup.get('showDashboardExport').enable();
|
|
|
|
|
this.settingsFormGroup.get('showUpdateDashboardImage').enable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2019-10-31 10:06:57 +02:00
|
|
|
} else {
|
|
|
|
|
this.settingsFormGroup = this.fb.group({});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.gridSettings) {
|
2024-08-16 13:42:55 +03:00
|
|
|
if (isDefined(this.gridSettings.layoutType)) {
|
|
|
|
|
this.layoutType = this.gridSettings.layoutType;
|
|
|
|
|
}
|
|
|
|
|
if (this.layoutType !== LayoutType.divider) {
|
|
|
|
|
this.layoutSettingsType = this.dashboardUtils.getBreakpointName(this.breakpointId);
|
|
|
|
|
} else if (this.isRightLayout) {
|
|
|
|
|
this.layoutSettingsType = this.translate.instant('layout.right');
|
|
|
|
|
} else {
|
|
|
|
|
this.layoutSettingsType = this.translate.instant('layout.left');
|
|
|
|
|
}
|
2024-06-14 17:59:28 +03:00
|
|
|
let columns = 24;
|
|
|
|
|
while (columns <= 1008) {
|
|
|
|
|
this.scadaColumns.push(columns);
|
|
|
|
|
columns += 24;
|
|
|
|
|
}
|
2021-06-04 19:08:01 +03:00
|
|
|
const mobileAutoFillHeight = isUndefined(this.gridSettings.mobileAutoFillHeight) ? false : this.gridSettings.mobileAutoFillHeight;
|
2019-10-31 10:06:57 +02:00
|
|
|
this.gridSettingsFormGroup = this.fb.group({
|
2024-06-14 17:59:28 +03:00
|
|
|
columns: [this.gridSettings.columns || 24, [Validators.required, Validators.min(10), Validators.max(1008)]],
|
|
|
|
|
minColumns: [this.gridSettings.minColumns || this.gridSettings.columns || 24,
|
|
|
|
|
[Validators.required, Validators.min(10), Validators.max(1008)]],
|
2020-05-25 17:22:17 +03:00
|
|
|
margin: [isDefined(this.gridSettings.margin) ? this.gridSettings.margin : 10,
|
|
|
|
|
[Validators.required, Validators.min(0), Validators.max(50)]],
|
2023-04-13 12:59:01 +03:00
|
|
|
outerMargin: [isUndefined(this.gridSettings.outerMargin) ? true : this.gridSettings.outerMargin, []],
|
2024-08-16 13:42:55 +03:00
|
|
|
viewFormat: [isUndefined(this.gridSettings.viewFormat) ? ViewFormatType.grid : this.gridSettings.viewFormat, []],
|
2019-10-31 10:06:57 +02:00
|
|
|
autoFillHeight: [isUndefined(this.gridSettings.autoFillHeight) ? false : this.gridSettings.autoFillHeight, []],
|
2024-08-16 13:42:55 +03:00
|
|
|
rowHeight: [isUndefined(this.gridSettings.rowHeight) ? 70 : this.gridSettings.rowHeight,
|
|
|
|
|
[Validators.required, Validators.min(5), Validators.max(200)]],
|
2019-10-31 10:06:57 +02:00
|
|
|
backgroundColor: [this.gridSettings.backgroundColor || 'rgba(0,0,0,0)', []],
|
|
|
|
|
backgroundImageUrl: [this.gridSettings.backgroundImageUrl, []],
|
|
|
|
|
backgroundSizeMode: [this.gridSettings.backgroundSizeMode || '100%', []],
|
2021-06-04 19:08:01 +03:00
|
|
|
mobileAutoFillHeight: [mobileAutoFillHeight, []],
|
|
|
|
|
mobileRowHeight: [{ value: isUndefined(this.gridSettings.mobileRowHeight) ? 70 : this.gridSettings.mobileRowHeight,
|
|
|
|
|
disabled: mobileAutoFillHeight}, [Validators.required, Validators.min(5), Validators.max(200)]]
|
2019-10-31 10:06:57 +02:00
|
|
|
});
|
2023-11-13 17:50:13 +02:00
|
|
|
if (this.isRightLayout) {
|
2024-06-11 18:44:50 +03:00
|
|
|
const mobileDisplayLayoutFirst =
|
|
|
|
|
isUndefined(this.gridSettings.mobileDisplayLayoutFirst) ? false : this.gridSettings.mobileDisplayLayoutFirst;
|
2023-11-13 17:50:13 +02:00
|
|
|
this.gridSettingsFormGroup.addControl('mobileDisplayLayoutFirst', this.fb.control(mobileDisplayLayoutFirst, []));
|
|
|
|
|
}
|
2024-08-16 13:42:55 +03:00
|
|
|
if (this.isScada()) {
|
|
|
|
|
this.gridSettingsFormGroup.get('margin').disable();
|
|
|
|
|
this.gridSettingsFormGroup.get('outerMargin').disable();
|
|
|
|
|
this.gridSettingsFormGroup.get('viewFormat').disable({emitEvent: false});
|
|
|
|
|
this.gridSettingsFormGroup.get('rowHeight').disable();
|
|
|
|
|
this.gridSettingsFormGroup.get('autoFillHeight').disable({emitEvent: false});
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileAutoFillHeight').disable({emitEvent: false});
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileRowHeight').disable();
|
|
|
|
|
const columnsFields: number = this.gridSettingsFormGroup.get('columns').value;
|
|
|
|
|
if (columnsFields % 24 !== 0) {
|
|
|
|
|
const newColumns = Math.min(1008, 24 * Math.ceil(columnsFields / 24));
|
|
|
|
|
this.gridSettingsFormGroup.get('columns').patchValue(newColumns);
|
2021-06-04 19:08:01 +03:00
|
|
|
}
|
2024-08-16 13:42:55 +03:00
|
|
|
} else {
|
|
|
|
|
merge(
|
|
|
|
|
this.gridSettingsFormGroup.get('viewFormat').valueChanges,
|
|
|
|
|
this.breakpointId !== 'default'
|
|
|
|
|
? this.gridSettingsFormGroup.get('autoFillHeight').valueChanges
|
|
|
|
|
: this.gridSettingsFormGroup.get('mobileAutoFillHeight').valueChanges
|
|
|
|
|
).pipe(
|
|
|
|
|
takeUntil(this.destroy$)
|
|
|
|
|
).subscribe(() => {
|
|
|
|
|
this.updateGridSettingsFormState();
|
|
|
|
|
});
|
|
|
|
|
this.updateGridSettingsFormState();
|
|
|
|
|
}
|
|
|
|
|
if (this.layoutType === LayoutType.default && this.breakpointId !== 'default' || this.isScada()) {
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileAutoFillHeight').disable({emitEvent: false});
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileRowHeight').disable();
|
|
|
|
|
}
|
2019-10-31 10:06:57 +02:00
|
|
|
} else {
|
|
|
|
|
this.gridSettingsFormGroup = this.fb.group({});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-16 13:42:55 +03:00
|
|
|
ngOnDestroy(): void {
|
|
|
|
|
this.destroy$.next();
|
|
|
|
|
this.destroy$.complete();
|
2019-10-31 10:06:57 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-21 12:31:40 +03:00
|
|
|
isScada() {
|
2024-08-16 13:42:55 +03:00
|
|
|
return this.layoutType === LayoutType.scada;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get isDefaultLayout() {
|
|
|
|
|
return this.layoutType === LayoutType.default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get isDefaultBreakpoint(): boolean {
|
|
|
|
|
return this.breakpointId === 'default';
|
2024-06-21 12:31:40 +03:00
|
|
|
}
|
|
|
|
|
|
2023-12-19 16:08:05 +02:00
|
|
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
2019-10-31 10:06:57 +02:00
|
|
|
const originalErrorState = this.errorStateMatcher.isErrorState(control, form);
|
|
|
|
|
const customErrorState = !!(control && control.invalid && this.submitted);
|
|
|
|
|
return originalErrorState || customErrorState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancel(): void {
|
|
|
|
|
this.dialogRef.close(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
save(): void {
|
|
|
|
|
this.submitted = true;
|
|
|
|
|
let settings: DashboardSettings = null;
|
|
|
|
|
let gridSettings: GridSettings = null;
|
|
|
|
|
if (this.settings) {
|
2021-06-04 19:08:01 +03:00
|
|
|
settings = {...this.settings, ...this.settingsFormGroup.getRawValue()};
|
2019-10-31 10:06:57 +02:00
|
|
|
}
|
|
|
|
|
if (this.gridSettings) {
|
2021-06-04 19:08:01 +03:00
|
|
|
gridSettings = {...this.gridSettings, ...this.gridSettingsFormGroup.getRawValue()};
|
2019-10-31 10:06:57 +02:00
|
|
|
}
|
|
|
|
|
this.dialogRef.close({settings, gridSettings});
|
|
|
|
|
}
|
2023-12-19 16:08:05 +02:00
|
|
|
|
|
|
|
|
getStatesControllerTranslation(stateControllerId: string): string {
|
|
|
|
|
if (this.stateControllerTranslationMap.has(stateControllerId)) {
|
|
|
|
|
return this.translate.instant(this.stateControllerTranslationMap.get(stateControllerId));
|
|
|
|
|
}
|
|
|
|
|
return stateControllerId;
|
|
|
|
|
}
|
2024-06-11 18:44:50 +03:00
|
|
|
|
|
|
|
|
private updateGridSettingsFormState() {
|
2024-08-16 13:42:55 +03:00
|
|
|
if (this.breakpointId === 'default') {
|
2024-06-11 18:44:50 +03:00
|
|
|
const mobileAutoFillHeight: boolean = this.gridSettingsFormGroup.get('mobileAutoFillHeight').value;
|
|
|
|
|
if (mobileAutoFillHeight) {
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileRowHeight').disable();
|
|
|
|
|
} else {
|
|
|
|
|
this.gridSettingsFormGroup.get('mobileRowHeight').enable();
|
|
|
|
|
}
|
2024-08-16 13:42:55 +03:00
|
|
|
} else {
|
|
|
|
|
const autoFillHeight: boolean = this.gridSettingsFormGroup.get('autoFillHeight').value;
|
|
|
|
|
const viewFormat: ViewFormatType = this.gridSettingsFormGroup.get('viewFormat').value;
|
|
|
|
|
if (viewFormat !== ViewFormatType.list || autoFillHeight) {
|
|
|
|
|
this.gridSettingsFormGroup.get('rowHeight').disable();
|
|
|
|
|
} else {
|
|
|
|
|
this.gridSettingsFormGroup.get('rowHeight').enable();
|
|
|
|
|
}
|
|
|
|
|
if (viewFormat === ViewFormatType.list) {
|
|
|
|
|
this.gridSettingsFormGroup.get('columns').disable();
|
|
|
|
|
this.gridSettingsFormGroup.get('minColumns').disable();
|
|
|
|
|
} else {
|
|
|
|
|
this.gridSettingsFormGroup.get('columns').enable();
|
|
|
|
|
this.gridSettingsFormGroup.get('minColumns').enable();
|
|
|
|
|
}
|
2024-06-11 18:44:50 +03:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-31 10:06:57 +02:00
|
|
|
}
|