ehscan-react-table 0.0.10 → 0.0.12

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.
@@ -3,6 +3,7 @@ type TableColumn = {
3
3
  title?: string;
4
4
  type?: string;
5
5
  search?: boolean;
6
+ width?: number;
6
7
  };
7
8
  type SortOrder = {
8
9
  tag: string;
@@ -39,6 +39,9 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
39
39
  window.addEventListener("resize", calculateHeight);
40
40
  return () => window.removeEventListener("resize", calculateHeight);
41
41
  }, []);
42
+ useEffect(() => {
43
+ console.log(wrapperBottom);
44
+ }, [wrapperBottom]);
42
45
  const checkHead = (entry) => {
43
46
  if (entry === undefined)
44
47
  return;
@@ -102,9 +105,10 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
102
105
  };
103
106
  const HeadCols = () => {
104
107
  return (_jsxs(_Fragment, { children: [columns.map((col, i) => {
105
- const { tag, type } = col;
108
+ const { tag, type, width } = col;
109
+ const thWidth = width !== undefined ? `${width}px` : "32px";
106
110
  if (type === "checkbox") {
107
- return (_jsx("th", { className: styles.thcheckhead, style: { "--custom-width": `32px` }, children: _jsx(TableCellSelectHeadCol, { checkHead: checkHead, checkAll: checkAll }) }, `checkbox-${tag !== null && tag !== void 0 ? tag : i}`));
111
+ return (_jsx("th", { className: styles.thcheckhead, style: { "--custom-width": thWidth }, children: _jsx(TableCellSelectHeadCol, { checkHead: checkHead, checkAll: checkAll }) }, `checkbox-${tag !== null && tag !== void 0 ? tag : i}`));
108
112
  }
109
113
  return _jsx(HeadColMain, { col: col }, tag !== null && tag !== void 0 ? tag : i);
110
114
  }), _jsx(EndHeadCol, {})] }));
@@ -126,5 +130,5 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
126
130
  return (_jsx("td", { children: _jsx("div", { className: styles.exttablediv, children: _jsx(CellComponent, { row: row, col: col.tag }) }) }, ci));
127
131
  }), _jsx(EndCol, {})] }, `row-${rowIndex}`))) }, 'ext-tbody'));
128
132
  };
129
- return (_jsx(_Fragment, { children: _jsxs("div", { className: `${styles.tablewrapper} ${styles['_tbl']}`, style: { height: `calc(100vh - ${wrapperBottom}px)` }, children: [_jsxs("table", { className: styles.exttable, children: [_jsx("thead", { children: _jsx("tr", { className: styles.trstickyhead, children: _jsx(HeadCols, {}) }) }), rows && rows.length > 0 && _jsx(TableBody, {})] }), rows && rows.length === 0 && fallback()] }) }));
133
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: `${styles.tablewrapper} ${styles['_tbl']}`, style: { height: `calc(100vh - ${wrapperBottom}px)` }, children: [_jsxs("table", { className: styles.exttable, children: [_jsx("thead", { ref: headerRef, children: _jsx("tr", { className: styles.trstickyhead, children: _jsx(HeadCols, {}) }) }), rows && rows.length > 0 && _jsx(TableBody, {})] }), rows && rows.length === 0 && fallback()] }) }));
130
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-table",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",