@monolith-forensics/monolith-ui 1.2.0 → 1.2.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.
@@ -22,10 +22,19 @@ import StaticRows from "./StaticRows";
22
22
  import TableMenu from "./TableMenu";
23
23
  import useTable from "./useTable";
24
24
  import LoadingIndicator from "./LoadingIndicator";
25
+ import styled from "styled-components";
26
+ const StyledTableContainer = styled.div `
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 10px;
30
+
31
+ height: 0px;
32
+ flex: 1 1 auto;
33
+ `;
25
34
  const TableContent = () => {
26
35
  const { columnState, tableElement, headerRowElm, tableDimensions, targetElm, listElm, rowHeight, headerRowHeight, compactState, virtualized, loading, } = useTable();
27
36
  const visibleColumnCount = columnState.filter((column) => column.visible === true).length;
28
- return (_jsxs(_Fragment, { children: [_jsx(TableMenu, {}), _jsxs(StyledTable, { className: "mfui-table", ref: tableElement, "data-compact": compactState, children: [_jsx(LoadingIndicator, { visible: loading }), _jsx(TableHeader, { headerRowElm: headerRowElm }), visibleColumnCount === 0 && _jsx(_Fragment, {}), virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: rowHeight, headerRowHeight: headerRowHeight })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] })] }));
37
+ return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), _jsxs(StyledTable, { className: "mfui-table", ref: tableElement, "data-compact": compactState, children: [_jsx(LoadingIndicator, { visible: loading }), _jsx(TableHeader, { headerRowElm: headerRowElm }), visibleColumnCount === 0 && _jsx(_Fragment, {}), virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: rowHeight, headerRowHeight: headerRowHeight })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] })] }));
29
38
  };
30
39
  const Table = (_a) => {
31
40
  var { data, children } = _a, props = __rest(_a, ["data", "children"]) // pass through props straight to table context
@@ -27,7 +27,7 @@ const FlexedRow = styled.div `
27
27
  }
28
28
  `;
29
29
  const TableMenu = () => {
30
- var _a, _b, _c, _d, _e, _f, _g;
30
+ var _a, _b, _c, _d, _e, _f, _g, _h;
31
31
  const { data, columnState, searchState, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, filterState, handleFilterChange, } = useTable();
32
32
  if ((tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.enabled) !== true)
33
33
  return null;
@@ -88,7 +88,7 @@ const TableMenu = () => {
88
88
  return (_b = (_a = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.exportOptions) === null || _a === void 0 ? void 0 : _a.onExport) === null || _b === void 0 ? void 0 : _b.call(_a, item.value);
89
89
  }, dropDownProps: {
90
90
  style: { width: 175, maxWidth: 400 },
91
- }, children: _jsx(DownloadIcon, { size: 14 }) })), _jsx(Button, { variant: "outlined", title: "Toggle Compact", size: "xxs", style: { padding: "0px 4px" }, onClick: () => toggleCompact(), children: compactState ? _jsx(Rows4Icon, { size: 14 }) : _jsx(Rows3Icon, { size: 14 }) }), ((_e = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.columnSelectorOptions) === null || _e === void 0 ? void 0 : _e.enabled) !== false && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: columnState.map((col) => ({
91
+ }, children: _jsx(DownloadIcon, { size: 14 }) })), ((_e = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.compactOptions) === null || _e === void 0 ? void 0 : _e.enabled) !== false && (_jsx(Button, { variant: "outlined", title: "Toggle Compact", size: "xxs", style: { padding: "0px 4px" }, onClick: () => toggleCompact(), children: compactState ? _jsx(Rows4Icon, { size: 14 }) : _jsx(Rows3Icon, { size: 14 }) })), ((_f = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.columnSelectorOptions) === null || _f === void 0 ? void 0 : _f.enabled) !== false && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: columnState.map((col) => ({
92
92
  label: (col === null || col === void 0 ? void 0 : col.caption) || col.dataField,
93
93
  value: col.dataField,
94
94
  onClick: () => toggleColumnVisibility(col.dataField),
@@ -103,6 +103,6 @@ const TableMenu = () => {
103
103
  style: { padding: "0px 4px" },
104
104
  }, dropDownProps: {
105
105
  style: { width: 175, maxWidth: 400 },
106
- }, children: _jsx(Columns3Icon, { size: 14 }) })), ((_f = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _f === void 0 ? void 0 : _f.enabled) !== false && (_jsx(TextInput, { size: "xs", placeholder: ((_g = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _g === void 0 ? void 0 : _g.placeholder) || "Search", defaultValue: searchState, onChange: handleSearch }))] })] }), _jsx(QueryFilter, { queryFilter: queryFilter })] }));
106
+ }, children: _jsx(Columns3Icon, { size: 14 }) })), ((_g = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _g === void 0 ? void 0 : _g.enabled) !== false && (_jsx(TextInput, { size: "xs", placeholder: ((_h = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _h === void 0 ? void 0 : _h.placeholder) || "Search", defaultValue: searchState, onChange: handleSearch }))] })] }), _jsx(QueryFilter, { queryFilter: queryFilter })] }));
107
107
  };
108
108
  export default TableMenu;
@@ -191,6 +191,9 @@ export type TableFilterOptions = {
191
191
  };
192
192
  export type TableMenuOptions = {
193
193
  enabled?: boolean;
194
+ compactOptions?: {
195
+ enabled?: boolean;
196
+ };
194
197
  addButtonOptions?: {
195
198
  enabled?: boolean;
196
199
  label?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",