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;
if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) {
this.updateMobileOpts(parentHeight);
this.notifyGridsterOptionsChanged();
}
this.notifyGridsterOptionsChanged();
}
private updateLayoutOpts() {

View File

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

View File

@ -474,7 +474,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
if (mobileHeight) {
res = mobileHeight;
} 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 {
if (this.widgetLayout) {

View File

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