ehscan-react-table 0.0.23 → 0.0.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.
- package/dist/elements/Table.js +4 -19
- package/package.json +1 -1
package/dist/elements/Table.js
CHANGED
|
@@ -30,7 +30,11 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
30
30
|
}, [searchTermArraySetter]);
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
const calculateHeight = () => {
|
|
33
|
+
if (colRefs.current) {
|
|
34
|
+
console.log(colRefs.current);
|
|
35
|
+
}
|
|
33
36
|
if (headerRef.current) {
|
|
37
|
+
console.log(headerRef.current);
|
|
34
38
|
const { bottom } = headerRef.current.getBoundingClientRect();
|
|
35
39
|
setWrapperBottom(bottom - 20);
|
|
36
40
|
}
|
|
@@ -105,25 +109,6 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
105
109
|
? _jsx(HeadSearchBar, { content: colTitle, tag: tag })
|
|
106
110
|
: _jsx("div", { onClick: () => setOpenCol(tag), children: colTitle }) })] }) }));
|
|
107
111
|
};
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
const timeout = setTimeout(() => {
|
|
110
|
-
const observer = new ResizeObserver((entries) => {
|
|
111
|
-
entries.forEach((entry) => {
|
|
112
|
-
const tag = Object.keys(colRefs.current).find(k => colRefs.current[k] === entry.target);
|
|
113
|
-
if (tag) {
|
|
114
|
-
const width = entry.contentRect.width;
|
|
115
|
-
console.log(`Column "${tag}" resized to:`, width);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
Object.values(colRefs.current).forEach((el) => {
|
|
120
|
-
if (el)
|
|
121
|
-
observer.observe(el);
|
|
122
|
-
});
|
|
123
|
-
return () => observer.disconnect();
|
|
124
|
-
}, 50); // 50ms is usually enough
|
|
125
|
-
return () => clearTimeout(timeout);
|
|
126
|
-
}, []);
|
|
127
112
|
const HeadCols = () => {
|
|
128
113
|
return (_jsxs(_Fragment, { children: [columns.map((col, i) => {
|
|
129
114
|
const { tag, type, width } = col;
|