ehscan-react-table 0.0.24 → 0.0.26
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 +8 -4
- package/package.json +1 -1
package/dist/elements/Table.js
CHANGED
|
@@ -30,11 +30,11 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
30
30
|
}, [searchTermArraySetter]);
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
const calculateHeight = () => {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
var _a;
|
|
34
|
+
if ((_a = colRefs === null || colRefs === void 0 ? void 0 : colRefs.current) === null || _a === void 0 ? void 0 : _a['duedate']) {
|
|
35
|
+
console.log(colRefs.current['duedate'].getBoundingClientRect());
|
|
35
36
|
}
|
|
36
37
|
if (headerRef.current) {
|
|
37
|
-
console.log(headerRef.current);
|
|
38
38
|
const { bottom } = headerRef.current.getBoundingClientRect();
|
|
39
39
|
setWrapperBottom(bottom - 20);
|
|
40
40
|
}
|
|
@@ -100,6 +100,10 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
100
100
|
return (_jsx(_Fragment, { children: _jsxs("div", { className: "sort-col", onClick: () => setSortOrder({ tag, dir: sortOrder.dir === 'desc' ? 'asc' : 'desc' }), children: [sortOrder.tag === tag && _jsx(SortButton, {}), openCol === tag && sortOrder.tag !== tag && _jsx(EmptySort, {})] }) }));
|
|
101
101
|
};
|
|
102
102
|
const colRefs = useRef({});
|
|
103
|
+
const HeadColMainLit = {
|
|
104
|
+
def: (tag) => tag !== null && tag !== void 0 ? tag : "",
|
|
105
|
+
duedate: () => `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="black" viewBox="0 0 24 24"><path d="M19.778 3.5H4.222C2.995 3.5 2 4.543 2 5.77v14.008C2 21.005 2.995 22 4.222 22h15.556A2.222 2.222 0 0 0 22 19.778V5.77c0-1.227-.995-2.27-2.222-2.27ZM7 5V2m10 3V2m5 7H2m5.5 4h-1m1 3h-1m1 3h-1m11-6h-1m1 3h-1m1 3h-1m-4-6h-1m1 3h-1m1 3h-1"/></svg>`
|
|
106
|
+
};
|
|
103
107
|
const HeadColMain = ({ col }) => {
|
|
104
108
|
const { tag, search, title, width } = col;
|
|
105
109
|
const shouldMeasure = ['duedate'].includes(tag);
|
|
@@ -107,7 +111,7 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
107
111
|
const thWidth = width !== undefined ? `${width}px` : "30px";
|
|
108
112
|
return (_jsx("th", { ref: shouldMeasure ? (el) => { colRefs.current[tag] = el; } : undefined, style: { "--custom-width": thWidth }, children: _jsxs("div", { className: styles.headcolcell, children: [_jsx(HeadColSort, { tag: tag }), _jsx("div", { className: styles.headcolcellmain, children: search
|
|
109
113
|
? _jsx(HeadSearchBar, { content: colTitle, tag: tag })
|
|
110
|
-
: _jsx("div", { onClick: () => setOpenCol(tag), children: colTitle }) })] }) }));
|
|
114
|
+
: _jsx("div", { onClick: () => setOpenCol(tag), children: HeadColMainLit[colTitle] ? HeadColMainLit[colTitle](colTitle) : colTitle }) })] }) }));
|
|
111
115
|
};
|
|
112
116
|
const HeadCols = () => {
|
|
113
117
|
return (_jsxs(_Fragment, { children: [columns.map((col, i) => {
|