@equinor/echo-framework 0.9.0 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.js +9 -0
- package/dist/components/containers/layouts.d.ts +3 -5
- package/dist/components/panel/corePanelLeft.d.ts +4 -1
- package/dist/components/panel/corePanelRight.d.ts +4 -1
- package/dist/components/router/echoRoute.d.ts +2 -2
- package/dist/components/router/index.d.ts +0 -1
- package/dist/coreApplication/EchoBarComponent.d.ts +12 -0
- package/dist/coreApplication/EchoContent.d.ts +1 -0
- package/dist/coreApplication/index.d.ts +1 -0
- package/dist/hooks/hookLibrary.d.ts +13 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useScreenOrientation.d.ts +2 -0
- package/dist/index.d.ts +6 -1
- package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +1 -1
- package/dist/node_modules/classnames/index.js +67 -0
- package/dist/services/api/api-manager.d.ts +10 -1
- package/dist/src/components/containers/layout.module.css.js +6 -2
- package/dist/src/components/containers/layouts.js +72 -36
- package/dist/src/components/footer/footer.module.css.js +1 -1
- package/dist/src/components/panel/corePanelLeft.js +5 -2
- package/dist/src/components/panel/corePanelLeft.module.css.js +1 -1
- package/dist/src/components/panel/corePanelRight.js +5 -2
- package/dist/src/components/panel/corePanelRight.module.css.js +1 -1
- package/dist/src/components/router/echoRoute.js +9 -3
- package/dist/src/components/router/routes.js +2 -4
- package/dist/src/coreApplication/EchoBarComponent.js +201 -0
- package/dist/src/coreApplication/EchoContent.js +7 -2
- package/dist/src/coreApplication/EchoContent.module.css.js +17 -0
- package/dist/src/globalStyles.css.js +1 -1
- package/dist/src/hooks/hookLibrary.js +17 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/useScreenOrientation.js +58 -0
- package/dist/src/index.js +13 -8
- package/dist/src/index2.js +37 -26
- package/dist/src/services/api/api-manager.js +107 -47
- package/dist/src/services/api/api-plantinfo.js +125 -8
- package/dist/src/services/api/api-plants.js +34 -3
- package/dist/src/services/api/api-realtimedata.js +9 -2
- package/dist/src/services/api/api-tags.js +61 -2
- package/dist/src/services/api/api-version.js +68 -6
- package/dist/src/utils/taskCache.js +89 -0
- package/dist/types/hookLibrary.d.ts +4 -0
- package/dist/utils/taskCache.d.ts +23 -0
- package/dist/utils/taskCache.test.d.ts +1 -0
- package/package.json +25 -25
- package/dist/components/router/useLayout.d.ts +0 -3
- package/dist/src/components/router/useLayout.js +0 -32
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, '__esModule', {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var TaskCache = /*#__PURE__*/function () {
|
|
14
|
+
function TaskCache(cacheOptions) {
|
|
15
|
+
_classCallCheck(this, TaskCache);
|
|
16
|
+
|
|
17
|
+
this.cache = [];
|
|
18
|
+
this.cacheOptions = cacheOptions;
|
|
19
|
+
|
|
20
|
+
if (cacheOptions.maxItems < 0) {
|
|
21
|
+
throw new Error('cacheOptions.maxItems must be positive');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_createClass(TaskCache, [{
|
|
26
|
+
key: "add",
|
|
27
|
+
value: function add(item) {
|
|
28
|
+
var _a;
|
|
29
|
+
|
|
30
|
+
var existingItem = this.removeItem(item.key);
|
|
31
|
+
var newItem = Object.assign(Object.assign({}, item), {
|
|
32
|
+
timeStamp: (_a = existingItem === null || existingItem === void 0 ? void 0 : existingItem.timeStamp) !== null && _a !== void 0 ? _a : new Date()
|
|
33
|
+
});
|
|
34
|
+
this.cache.push(newItem);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "get",
|
|
38
|
+
value: function get(url) {
|
|
39
|
+
this.clearExpired();
|
|
40
|
+
return this.cache.find(function (item) {
|
|
41
|
+
return item.key === url;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "clear",
|
|
46
|
+
value: function clear() {
|
|
47
|
+
this.cache = [];
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "clearExpired",
|
|
51
|
+
value: function clearExpired() {
|
|
52
|
+
var _this = this;
|
|
53
|
+
|
|
54
|
+
var now = new Date();
|
|
55
|
+
var defaultTimeToLive = this.cacheOptions.defaultTimeToLiveMilliseconds;
|
|
56
|
+
var expiredItems = this.cache.filter(function (item) {
|
|
57
|
+
var _a;
|
|
58
|
+
|
|
59
|
+
return now.getTime() - item.timeStamp.getTime() > ((_a = item === null || item === void 0 ? void 0 : item.timeToLiveMilliseconds) !== null && _a !== void 0 ? _a : defaultTimeToLive);
|
|
60
|
+
});
|
|
61
|
+
expiredItems.forEach(function (expiredItem) {
|
|
62
|
+
_this.removeItem(expiredItem.key);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
while (this.cache.length > this.cacheOptions.maxItems) {
|
|
66
|
+
this.cache.shift(); //First in, first out
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "removeItem",
|
|
71
|
+
value: function removeItem(key) {
|
|
72
|
+
var index = this.cache.findIndex(function (item) {
|
|
73
|
+
return item.key === key;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (index >= 0) {
|
|
77
|
+
var item = this.cache[index];
|
|
78
|
+
this.cache.splice(index, 1);
|
|
79
|
+
return item;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}]);
|
|
85
|
+
|
|
86
|
+
return TaskCache;
|
|
87
|
+
}();
|
|
88
|
+
|
|
89
|
+
exports.TaskCache = TaskCache;
|
|
@@ -2,3 +2,7 @@ export declare type SetActiveTagNo = (tagNo: string, activeTagTab?: string, acti
|
|
|
2
2
|
export declare type TagData = [(tagNo: string, instCode: string) => void];
|
|
3
3
|
export declare type SetActiveCommPackNo = (commPackNo: string, activeCommPackProject: string, activeCommPackTab?: string, activeCommPackSubTab?: string) => void;
|
|
4
4
|
export declare type SetActiveMcPackNo = (mcPackNo: string, activeMcPackProject: string, activeMcPackTab?: string, activeMcPackSubTab?: string) => void;
|
|
5
|
+
export interface DeviceOrientation {
|
|
6
|
+
portrait: boolean;
|
|
7
|
+
landscape: boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CachedTaskItem<T> {
|
|
2
|
+
task: Promise<T>;
|
|
3
|
+
key: string;
|
|
4
|
+
timeToLiveMilliseconds?: number;
|
|
5
|
+
}
|
|
6
|
+
interface InternalCachedTaskItem<T> extends CachedTaskItem<T> {
|
|
7
|
+
timeStamp: Date;
|
|
8
|
+
}
|
|
9
|
+
export interface CacheOptions {
|
|
10
|
+
maxItems: number;
|
|
11
|
+
defaultTimeToLiveMilliseconds: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class TaskCache {
|
|
14
|
+
cache: InternalCachedTaskItem<unknown>[];
|
|
15
|
+
cacheOptions: CacheOptions;
|
|
16
|
+
constructor(cacheOptions: CacheOptions);
|
|
17
|
+
add<T>(item: CachedTaskItem<T>): void;
|
|
18
|
+
get(url: string): CachedTaskItem<unknown> | undefined;
|
|
19
|
+
clear(): void;
|
|
20
|
+
private clearExpired;
|
|
21
|
+
private removeItem;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/echo-framework",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Modules and components for EchoWeb, utilizing EchoCore",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,71 +36,71 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@equinor/echo-base": "^0.6.8",
|
|
38
38
|
"@equinor/echo-components": "^0.4.0",
|
|
39
|
-
"@equinor/echo-core": "^0.6.
|
|
39
|
+
"@equinor/echo-core": "^0.6.12",
|
|
40
40
|
"@equinor/echo-search": "^0.12.4",
|
|
41
41
|
"@equinor/echo-utils": "^0.2.11",
|
|
42
42
|
"@equinor/eds-core-react": "^0.19.0",
|
|
43
43
|
"react": "^17.0.2",
|
|
44
44
|
"react-dom": "^17.0.2",
|
|
45
|
-
"react-router-dom": "^5.3.
|
|
45
|
+
"react-router-dom": "^5.3.3",
|
|
46
46
|
"styled-components": "^5.3.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.18.
|
|
49
|
+
"@babel/core": "^7.18.5",
|
|
50
50
|
"@babel/preset-env": "^7.18.2",
|
|
51
51
|
"@babel/preset-react": "^7.17.12",
|
|
52
52
|
"@equinor/echo-base": "^0.6.8",
|
|
53
53
|
"@equinor/echo-components": "^0.4.0",
|
|
54
|
-
"@equinor/echo-core": "^0.6.
|
|
54
|
+
"@equinor/echo-core": "^0.6.12",
|
|
55
55
|
"@equinor/echo-scripts": "^0.1.5",
|
|
56
56
|
"@equinor/echo-search": "^0.12.4",
|
|
57
57
|
"@equinor/echo-update": "^1.3.0",
|
|
58
58
|
"@equinor/echo-utils": "^0.2.11",
|
|
59
59
|
"@equinor/eds-core-react": "^0.19.0",
|
|
60
|
-
"@modular-css/rollup": "^28.1.
|
|
60
|
+
"@modular-css/rollup": "^28.1.3",
|
|
61
61
|
"@rollup/plugin-babel": "^5.3.1",
|
|
62
62
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
63
63
|
"@rollup/plugin-image": "^2.1.1",
|
|
64
64
|
"@rollup/plugin-json": "^4.1.0",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
66
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
66
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
67
67
|
"@rollup/plugin-url": "^7.0.0",
|
|
68
68
|
"@svgr/rollup": "^6.2.1",
|
|
69
69
|
"@testing-library/react-hooks": "^8.0.0",
|
|
70
|
-
"@types/jest": "^
|
|
71
|
-
"@types/node": "^17.0.
|
|
72
|
-
"@types/react": "^
|
|
73
|
-
"@types/react-dom": "^
|
|
70
|
+
"@types/jest": "^28.1.1",
|
|
71
|
+
"@types/node": "^17.0.43",
|
|
72
|
+
"@types/react": "^17.0.45",
|
|
73
|
+
"@types/react-dom": "^17.0.17",
|
|
74
74
|
"@types/react-router-dom": "^5.3.3",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
76
|
-
"@typescript-eslint/parser": "^5.
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
|
76
|
+
"@typescript-eslint/parser": "^5.28.0",
|
|
77
77
|
"@wessberg/rollup-plugin-ts": "^2.0.4",
|
|
78
78
|
"autoprefixer": "^10.4.7",
|
|
79
|
-
"babel-jest": "^28.1.
|
|
80
|
-
"eslint": "^8.
|
|
79
|
+
"babel-jest": "^28.1.1",
|
|
80
|
+
"eslint": "^8.17.0",
|
|
81
81
|
"eslint-config-prettier": "^8.5.0",
|
|
82
82
|
"eslint-plugin-prettier": "^4.0.0",
|
|
83
83
|
"eslint-plugin-react": "^7.30.0",
|
|
84
|
-
"eslint-plugin-react-hooks": "^4.
|
|
85
|
-
"jest": "^28.1.
|
|
86
|
-
"jest-environment-jsdom": "^28.1.
|
|
84
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
85
|
+
"jest": "^28.1.1",
|
|
86
|
+
"jest-environment-jsdom": "^28.1.1",
|
|
87
87
|
"jest-expo": "^45.0.1",
|
|
88
88
|
"postcss": "^8.4.14",
|
|
89
89
|
"postcss-assets": "^6.0.0",
|
|
90
90
|
"postcss-modules": "^4.3.1",
|
|
91
|
-
"prettier": "^2.
|
|
91
|
+
"prettier": "^2.7.0",
|
|
92
92
|
"react": "^17.0.2",
|
|
93
93
|
"react-dom": "^17.0.2",
|
|
94
|
-
"react-router-dom": "^5.3.
|
|
95
|
-
"rollup": "^2.75.
|
|
94
|
+
"react-router-dom": "^5.3.3",
|
|
95
|
+
"rollup": "^2.75.6",
|
|
96
96
|
"rollup-plugin-delete": "^2.0.0",
|
|
97
97
|
"rollup-plugin-postcss": "^4.0.2",
|
|
98
98
|
"rollup-plugin-typescript-paths": "^1.3.1",
|
|
99
|
-
"rollup-plugin-typescript2": "^0.
|
|
99
|
+
"rollup-plugin-typescript2": "^0.32.1",
|
|
100
100
|
"styled-components": "^5.3.5",
|
|
101
|
-
"ts-jest": "^28.0.
|
|
101
|
+
"ts-jest": "^28.0.5",
|
|
102
102
|
"tslib": "^2.4.0",
|
|
103
|
-
"typescript": "
|
|
103
|
+
"typescript": "4.7.3"
|
|
104
104
|
},
|
|
105
105
|
"compilerOptions": {
|
|
106
106
|
"declaration": true
|
|
@@ -113,6 +113,6 @@
|
|
|
113
113
|
"npm": ">=7.0.0"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@microsoft/signalr": "^6.0.
|
|
116
|
+
"@microsoft/signalr": "^6.0.6"
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var React = require('react');
|
|
8
|
-
|
|
9
|
-
var layouts$1 = require('../containers/layouts.js');
|
|
10
|
-
|
|
11
|
-
var layouts = {
|
|
12
|
-
main: layouts$1.MainLayout,
|
|
13
|
-
app: layouts$1.MainLayout,
|
|
14
|
-
camera: layouts$1.CameraLayout,
|
|
15
|
-
nativePdf: layouts$1.PdfViewerNative,
|
|
16
|
-
colorLayout: layouts$1.ColorLayout
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function useLayout() {
|
|
20
|
-
var getLayout = React.useCallback(function (layoutKey) {
|
|
21
|
-
var Layout = layoutKey && layouts["".concat(layoutKey)];
|
|
22
|
-
|
|
23
|
-
if (Layout) {
|
|
24
|
-
return Layout;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return layouts$1.DefaultLayout;
|
|
28
|
-
}, []);
|
|
29
|
-
return getLayout;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.useLayout = useLayout;
|