@reltio/components 1.4.1626 → 1.4.1627
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/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +3 -2
- package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +2 -3
- package/cjs/contexts/ScrollToElementContext/index.js +4 -6
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +3 -4
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts +3 -2
- package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js +2 -3
- package/esm/contexts/ScrollToElementContext/index.js +4 -6
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.js +5 -6
- package/package.json +3 -3
package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ContextType } from 'react';
|
|
2
|
+
import { ScrollToElementContext } from '../../../../../contexts';
|
|
3
|
+
export declare const useScrollToAttribute: (context?: ContextType<typeof ScrollToElementContext>) => {
|
|
3
4
|
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
4
5
|
highlightedClassName: string;
|
|
5
6
|
} | {
|
package/cjs/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js
CHANGED
|
@@ -6,12 +6,11 @@ var styles_1 = require("./styles");
|
|
|
6
6
|
var useScrollToAttribute = function (context) {
|
|
7
7
|
var styles = (0, styles_1.useStyles)();
|
|
8
8
|
var ref = (0, react_1.useRef)(null);
|
|
9
|
-
var scrollIntoRef = (context || {}).scrollIntoRef;
|
|
10
9
|
(0, react_1.useEffect)(function () {
|
|
11
10
|
if (context) {
|
|
12
|
-
scrollIntoRef(ref);
|
|
11
|
+
context.scrollIntoRef(ref);
|
|
13
12
|
}
|
|
14
|
-
}, [context
|
|
13
|
+
}, [context]);
|
|
15
14
|
return context ? { ref: ref, highlightedClassName: styles.highlighted } : { ref: ref };
|
|
16
15
|
};
|
|
17
16
|
exports.useScrollToAttribute = useScrollToAttribute;
|
|
@@ -47,13 +47,11 @@ var ScrollToElementProvider = function (_a) {
|
|
|
47
47
|
var _b = (0, react_1.useState)(null), element = _b[0], setElement = _b[1];
|
|
48
48
|
var highlightTimer = (0, react_1.useRef)(null);
|
|
49
49
|
var scrollIntoRef = (0, react_1.useCallback)(function (ref) {
|
|
50
|
+
if (!ref.current)
|
|
51
|
+
return;
|
|
50
52
|
ref.current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
highlightTimer.current = setTimeout(function () {
|
|
55
|
-
setElement(null);
|
|
56
|
-
}, 2000);
|
|
53
|
+
clearTimeout(highlightTimer.current);
|
|
54
|
+
highlightTimer.current = setTimeout(function () { return setElement(null); }, 2000);
|
|
57
55
|
}, []);
|
|
58
56
|
var handleHighlightError = (0, react_1.useCallback)(function (highlightedError) {
|
|
59
57
|
setElement({ value: highlightedError, type: ScrollType.Error });
|
|
@@ -14,8 +14,7 @@ var useScrollToAttributeError = function (_a) {
|
|
|
14
14
|
var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
|
|
15
15
|
var styles = (0, styles_1.useStyles)();
|
|
16
16
|
var ref = (0, react_1.useRef)(null);
|
|
17
|
-
var
|
|
18
|
-
var severity = (0, react_1.useMemo)(function () { return (0, ramda_1.propOr)(mdm_sdk_1.ErrorSeverity.ERROR, 'severity')(element); }, [element]);
|
|
17
|
+
var severity = (0, ramda_1.pathOr)(mdm_sdk_1.ErrorSeverity.ERROR, ['element', 'severity'])(context);
|
|
19
18
|
var errorClassName = (0, classnames_1.default)((_b = {},
|
|
20
19
|
_b[styles.highlightError] = severity === mdm_sdk_1.ErrorSeverity.ERROR,
|
|
21
20
|
_b[styles.highlightWarning] = severity === mdm_sdk_1.ErrorSeverity.WARNING,
|
|
@@ -23,9 +22,9 @@ var useScrollToAttributeError = function (_a) {
|
|
|
23
22
|
_b));
|
|
24
23
|
(0, react_1.useEffect)(function () {
|
|
25
24
|
if (context) {
|
|
26
|
-
scrollIntoRef(ref);
|
|
25
|
+
context.scrollIntoRef(ref);
|
|
27
26
|
}
|
|
28
|
-
}, [context
|
|
27
|
+
}, [context]);
|
|
29
28
|
return context ? { ref: ref, errorClassName: errorClassName } : { ref: ref };
|
|
30
29
|
};
|
|
31
30
|
exports.useScrollToAttributeError = useScrollToAttributeError;
|
package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ContextType } from 'react';
|
|
2
|
+
import { ScrollToElementContext } from '../../../../../contexts';
|
|
3
|
+
export declare const useScrollToAttribute: (context?: ContextType<typeof ScrollToElementContext>) => {
|
|
3
4
|
ref: import("react").MutableRefObject<HTMLDivElement>;
|
|
4
5
|
highlightedClassName: string;
|
|
5
6
|
} | {
|
package/esm/components/attributes/editMode/hooks/useScrollToAttribute/useScrollToAttribute.js
CHANGED
|
@@ -3,11 +3,10 @@ import { useStyles } from './styles';
|
|
|
3
3
|
export var useScrollToAttribute = function (context) {
|
|
4
4
|
var styles = useStyles();
|
|
5
5
|
var ref = useRef(null);
|
|
6
|
-
var scrollIntoRef = (context || {}).scrollIntoRef;
|
|
7
6
|
useEffect(function () {
|
|
8
7
|
if (context) {
|
|
9
|
-
scrollIntoRef(ref);
|
|
8
|
+
context.scrollIntoRef(ref);
|
|
10
9
|
}
|
|
11
|
-
}, [context
|
|
10
|
+
}, [context]);
|
|
12
11
|
return context ? { ref: ref, highlightedClassName: styles.highlighted } : { ref: ref };
|
|
13
12
|
};
|
|
@@ -19,13 +19,11 @@ export var ScrollToElementProvider = function (_a) {
|
|
|
19
19
|
var _b = useState(null), element = _b[0], setElement = _b[1];
|
|
20
20
|
var highlightTimer = useRef(null);
|
|
21
21
|
var scrollIntoRef = useCallback(function (ref) {
|
|
22
|
+
if (!ref.current)
|
|
23
|
+
return;
|
|
22
24
|
ref.current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
highlightTimer.current = setTimeout(function () {
|
|
27
|
-
setElement(null);
|
|
28
|
-
}, 2000);
|
|
25
|
+
clearTimeout(highlightTimer.current);
|
|
26
|
+
highlightTimer.current = setTimeout(function () { return setElement(null); }, 2000);
|
|
29
27
|
}, []);
|
|
30
28
|
var handleHighlightError = useCallback(function (highlightedError) {
|
|
31
29
|
setElement({ value: highlightedError, type: ScrollType.Error });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEffect,
|
|
2
|
-
import {
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { pathOr } from 'ramda';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { ErrorSeverity } from '@reltio/mdm-sdk';
|
|
5
5
|
import { useStyles } from './styles';
|
|
@@ -8,8 +8,7 @@ export var useScrollToAttributeError = function (_a) {
|
|
|
8
8
|
var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
|
|
9
9
|
var styles = useStyles();
|
|
10
10
|
var ref = useRef(null);
|
|
11
|
-
var
|
|
12
|
-
var severity = useMemo(function () { return propOr(ErrorSeverity.ERROR, 'severity')(element); }, [element]);
|
|
11
|
+
var severity = pathOr(ErrorSeverity.ERROR, ['element', 'severity'])(context);
|
|
13
12
|
var errorClassName = classnames((_b = {},
|
|
14
13
|
_b[styles.highlightError] = severity === ErrorSeverity.ERROR,
|
|
15
14
|
_b[styles.highlightWarning] = severity === ErrorSeverity.WARNING,
|
|
@@ -17,8 +16,8 @@ export var useScrollToAttributeError = function (_a) {
|
|
|
17
16
|
_b));
|
|
18
17
|
useEffect(function () {
|
|
19
18
|
if (context) {
|
|
20
|
-
scrollIntoRef(ref);
|
|
19
|
+
context.scrollIntoRef(ref);
|
|
21
20
|
}
|
|
22
|
-
}, [context
|
|
21
|
+
}, [context]);
|
|
23
22
|
return context ? { ref: ref, errorClassName: errorClassName } : { ref: ref };
|
|
24
23
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1627",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1627",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1627",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|