carbon-react 104.58.4 → 104.58.7
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/esm/components/pager/pager.component.js +1 -2
- package/esm/components/textarea/textarea.component.js +7 -3
- package/esm/components/textarea/textarea.style.d.ts +1 -0
- package/esm/components/textarea/textarea.style.js +2 -1
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
- package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
- package/esm/hooks/__internal__/useScrollBlock/useScrollBlock.js +30 -5
- package/lib/components/pager/pager.component.js +1 -2
- package/lib/components/textarea/textarea.component.js +7 -3
- package/lib/components/textarea/textarea.style.d.ts +1 -0
- package/lib/components/textarea/textarea.style.js +4 -2
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
- package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
- package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.js +29 -4
- package/package.json +1 -1
|
@@ -110,8 +110,7 @@ const Pager = ({
|
|
|
110
110
|
onChange: ev => setValue(ev.target.value),
|
|
111
111
|
onBlur: () => setValue(currentPageSize),
|
|
112
112
|
onKeyDown: handleKeyDown,
|
|
113
|
-
"data-element": "page-select"
|
|
114
|
-
id: "page-select"
|
|
113
|
+
"data-element": "page-select"
|
|
115
114
|
}, pageSizeSelectionOptions.map(sizeOption => /*#__PURE__*/React.createElement(Option, {
|
|
116
115
|
key: sizeOption.id,
|
|
117
116
|
text: sizeOption.id,
|
|
@@ -11,7 +11,7 @@ import { InputBehaviour } from "../../__internal__/input-behaviour";
|
|
|
11
11
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
12
12
|
import InputIconToggle from "../../__internal__/input-icon-toggle";
|
|
13
13
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
14
|
-
import StyledTextarea from "./textarea.style";
|
|
14
|
+
import StyledTextarea, { MIN_HEIGHT } from "./textarea.style";
|
|
15
15
|
import LocaleContext from "../../__internal__/i18n-context";
|
|
16
16
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
17
17
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
@@ -72,13 +72,12 @@ const Textarea = ({
|
|
|
72
72
|
current: id
|
|
73
73
|
} = useRef(idProp || guid());
|
|
74
74
|
const inputRef = useRef();
|
|
75
|
-
const minHeight = useRef(
|
|
75
|
+
const minHeight = useRef(MIN_HEIGHT);
|
|
76
76
|
|
|
77
77
|
const expandTextarea = () => {
|
|
78
78
|
const textarea = inputRef.current;
|
|
79
79
|
|
|
80
80
|
if (textarea.scrollHeight > minHeight.current) {
|
|
81
|
-
// Reset height to zero - IE specific
|
|
82
81
|
textarea.style.height = "0px"; // Set the height so all content is shown
|
|
83
82
|
|
|
84
83
|
textarea.style.height = `${Math.max(textarea.scrollHeight, minHeight.current)}px`;
|
|
@@ -99,6 +98,11 @@ const Textarea = ({
|
|
|
99
98
|
label,
|
|
100
99
|
fieldHelp
|
|
101
100
|
});
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (rows) {
|
|
103
|
+
minHeight.current = inputRef.current.scrollHeight;
|
|
104
|
+
}
|
|
105
|
+
}, [rows]);
|
|
102
106
|
useEffect(() => {
|
|
103
107
|
if (expandable) {
|
|
104
108
|
expandTextarea();
|
|
@@ -4,12 +4,13 @@ import StyledInput from "../../__internal__/input/input.style";
|
|
|
4
4
|
import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
5
5
|
import InputIconToggleStyle from "../../__internal__/input-icon-toggle/input-icon-toggle.style";
|
|
6
6
|
import BaseTheme from "../../style/themes/base";
|
|
7
|
+
export const MIN_HEIGHT = 40;
|
|
7
8
|
const StyledTextarea = styled.div`
|
|
8
9
|
${margin};
|
|
9
10
|
|
|
10
11
|
${StyledInput} {
|
|
11
12
|
resize: none;
|
|
12
|
-
min-height:
|
|
13
|
+
min-height: ${MIN_HEIGHT}px;
|
|
13
14
|
margin-top: 5px;
|
|
14
15
|
margin-bottom: 5px;
|
|
15
16
|
}
|
|
@@ -5,6 +5,8 @@ declare class ScrollBlockManager {
|
|
|
5
5
|
registerComponent(id: any): void;
|
|
6
6
|
unregisterComponent(id: any): void;
|
|
7
7
|
saveOriginalValues(values: any): void;
|
|
8
|
+
saveRestoreValuesCallback(callback: any): void;
|
|
9
|
+
getRestoreValuesCallback(): any;
|
|
8
10
|
getOriginalValues(): any;
|
|
9
11
|
isBlocked(): boolean;
|
|
10
12
|
}
|
|
@@ -4,6 +4,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
4
4
|
|
|
5
5
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6
6
|
|
|
7
|
+
// TODO: This component can be refactored to remove redundant code after
|
|
8
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
7
9
|
let ScrollBlockManager = /*#__PURE__*/function () {
|
|
8
10
|
function ScrollBlockManager() {
|
|
9
11
|
_classCallCheck(this, ScrollBlockManager);
|
|
@@ -13,11 +15,13 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
13
15
|
if (!window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
|
|
14
16
|
window.__CARBON_INTERNALS_SCROLL_BLOCKERS = {
|
|
15
17
|
components: {},
|
|
18
|
+
// originalValues can be removed
|
|
16
19
|
originalValues: []
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components;
|
|
23
|
+
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components; // TODO: originalValues can be removed
|
|
24
|
+
|
|
21
25
|
this.originalValues = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues;
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -30,13 +34,25 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
30
34
|
key: "unregisterComponent",
|
|
31
35
|
value: function unregisterComponent(id) {
|
|
32
36
|
delete this.components[id];
|
|
33
|
-
}
|
|
37
|
+
} // TODO: saveOriginalValues can be removed
|
|
38
|
+
|
|
34
39
|
}, {
|
|
35
40
|
key: "saveOriginalValues",
|
|
36
41
|
value: function saveOriginalValues(values) {
|
|
37
42
|
this.originalValues.length = 0;
|
|
38
43
|
this.originalValues.push(...values);
|
|
39
44
|
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "saveRestoreValuesCallback",
|
|
47
|
+
value: function saveRestoreValuesCallback(callback) {
|
|
48
|
+
window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "getRestoreValuesCallback",
|
|
52
|
+
value: function getRestoreValuesCallback() {
|
|
53
|
+
return window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues;
|
|
54
|
+
} // TODO: getOriginalValues can be removed
|
|
55
|
+
|
|
40
56
|
}, {
|
|
41
57
|
key: "getOriginalValues",
|
|
42
58
|
value: function getOriginalValues() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useRef, useCallback, useMemo } from "react";
|
|
2
2
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
3
|
-
import ScrollBlockManager from "./scroll-block-manager";
|
|
3
|
+
import ScrollBlockManager from "./scroll-block-manager"; // TODO: This component can be refactored to remove redundant code after
|
|
4
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
5
|
+
|
|
4
6
|
const scrollBlockManager = new ScrollBlockManager();
|
|
5
7
|
/* istanbul ignore next */
|
|
6
8
|
|
|
@@ -10,6 +12,7 @@ const useScrollBlock = () => {
|
|
|
10
12
|
const {
|
|
11
13
|
current: containerGuid
|
|
12
14
|
} = useRef(guid());
|
|
15
|
+
const originalValuesRef = useRef();
|
|
13
16
|
const rules = useMemo(() => {
|
|
14
17
|
const {
|
|
15
18
|
documentElement,
|
|
@@ -17,7 +20,8 @@ const useScrollBlock = () => {
|
|
|
17
20
|
} = safeDocument;
|
|
18
21
|
const scrollBarWidth = window.innerWidth - documentElement.clientWidth;
|
|
19
22
|
const bodyPaddingRight = parseInt(window.getComputedStyle(body).getPropertyValue("padding-right")) || 0;
|
|
20
|
-
return [
|
|
23
|
+
return [// TODO: First two entries of this array with the documentElement can be removed
|
|
24
|
+
{
|
|
21
25
|
element: documentElement,
|
|
22
26
|
property: "position",
|
|
23
27
|
blockingValue: "relative"
|
|
@@ -39,6 +43,14 @@ const useScrollBlock = () => {
|
|
|
39
43
|
blockingValue: `${bodyPaddingRight + scrollBarWidth}px`
|
|
40
44
|
}];
|
|
41
45
|
}, []);
|
|
46
|
+
const restoreValues = useCallback(() => {
|
|
47
|
+
rules.forEach(({
|
|
48
|
+
element,
|
|
49
|
+
property
|
|
50
|
+
}, index) => {
|
|
51
|
+
element.style[property] = originalValuesRef.current[index];
|
|
52
|
+
});
|
|
53
|
+
}, [rules]);
|
|
42
54
|
const blockScroll = useCallback(() => {
|
|
43
55
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
44
56
|
scrollBlockManager.registerComponent(containerGuid);
|
|
@@ -51,19 +63,32 @@ const useScrollBlock = () => {
|
|
|
51
63
|
element,
|
|
52
64
|
property
|
|
53
65
|
}) => element.style[property]);
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
originalValuesRef.current = originalValues;
|
|
67
|
+
scrollBlockManager.saveRestoreValuesCallback(restoreValues); // TODO: saveOriginalValues can be removed
|
|
68
|
+
|
|
69
|
+
scrollBlockManager.saveOriginalValues(originalValues); // TODO: slice san be removed
|
|
70
|
+
|
|
71
|
+
rules.slice(-3).forEach(({
|
|
56
72
|
element,
|
|
57
73
|
property,
|
|
58
74
|
blockingValue
|
|
59
75
|
}) => {
|
|
60
76
|
element.style[property] = blockingValue;
|
|
61
77
|
});
|
|
62
|
-
}, [containerGuid, rules]);
|
|
78
|
+
}, [restoreValues, containerGuid, rules]);
|
|
63
79
|
const allowScroll = useCallback(() => {
|
|
64
80
|
scrollBlockManager.unregisterComponent(containerGuid);
|
|
65
81
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
66
82
|
if (isBlocked) return;
|
|
83
|
+
const restoreValuesCallback = scrollBlockManager.getRestoreValuesCallback();
|
|
84
|
+
|
|
85
|
+
if (restoreValuesCallback) {
|
|
86
|
+
restoreValuesCallback();
|
|
87
|
+
scrollBlockManager.saveRestoreValuesCallback(null);
|
|
88
|
+
return;
|
|
89
|
+
} // TODO: all of the code below can be removed from this block
|
|
90
|
+
|
|
91
|
+
|
|
67
92
|
const originalValues = scrollBlockManager.getOriginalValues();
|
|
68
93
|
rules.forEach(({
|
|
69
94
|
element,
|
|
@@ -130,8 +130,7 @@ const Pager = ({
|
|
|
130
130
|
onChange: ev => setValue(ev.target.value),
|
|
131
131
|
onBlur: () => setValue(currentPageSize),
|
|
132
132
|
onKeyDown: handleKeyDown,
|
|
133
|
-
"data-element": "page-select"
|
|
134
|
-
id: "page-select"
|
|
133
|
+
"data-element": "page-select"
|
|
135
134
|
}, pageSizeSelectionOptions.map(sizeOption => /*#__PURE__*/_react.default.createElement(_option.default, {
|
|
136
135
|
key: sizeOption.id,
|
|
137
136
|
text: sizeOption.id,
|
|
@@ -27,7 +27,7 @@ var _inputIconToggle = _interopRequireDefault(require("../../__internal__/input-
|
|
|
27
27
|
|
|
28
28
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
29
29
|
|
|
30
|
-
var _textarea =
|
|
30
|
+
var _textarea = _interopRequireWildcard(require("./textarea.style"));
|
|
31
31
|
|
|
32
32
|
var _i18nContext = _interopRequireDefault(require("../../__internal__/i18n-context"));
|
|
33
33
|
|
|
@@ -102,13 +102,12 @@ const Textarea = ({
|
|
|
102
102
|
current: id
|
|
103
103
|
} = (0, _react.useRef)(idProp || (0, _guid.default)());
|
|
104
104
|
const inputRef = (0, _react.useRef)();
|
|
105
|
-
const minHeight = (0, _react.useRef)(
|
|
105
|
+
const minHeight = (0, _react.useRef)(_textarea.MIN_HEIGHT);
|
|
106
106
|
|
|
107
107
|
const expandTextarea = () => {
|
|
108
108
|
const textarea = inputRef.current;
|
|
109
109
|
|
|
110
110
|
if (textarea.scrollHeight > minHeight.current) {
|
|
111
|
-
// Reset height to zero - IE specific
|
|
112
111
|
textarea.style.height = "0px"; // Set the height so all content is shown
|
|
113
112
|
|
|
114
113
|
textarea.style.height = `${Math.max(textarea.scrollHeight, minHeight.current)}px`;
|
|
@@ -129,6 +128,11 @@ const Textarea = ({
|
|
|
129
128
|
label,
|
|
130
129
|
fieldHelp
|
|
131
130
|
});
|
|
131
|
+
(0, _react.useEffect)(() => {
|
|
132
|
+
if (rows) {
|
|
133
|
+
minHeight.current = inputRef.current.scrollHeight;
|
|
134
|
+
}
|
|
135
|
+
}, [rows]);
|
|
132
136
|
(0, _react.useEffect)(() => {
|
|
133
137
|
if (expandable) {
|
|
134
138
|
expandTextarea();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.MIN_HEIGHT = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
@@ -23,12 +23,14 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
+
const MIN_HEIGHT = 40;
|
|
27
|
+
exports.MIN_HEIGHT = MIN_HEIGHT;
|
|
26
28
|
const StyledTextarea = _styledComponents.default.div`
|
|
27
29
|
${_styledSystem.margin};
|
|
28
30
|
|
|
29
31
|
${_input.default} {
|
|
30
32
|
resize: none;
|
|
31
|
-
min-height:
|
|
33
|
+
min-height: ${MIN_HEIGHT}px;
|
|
32
34
|
margin-top: 5px;
|
|
33
35
|
margin-bottom: 5px;
|
|
34
36
|
}
|
|
@@ -5,6 +5,8 @@ declare class ScrollBlockManager {
|
|
|
5
5
|
registerComponent(id: any): void;
|
|
6
6
|
unregisterComponent(id: any): void;
|
|
7
7
|
saveOriginalValues(values: any): void;
|
|
8
|
+
saveRestoreValuesCallback(callback: any): void;
|
|
9
|
+
getRestoreValuesCallback(): any;
|
|
8
10
|
getOriginalValues(): any;
|
|
9
11
|
isBlocked(): boolean;
|
|
10
12
|
}
|
|
@@ -11,6 +11,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
11
11
|
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
13
13
|
|
|
14
|
+
// TODO: This component can be refactored to remove redundant code after
|
|
15
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
14
16
|
let ScrollBlockManager = /*#__PURE__*/function () {
|
|
15
17
|
function ScrollBlockManager() {
|
|
16
18
|
_classCallCheck(this, ScrollBlockManager);
|
|
@@ -20,11 +22,13 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
20
22
|
if (!window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
|
|
21
23
|
window.__CARBON_INTERNALS_SCROLL_BLOCKERS = {
|
|
22
24
|
components: {},
|
|
25
|
+
// originalValues can be removed
|
|
23
26
|
originalValues: []
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components;
|
|
30
|
+
this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components; // TODO: originalValues can be removed
|
|
31
|
+
|
|
28
32
|
this.originalValues = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues;
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -37,13 +41,25 @@ let ScrollBlockManager = /*#__PURE__*/function () {
|
|
|
37
41
|
key: "unregisterComponent",
|
|
38
42
|
value: function unregisterComponent(id) {
|
|
39
43
|
delete this.components[id];
|
|
40
|
-
}
|
|
44
|
+
} // TODO: saveOriginalValues can be removed
|
|
45
|
+
|
|
41
46
|
}, {
|
|
42
47
|
key: "saveOriginalValues",
|
|
43
48
|
value: function saveOriginalValues(values) {
|
|
44
49
|
this.originalValues.length = 0;
|
|
45
50
|
this.originalValues.push(...values);
|
|
46
51
|
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "saveRestoreValuesCallback",
|
|
54
|
+
value: function saveRestoreValuesCallback(callback) {
|
|
55
|
+
window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "getRestoreValuesCallback",
|
|
59
|
+
value: function getRestoreValuesCallback() {
|
|
60
|
+
return window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues;
|
|
61
|
+
} // TODO: getOriginalValues can be removed
|
|
62
|
+
|
|
47
63
|
}, {
|
|
48
64
|
key: "getOriginalValues",
|
|
49
65
|
value: function getOriginalValues() {
|
|
@@ -13,6 +13,8 @@ var _scrollBlockManager = _interopRequireDefault(require("./scroll-block-manager
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
+
// TODO: This component can be refactored to remove redundant code after
|
|
17
|
+
// we can confirm that all Sage products use version 105.0.0^
|
|
16
18
|
const scrollBlockManager = new _scrollBlockManager.default();
|
|
17
19
|
/* istanbul ignore next */
|
|
18
20
|
|
|
@@ -22,6 +24,7 @@ const useScrollBlock = () => {
|
|
|
22
24
|
const {
|
|
23
25
|
current: containerGuid
|
|
24
26
|
} = (0, _react.useRef)((0, _guid.default)());
|
|
27
|
+
const originalValuesRef = (0, _react.useRef)();
|
|
25
28
|
const rules = (0, _react.useMemo)(() => {
|
|
26
29
|
const {
|
|
27
30
|
documentElement,
|
|
@@ -29,7 +32,8 @@ const useScrollBlock = () => {
|
|
|
29
32
|
} = safeDocument;
|
|
30
33
|
const scrollBarWidth = window.innerWidth - documentElement.clientWidth;
|
|
31
34
|
const bodyPaddingRight = parseInt(window.getComputedStyle(body).getPropertyValue("padding-right")) || 0;
|
|
32
|
-
return [
|
|
35
|
+
return [// TODO: First two entries of this array with the documentElement can be removed
|
|
36
|
+
{
|
|
33
37
|
element: documentElement,
|
|
34
38
|
property: "position",
|
|
35
39
|
blockingValue: "relative"
|
|
@@ -51,6 +55,14 @@ const useScrollBlock = () => {
|
|
|
51
55
|
blockingValue: `${bodyPaddingRight + scrollBarWidth}px`
|
|
52
56
|
}];
|
|
53
57
|
}, []);
|
|
58
|
+
const restoreValues = (0, _react.useCallback)(() => {
|
|
59
|
+
rules.forEach(({
|
|
60
|
+
element,
|
|
61
|
+
property
|
|
62
|
+
}, index) => {
|
|
63
|
+
element.style[property] = originalValuesRef.current[index];
|
|
64
|
+
});
|
|
65
|
+
}, [rules]);
|
|
54
66
|
const blockScroll = (0, _react.useCallback)(() => {
|
|
55
67
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
56
68
|
scrollBlockManager.registerComponent(containerGuid);
|
|
@@ -63,19 +75,32 @@ const useScrollBlock = () => {
|
|
|
63
75
|
element,
|
|
64
76
|
property
|
|
65
77
|
}) => element.style[property]);
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
originalValuesRef.current = originalValues;
|
|
79
|
+
scrollBlockManager.saveRestoreValuesCallback(restoreValues); // TODO: saveOriginalValues can be removed
|
|
80
|
+
|
|
81
|
+
scrollBlockManager.saveOriginalValues(originalValues); // TODO: slice san be removed
|
|
82
|
+
|
|
83
|
+
rules.slice(-3).forEach(({
|
|
68
84
|
element,
|
|
69
85
|
property,
|
|
70
86
|
blockingValue
|
|
71
87
|
}) => {
|
|
72
88
|
element.style[property] = blockingValue;
|
|
73
89
|
});
|
|
74
|
-
}, [containerGuid, rules]);
|
|
90
|
+
}, [restoreValues, containerGuid, rules]);
|
|
75
91
|
const allowScroll = (0, _react.useCallback)(() => {
|
|
76
92
|
scrollBlockManager.unregisterComponent(containerGuid);
|
|
77
93
|
const isBlocked = scrollBlockManager.isBlocked();
|
|
78
94
|
if (isBlocked) return;
|
|
95
|
+
const restoreValuesCallback = scrollBlockManager.getRestoreValuesCallback();
|
|
96
|
+
|
|
97
|
+
if (restoreValuesCallback) {
|
|
98
|
+
restoreValuesCallback();
|
|
99
|
+
scrollBlockManager.saveRestoreValuesCallback(null);
|
|
100
|
+
return;
|
|
101
|
+
} // TODO: all of the code below can be removed from this block
|
|
102
|
+
|
|
103
|
+
|
|
79
104
|
const originalValues = scrollBlockManager.getOriginalValues();
|
|
80
105
|
rules.forEach(({
|
|
81
106
|
element,
|