ehscan-react-table 0.0.22 → 0.0.23

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.
@@ -32,8 +32,7 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
32
32
  const calculateHeight = () => {
33
33
  if (headerRef.current) {
34
34
  const { bottom } = headerRef.current.getBoundingClientRect();
35
- console.log(bottom);
36
- setWrapperBottom(bottom + 20);
35
+ setWrapperBottom(bottom - 20);
37
36
  }
38
37
  };
39
38
  calculateHeight();
@@ -107,20 +106,23 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
107
106
  : _jsx("div", { onClick: () => setOpenCol(tag), children: colTitle }) })] }) }));
108
107
  };
109
108
  useEffect(() => {
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
- }
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
+ });
117
118
  });
118
- });
119
- Object.values(colRefs.current).forEach((el) => {
120
- if (el)
121
- observer.observe(el);
122
- });
123
- return () => observer.disconnect();
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);
124
126
  }, []);
125
127
  const HeadCols = () => {
126
128
  return (_jsxs(_Fragment, { children: [columns.map((col, i) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-table",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",