@monolith-forensics/monolith-ui 1.2.95 → 1.2.97
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/FieldLabel/FieldLabel.d.ts +2 -1
- package/dist/FieldLabel/FieldLabel.js +2 -2
- package/dist/Switch/Switch.js +1 -1
- package/dist/Table/Table.js +4 -4
- package/dist/Table/TableMenu/TableMenu.js +2 -2
- package/dist/Table/TableProvider.js +5 -0
- package/dist/Table/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ interface FieldLabelProps {
|
|
|
14
14
|
description?: string;
|
|
15
15
|
size?: Size;
|
|
16
16
|
asterisk?: boolean;
|
|
17
|
+
style?: React.CSSProperties;
|
|
17
18
|
}
|
|
18
|
-
declare const FieldLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<FieldLabelProps, never>> & string & Omit<({ className, children, error, description, size, }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
19
|
+
declare const FieldLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<FieldLabelProps, never>> & string & Omit<({ className, children, error, description, size, style, }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
19
20
|
export default FieldLabel;
|
|
@@ -24,8 +24,8 @@ export const InfoComponent = styled(({ className, children, description, label }
|
|
|
24
24
|
margin-bottom: 5px;
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
|
-
const FieldLabel = styled(({ className, children, error, description, size = "sm", }) => {
|
|
28
|
-
return (_jsxs("div", { className: className + " FieldLabel", children: [_jsx(InfoComponent, { description: description, label: children, children: _jsx("div", { className: "label", children: children }) }), error && (_jsx("div", { className: "error", title: error, children: error || "Invalid Value" }))] }));
|
|
27
|
+
const FieldLabel = styled(({ className, children, error, description, size = "sm", style, }) => {
|
|
28
|
+
return (_jsxs("div", { className: className + " FieldLabel", style: style, children: [_jsx(InfoComponent, { description: description, label: children, children: _jsx("div", { className: "label", children: children }) }), error && (_jsx("div", { className: "error", title: error, children: error || "Invalid Value" }))] }));
|
|
29
29
|
}) `
|
|
30
30
|
user-select: none;
|
|
31
31
|
font-family: apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -120,7 +120,7 @@ const StyledThumb = styled(RadixSwitch.Thumb) `
|
|
|
120
120
|
`;
|
|
121
121
|
const Switch = styled((_a) => {
|
|
122
122
|
var { className, onChange, size = "xs", label, labelPosition = "right", description, error, required, disabled = false, defaultValue, value, style = {} } = _a, other = __rest(_a, ["className", "onChange", "size", "label", "labelPosition", "description", "error", "required", "disabled", "defaultValue", "value", "style"]);
|
|
123
|
-
return (_jsxs("div", { className: className, children: [label && labelPosition === "left" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsx(StyledRoot, Object.assign({ size: size, className: "SwitchRoot", onCheckedChange: onChange, defaultChecked: defaultValue, checked: value, disabled: disabled, style: style }, other, { children: _jsx(StyledThumb, { size: size, className: "SwitchThumb" }) })), label && labelPosition === "right" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label }))] }));
|
|
123
|
+
return (_jsxs("div", { className: className, children: [label && labelPosition === "left" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, style: { margin: 0 }, children: label })), _jsx(StyledRoot, Object.assign({ size: size, className: "SwitchRoot", onCheckedChange: onChange, defaultChecked: defaultValue, checked: value, disabled: disabled, style: style }, other, { children: _jsx(StyledThumb, { size: size, className: "SwitchThumb" }) })), label && labelPosition === "right" && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, style: { margin: 0 }, children: label }))] }));
|
|
124
124
|
}) `
|
|
125
125
|
display: flex;
|
|
126
126
|
flex-direction: row;
|
package/dist/Table/Table.js
CHANGED
|
@@ -30,17 +30,17 @@ const StyledTableContainer = styled.div `
|
|
|
30
30
|
height: 0px;
|
|
31
31
|
flex: 1 1 auto;
|
|
32
32
|
`;
|
|
33
|
-
const TableContent = () => {
|
|
33
|
+
const TableContent = ({ children, }) => {
|
|
34
34
|
const { columnState, tableElement, tableHeight, tableMaxHeight, tableMinHeight, headerRowElm, tableDimensions, targetElm, listElm, rowHeight, headerRowHeight, compactState, virtualized, loading, } = useTable();
|
|
35
35
|
const visibleColumnCount = columnState.filter((column) => column.visible === true).length;
|
|
36
|
-
return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), _jsxs(StyledTable, { className: "mfui-table", style: {
|
|
36
|
+
return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), children, _jsxs(StyledTable, { className: "mfui-table", style: {
|
|
37
37
|
height: tableHeight || "100%",
|
|
38
38
|
maxHeight: tableMaxHeight,
|
|
39
39
|
minHeight: tableMinHeight,
|
|
40
40
|
}, 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 }))] })] }));
|
|
41
41
|
};
|
|
42
42
|
export const Table = (_a) => {
|
|
43
|
-
var { data, columnProps } = _a, props = __rest(_a, ["data", "columnProps"]) // pass through props straight to table context
|
|
43
|
+
var { data, columnProps, children } = _a, props = __rest(_a, ["data", "columnProps", "children"]) // pass through props straight to table context
|
|
44
44
|
;
|
|
45
45
|
const tableElement = useRef(null);
|
|
46
46
|
const targetElm = useRef(null);
|
|
@@ -110,5 +110,5 @@ export const Table = (_a) => {
|
|
|
110
110
|
};
|
|
111
111
|
}, []);
|
|
112
112
|
const __data = useMemo(() => data === null || data === void 0 ? void 0 : data.map((d, i) => (Object.assign(Object.assign({}, d), { __key: shortUUID.generate(), __index: i }))), [data]);
|
|
113
|
-
return (_jsx(TableProvider, Object.assign({ columns: columnProps, data: __data, tableElement: tableElement, headerRowElm: headerRowElm, tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm }, props, { children: _jsx(TableContent, {}) })));
|
|
113
|
+
return (_jsx(TableProvider, Object.assign({ columns: columnProps, data: __data, tableElement: tableElement, headerRowElm: headerRowElm, tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm }, props, { children: _jsx(TableContent, { children: children }) })));
|
|
114
114
|
};
|
|
@@ -31,7 +31,7 @@ const TableMenu = () => {
|
|
|
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;
|
|
34
|
-
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, } = tableMenuOptions;
|
|
34
|
+
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, children, } = tableMenuOptions;
|
|
35
35
|
const queryFilter = useQueryFilter({
|
|
36
36
|
defaultFilter: filterState,
|
|
37
37
|
filterDefinitions: (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.filterDefinitions) || [],
|
|
@@ -76,7 +76,7 @@ const TableMenu = () => {
|
|
|
76
76
|
}, onItemSelect: handleSelectFilter, dropDownProps: {
|
|
77
77
|
style: { width: 175, maxWidth: 400 },
|
|
78
78
|
}, searchable: true, children: "Filter" })), (tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.recordsTotalEnabled) === true && (_jsx(InfoBadge, { total: totalRecords || data.length })), enableSelection === true &&
|
|
79
|
-
(tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.selectionTotalEnabled) === true && (_jsx(InfoBadge, { total: getCalculatedSelectionTotal(), hint: "Selected Items", icon: CheckSquareIcon }))] }), _jsxs(FlexedRow, { children: [(exportOptions === null || exportOptions === void 0 ? void 0 : exportOptions.enabled) === true && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: [
|
|
79
|
+
(tableCountOptions === null || tableCountOptions === void 0 ? void 0 : tableCountOptions.selectionTotalEnabled) === true && (_jsx(InfoBadge, { total: getCalculatedSelectionTotal(), hint: "Selected Items", icon: CheckSquareIcon })), children] }), _jsxs(FlexedRow, { children: [(exportOptions === null || exportOptions === void 0 ? void 0 : exportOptions.enabled) === true && (_jsx(DropDownMenu, { variant: "outlined", size: "xs", data: [
|
|
80
80
|
{
|
|
81
81
|
label: "Export Visible Columns",
|
|
82
82
|
value: TableExportOptions.ExportVisible,
|
|
@@ -116,6 +116,9 @@ const TableProvider = (_a) => {
|
|
|
116
116
|
const runSearch = (searchText) => {
|
|
117
117
|
setSearch(searchText);
|
|
118
118
|
};
|
|
119
|
+
const clearSearch = () => {
|
|
120
|
+
setSearch("");
|
|
121
|
+
};
|
|
119
122
|
const sortData = (sortState) => {
|
|
120
123
|
// sort data
|
|
121
124
|
return props.data.sort((a, b) => {
|
|
@@ -418,6 +421,7 @@ const TableProvider = (_a) => {
|
|
|
418
421
|
selectAllRows,
|
|
419
422
|
clearSelections,
|
|
420
423
|
runSearch,
|
|
424
|
+
clearSearch,
|
|
421
425
|
};
|
|
422
426
|
}
|
|
423
427
|
}, [columnState]);
|
|
@@ -503,6 +507,7 @@ const TableProvider = (_a) => {
|
|
|
503
507
|
clearSelections,
|
|
504
508
|
toggleColumnVisibility,
|
|
505
509
|
runSearch,
|
|
510
|
+
clearSearch,
|
|
506
511
|
handleFilterChange,
|
|
507
512
|
filterState,
|
|
508
513
|
compactState,
|
package/dist/Table/types.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export type TableContextType = {
|
|
|
126
126
|
toggleCompact: () => void;
|
|
127
127
|
toggleColumnVisibility: (dataField: string) => void;
|
|
128
128
|
runSearch: (query: string) => void;
|
|
129
|
+
clearSearch: () => void;
|
|
129
130
|
handleFilterChange: (query: Query) => void;
|
|
130
131
|
selectAllRows: () => void;
|
|
131
132
|
clearSelections: () => void;
|
|
@@ -237,6 +238,7 @@ export type TableMenuOptions = {
|
|
|
237
238
|
columnSelectorOptions?: {
|
|
238
239
|
enabled?: boolean;
|
|
239
240
|
};
|
|
241
|
+
children?: React.ReactNode;
|
|
240
242
|
};
|
|
241
243
|
export interface TableProps {
|
|
242
244
|
columnProps: ColumnProps[];
|
|
@@ -265,6 +267,7 @@ export interface TableProps {
|
|
|
265
267
|
manualFiltering?: boolean;
|
|
266
268
|
manualExport?: boolean;
|
|
267
269
|
tableMenuOptions?: TableMenuOptions;
|
|
270
|
+
children?: React.ReactNode;
|
|
268
271
|
onRowUpdated?: () => void;
|
|
269
272
|
onSelectionChange?: onSelectionChangeFn;
|
|
270
273
|
onActionButtonClick?: (rowData: any) => void;
|
|
@@ -299,5 +302,6 @@ export type TableInstance = {
|
|
|
299
302
|
deselectRow: (row: any) => void;
|
|
300
303
|
selectAllRows: () => void;
|
|
301
304
|
runSearch: (query: string) => void;
|
|
305
|
+
clearSearch: () => void;
|
|
302
306
|
clearSelections: () => void;
|
|
303
307
|
};
|