@monolith-forensics/monolith-ui 1.2.97 → 1.2.99
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.
|
@@ -11,6 +11,7 @@ import InfoBadge from "./InfoBadge";
|
|
|
11
11
|
import { QueryFilter, useQueryFilter, } from "../../QueryFilter";
|
|
12
12
|
import shortUUID from "short-uuid";
|
|
13
13
|
import { DefaultOperators } from "../../QueryFilter";
|
|
14
|
+
import { useEffect, useRef } from "react";
|
|
14
15
|
const StyledContainer = styled.div `
|
|
15
16
|
display: flex;
|
|
16
17
|
flex-direction: column;
|
|
@@ -28,7 +29,8 @@ const FlexedRow = styled.div `
|
|
|
28
29
|
`;
|
|
29
30
|
const TableMenu = () => {
|
|
30
31
|
var _a, _b, _c, _d;
|
|
31
|
-
const { data, columnState, searchState, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, filterState, handleFilterChange, } = useTable();
|
|
32
|
+
const { data, columnState, searchState, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, filterState, handleFilterChange, clearSearch, } = useTable();
|
|
33
|
+
const inputRef = useRef(null);
|
|
32
34
|
if ((tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.enabled) !== true)
|
|
33
35
|
return null;
|
|
34
36
|
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, children, } = tableMenuOptions;
|
|
@@ -59,6 +61,12 @@ const TableMenu = () => {
|
|
|
59
61
|
label: item.label,
|
|
60
62
|
});
|
|
61
63
|
};
|
|
64
|
+
// simultate
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (inputRef.current && searchState === "") {
|
|
67
|
+
inputRef.current.value = "";
|
|
68
|
+
}
|
|
69
|
+
}, [searchState]);
|
|
62
70
|
return (_jsxs(StyledContainer, { children: [_jsxs(FlexedRow, { className: "justify-sb", children: [_jsxs(FlexedRow, { children: [(addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.enabled) === true &&
|
|
63
71
|
((addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.type) === "button" ||
|
|
64
72
|
(addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.type) === undefined) && (_jsx(Button, Object.assign({ color: "primary", variant: "contained", size: "xxs", onClick: () => { var _a; return (_a = addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.onClick) === null || _a === void 0 ? void 0 : _a.call(addButtonOptions); } }, addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.buttonOptions, { children: ((_a = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.addButtonOptions) === null || _a === void 0 ? void 0 : _a.label) || "+ Add Record" }))), (addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.enabled) === true &&
|
|
@@ -109,6 +117,6 @@ const TableMenu = () => {
|
|
|
109
117
|
style: { padding: "0px 4px", height: 24 },
|
|
110
118
|
}, dropDownProps: {
|
|
111
119
|
style: { width: 175, maxWidth: 400 },
|
|
112
|
-
}, children: _jsx(Columns3Icon, { size: 14 }) })), (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.enabled) === true && (_jsx(TextInput, { size: "xs", placeholder: ((_d = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _d === void 0 ? void 0 : _d.placeholder) || "Search", defaultValue: searchState, onChange: handleSearch }))] })] }), _jsx(QueryFilter, { queryFilter: queryFilter })] }));
|
|
120
|
+
}, children: _jsx(Columns3Icon, { size: 14 }) })), (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.enabled) === true && (_jsx(TextInput, { ref: inputRef, size: "xs", placeholder: ((_d = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _d === void 0 ? void 0 : _d.placeholder) || "Search", defaultValue: searchState, onChange: handleSearch }))] })] }), _jsx(QueryFilter, { queryFilter: queryFilter })] }));
|
|
113
121
|
};
|
|
114
122
|
export default TableMenu;
|