@doyourjob/gravity-ui-page-constructor 5.31.22 → 5.31.24
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.
|
@@ -30,14 +30,12 @@ const HighlightTableBlock = (props) => {
|
|
|
30
30
|
return () => { };
|
|
31
31
|
const updateSizes = (0, debounce_1.default)(() => {
|
|
32
32
|
const width = Math.max(672, blockElem.clientWidth);
|
|
33
|
-
const tableWidth = (1 / (12 / maxColumns)) * width;
|
|
34
|
-
tableContentElem.style.setProperty('width', `${tableWidth}px`);
|
|
35
33
|
tableContentElem.style.setProperty('--block-width', `${width}px`);
|
|
36
34
|
});
|
|
37
35
|
updateSizes();
|
|
38
|
-
|
|
36
|
+
window.addEventListener('resize', updateSizes, { passive: true });
|
|
39
37
|
return () => {
|
|
40
|
-
|
|
38
|
+
window.removeEventListener('resize', updateSizes);
|
|
41
39
|
};
|
|
42
40
|
}, [maxColumns]);
|
|
43
41
|
(0, react_1.useEffect)(() => {
|
|
@@ -46,16 +44,18 @@ const HighlightTableBlock = (props) => {
|
|
|
46
44
|
const scrollThumb = scrollThumbRef.current;
|
|
47
45
|
if (!tableElem || !scrollBar || !scrollThumb)
|
|
48
46
|
return () => { };
|
|
49
|
-
const updateProgress = () => {
|
|
47
|
+
const updateProgress = (0, debounce_1.default)(() => {
|
|
50
48
|
const scrollWidth = Math.round(scrollBar.clientWidth * (tableElem.clientWidth / tableElem.scrollWidth));
|
|
51
49
|
const scrollLeft = Math.round(scrollBar.clientWidth * (tableElem.scrollLeft / tableElem.scrollWidth));
|
|
52
50
|
scrollThumb.style.setProperty('transform', `translateX(${scrollLeft}px)`);
|
|
53
51
|
scrollThumb.style.setProperty('width', `${scrollWidth}px`);
|
|
54
|
-
};
|
|
52
|
+
});
|
|
55
53
|
setTimeout(updateProgress, 0);
|
|
56
54
|
tableElem.addEventListener('scroll', updateProgress);
|
|
55
|
+
window.addEventListener('resize', updateProgress, { passive: true });
|
|
57
56
|
return () => {
|
|
58
57
|
tableElem.removeEventListener('scroll', updateProgress);
|
|
58
|
+
window.removeEventListener('resize', updateProgress);
|
|
59
59
|
};
|
|
60
60
|
}, []);
|
|
61
61
|
const renderRow = (0, react_1.useCallback)((row, index) => {
|
|
@@ -27,14 +27,12 @@ export const HighlightTableBlock = (props) => {
|
|
|
27
27
|
return () => { };
|
|
28
28
|
const updateSizes = debounce(() => {
|
|
29
29
|
const width = Math.max(672, blockElem.clientWidth);
|
|
30
|
-
const tableWidth = (1 / (12 / maxColumns)) * width;
|
|
31
|
-
tableContentElem.style.setProperty('width', `${tableWidth}px`);
|
|
32
30
|
tableContentElem.style.setProperty('--block-width', `${width}px`);
|
|
33
31
|
});
|
|
34
32
|
updateSizes();
|
|
35
|
-
|
|
33
|
+
window.addEventListener('resize', updateSizes, { passive: true });
|
|
36
34
|
return () => {
|
|
37
|
-
|
|
35
|
+
window.removeEventListener('resize', updateSizes);
|
|
38
36
|
};
|
|
39
37
|
}, [maxColumns]);
|
|
40
38
|
useEffect(() => {
|
|
@@ -43,16 +41,18 @@ export const HighlightTableBlock = (props) => {
|
|
|
43
41
|
const scrollThumb = scrollThumbRef.current;
|
|
44
42
|
if (!tableElem || !scrollBar || !scrollThumb)
|
|
45
43
|
return () => { };
|
|
46
|
-
const updateProgress = () => {
|
|
44
|
+
const updateProgress = debounce(() => {
|
|
47
45
|
const scrollWidth = Math.round(scrollBar.clientWidth * (tableElem.clientWidth / tableElem.scrollWidth));
|
|
48
46
|
const scrollLeft = Math.round(scrollBar.clientWidth * (tableElem.scrollLeft / tableElem.scrollWidth));
|
|
49
47
|
scrollThumb.style.setProperty('transform', `translateX(${scrollLeft}px)`);
|
|
50
48
|
scrollThumb.style.setProperty('width', `${scrollWidth}px`);
|
|
51
|
-
};
|
|
49
|
+
});
|
|
52
50
|
setTimeout(updateProgress, 0);
|
|
53
51
|
tableElem.addEventListener('scroll', updateProgress);
|
|
52
|
+
window.addEventListener('resize', updateProgress, { passive: true });
|
|
54
53
|
return () => {
|
|
55
54
|
tableElem.removeEventListener('scroll', updateProgress);
|
|
55
|
+
window.removeEventListener('resize', updateProgress);
|
|
56
56
|
};
|
|
57
57
|
}, []);
|
|
58
58
|
const renderRow = useCallback((row, index) => {
|