mig-schema-table 2.0.1 → 2.0.2
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.
|
@@ -298,5 +298,13 @@ export default function SchemaTable(props) {
|
|
|
298
298
|
const totalWidth = React.useMemo(() => columnWidths.reduce((a, b) => {
|
|
299
299
|
return a + b;
|
|
300
300
|
}, 0), [columnWidths]);
|
|
301
|
-
|
|
301
|
+
const tableBodyHeight = React.useMemo(() => {
|
|
302
|
+
const defaultHeight = props.height - (isSearchable ? 50 : 0);
|
|
303
|
+
if (!sortedRenderData) {
|
|
304
|
+
return defaultHeight;
|
|
305
|
+
}
|
|
306
|
+
const dynamicHeight = sortedRenderData.length * rowHeight;
|
|
307
|
+
return dynamicHeight < defaultHeight ? dynamicHeight : defaultHeight;
|
|
308
|
+
}, [isSearchable, props.height, rowHeight, sortedRenderData]);
|
|
309
|
+
return (_jsxs("div", Object.assign({ className: `schema-table${onRowClick ? " schema-table--clickable-rows" : ""}`, style: Object.assign(Object.assign({}, style), { width: dynamicWidthColumnCount ? gridWidth : fixedWidthColumnsWidth }) }, { children: [_jsx("div", Object.assign({ className: "tableTitle" }, { children: tableTitle })), _jsxs("div", Object.assign({ className: "action-container" }, { children: [_jsx("div", Object.assign({ style: { flex: 1 } }, { children: isSearchable ? (_jsx("input", { id: "input-filter", type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, autoFocus: true })) : null })), customElement] })), _jsx(Heading, Object.assign({ height: 50, itemCount: columnCount, itemSize: getColumnWidth, layout: "horizontal", width: width, sortAsc: sortAsc, setSortAsc: setSortAsc, setSortColumn: setSortColumn, sortColumn: sortColumn, sortedRenderData: sortedRenderData, className: "schema-table__th-row" }, { children: SchemaTableTh }), `thead_${width}_${sortColumn}_${sortAsc}_${searchQuery}`), _jsx(VariableSizeGrid, Object.assign({ className: "schema-table__tbody", height: tableBodyHeight, width: totalWidth, columnWidth: getColumnWidth, rowHeight: getRowHeight, columnCount: columnCount, rowCount: sortedRenderData ? sortedRenderData.length : 0 }, { children: Td }), `tbody_${width}_${sortColumn}_${sortAsc}_${searchQuery}_${columnCount}`)] })));
|
|
302
310
|
}
|