ato-water-lib 0.0.34 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/esm2020/ato-water-lib.mjs +5 -0
  2. package/esm2020/lib/ato-water-lib.component.mjs +19 -0
  3. package/esm2020/lib/ato-water-lib.module.mjs +49 -0
  4. package/esm2020/lib/ato-water-lib.service.mjs +14 -0
  5. package/esm2020/lib/components/asset-flow/asset-flow.component.mjs +123 -0
  6. package/esm2020/lib/components/asset-params-view/asset-params-view.component.mjs +26 -0
  7. package/esm2020/lib/components/flow-diagram-lib/flow-diagram-lib.component.mjs +54 -0
  8. package/esm2020/lib/constants/applicable-prefixes-const.mjs +441 -0
  9. package/esm2020/lib/constants/base64.const.mjs +5 -0
  10. package/esm2020/lib/constants/components-group-const.mjs +1629 -0
  11. package/esm2020/lib/constants/icon-base64.const.mjs +4 -0
  12. package/esm2020/lib/constants/key.const.mjs +4 -0
  13. package/esm2020/lib/constants/plant.constant.mjs +51 -0
  14. package/esm2020/lib/constants/value.const.mjs +782 -0
  15. package/esm2020/lib/directive/ato-loading.directive.mjs +55 -0
  16. package/esm2020/lib/directive/ng-var.directive.mjs +31 -0
  17. package/esm2020/lib/models/ato-asset-flow.model.mjs +2 -0
  18. package/esm2020/lib/models/default-gojs-editor.model.mjs +3227 -0
  19. package/esm2020/lib/models/gojs-data.model.mjs +6 -0
  20. package/esm2020/lib/models/gojs-editor.model.mjs +1754 -0
  21. package/esm2020/lib/services/utils/utils.service.mjs +133 -0
  22. package/esm2020/public-api.mjs +15 -0
  23. package/fesm2015/ato-water-lib.mjs +8208 -0
  24. package/fesm2015/ato-water-lib.mjs.map +1 -0
  25. package/fesm2020/ato-water-lib.mjs +8360 -0
  26. package/fesm2020/ato-water-lib.mjs.map +1 -0
  27. package/index.d.ts +5 -0
  28. package/lib/ato-water-lib.component.d.ts +5 -0
  29. package/lib/ato-water-lib.module.d.ts +13 -0
  30. package/lib/ato-water-lib.service.d.ts +6 -0
  31. package/lib/components/asset-flow/asset-flow.component.d.ts +35 -0
  32. package/lib/components/asset-params-view/asset-params-view.component.d.ts +10 -0
  33. package/lib/components/flow-diagram-lib/flow-diagram-lib.component.d.ts +16 -0
  34. package/lib/constants/applicable-prefixes-const.d.ts +162 -0
  35. package/lib/constants/base64.const.d.ts +3 -0
  36. package/lib/constants/components-group-const.d.ts +1264 -0
  37. package/lib/constants/icon-base64.const.d.ts +3 -0
  38. package/lib/constants/key.const.d.ts +1 -0
  39. package/lib/constants/plant.constant.d.ts +7 -0
  40. package/lib/constants/value.const.d.ts +71 -0
  41. package/lib/directive/ato-loading.directive.d.ts +14 -0
  42. package/lib/directive/ng-var.directive.d.ts +12 -0
  43. package/lib/models/ato-asset-flow.model.d.ts +5 -0
  44. package/lib/models/default-gojs-editor.model.d.ts +197 -0
  45. package/{src/lib/models/gojs-data.model.ts → lib/models/gojs-data.model.d.ts} +3 -3
  46. package/lib/models/gojs-editor.model.d.ts +436 -0
  47. package/lib/services/utils/utils.service.d.ts +24 -0
  48. package/package.json +22 -3
  49. package/{src/public-api.ts → public-api.d.ts} +0 -10
  50. package/ng-package.json +0 -11
  51. package/src/lib/ato-water-lib.component.spec.ts +0 -23
  52. package/src/lib/ato-water-lib.component.ts +0 -15
  53. package/src/lib/ato-water-lib.module.ts +0 -31
  54. package/src/lib/ato-water-lib.service.spec.ts +0 -16
  55. package/src/lib/ato-water-lib.service.ts +0 -9
  56. package/src/lib/components/asset-flow/asset-flow.component.html +0 -21
  57. package/src/lib/components/asset-flow/asset-flow.component.scss +0 -4
  58. package/src/lib/components/asset-flow/asset-flow.component.spec.ts +0 -23
  59. package/src/lib/components/asset-flow/asset-flow.component.ts +0 -137
  60. package/src/lib/components/asset-params-view/asset-params-view.component.html +0 -85
  61. package/src/lib/components/asset-params-view/asset-params-view.component.scss +0 -37
  62. package/src/lib/components/asset-params-view/asset-params-view.component.spec.ts +0 -23
  63. package/src/lib/components/asset-params-view/asset-params-view.component.ts +0 -16
  64. package/src/lib/components/flow-diagram-lib/flow-diagram-lib.component.css +0 -0
  65. package/src/lib/components/flow-diagram-lib/flow-diagram-lib.component.html +0 -25
  66. package/src/lib/components/flow-diagram-lib/flow-diagram-lib.component.ts +0 -69
  67. package/src/lib/constants/applicable-prefixes-const.ts +0 -452
  68. package/src/lib/constants/base64.const.ts +0 -5
  69. package/src/lib/constants/components-group-const.ts +0 -1637
  70. package/src/lib/constants/icon-base64.const.ts +0 -3
  71. package/src/lib/constants/icon-svg.const.ts +0 -8
  72. package/src/lib/constants/key.const.ts +0 -5
  73. package/src/lib/constants/plant.constant.ts +0 -52
  74. package/src/lib/constants/value.const.ts +0 -822
  75. package/src/lib/directive/ato-loading.directive.ts +0 -55
  76. package/src/lib/directive/ng-var.directive.ts +0 -28
  77. package/src/lib/models/default-gojs-editor.model.ts +0 -4906
  78. package/src/lib/models/gojs-editor.model.ts +0 -1901
  79. package/src/lib/services/utils/utils.service.ts +0 -141
  80. package/tsconfig.lib.json +0 -14
  81. package/tsconfig.lib.prod.json +0 -10
  82. package/tsconfig.spec.json +0 -14
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { AssetFlowComponent } from './asset-flow.component';
4
-
5
- describe('AssetFlowComponent', () => {
6
- let component: AssetFlowComponent;
7
- let fixture: ComponentFixture<AssetFlowComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ AssetFlowComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(AssetFlowComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,137 +0,0 @@
1
- import {
2
- Component,
3
- EventEmitter,
4
- HostListener,
5
- Input,
6
- OnInit,
7
- Output,
8
- ViewChild,
9
- } from '@angular/core';
10
- import * as go from 'gojs';
11
- import _ from 'lodash';
12
- import { AtoGoJSBase64 } from '../../constants/base64.const';
13
- import { ATO_ASSET_LAYERS, ATO_COMPONENTS_GROUP_DATA } from '../../constants/components-group-const';
14
- import { AtoGoJSData } from '../../models/gojs-data.model';
15
- import { AtoGojsEditorModel } from '../../models/gojs-editor.model';
16
- import { AtoAssetParamsViewComponent } from '../asset-params-view/asset-params-view.component';
17
- import { AtoFlowDiagramLibComponent } from '../flow-diagram-lib/flow-diagram-lib.component';
18
-
19
- export interface AtoDefaultFlowData {
20
- systemType: string;
21
- isUseBase64?: boolean;
22
- assetLayer?: string;
23
- }
24
-
25
- @Component({
26
- selector: 'ato-asset-flow',
27
- templateUrl: './asset-flow.component.html',
28
- styleUrls: ['./asset-flow.component.scss'],
29
- })
30
- export class AssetFlowComponent implements OnInit {
31
- @Input() assetLayer: string;
32
- @ViewChild(AtoFlowDiagramLibComponent)
33
- gjFlowDiagramTemp: AtoFlowDiagramLibComponent;
34
- @ViewChild(AtoAssetParamsViewComponent)
35
- assetParamsViewTemp: AtoAssetParamsViewComponent;
36
- @Input() selectedComponent: any;
37
- @Input() systemType: AtoGojsEditorModel.ENUM_TYPES;
38
- @Output() onClickParamOfTableEvent: EventEmitter<any> =
39
- new EventEmitter<any>();
40
- @Input() isUseBase64 = false;
41
- $ = go.GraphObject.make;
42
- options = {
43
- layout: this.$(go.LayeredDigraphLayout, {
44
- // direction: 0,
45
- }),
46
- // isReadOnly: true,
47
- };
48
- @Input() flowData: AtoGoJSData = {} as AtoGoJSData;
49
-
50
- // Reponsive
51
- dataTableAssetParams: any[];
52
- @Input() isResponsiveView = false;
53
- @Input() getFlowDataCallBack: Function;
54
-
55
- timeoutResizeWindow;
56
- @HostListener('window:resize', ['$event'])
57
- onResize(event: Event): void {
58
- // Now only Support Cooling Tower Responsive
59
- if (this.timeoutResizeWindow) {
60
- clearTimeout(this.timeoutResizeWindow);
61
- }
62
- this.timeoutResizeWindow = setTimeout(() => {
63
- this.checkResponsiveView();
64
- this.updateLocationReponsive();
65
- }, 1000);
66
- }
67
-
68
- checkResponsiveView() {
69
- if (
70
- this?.systemType ===
71
- AtoGojsEditorModel.ENUM_TYPES.COOLING_TOWER
72
- ) {
73
- this.isResponsiveView = window.innerWidth < 1024;
74
- } else {
75
- this.isResponsiveView = false;
76
- }
77
- }
78
-
79
- updateLocationReponsive() {
80
- if (!this.flowData?.nodeDataArray) {
81
- this.flowData = AssetFlowComponent.getDefaultFlowData({
82
- systemType: this.systemType,
83
- isUseBase64: this.isUseBase64,
84
- assetLayer: this.assetLayer
85
- });
86
- }
87
- _.forEach(
88
- this.flowData?.nodeDataArray,
89
- (node: any) => {
90
- node = _.merge(node, node[`extendedData${this.isResponsiveView ? 'Responsive' : ''}`]);
91
- }
92
- );
93
- this.setFlowData(_.cloneDeep(this.flowData));
94
- }
95
-
96
- ngOnInit() {
97
- this.checkResponsiveView();
98
- this.updateLocationReponsive();
99
- }
100
- onClickParamOfTable($event: any) {
101
- this.onClickParamOfTableEvent.emit($event);
102
- }
103
-
104
- static getDefaultFlowData(defaultData: AtoDefaultFlowData) {
105
- const flowData = {
106
- ..._.cloneDeep(ATO_COMPONENTS_GROUP_DATA)[
107
- defaultData?.systemType
108
- ],
109
- linkFromPortIdProperty: 'fromPort',
110
- linkToPortIdProperty: 'toPort',
111
- };
112
- // assetLayer
113
- flowData.nodeDataArray = _.filter(flowData.nodeDataArray, x => !x?.assetLayers || (x?.assetLayers && x?.assetLayers === (defaultData?.assetLayer ?? ATO_ASSET_LAYERS.FLOW)))
114
- if (defaultData?.isUseBase64) {
115
- const itemImageTemp = (flowData as AtoGoJSData)?.nodeDataArray?.find(
116
- (x) => x?.type === 'Image Template'
117
- );
118
- if (itemImageTemp) {
119
- itemImageTemp.source = AtoGoJSBase64[defaultData?.systemType];
120
- }
121
- }
122
- return flowData;
123
- }
124
-
125
- setFlowData(data: AtoGoJSData) {
126
- this.flowData = { ...data };
127
- this.dataTableAssetParams = _.forEach(
128
- this.flowData?.nodeDataArray?.filter(
129
- (e) => e?.type === AtoGojsEditorModel.ENUM_TEMPLATES.PARAM_TABLE && e?.assetLayers?.includes(this?.assetLayer ?? ATO_ASSET_LAYERS.FLOW)
130
- ), x => {
131
- if (!data?.isRefresh) {
132
- x.isCollapsed = this.assetParamsViewTemp?.data?.find(y => y?.key === x?.key)?.isCollapsed;
133
- }
134
- }
135
- );
136
- }
137
- }
@@ -1,85 +0,0 @@
1
- <div class="d-flex flex-column flex-gap-2">
2
- <div class="" *ngFor="let tableParam of data">
3
- <ng-template
4
- [ngTemplateOutlet]="tableParamTemplate"
5
- [ngTemplateOutletContext]="{
6
- data: tableParam
7
- }"
8
- ></ng-template>
9
- </div>
10
- </div>
11
-
12
- <ng-template #tableParamTemplate let-data="data">
13
- <div
14
- class="d-flex flex-column asset-param-item w-100"
15
- [style.backgroundColor]="data?.color"
16
- >
17
- <div
18
- class="d-flex align-items-center justify-content-between py-1 pl-1 pr-2 cursor-pointer"
19
- (click)="data.isCollapsed = !data.isCollapsed"
20
- >
21
- <div class="font-size-14px flex-grow-1 text-truncate color-white">
22
- {{ data?.title }}
23
- </div>
24
- <svg
25
- *ngIf="data.isCollapsed"
26
- xmlns="http://www.w3.org/2000/svg"
27
- viewBox="0 0 320 512"
28
- fill="#FFFF"
29
- class="fa-solid font-size-14px color-white svg-15px"
30
- >
31
- <path
32
- d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"
33
- />
34
- </svg>
35
- <svg
36
- *ngIf="!data.isCollapsed"
37
- xmlns="http://www.w3.org/2000/svg"
38
- viewBox="0 0 448 512"
39
- fill="#FFFF"
40
- class="fa-solid font-size-14px color-white svg-15px"
41
- >
42
- <path
43
- d="M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"
44
- />
45
- </svg>
46
- </div>
47
- <div class="px-1 pb-1" *ngIf="!data.isCollapsed">
48
- <div
49
- class="table-asset-param-wrapper"
50
- [style.backgroundColor]="data?.bgColor"
51
- >
52
- <table>
53
- <tbody>
54
- <tr
55
- *ngFor="let itemTable of data?.dataTable"
56
- (click)="onClickRowParam(itemTable)"
57
- class="cursor-pointer"
58
- >
59
- <td
60
- class="font-size-13px"
61
- [style.borderColor]="data?.borderTable"
62
- >
63
- {{ itemTable?.name }}
64
- </td>
65
- <td
66
- class="font-size-13px"
67
- [style.borderColor]="data?.borderTable"
68
- >
69
- <div class="d-flex align-items-center">
70
- <div
71
- class="mr-auto font-size-13px text-truncate flex-grow-1"
72
- [style.color]="itemTable?.color"
73
- >
74
- {{ itemTable?.value }}
75
- </div>
76
- <svg *ngIf="isEditView" class="svg-15px" fill="#333333" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M441 58.9L453.1 71c9.4 9.4 9.4 24.6 0 33.9L424 134.1 377.9 88 407 58.9c9.4-9.4 24.6-9.4 33.9 0zM209.8 256.2L344 121.9 390.1 168 255.8 302.2c-2.9 2.9-6.5 5-10.4 6.1l-58.5 16.7 16.7-58.5c1.1-3.9 3.2-7.5 6.1-10.4zM373.1 25L175.8 222.2c-8.7 8.7-15 19.4-18.3 31.1l-28.6 100c-2.4 8.4-.1 17.4 6.1 23.6s15.2 8.5 23.6 6.1l100-28.6c11.8-3.4 22.5-9.7 31.1-18.3L487 138.9c28.1-28.1 28.1-73.7 0-101.8L474.9 25C446.8-3.1 401.2-3.1 373.1 25zM88 64C39.4 64 0 103.4 0 152V424c0 48.6 39.4 88 88 88H360c48.6 0 88-39.4 88-88V312c0-13.3-10.7-24-24-24s-24 10.7-24 24V424c0 22.1-17.9 40-40 40H88c-22.1 0-40-17.9-40-40V152c0-22.1 17.9-40 40-40H200c13.3 0 24-10.7 24-24s-10.7-24-24-24H88z"/></svg>
77
- </div>
78
- </td>
79
- </tr>
80
- </tbody>
81
- </table>
82
- </div>
83
- </div>
84
- </div>
85
- </ng-template>
@@ -1,37 +0,0 @@
1
- .asset-param-item {
2
- border-radius: 5px;
3
-
4
- .table-asset-param-wrapper {
5
- border-radius: 5px;
6
- background-color: aliceblue;
7
- table {
8
- border-collapse: collapse;
9
- width: 100%;
10
-
11
- tbody {
12
- tr {
13
- td {
14
- border: 1px solid red;
15
- height: 30px;
16
- padding: 4px;
17
- }
18
- }
19
- }
20
- }
21
- }
22
- }
23
-
24
-
25
- .color-white {
26
- color: white;
27
- }
28
-
29
- .flex-gap-2 {
30
- gap: 0.5rem;
31
- }
32
-
33
- .svg-15px {
34
- width: 15px;
35
- height: 15px;
36
- flex: 0 0 15px;
37
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { AssetParamsViewComponent } from './asset-params-view.component';
4
-
5
- describe('AssetParamsViewComponent', () => {
6
- let component: AssetParamsViewComponent;
7
- let fixture: ComponentFixture<AssetParamsViewComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ AssetParamsViewComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(AssetParamsViewComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,16 +0,0 @@
1
- import { Component, EventEmitter, Input, Output } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'ato-asset-params-view',
5
- templateUrl: './asset-params-view.component.html',
6
- styleUrls: ['./asset-params-view.component.scss']
7
- })
8
- export class AtoAssetParamsViewComponent {
9
- @Input() isEditView = false;
10
- @Input() data: any[] = [];
11
- @Output() clickParamTableRow = new EventEmitter();
12
-
13
- onClickRowParam(itemTable) {
14
- this.clickParamTableRow.emit(itemTable);
15
- }
16
- }
@@ -1,25 +0,0 @@
1
- <div class="w-100 h-100 gj-flow-diagram-wrapper" atoLoading [appLoading]="data === null || !!isLoading">
2
- <div class="w-100 h-100 d-flex">
3
- <!-- <button
4
- id="actionMenuId"
5
- class="invisible-btn"
6
- mat-button
7
- [matMenuTriggerFor]="menu"
8
- #menuTrigger="matMenuTrigger"
9
- ></button>
10
- <mat-menu #menu="matMenu">
11
- <button mat-menu-item *ngFor="let item of actions" (click)="item?.onClick($event)">
12
- <div class="d-flex flex-gap-2">
13
- <div><i class="{{ item?.iconClassName }}"></i></div>
14
- <div>{{ item?.name }}</div>
15
- </div>
16
- </button>
17
- </mat-menu> -->
18
-
19
- <div #myDiagramDivTemp [id]="myDiagramDiv" class="flex-grow-1"></div>
20
- <div *ngIf="initialOptions?.isReadOnly && !data?.nodeDataArray?.length" class="empty-data">
21
- <!-- <nz-empty nzNotFoundImage="simple"></nz-empty> -->
22
- No Data
23
- </div>
24
- </div>
25
- </div>
@@ -1,69 +0,0 @@
1
- import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
2
- import _ from 'lodash';
3
-
4
- import { AtoDefaultGojsEditor } from '../../models/default-gojs-editor.model';
5
- import { AtoGojsEditorModel } from '../../models/gojs-editor.model';
6
-
7
- @Component({
8
- selector: 'ato-flow-diagram-lib',
9
- templateUrl: './flow-diagram-lib.component.html',
10
- styleUrls: ['./flow-diagram-lib.component.css']
11
- })
12
- export class AtoFlowDiagramLibComponent extends AtoDefaultGojsEditor implements OnInit {
13
- @ViewChild('myDiagramDivTemp') myDiagramDivTemp: any;
14
- _data: any = null;
15
- @Input() set data(v) {
16
- this._data = v;
17
- this.loadDiagram();
18
- }
19
-
20
- @Input() isLoading = false;
21
-
22
- get data() {
23
- return this._data;
24
- }
25
-
26
- constructor(
27
- _elRef: ElementRef,
28
- ) {
29
- super(_elRef);
30
- this.actions = [
31
- AtoDefaultGojsEditor.ACTIONS[AtoDefaultGojsEditor.ENUM_ACTIONS.DETAILS],
32
- AtoDefaultGojsEditor.ACTIONS[AtoDefaultGojsEditor.ENUM_ACTIONS.DELETE],
33
- ];
34
- this.unsubscribeAll();
35
- }
36
-
37
-
38
-
39
- ngOnInit(): void {
40
- this.addSubscribes(
41
- this.committedTransactionSubject?.subscribe((e) => {
42
- this.onModelChangeListenerEvent.emit(e);
43
- }),
44
- // this._GjUtilsService?.updateNameDataBox$?.subscribe((rs) => {
45
- // if (rs && rs?.key) {
46
- // const node = this.myDiagram.findNodeForKey(rs?.key);
47
- // this.myDiagram.model.setDataProperty(node?.data, 'name', rs?.name);
48
- // }
49
- // }),
50
- );
51
- }
52
-
53
- loadDiagram() {
54
- this.editor = new AtoGojsEditorModel({
55
- class: 'go.GraphLinksModel',
56
- nodeCategoryProperty: 'type',
57
- ...this.data,
58
- });
59
- }
60
-
61
- findNodeForKey(key: number | string) {
62
- this.myDiagram.select(this.myDiagram.findNodeForKey(key));
63
- }
64
- }
65
-
66
-
67
-
68
-
69
-