ehscan-react-table 0.0.21 → 0.0.22
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/elements/Table.js +7 -12
- package/package.json +1 -1
package/dist/elements/Table.js
CHANGED
|
@@ -33,16 +33,13 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
33
33
|
if (headerRef.current) {
|
|
34
34
|
const { bottom } = headerRef.current.getBoundingClientRect();
|
|
35
35
|
console.log(bottom);
|
|
36
|
-
setWrapperBottom(bottom);
|
|
36
|
+
setWrapperBottom(bottom + 20);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
calculateHeight();
|
|
40
40
|
window.addEventListener("resize", calculateHeight);
|
|
41
41
|
return () => window.removeEventListener("resize", calculateHeight);
|
|
42
42
|
}, []);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
console.log(wrapperBottom);
|
|
45
|
-
}, [wrapperBottom]);
|
|
46
43
|
const checkHead = (entry) => {
|
|
47
44
|
if (entry === undefined)
|
|
48
45
|
return;
|
|
@@ -110,21 +107,19 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
110
107
|
: _jsx("div", { onClick: () => setOpenCol(tag), children: colTitle }) })] }) }));
|
|
111
108
|
};
|
|
112
109
|
useEffect(() => {
|
|
113
|
-
const entries = Object.entries(colRefs.current)
|
|
114
|
-
.filter(([, el]) => el !== null);
|
|
115
|
-
if (entries.length === 0)
|
|
116
|
-
return;
|
|
117
110
|
const observer = new ResizeObserver((entries) => {
|
|
118
111
|
entries.forEach((entry) => {
|
|
119
|
-
const tag = Object.keys(colRefs.current)
|
|
120
|
-
.find(k => colRefs.current[k] === entry.target);
|
|
112
|
+
const tag = Object.keys(colRefs.current).find(k => colRefs.current[k] === entry.target);
|
|
121
113
|
if (tag) {
|
|
122
114
|
const width = entry.contentRect.width;
|
|
123
|
-
console.log(`Column "${tag}" resized to
|
|
115
|
+
console.log(`Column "${tag}" resized to:`, width);
|
|
124
116
|
}
|
|
125
117
|
});
|
|
126
118
|
});
|
|
127
|
-
|
|
119
|
+
Object.values(colRefs.current).forEach((el) => {
|
|
120
|
+
if (el)
|
|
121
|
+
observer.observe(el);
|
|
122
|
+
});
|
|
128
123
|
return () => observer.disconnect();
|
|
129
124
|
}, []);
|
|
130
125
|
const HeadCols = () => {
|