Commit c979a9309920897295443586699f63c89d6671d7

Authored by Igor Kulikov
1 parent 66d08103

IE11 fixes.

... ... @@ -11724,17 +11724,17 @@
11724 11724 }
11725 11725 },
11726 11726 "schema-inspector": {
11727   - "version": "1.6.9",
11728   - "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.9.tgz",
11729   - "integrity": "sha512-MNS3SOn6noecIv9R+gwroIgiOLQoRY1IRXToFvVBo2QMfnXy1E+SGRVWJFsJPqgy0lAivUfPLaVLhvAI35HKRg==",
  11727 + "version": "1.6.8",
  11728 + "resolved": "https://registry.npmjs.org/schema-inspector/-/schema-inspector-1.6.8.tgz",
  11729 + "integrity": "sha1-ueU5g8xV/y29e2Xj2+CF2dEoXyo=",
11730 11730 "requires": {
11731   - "async": "^3.1.0"
  11731 + "async": "^1.5.0"
11732 11732 },
11733 11733 "dependencies": {
11734 11734 "async": {
11735   - "version": "3.1.1",
11736   - "resolved": "https://registry.npmjs.org/async/-/async-3.1.1.tgz",
11737   - "integrity": "sha512-X5Dj8hK1pJNC2Wzo2Rcp9FBVdJMGRR/S7V+lH46s8GVFhtbo5O4Le5GECCF/8PISVdkUA6mMPvgz7qTTD1rf1g=="
  11735 + "version": "1.5.2",
  11736 + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
  11737 + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
11738 11738 }
11739 11739 }
11740 11740 },
... ...
... ... @@ -74,7 +74,7 @@
74 74 "react-dropzone": "^10.2.1",
75 75 "reactcss": "^1.2.3",
76 76 "rxjs": "^6.5.4",
77   - "schema-inspector": "^1.6.9",
  77 + "schema-inspector": "1.6.8",
78 78 "screenfull": "^5.0.1",
79 79 "split.js": "^1.5.11",
80 80 "systemjs": "0.21.5",
... ...
... ... @@ -109,7 +109,7 @@ export function isString(value: any): boolean {
109 109
110 110 export function formatValue(value: any, dec?: number, units?: string, showZeroDecimals?: boolean): string | undefined {
111 111 if (isDefined(value) &&
112   - value != null && isNumeric(value)) {
  112 + value !== null && isNumeric(value)) {
113 113 let formatted: string | number = Number(value);
114 114 if (isDefined(dec)) {
115 115 formatted = formatted.toFixed(dec);
... ... @@ -123,10 +123,14 @@ export function formatValue(value: any, dec?: number, units?: string, showZeroDe
123 123 }
124 124 return formatted;
125 125 } else {
126   - return value;
  126 + return value !== null ? value : '';
127 127 }
128 128 }
129 129
  130 +export function objectValues(obj: any): any[] {
  131 + return Object.keys(obj).map(e => obj[e]);
  132 +}
  133 +
130 134 export function deleteNullProperties(obj: any) {
131 135 if (isUndefined(obj) || obj == null) {
132 136 return;
... ...
... ... @@ -15,7 +15,7 @@
15 15 limitations under the License.
16 16
17 17 -->
18   -<form [formGroup]="alarmFormGroup" style="width: 600px;">
  18 +<form [formGroup]="alarmFormGroup" style="min-width: 600px;">
19 19 <mat-toolbar fxLayout="row" color="primary">
20 20 <h2>{{ 'alarm.alarm-details' | translate }}</h2>
21 21 <span fxFlex></span>
... ...
... ... @@ -221,7 +221,7 @@
221 221 'tb-current-entity': dataSource.isCurrentEntity(entity)}"
222 222 *matRowDef="let entity; columns: displayedColumns;" (click)="onRowClick($event, entity)"></mat-row>
223 223 </mat-table>
224   - <span [fxShow]="dataSource.isEmpty() | async"
  224 + <span [fxShow]="!(isLoading$ | async) && (dataSource.isEmpty() | async)"
225 225 fxLayoutAlign="center center"
226 226 class="no-data-found" translate>{{ translations.noEntities }}</span>
227 227 </div>
... ...
... ... @@ -419,7 +419,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn
419 419 }
420 420 return res;
421 421 } else {
422   - return null;
  422 + return '';
423 423 }
424 424 }
425 425
... ...
... ... @@ -18,11 +18,9 @@
18 18 height: 100%;
19 19 .tb-table-widget {
20 20 mat-footer-row, mat-row {
21   - min-height: 38px;
22 21 height: 38px;
23 22 }
24 23 mat-header-row {
25   - min-height: 40px;
26 24 height: 40px;
27 25 }
28 26 mat-toolbar {
... ...
... ... @@ -426,7 +426,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
426 426
427 427 this.initialize().subscribe(
428 428 () => {
429   - this.cd.detectChanges();
  429 + this.detectChanges();
430 430 this.onInit();
431 431 },
432 432 (err) => {
... ... @@ -435,6 +435,12 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
435 435 );
436 436 }
437 437
  438 + private detectChanges() {
  439 + if (!this.destroyed) {
  440 + this.cd.detectChanges();
  441 + }
  442 + }
  443 +
438 444 private isReady(): boolean {
439 445 return this.subscriptionInited && this.widgetSizeDetected;
440 446 }
... ... @@ -546,7 +552,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
546 552 this.widgetContext.reset();
547 553 this.subscriptionInited = true;
548 554 this.configureDynamicWidgetComponent();
549   - this.cd.detectChanges();
  555 + this.detectChanges();
550 556 this.onInit();
551 557 }
552 558 },
... ... @@ -564,7 +570,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
564 570 this.widgetContext.reset();
565 571 this.subscriptionInited = true;
566 572 this.configureDynamicWidgetComponent();
567   - this.cd.detectChanges();
  573 + this.detectChanges();
