UI: Apply angular zone on resize observer callback when necessary.
This commit is contained in:
parent
20635e85cd
commit
c428633795
@ -471,7 +471,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
|||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.dashboardResize$ = new ResizeObserver(() => {
|
this.dashboardResize$ = new ResizeObserver(() => {
|
||||||
this.updateLayoutSizes();
|
this.ngZone.run(() => {
|
||||||
|
this.updateLayoutSizes();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.dashboardResize$.observe(this.dashboardContainer.nativeElement);
|
this.dashboardResize$.observe(this.dashboardContainer.nativeElement);
|
||||||
if (!this.widgetEditMode && !this.readonly && this.dashboardUtils.isEmptyDashboard(this.dashboard)) {
|
if (!this.widgetEditMode && !this.readonly && this.dashboardUtils.isEmptyDashboard(this.dashboard)) {
|
||||||
|
|||||||
@ -361,7 +361,9 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
|
|||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.gridsterResize$ = new ResizeObserver(() => {
|
this.gridsterResize$ = new ResizeObserver(() => {
|
||||||
this.onGridsterParentResize();
|
this.ngZone.run(() => {
|
||||||
|
this.onGridsterParentResize();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.gridsterResize$.observe(this.gridster.el.parentElement);
|
this.gridsterResize$.observe(this.gridster.el.parentElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import {
|
|||||||
ComponentFactoryResolver,
|
ComponentFactoryResolver,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
@ -142,7 +142,8 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
private elementRef: ElementRef,
|
private elementRef: ElementRef,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,11 +158,13 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
ViewChild
|
ViewChild
|
||||||
@ -121,7 +121,8 @@ export class RelationTableComponent extends PageComponent implements AfterViewIn
|
|||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private elementRef: ElementRef,
|
private elementRef: ElementRef,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
this.dirtyValue = !this.activeValue;
|
this.dirtyValue = !this.activeValue;
|
||||||
const sortOrder: SortOrder = { property: 'type', direction: Direction.ASC };
|
const sortOrder: SortOrder = { property: 'type', direction: Direction.ASC };
|
||||||
@ -133,11 +134,13 @@ export class RelationTableComponent extends PageComponent implements AfterViewIn
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
@ -141,7 +141,8 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
|
|||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private viewContainerRef: ViewContainerRef,
|
private viewContainerRef: ViewContainerRef,
|
||||||
private elementRef: ElementRef,
|
private elementRef: ElementRef,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
this.dirtyValue = !this.activeValue;
|
this.dirtyValue = !this.activeValue;
|
||||||
const sortOrder: SortOrder = { property: 'timestamp', direction: Direction.DESC };
|
const sortOrder: SortOrder = { property: 'timestamp', direction: Direction.DESC };
|
||||||
@ -151,11 +152,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.componentResize$ = new ResizeObserver(() => {
|
this.componentResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.componentResize$.observe(this.elementRef.nativeElement);
|
this.componentResize$.observe(this.elementRef.nativeElement);
|
||||||
this.isReadOnly = this.adminService.getRepositorySettingsInfo().pipe(map(settings => settings.readOnly));
|
this.isReadOnly = this.adminService.getRepositorySettingsInfo().pipe(map(settings => settings.readOnly));
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
ViewChild
|
ViewChild
|
||||||
@ -105,7 +105,8 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni
|
|||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private dialogs: DialogService,
|
private dialogs: DialogService,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private elementRef: ElementRef) {
|
private elementRef: ElementRef,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
const sortOrder: SortOrder = { property: 'actionSourceName', direction: Direction.ASC };
|
const sortOrder: SortOrder = { property: 'actionSourceName', direction: Direction.ASC };
|
||||||
this.pageLink = new PageLink(10, 0, null, sortOrder);
|
this.pageLink = new PageLink(10, 0, null, sortOrder);
|
||||||
@ -115,11 +116,13 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -273,11 +273,13 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
|
|||||||
() => this.pageLink.page = 0
|
() => this.pageLink.page = 0
|
||||||
);
|
);
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.ngZone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -220,11 +220,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
|
|||||||
this.ctx.updateWidgetParams();
|
this.ctx.updateWidgetParams();
|
||||||
if (this.displayPagination) {
|
if (this.displayPagination) {
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.ngZone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import { ChangeDetectorRef, Component, ElementRef, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
import { ChangeDetectorRef, Component, ElementRef, Input, NgZone, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@ -81,7 +81,8 @@ export class MobileAppQrcodeWidgetComponent extends PageComponent implements OnI
|
|||||||
private utilsService: UtilsService,
|
private utilsService: UtilsService,
|
||||||
private elementRef: ElementRef,
|
private elementRef: ElementRef,
|
||||||
private imagePipe: ImagePipe,
|
private imagePipe: ImagePipe,
|
||||||
private sanitizer: DomSanitizer,) {
|
private sanitizer: DomSanitizer,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,11 +102,13 @@ export class MobileAppQrcodeWidgetComponent extends PageComponent implements OnI
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHideBadgeContainer = this.elementRef.nativeElement.offsetWidth > 250;
|
this.zone.run(() => {
|
||||||
if (showHideBadgeContainer !== this.showBadgeContainer) {
|
const showHideBadgeContainer = this.elementRef.nativeElement.offsetWidth > 250;
|
||||||
this.showBadgeContainer = showHideBadgeContainer;
|
if (showHideBadgeContainer !== this.showBadgeContainer) {
|
||||||
this.cd.markForCheck();
|
this.showBadgeContainer = showHideBadgeContainer;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
|
|||||||
@ -189,7 +189,9 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
|
|||||||
this.buildForm();
|
this.buildForm();
|
||||||
this.ctx.updateWidgetParams();
|
this.ctx.updateWidgetParams();
|
||||||
this.formResize$ = new ResizeObserver(() => {
|
this.formResize$ = new ResizeObserver(() => {
|
||||||
this.resize();
|
this.ngZone.run(() => {
|
||||||
|
this.resize();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.formResize$.observe(this.formContainerRef.nativeElement);
|
this.formResize$.observe(this.formContainerRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,11 +15,12 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
AfterViewInit,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
Injector,
|
Injector,
|
||||||
Input,
|
Input, NgZone, OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
StaticProvider,
|
StaticProvider,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
@ -100,7 +101,7 @@ interface PersistentTableWidgetActionDescriptor extends TableCellButtonActionDes
|
|||||||
styleUrls: ['./persistent-table.component.scss' , '../table-widget.scss']
|
styleUrls: ['./persistent-table.component.scss' , '../table-widget.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class PersistentTableComponent extends PageComponent implements OnInit {
|
export class PersistentTableComponent extends PageComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
ctx: WidgetContext;
|
ctx: WidgetContext;
|
||||||
@ -144,7 +145,8 @@ export class PersistentTableComponent extends PageComponent implements OnInit {
|
|||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private deviceService: DeviceService,
|
private deviceService: DeviceService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private cd: ChangeDetectorRef) {
|
private cd: ChangeDetectorRef,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,11 +160,13 @@ export class PersistentTableComponent extends PageComponent implements OnInit {
|
|||||||
this.ctx.updateWidgetParams();
|
this.ctx.updateWidgetParams();
|
||||||
if (this.displayPagination) {
|
if (this.displayPagination) {
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1218,8 +1218,8 @@ class CssScadaSymbolAnimation implements ScadaSymbolAnimation {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ease(easing: string): this {
|
public ease(easing: string | EasingLiteral): this {
|
||||||
this._easing = easing;
|
this._easing = this.easingLiteralToCssEasing(easing);
|
||||||
this.updateAnimationStyle('animation-timing-function', this._easing);
|
this.updateAnimationStyle('animation-timing-function', this._easing);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -1566,6 +1566,21 @@ class CssScadaSymbolAnimation implements ScadaSymbolAnimation {
|
|||||||
return Math.round((num + Number.EPSILON) * factor) / factor;
|
return Math.round((num + Number.EPSILON) * factor) / factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private easingLiteralToCssEasing(easing: string | EasingLiteral): string {
|
||||||
|
switch (easing) {
|
||||||
|
case '<>':
|
||||||
|
return 'ease-in-out';
|
||||||
|
case '-':
|
||||||
|
return 'linear';
|
||||||
|
case '>':
|
||||||
|
return 'ease-out';
|
||||||
|
case '<':
|
||||||
|
return 'ease-in';
|
||||||
|
default:
|
||||||
|
return easing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JsScadaSymbolAnimation implements ScadaSymbolAnimation {
|
class JsScadaSymbolAnimation implements ScadaSymbolAnimation {
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
Injector,
|
Injector,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
QueryList,
|
QueryList,
|
||||||
@ -224,7 +224,8 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
|||||||
private domSanitizer: DomSanitizer,
|
private domSanitizer: DomSanitizer,
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,11 +250,13 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,16 +18,20 @@ import {
|
|||||||
AfterViewInit,
|
AfterViewInit,
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component, ComponentRef,
|
Component,
|
||||||
|
ComponentRef,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
HostBinding,
|
HostBinding,
|
||||||
Input, NgZone, OnChanges,
|
Input,
|
||||||
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
Renderer2, SimpleChanges,
|
Renderer2,
|
||||||
ViewChild, ViewContainerRef,
|
SimpleChanges,
|
||||||
|
ViewChild,
|
||||||
|
ViewContainerRef,
|
||||||
ViewEncapsulation
|
ViewEncapsulation
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
@ -38,9 +42,9 @@ import { SafeStyle } from '@angular/platform-browser';
|
|||||||
import { isNotEmptyStr } from '@core/utils';
|
import { isNotEmptyStr } from '@core/utils';
|
||||||
import { GridsterItemComponent } from 'angular-gridster2';
|
import { GridsterItemComponent } from 'angular-gridster2';
|
||||||
import { UtilsService } from '@core/services/utils.service';
|
import { UtilsService } from '@core/services/utils.service';
|
||||||
import ITooltipsterInstance = JQueryTooltipster.ITooltipsterInstance;
|
|
||||||
import { from } from 'rxjs';
|
import { from } from 'rxjs';
|
||||||
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
|
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
|
||||||
|
import ITooltipsterInstance = JQueryTooltipster.ITooltipsterInstance;
|
||||||
|
|
||||||
export enum WidgetComponentActionType {
|
export enum WidgetComponentActionType {
|
||||||
MOUSE_DOWN,
|
MOUSE_DOWN,
|
||||||
@ -134,8 +138,7 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O
|
|||||||
private renderer: Renderer2,
|
private renderer: Renderer2,
|
||||||
private container: ViewContainerRef,
|
private container: ViewContainerRef,
|
||||||
private dashboardUtils: DashboardUtilsService,
|
private dashboardUtils: DashboardUtilsService,
|
||||||
private utils: UtilsService,
|
private utils: UtilsService) {
|
||||||
private zone: NgZone) {
|
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,26 +310,24 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.editWidgetActionsTooltip = $(this.gridsterItem.el).tooltipster('instance');
|
this.editWidgetActionsTooltip = $(this.gridsterItem.el).tooltipster('instance');
|
||||||
this.zone.run(() => {
|
componentRef = this.container.createComponent(EditWidgetActionsTooltipComponent);
|
||||||
componentRef = this.container.createComponent(EditWidgetActionsTooltipComponent);
|
componentRef.instance.container = this;
|
||||||
componentRef.instance.container = this;
|
componentRef.instance.viewInited.subscribe(() => {
|
||||||
componentRef.instance.viewInited.subscribe(() => {
|
if (this.editWidgetActionsTooltip.status().open) {
|
||||||
if (this.editWidgetActionsTooltip.status().open) {
|
this.editWidgetActionsTooltip.reposition();
|
||||||
this.editWidgetActionsTooltip.reposition();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
this.editWidgetActionsTooltip.on('destroyed', () => {
|
|
||||||
componentRef.destroy();
|
|
||||||
});
|
|
||||||
const parentElement = componentRef.instance.element.nativeElement;
|
|
||||||
const content = parentElement.firstChild;
|
|
||||||
parentElement.removeChild(content);
|
|
||||||
parentElement.style.display = 'none';
|
|
||||||
this.editWidgetActionsTooltip.content(content);
|
|
||||||
this.updateEditWidgetActionsTooltipState();
|
|
||||||
this.widget.onSelected((selected) =>
|
|
||||||
this.updateEditWidgetActionsTooltipSelectedState(selected));
|
|
||||||
});
|
});
|
||||||
|
this.editWidgetActionsTooltip.on('destroyed', () => {
|
||||||
|
componentRef.destroy();
|
||||||
|
});
|
||||||
|
const parentElement = componentRef.instance.element.nativeElement;
|
||||||
|
const content = parentElement.firstChild;
|
||||||
|
parentElement.removeChild(content);
|
||||||
|
parentElement.style.display = 'none';
|
||||||
|
this.editWidgetActionsTooltip.content(content);
|
||||||
|
this.updateEditWidgetActionsTooltipState();
|
||||||
|
this.widget.onSelected((selected) =>
|
||||||
|
this.updateEditWidgetActionsTooltipSelectedState(selected));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -546,7 +546,9 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.onInit(true);
|
this.ngZone.run(() => {
|
||||||
|
this.onInit(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ export class ScadaSymbolEditObject {
|
|||||||
constructor(private rootElement: HTMLElement,
|
constructor(private rootElement: HTMLElement,
|
||||||
public tooltipsContainer: HTMLElement,
|
public tooltipsContainer: HTMLElement,
|
||||||
public viewContainerRef: ViewContainerRef,
|
public viewContainerRef: ViewContainerRef,
|
||||||
public zone: NgZone,
|
private zone: NgZone,
|
||||||
private callbacks: ScadaSymbolEditObjectCallbacks,
|
private callbacks: ScadaSymbolEditObjectCallbacks,
|
||||||
public readonly: boolean) {
|
public readonly: boolean) {
|
||||||
this.shapeResize$ = new ResizeObserver(() => {
|
this.shapeResize$ = new ResizeObserver(() => {
|
||||||
@ -194,7 +194,9 @@ export class ScadaSymbolEditObject {
|
|||||||
from(import('tooltipster')),
|
from(import('tooltipster')),
|
||||||
from(import('tooltipster/dist/js/plugins/tooltipster/SVG/tooltipster-SVG.min.js'))
|
from(import('tooltipster/dist/js/plugins/tooltipster/SVG/tooltipster-SVG.min.js'))
|
||||||
]).subscribe(() => {
|
]).subscribe(() => {
|
||||||
this.setupElements();
|
this.zone.run(() => {
|
||||||
|
this.setupElements();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,9 +761,7 @@ export class ScadaSymbolElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setupTagPanel() {
|
private setupTagPanel() {
|
||||||
this.editObject.zone.run(() => {
|
setupTagPanelTooltip(this, this.editObject.viewContainerRef);
|
||||||
setupTagPanelTooltip(this, this.editObject.viewContainerRef);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private createAddTagTooltip() {
|
private createAddTagTooltip() {
|
||||||
@ -809,9 +809,7 @@ export class ScadaSymbolElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setupAddTagPanel() {
|
private setupAddTagPanel() {
|
||||||
this.editObject.zone.run(() => {
|
setupAddTagPanelTooltip(this, this.editObject.viewContainerRef);
|
||||||
setupAddTagPanelTooltip(this, this.editObject.viewContainerRef);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private innerTagTooltipPosition(_instance: ITooltipsterInstance, helper: ITooltipsterHelper,
|
private innerTagTooltipPosition(_instance: ITooltipsterInstance, helper: ITooltipsterHelper,
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
import {
|
import {
|
||||||
AfterViewInit, ChangeDetectorRef,
|
AfterViewInit, ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnChanges, OnDestroy,
|
OnChanges, OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Renderer2,
|
Renderer2,
|
||||||
@ -90,7 +90,8 @@ export class ScrollGridComponent<T, F> implements OnInit, AfterViewInit, OnChang
|
|||||||
|
|
||||||
constructor(private breakpointObserver: BreakpointObserver,
|
constructor(private breakpointObserver: BreakpointObserver,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private renderer: Renderer2) {
|
private renderer: Renderer2,
|
||||||
|
private zone: NgZone) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -109,7 +110,9 @@ export class ScrollGridComponent<T, F> implements OnInit, AfterViewInit, OnChang
|
|||||||
this.renderer.setStyle(this.viewport._contentWrapper.nativeElement, 'padding', this.gap + 'px');
|
this.renderer.setStyle(this.viewport._contentWrapper.nativeElement, 'padding', this.gap + 'px');
|
||||||
if (!(typeof this.itemSize === 'number')) {
|
if (!(typeof this.itemSize === 'number')) {
|
||||||
this.contentResize$ = new ResizeObserver(() => {
|
this.contentResize$ = new ResizeObserver(() => {
|
||||||
this.onContentResize();
|
this.zone.run(() => {
|
||||||
|
this.onContentResize();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.contentResize$.observe(this.viewport._contentWrapper.nativeElement);
|
this.contentResize$.observe(this.viewport._contentWrapper.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import {
|
|||||||
ElementRef,
|
ElementRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
HostBinding,
|
HostBinding,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
@ -196,7 +196,8 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
private importExportService: ImportExportService,
|
private importExportService: ImportExportService,
|
||||||
private elementRef: ElementRef,
|
private elementRef: ElementRef,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private fb: FormBuilder) {
|
private fb: FormBuilder,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
|
|
||||||
this.gridImagesFetchFunction = (pageSize, page, filter) => {
|
this.gridImagesFetchFunction = (pageSize, page, filter) => {
|
||||||
@ -361,11 +362,13 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
private initListMode() {
|
private initListMode() {
|
||||||
this.destroyListMode$ = new Subject<void>();
|
this.destroyListMode$ = new Subject<void>();
|
||||||
this.widgetResize$ = new ResizeObserver(() => {
|
this.widgetResize$ = new ResizeObserver(() => {
|
||||||
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
this.zone.run(() => {
|
||||||
if (showHidePageSize !== this.hidePageSize) {
|
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
|
||||||
this.hidePageSize = showHidePageSize;
|
if (showHidePageSize !== this.hidePageSize) {
|
||||||
this.cd.markForCheck();
|
this.hidePageSize = showHidePageSize;
|
||||||
}
|
this.cd.markForCheck();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.widgetResize$.observe(this.elementRef.nativeElement);
|
this.widgetResize$.observe(this.elementRef.nativeElement);
|
||||||
if (this.pageMode) {
|
if (this.pageMode) {
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import {
|
|||||||
ElementRef,
|
ElementRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
HostBinding,
|
HostBinding,
|
||||||
Input,
|
Input, NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
@ -213,7 +213,8 @@ export class ToggleHeaderComponent extends _ToggleBase implements OnInit, AfterV
|
|||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private breakpointObserver: BreakpointObserver) {
|
private breakpointObserver: BreakpointObserver,
|
||||||
|
private zone: NgZone) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +297,9 @@ export class ToggleHeaderComponent extends _ToggleBase implements OnInit, AfterV
|
|||||||
|
|
||||||
private startObservePagination() {
|
private startObservePagination() {
|
||||||
this.toggleGroupResize$ = new ResizeObserver(() => {
|
this.toggleGroupResize$ = new ResizeObserver(() => {
|
||||||
this.updatePagination();
|
this.zone.run(() => {
|
||||||
|
this.updatePagination();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
this.toggleGroupResize$.observe(this.toggleGroupContainer.nativeElement);
|
this.toggleGroupResize$.observe(this.toggleGroupContainer.nativeElement);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user