Minor UI fixes

This commit is contained in:
Igor Kulikov 2020-04-23 13:27:21 +03:00
parent 28d48933f2
commit 00e7779f71
4 changed files with 26 additions and 13 deletions

View File

@ -492,8 +492,8 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
const parentHeight = this.gridster.el.offsetHeight; const parentHeight = this.gridster.el.offsetHeight;
if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) { if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) {
this.updateMobileOpts(parentHeight); this.updateMobileOpts(parentHeight);
this.notifyGridsterOptionsChanged();
} }
this.notifyGridsterOptionsChanged();
} }
private updateLayoutOpts() { private updateLayoutOpts() {

View File

@ -84,9 +84,6 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
} }
ngOnInit(): void { ngOnInit(): void {
this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {
this.widgetContextTimewindowSync();
});
this.settings = this.ctx.settings; this.settings = this.ctx.settings;
this.settings.useSessionStorage = isDefined(this.settings.useSessionStorage) ? this.settings.useSessionStorage : true; this.settings.useSessionStorage = isDefined(this.settings.useSessionStorage) ? this.settings.useSessionStorage : true;
let selection; let selection;
@ -110,6 +107,9 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
} }
this.selectedStepSize = this.datesMap[this.settings.stepSize || 'day'].ts; this.selectedStepSize = this.datesMap[this.settings.stepSize || 'day'].ts;
this.widgetContextTimewindowSync(); this.widgetContextTimewindowSync();
this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {
this.widgetContextTimewindowSync();
});
} }
ngOnDestroy(): void { ngOnDestroy(): void {

View File

@ -474,7 +474,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
if (mobileHeight) { if (mobileHeight) {
res = mobileHeight; res = mobileHeight;
} else { } else {
res = this.widget.sizeY * 24 / this.dashboard.gridsterOpts.minCols; const sizeY = this.widgetLayout ? this.widgetLayout.sizeY : this.widget.sizeY;
res = sizeY * 24 / this.dashboard.gridsterOpts.minCols;
} }
} else { } else {
if (this.widgetLayout) { if (this.widgetLayout) {

View File

@ -15,7 +15,6 @@
/// ///
import { import {
ChangeDetectionStrategy,
Component, Component,
ElementRef, ElementRef,
forwardRef, forwardRef,
@ -106,6 +105,8 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
private propagateChange = null; private propagateChange = null;
private propagateChangePending = false; private propagateChangePending = false;
private writingValue = false;
private updateViewPending = false;
constructor(public elementRef: ElementRef, constructor(public elementRef: ElementRef,
private translate: TranslateService, private translate: TranslateService,
@ -143,6 +144,7 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
} }
writeValue(data: JsonFormComponentData): void { writeValue(data: JsonFormComponentData): void {
this.writingValue = true;
this.data = data; this.data = data;
this.schema = this.data && this.data.schema ? deepClone(this.data.schema) : { this.schema = this.data && this.data.schema ? deepClone(this.data.schema) : {
type: 'object' type: 'object'
@ -154,20 +156,30 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
this.model = inspector.sanitize(this.schema, this.model).data; this.model = inspector.sanitize(this.schema, this.model).data;
this.updateAndRender(); this.updateAndRender();
this.isModelValid = this.validateModel(); this.isModelValid = this.validateModel();
if (!this.isModelValid) { this.writingValue = false;
if (!this.isModelValid || this.updateViewPending) {
this.updateView(); this.updateView();
} }
} }
updateView() { updateView() {
if (!this.writingValue) {
this.updateViewPending = false;
if (this.data) { if (this.data) {
this.data.model = this.model; this.data.model = this.model;
if (this.propagateChange) { if (this.propagateChange) {
try {
this.propagateChange(this.data); this.propagateChange(this.data);
} catch (e) {
this.propagateChangePending = true;
}
} else { } else {
this.propagateChangePending = true; this.propagateChangePending = true;
} }
} }
} else {
this.updateViewPending = true;
}
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {