@truedat/core 4.40.4 → 4.40.8
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/package.json +3 -3
- package/src/hooks/index.js +1 -0
- package/src/hooks/useIsOverflow.js +16 -0
- package/src/hooks/useOnScreen.js +26 -0
- package/src/hooks/useWindowSize.js +23 -0
- package/src/routes.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.8",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@babel/plugin-transform-modules-commonjs": "^7.15.0",
|
|
33
33
|
"@babel/preset-env": "^7.15.0",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
|
-
"@truedat/test": "4.40.
|
|
35
|
+
"@truedat/test": "4.40.8",
|
|
36
36
|
"babel-jest": "^27.0.6",
|
|
37
37
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
38
38
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"react-dom": ">= 16.8.6 < 17",
|
|
107
107
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "b3570c4151f142384ee7201d05f72ed274f2eeb9"
|
|
110
110
|
}
|
package/src/hooks/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { useWindowSize } from "./useWindowSize";
|
|
3
|
+
|
|
4
|
+
export const useIsOverflow = (ref) => {
|
|
5
|
+
const [isOverflow, setIsOverflow] = useState(undefined);
|
|
6
|
+
const size = useWindowSize();
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const { current } = ref;
|
|
10
|
+
if (current) {
|
|
11
|
+
setIsOverflow(current.scrollWidth > current.clientWidth);
|
|
12
|
+
}
|
|
13
|
+
}, [ref, size]);
|
|
14
|
+
|
|
15
|
+
return isOverflow;
|
|
16
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export const useOnScreen = (ref, rootMargin = "0px") => {
|
|
4
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const observer = new IntersectionObserver(
|
|
8
|
+
([entry]) => {
|
|
9
|
+
setIsVisible(entry.isIntersecting);
|
|
10
|
+
},
|
|
11
|
+
{ rootMargin }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const currentElement = ref?.current;
|
|
15
|
+
|
|
16
|
+
if (currentElement) {
|
|
17
|
+
observer.observe(currentElement);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return () => observer.unobserve(currentElement);
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return isVisible;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default useOnScreen;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
|
|
4
|
+
export const useWindowSize = (delay = 600) => {
|
|
5
|
+
const [size, setSize] = useState();
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const handleResize = () => {
|
|
9
|
+
setSize({
|
|
10
|
+
width: window.innerWidth,
|
|
11
|
+
height: window.innerHeight,
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const debouncedHandleResize = _.debounce(delay)(handleResize);
|
|
16
|
+
window.addEventListener("resize", debouncedHandleResize);
|
|
17
|
+
return () => {
|
|
18
|
+
window.removeEventListener("resize", debouncedHandleResize);
|
|
19
|
+
};
|
|
20
|
+
}, [delay]);
|
|
21
|
+
|
|
22
|
+
return size;
|
|
23
|
+
};
|
package/src/routes.js
CHANGED
|
@@ -86,15 +86,20 @@ export const PROFILE_EXECUTION =
|
|
|
86
86
|
"/profileGroups/:group_id/profileExecutions/:id";
|
|
87
87
|
export const PROFILE_GROUP = "/profileGroups/:id";
|
|
88
88
|
export const QUALITY_DASHBOARD = "/quality_dashboard";
|
|
89
|
+
export const REMEDIATION_PLAN = "/rule_results/:rule_result_id/remediation";
|
|
90
|
+
export const REMEDIATION_EDIT =
|
|
91
|
+
"/rules/:id/implementations/:implementation_id/ruleResults/:rule_result_id/remediation/edit";
|
|
92
|
+
export const REMEDIATION_NEW =
|
|
93
|
+
"/rules/:id/implementations/:implementation_id/ruleResults/:rule_result_id/remediation/new";
|
|
89
94
|
export const ROLE = "/roles/:id";
|
|
90
95
|
export const ROLES = "/roles";
|
|
91
96
|
export const ROLES_NEW = "/roles/new";
|
|
92
|
-
export const RULE = "/rules/:id";
|
|
97
|
+
export const RULE = "/rules/:id(\\d+)";
|
|
93
98
|
export const RULES = "/rules";
|
|
94
99
|
export const RULE_EDIT = "/rules/:id/edit";
|
|
95
100
|
export const RULE_EVENTS = "/rules/:id/events";
|
|
96
101
|
export const RULE_IMPLEMENTATION =
|
|
97
|
-
"/rules/:id/implementations/:implementation_id";
|
|
102
|
+
"/rules/:id/implementations/:implementation_id(\\d+)";
|
|
98
103
|
export const RULE_IMPLEMENTATIONS = "/rules/:id/implementations";
|
|
99
104
|
export const RULE_IMPLEMENTATION_EVENTS =
|
|
100
105
|
"/rules/:id/implementations/:implementation_id/events";
|
|
@@ -238,6 +243,9 @@ const routes = {
|
|
|
238
243
|
PROFILE_EXECUTION,
|
|
239
244
|
PROFILE_GROUP,
|
|
240
245
|
QUALITY_DASHBOARD,
|
|
246
|
+
REMEDIATION_PLAN,
|
|
247
|
+
REMEDIATION_EDIT,
|
|
248
|
+
REMEDIATION_NEW,
|
|
241
249
|
ROLE,
|
|
242
250
|
ROLES_NEW,
|
|
243
251
|
ROLES,
|