568 574 this.onInit();
569 575 }
570 576 }
... ... @@ -760,22 +766,18 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
760 766 dataLoading: (subscription) => {
761 767 if (this.loadingData !== subscription.loadingData) {
762 768 this.loadingData = subscription.loadingData;
763   - if (!this.destroyed) {
764   - this.cd.detectChanges();
765   - }
  769 + this.detectChanges();
766 770 }
767 771 },
768 772 legendDataUpdated: (subscription, detectChanges) => {
769   - if (detectChanges && !this.destroyed) {
770   - this.cd.detectChanges();
  773 + if (detectChanges) {
  774 + this.detectChanges();
771 775 }
772 776 },
773 777 timeWindowUpdated: (subscription, timeWindowConfig) => {
774 778 this.ngZone.run(() => {
775 779 this.widget.config.timewindow = timeWindowConfig;
776   - if (!this.destroyed) {
777   - this.cd.detectChanges();
778   - }
  780 + this.detectChanges();
779 781 });
780 782 }
781 783 };
... ... @@ -836,7 +838,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
836 838 if (this.dynamicWidgetComponent) {
837 839 this.dynamicWidgetComponent.rpcEnabled = subscription.rpcEnabled;
838 840 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
839   - this.cd.detectChanges();
  841 + this.detectChanges();
840 842 }
841 843 },
842 844 onRpcSuccess: (subscription) => {
... ... @@ -844,7 +846,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
844 846 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
845 847 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText;
846 848 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection;
847   - this.cd.detectChanges();
  849 + this.detectChanges();
848 850 }
849 851 },
850 852 onRpcFailed: (subscription) => {
... ... @@ -852,14 +854,14 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
852 854 this.dynamicWidgetComponent.executingRpcRequest = subscription.executingRpcRequest;
853 855 this.dynamicWidgetComponent.rpcErrorText = subscription.rpcErrorText;
854 856 this.dynamicWidgetComponent.rpcRejection = subscription.rpcRejection;
855   - this.cd.detectChanges();
  857 + this.detectChanges();
856 858 }
857 859 },
858 860 onRpcErrorCleared: (subscription) => {
859 861 if (this.dynamicWidgetComponent) {
860 862 this.dynamicWidgetComponent.rpcErrorText = null;
861 863 this.dynamicWidgetComponent.rpcRejection = null;
862   - this.cd.detectChanges();
  864 + this.detectChanges();
863 865 }
864 866 }
865 867 };
... ... @@ -873,16 +875,16 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
873 875 createSubscriptionSubject.error(err);
874 876 }
875 877 );
876   - this.cd.detectChanges();
  878 + this.detectChanges();
877 879 } else if (this.widget.type === widgetType.static) {
878 880 this.loadingData = false;
879 881 createSubscriptionSubject.next();
880 882 createSubscriptionSubject.complete();
881   - this.cd.detectChanges();
  883 + this.detectChanges();
882 884 } else {
883 885 createSubscriptionSubject.next();
884 886 createSubscriptionSubject.complete();
885   - this.cd.detectChanges();
  887 + this.detectChanges();
886 888 }
887 889 return createSubscriptionSubject.asObservable();
888 890 }
... ...
... ... @@ -20,7 +20,7 @@ import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs';
20 20 import { emptyPageData, PageData } from '@shared/models/page/page-data';
21 21 import { BaseData, HasId } from '@shared/models/base-data';
22 22 import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections';
23   -import { catchError, map, take, tap } from 'rxjs/operators';
  23 +import { catchError, map, share, take, tap } from 'rxjs/operators';
