Commit 00e7779f711a528b00a6ca4f1afd7eb3bb2e655f

Authored by Igor Kulikov
1 parent 28d48933

Minor UI fixes

... ... @@ -492,8 +492,8 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
492 492 const parentHeight = this.gridster.el.offsetHeight;
493 493 if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) {
494 494 this.updateMobileOpts(parentHeight);
495   - this.notifyGridsterOptionsChanged();
496 495 }
  496 + this.notifyGridsterOptionsChanged();
497 497 }
498 498
499 499 private updateLayoutOpts() {
... ...
... ... @@ -84,9 +84,6 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
84 84 }
85 85
86 86 ngOnInit(): void {
87   - this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {
88   - this.widgetContextTimewindowSync();
89   - });
90 87 this.settings = this.ctx.settings;
91 88 this.settings.useSessionStorage = isDefined(this.settings.useSessionStorage) ? this.settings.useSessionStorage : true;
92 89 let selection;
... ... @@ -110,6 +107,9 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
110 107 }
111 108 this.selectedStepSize = this.datesMap[this.settings.stepSize || 'day'].ts;
112 109 this.widgetContextTimewindowSync();
  110 + this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {
  111 + this.widgetContextTimewindowSync();
  112 + });
113 113 }
114 114
115 115 ngOnDestroy(): void {
... ...
... ... @@ -474,7 +474,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
474 474 if (mobileHeight) {
475 475 res = mobileHeight;
476 476 } else {
477   - res = this.widget.sizeY * 24 / this.dashboard.gridsterOpts.minCols;
  477 + const sizeY = this.widgetLayout ? this.widgetLayout.sizeY : this.widget.sizeY;
  478 + res = sizeY * 24 / this.dashboard.gridsterOpts.minCols;
478 479 }
479 480 } else {
480 481 if (this.widgetLayout) {
... ...
... ... @@ -15,7 +15,6 @@
15 15 ///
16 16
17 17 import {
18   - ChangeDetectionStrategy,
19 18 Component,
20 19 ElementRef,
21 20 forwardRef,
... ... @@ -106,6 +105,8 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
106 105
107 106 private propagateChange = null;
108 107 private propagateChangePending = false;
  108 + private writingValue = false;
  109 + private updateViewPending = false;
109 110
110 111 constructor(public elementRef: ElementRef,
111 112 private translate: TranslateService,
... ... @@ -143,6 +144,7 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
143 144 }
144 145
145 146 writeValue(data: JsonFormComponentData): void {
  147 + this.writingValue = true;
146 148 this.data = data;
147 149 this.schema = this.data && this.data.schema ? deepClone(this.data.schema) : {
148 150 type: 'object'
... ... @@ -154,19 +156,29 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
154 156 this.model = inspector.sanitize(this.schema, this.model).data;
155 157 this.updateAndRender();
156 158 this.isModelValid = this.validateModel();
157   - if (!this.isModelValid) {
  159 + this.writingValue = false;
  160 + if (!this.isModelValid || this.updateViewPending) {
158 161 this.updateView();
159 162 }
160 163 }
161 164
162 165 updateView() {
163   - if (this.data) {
164   - this.data.model = this.model;
165   - if (this.propagateChange) {
166   - this.propagateChange(this.data);
167   - } else {
168   - this.propagateChangePending = true;
  166 + if (!this.writingValue) {
  167 + this.updateViewPending = false;
  168 + if (this.data) {
  169 + this.data.model = this.model;
  170 + if (this.propagateChange) {
  171 + try {
  172 + this.propagateChange(this.data);
  173 + } catch (e) {
  174 + this.propagateChangePending = true;
  175 + }
  176 + } else {
  177 + this.propagateChangePending = true;
  178 + }
169 179 }
  180 + } else {
  181 + this.updateViewPending = true;
170 182 }
171 183 }
172 184
... ...