ato-water-lib 0.0.90 → 0.0.92

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/{esm2022 → esm2020}/lib/ato-water-lib.component.mjs +5 -5
  2. package/{esm2022 → esm2020}/lib/ato-water-lib.module.mjs +15 -15
  3. package/{esm2022 → esm2020}/lib/ato-water-lib.service.mjs +5 -5
  4. package/esm2020/lib/components/asset-flow/asset-flow.component.mjs +165 -0
  5. package/{esm2022 → esm2020}/lib/components/asset-params-view/asset-params-view.component.mjs +9 -7
  6. package/esm2020/lib/components/flow-diagram-lib/flow-diagram-lib.component.mjs +54 -0
  7. package/esm2020/lib/constants/components-group-const.mjs +3687 -0
  8. package/esm2020/lib/directive/ato-loading.directive.mjs +55 -0
  9. package/esm2020/lib/directive/ng-var.directive.mjs +31 -0
  10. package/esm2020/lib/models/default-gojs-editor.model.mjs +3589 -0
  11. package/esm2020/lib/models/gojs-data.model.mjs +6 -0
  12. package/esm2020/lib/models/gojs-editor.model.mjs +1822 -0
  13. package/esm2020/lib/services/utils/utils.service.mjs +133 -0
  14. package/fesm2015/ato-water-lib.mjs +9810 -0
  15. package/fesm2015/ato-water-lib.mjs.map +1 -0
  16. package/{fesm2022 → fesm2020}/ato-water-lib.mjs +1980 -568
  17. package/fesm2020/ato-water-lib.mjs.map +1 -0
  18. package/lib/components/asset-flow/asset-flow.component.d.ts +1 -1
  19. package/lib/components/asset-params-view/asset-params-view.component.d.ts +1 -1
  20. package/lib/components/flow-diagram-lib/flow-diagram-lib.component.d.ts +1 -1
  21. package/lib/constants/components-group-const.d.ts +710 -115
  22. package/lib/directive/ato-loading.directive.d.ts +1 -1
  23. package/lib/directive/ng-var.directive.d.ts +1 -1
  24. package/lib/models/default-gojs-editor.model.d.ts +2 -2
  25. package/lib/models/gojs-editor.model.d.ts +12 -5
  26. package/package.json +13 -7
  27. package/esm2022/lib/components/asset-flow/asset-flow.component.mjs +0 -174
  28. package/esm2022/lib/components/flow-diagram-lib/flow-diagram-lib.component.mjs +0 -55
  29. package/esm2022/lib/constants/components-group-const.mjs +0 -2291
  30. package/esm2022/lib/directive/ato-loading.directive.mjs +0 -59
  31. package/esm2022/lib/directive/ng-var.directive.mjs +0 -33
  32. package/esm2022/lib/models/default-gojs-editor.model.mjs +0 -3582
  33. package/esm2022/lib/models/gojs-data.model.mjs +0 -10
  34. package/esm2022/lib/models/gojs-editor.model.mjs +0 -1799
  35. package/esm2022/lib/services/utils/utils.service.mjs +0 -133
  36. package/fesm2022/ato-water-lib.mjs.map +0 -1
  37. /package/{esm2022 → esm2020}/ato-water-lib.mjs +0 -0
  38. /package/{esm2022 → esm2020}/lib/constants/applicable-prefixes-const.mjs +0 -0
  39. /package/{esm2022 → esm2020}/lib/constants/base64.const.mjs +0 -0
  40. /package/{esm2022 → esm2020}/lib/constants/icon-base64.const.mjs +0 -0
  41. /package/{esm2022 → esm2020}/lib/constants/key.const.mjs +0 -0
  42. /package/{esm2022 → esm2020}/lib/constants/plant.constant.mjs +0 -0
  43. /package/{esm2022 → esm2020}/lib/constants/value.const.mjs +0 -0
  44. /package/{esm2022 → esm2020}/lib/models/ato-asset-flow.model.mjs +0 -0
  45. /package/{esm2022 → esm2020}/public-api.mjs +0 -0