24 24 import { SelectionModel } from '@angular/cdk/collections';
25 25 import {EntityBooleanFunction} from '@home/models/entity/entities-table-config.models';
26 26
... ... @@ -78,19 +78,22 @@ export class EntitiesDataSource<T extends BaseData<HasId>, P extends PageLink =
78 78 isAllSelected(): Observable<boolean> {
79 79 const numSelected = this.selection.selected.length;
80 80 return this.entitiesSubject.pipe(
81   - map((entities) => numSelected === this.selectableEntitiesCount(entities))
  81 + map((entities) => numSelected === this.selectableEntitiesCount(entities)),
  82 + share()
82 83 );
83 84 }
84 85
85 86 isEmpty(): Observable<boolean> {
86 87 return this.entitiesSubject.pipe(
87   - map((entities) => !entities.length)
  88 + map((entities) => !entities.length),
  89 + share()
88 90 );
89 91 }
90 92
91 93 total(): Observable<number> {
92 94 return this.pageDataSubject.pipe(
93   - map((pageData) => pageData.totalElements)
  95 + map((pageData) => pageData.totalElements),
  96 + share()
94 97 );
95 98 }
96 99
... ...
... ... @@ -84,7 +84,7 @@ export class EntityTableColumn<T extends BaseData<HasId>> extends BaseEntityTabl
84 84 constructor(public key: string,
85 85 public title: string,
86 86 public width: string = '0px',
87   - public cellContentFunction: CellContentFunction<T> = (entity, property) => entity[property],
  87 + public cellContentFunction: CellContentFunction<T> = (entity, property) => entity[property] ? entity[property] : '',
88 88 public cellStyleFunction: CellStyleFunction<T> = () => ({}),
89 89 public sortable: boolean = true,
90 90 public headerCellStyleFunction: HeaderCellStyleFunction<T> = () => ({}),
... ...
... ... @@ -18,7 +18,6 @@
18 18 <div class="mat-padding" fxLayout="column">
19 19 <form #ruleNodeLinkForm="ngForm" [formGroup]="ruleNodeLinkFormGroup">
20 20 <tb-link-labels
21   - fxFlex
22 21 required
23 22 formControlName="labels"
24 23 [allowedLabels]="allowedLabels"
... ...
... ... @@ -23,6 +23,7 @@ import { AppState } from '@app/core/core.state';
23 23 import { TranslateService } from '@ngx-translate/core';
24 24 import { coerceBooleanProperty } from '@angular/cdk/coercion';
25 25 import { MessageType, messageTypeNames } from '@shared/models/rule-node.models';
  26 +import { objectValues } from '@core/utils';
26 27
27 28 @Component({
28 29 selector: 'tb-message-type-autocomplete',
... ... @@ -109,7 +110,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
109 110 this.modelValue = value;
110 111 let res: MessageType | string = null;
111 112 if (value) {
112   - if (Object.values(MessageType).includes(value)) {
  113 + if (objectValues(MessageType).includes(value)) {
113 114 res = MessageType[value];
114 115 } else {
115 116 res = value;
... ... @@ -129,7 +130,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
129 130 updateView(value: MessageType | string | null) {
130 131 let res: string = null;
131 132 if (value) {
132   - if (Object.values(MessageType).includes(value)) {
  133 + if (objectValues(MessageType).includes(value)) {
133 134 res = MessageType[value];
134 135 } else {
135 136 res = value;
... ... @@ -143,7 +144,7 @@ export class MessageTypeAutocompleteComponent implements ControlValueAccessor, O
143 144
144 145 displayMessageTypeFn(messageType?: MessageType | string): string | undefined {
145 146 if (messageType) {
146   - if (Object.values(MessageType).includes(messageType)) {
  147 + if (objectValues(MessageType).includes(messageType)) {
147 148 return messageTypeNames.get(MessageType[messageType]);
148 149 } else {
149 150 return messageType;
... ...
... ... @@ -120,7 +120,7 @@ export function getDashboardAssignedCustomersText(dashboard: DashboardInfo): str
120 120 .map(customerInfo => customerInfo.title)
121 121 .join(', ');
122 122 } else {
123   - return null;
  123 + return '';
124 124 }
125 125 }
126 126
... ...
... ... @@ -521,15 +521,17 @@ mat-label {
521 521 }
522 522
523 523 mat-header-row {
524   - min-height: 60px;
525 524 height: 60px;
526 525 }
527 526
528 527 mat-footer-row, mat-row {
529   - min-height: 52px;
530 528 height: 52px;
531 529 }
532 530
  531 + mat-header-row, mat-footer-row, mat-row {
  532 + min-height: auto;
  533 + }
  534 +
533 535 .mat-row,
534 536 .mat-header-row {
535 537 display: table-row;
... ... @@ -537,17 +539,23 @@ mat-label {
537 539
538 540
539 541 .mat-header-row.mat-table-sticky {
  542 + background-clip: padding-box;
540 543 .mat-header-cell {
541 544 position: sticky;
542 545 top: 0;
543 546 z-index: 10;
544 547 background: inherit;
  548 + background-clip: padding-box;
545 549 &.mat-table-sticky {
546 550 z-index: 11 !important;
547 551 }
548 552 }
549 553 }
550 554
  555 + .mat-cell.mat-table-sticky {
  556 + background-clip: padding-box;
  557 + }
  558 +
551 559 .mat-row {
552 560 transition: background-color .2s;
553 561 &:hover:not(.tb-current-entity) {
... ...