@@ -0,0 +1,133 @@
1
+ import { DecimalPipe } from '@angular/common';
2
+ import { Injectable } from '@angular/core';
3
+ import { ATO_ABBREVIATION, APPLICABLE_PREFIXES, ROUNDED_NUMBER, } from '../../constants/applicable-prefixes-const';
4
+ import { v4 as uuidV4 } from 'uuid';
5
+ import _ from 'lodash';
6
+ import * as i0 from "@angular/core";
7
+ export class UtilsService {
8
+ static convertPrefixesData(data) {
9
+ if (!data?.unit || (!+data?.value && data?.value !== '0')) {
10
+ return {
11
+ shortenedNumber: data?.value ?? '0',
12
+ unitPrefixes: '',
13
+ };
14
+ }
15
+ const [unitToConvert, suffixUnit] = data?.unit?.split('/');
16
+ if (unitToConvert === ATO_ABBREVIATION.kWh) {
17
+ return this.getDataFormatSpecialKwh(data?.value, data?.isChangeUnitKwh);
18
+ }
19
+ return this.getDataFormatUnit(data?.value, unitToConvert);
20
+ }
21
+ static getDataFormatSpecialKwh(value, isChangeUnitKwh) {
22
+ const _DecimalPipe = new DecimalPipe('en');
23
+ if (!!isChangeUnitKwh) {
24
+ // 1.000.000 KWh => 1 GWh
25
+ if (Math.abs(value) >= ROUNDED_NUMBER.MILLION) {
26
+ return {
27
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.MILLION) ?? 0, '1.0-2'),
28
+ unitPrefixes: APPLICABLE_PREFIXES?.[ATO_ABBREVIATION.kWh]?.[ROUNDED_NUMBER.BILLION],
29
+ };
30
+ }
31
+ // 1000 KWh => 1 MWh
32
+ if (Math.abs(value) >= ROUNDED_NUMBER.THOUSAND) {
33
+ return {
34
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.THOUSAND) ?? 0, '1.0-2'),
35
+ unitPrefixes: APPLICABLE_PREFIXES?.[ATO_ABBREVIATION.kWh]?.[ROUNDED_NUMBER.MILLION],
36
+ };
37
+ }
38
+ }
39
+ if (Math.abs(value) >= ROUNDED_NUMBER.BILLION) {
40
+ return {
41
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.MILLION) ?? 0, '1.0-2'),
42
+ unitPrefixes: APPLICABLE_PREFIXES?.[ATO_ABBREVIATION.kWh]?.[ROUNDED_NUMBER.BILLION],
43
+ };
44
+ }
45
+ if (Math.abs(value) >= ROUNDED_NUMBER.MILLION) {
46
+ return {
47
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.MILLION) ?? 0, '1.0-2'),
48
+ unitPrefixes: APPLICABLE_PREFIXES?.[ATO_ABBREVIATION.kWh]?.[ROUNDED_NUMBER.MILLION],
49
+ };
50
+ }
51
+ if (Math.abs(value) >= ROUNDED_NUMBER.THOUSAND) {
52
+ return {
53
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.THOUSAND) ?? 0, '1.0-2'),
54
+ unitPrefixes: APPLICABLE_PREFIXES?.[ATO_ABBREVIATION.kWh]?.[ROUNDED_NUMBER.THOUSAND],
55
+ };
56
+ }
57
+ return {
58
+ shortenedNumber: _DecimalPipe.transform(+value ?? 0, '1.0-2') ?? '0',
59
+ unitPrefixes: '',
60
+ };
61
+ }
62
+ static getDataFormatUnit(value, unit) {
63
+ const _DecimalPipe = new DecimalPipe('en');
64
+ if (Math.abs(value) >= ROUNDED_NUMBER.BILLION) {
65
+ return {
66
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.BILLION) ?? 0, '1.0-2'),
67
+ unitPrefixes: APPLICABLE_PREFIXES?.[unit]?.[ROUNDED_NUMBER.BILLION],
68
+ };
69
+ }
70
+ if (Math.abs(value) >= ROUNDED_NUMBER.MILLION) {
71
+ return {
72
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.MILLION) ?? 0, '1.0-2'),
73
+ unitPrefixes: APPLICABLE_PREFIXES?.[unit]?.[ROUNDED_NUMBER.MILLION],
74
+ };
75
+ }
76
+ if (Math.abs(value) >= ROUNDED_NUMBER.THOUSAND) {
77
+ return {
78
+ shortenedNumber: _DecimalPipe.transform(+(value / ROUNDED_NUMBER.THOUSAND) ?? 0, '1.0-2'),
79
+ unitPrefixes: APPLICABLE_PREFIXES?.[unit]?.[ROUNDED_NUMBER.THOUSAND],
80
+ };
81
+ }
82
+ return {
83
+ shortenedNumber: _DecimalPipe.transform(+value ?? 0, '1.0-2') ?? '0',
84
+ unitPrefixes: '',
85
+ };
86
+ }
87
+ static convertSpecialUnit(unit, unitPrefixes) {
88
+ switch (unit) {
89
+ case ATO_ABBREVIATION.kWh: {
90
+ return unitPrefixes ? ATO_ABBREVIATION.Wh : ATO_ABBREVIATION.kWh;
91
+ }
92
+ case ATO_ABBREVIATION.m3: {
93
+ return ATO_ABBREVIATION.m3_Special;
94
+ }
95
+ case ATO_ABBREVIATION.m3_unit: {
96
+ return ATO_ABBREVIATION.m3_unit_Special;
97
+ }
98
+ case ATO_ABBREVIATION.degC: {
99
+ return ATO_ABBREVIATION.degC_unit_Special;
100
+ }
101
+ case ATO_ABBREVIATION.degF: {
102
+ return ATO_ABBREVIATION.degF_unit_Special;
103
+ }
104
+ default: {
105
+ unit = UtilsService.replaceAll(unit ?? '', ATO_ABBREVIATION.m3, ATO_ABBREVIATION.m3_Special);
106
+ return UtilsService.replaceAll(unit ?? '', ATO_ABBREVIATION.CO2, ATO_ABBREVIATION.CO2_Special);
107
+ }
108
+ }
109
+ }
110
+ static generateUUID() {
111
+ const id = UtilsService.replaceAll(uuidV4(), '-', '').toUpperCase();
112
+ const randomPosition = _.random(0, 32);
113
+ const randomNumber = _.random(0, 9).toString();
114
+ const leftChar = id.slice(0, randomPosition);
115
+ const rightChar = id.slice(randomPosition);
116
+ return `${leftChar}${randomNumber}${rightChar}`;
117
+ }
118
+ static replaceAll(text, find, replace) {
119
+ function escapeRegExp(str) {
120
+ return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
121
+ }
122
+ return text.replace(new RegExp(escapeRegExp(find), 'g'), replace);
123
+ }
124
+ }
125
+ UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
126
+ UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsService, providedIn: 'root' });
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsService, decorators: [{
128
+ type: Injectable,
129
+ args: [{
130
+ providedIn: 'root',
131
+ }]
132
+ }] });
133
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4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cGUgPSBuZXcgRGVjaW1hbFBpcGUoJ2VuJyk7XG5cbiAgICAgICAgaWYgKCEhaXNDaGFuZ2VVbml0S3doKSB7XG4gICAgICAgICAgICAvLyAxLjAwMC4wMDAgS1doID0+IDEgR1doXG4gICAgICAgICAgICBpZiAoTWF0aC5hYnModmFsdWUpID49IFJPVU5ERURfTlVNQkVSLk1JTExJT04pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBzaG9ydGVuZWROdW1iZXI6IF9EZWNpbWFsUGlwZS50cmFuc2Zvcm0oKyh2YWx1ZSAvIFJPVU5ERURfTlVNQkVSLk1JTExJT04pID8/IDAsICcxLjAtMicpLFxuICAgICAgICAgICAgICAgICAgICB1bml0UHJlZml4ZXM6IEFQUExJQ0FCTEVfUFJFRklYRVM/LltBVE9fQUJCUkVWSUFUSU9OLmtXaF0/LltST1VOREVEX05VTUJFUi5CSUxMSU9OXSxcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gMTAwMCBLV2ggPT4gMSBNV2hcbiAgICAgICAgICAgIGlmIChNYXRoLmFicyh2YWx1ZSkgPj0gUk9VTkRFRF9OVU1CRVIuVEhPVVNBTkQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBzaG9ydGVuZWROdW1iZXI6IF9EZWNpbWFsUGlwZS50cmFuc2Zvcm0oKyh2YWx1ZSAvIFJPVU5ERURfTlVNQkVSLlRIT1VTQU5EKSA/PyAwLCAnMS4wLTInKSxcbiAgICAgICAgICAgICAgICAgICAgdW5pdFByZWZpeGVzOiBBUFBMSUNBQkxFX1BSRUZJWEVTPy5bQVRPX0FCQlJFVklBVElPTi5rV2hdPy5bUk9VTkRFRF9OVU1CRVIuTUlMTElPTl0sXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoTWF0aC5hYnModmFsdWUpID49IFJPVU5ERURfTlVNQkVSLkJJTExJT04pIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgc2hvcnRlbmVkTnVtYmVyOiBfRGVjaW1hbFBpcGUudHJhbnNmb3JtKCsodmFsdWUgLyBST1VOREVEX05VTUJFUi5NSUxMSU9OKSA/PyAwLCAnMS4wLTInKSxcbiAgICAgICAgICAgICAgICB1bml0UHJlZml4ZXM6IEFQUExJQ0FCTEVfUFJFRklYRVM/LltBVE9fQUJCUkVWSUFUSU9OLmtXaF0/LltST1VOREVEX05VTUJFUi5CSUxMSU9OXSxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKE1hdGguYWJzKHZhbHVlKSA+PSBST1VOREVEX05VTUJFUi5NSUxMSU9OKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHNob3J0ZW5lZE51bWJlcjogX0RlY2ltYWxQaXBlLnRyYW5zZm9ybSgrKHZhbHVlIC8gUk9VTkRFRF9OVU1CRVIuTUlMTElPTikgPz8gMCwgJzEuMC0yJyksXG4gICAgICAgICAgICAgICAgdW5pdFByZWZpeGVzOiBBUFBMSUNBQkxFX1BSRUZJWEVTPy5bQVRPX0FCQlJFVklBVElPTi5rV2hdPy5bUk9VTkRFRF9OVU1CRVIuTUlMTElPTl0sXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGlmIChNYXRoLmFicyh2YWx1ZSkgPj0gUk9VTkRFRF9OVU1CRVIuVEhPVVNBTkQpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgc2hvcnRlbmVkTnVtYmVyOiBfRGVjaW1hbFBpcGUudHJhbnNmb3JtKCsodmFsdWUgLyBST1VOREVEX05VTUJFUi5USE9VU0FORCkgPz8gMCwgJzEuMC0yJyksXG4gICAgICAgICAgICAgICAgdW5pdFByZWZpeGVzOiBBUFBMSUNBQkxFX1BSR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C0yJyksXG4gICAgICAgICAgICAgICAgdW5pdFByZWZpeGVzOiAoQVBQTElDQUJMRV9QUkVGSVhFUyBhcyBhbnkpPy5bdW5pdF0/LltST1VOREVEX05VTUJFUi5NSUxMSU9OXSxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKE1hdGguYWJzKHZhbHVlKSA+PSBST1VOREVEX05VTUJFUi5USE9VU0FORCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBzaG9ydGVuZWROdW1iZXI6IF9EZWNpbWFsUGlwZS50cmFuc2Zvcm0oKyh2YWx1ZSAvIFJPVU5ERURfTlVNQkVSLlRIT1VTQU5EKSA/PyAwLCAnMS4wLTInKSxcbiAgICAgICAgICAgICAgICB1bml0UHJlZml4ZXM6IChBUFBMSUNBQkxFX1BSRUZJWEVTIGFzIGFueSk/Llt1bml0XT8uW1JPVU5ERURfTlVNQkVSLlRIT1VTQU5EXSxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHNob3J0ZW5lZE51bWJlcjogX0RlY2ltYWxQaXBlLnRyYW5zZm9ybSgrdmFsdWUgPz8gMCwgJzEuMC0yJykgPz8gJzAnLFxuICAgICAgICAgICAgdW5pdFByZWZpeGVzOiAnJyxcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBzdGF0aWMgY29udmVydFNwZWNpYWxVbml0KHVuaXQ6IHN0cmluZywgdW5pdFByZWZpeGVzPzogYW55KSB7XG4gICAgICAgIHN3aXRjaCAodW5pdCkge1xuICAgICAgICAgICAgY2FzZSBBVE9fQUJCUkVWSUFUSU9OLmtXaDoge1xuICAgICAgICAgICAgICAgIHJldHVybiB1bml0UHJlZml4ZXMgPyBBVE9fQUJCUkVWSUFUSU9OLldoIDogQVRPX0FCQlJFVklBVElPTi5rV2g7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIEFUT19BQkJSRVZJQVRJT04ubTM6IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQVRPX0FCQlJFVklBVElPTi5tM19TcGVjaWFsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBBVE9fQUJCUkVWSUFUSU9OLm0zX3VuaXQ6IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQVRPX0FCQlJFVklBVElPTi5tM191bml0X1NwZWNpYWw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIEFUT19BQkJSRVZJQVRJT04uZGVnQzoge1xuICAgICAgICAgICAgICAgIHJldHVybiBBVE9fQUJCUkVWSUFUSU9OLmRlZ0NfdW5pdF9TcGVjaWFsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FzZSBBVE9fQUJCUkVWSUFUSU9OLmRlZ0Y6IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQVRPX0FCQlJFVklBVElPTi5kZWdGX3VuaXRfU3BlY2lhbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRlZmF1bHQ6IHtcbiAgICAgICAgICAgICAgICB1bml0ID0gVXRpbHNTZXJ2aWNlLnJlcGxhY2VBbGwodW5pdCA/PyAnJywgQVRPX0FCQlJFVklBVElPTi5tMywgQVRPX0FCQlJFVklBVElPTi5tM19TcGVjaWFsKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gVXRpbHNTZXJ2aWNlLnJlcGxhY2VBbGwodW5pdCA/PyAnJywgQVRPX0FCQlJFVklBVElPTi5DTzIsIEFUT19BQkJSRVZJQVRJT04uQ08yX1NwZWNpYWwpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgc3RhdGljIGdlbmVyYXRlVVVJRCgpIHtcbiAgICAgICAgY29uc3QgaWQgPSBVdGlsc1NlcnZpY2UucmVwbGFjZUFsbCh1dWlkVjQoKSwgJy0nLCAnJykudG9VcHBlckNhc2UoKTtcbiAgICAgICAgY29uc3QgcmFuZG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