@monolith-forensics/monolith-ui 1.3.25 → 1.3.27
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.
|
@@ -29,6 +29,16 @@ export const TR = styled.div `
|
|
|
29
29
|
visibility: visible;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
&[data-focused="true"] {
|
|
33
|
+
border-left: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
34
|
+
border-right: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
35
|
+
|
|
36
|
+
.mfui-td {
|
|
37
|
+
border-top: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
38
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
&:hover > .mfui-td {
|
|
33
43
|
background-color: ${({ theme }) => theme.palette.action.hover};
|
|
34
44
|
}
|
|
@@ -19,7 +19,7 @@ import { SelectionStatus } from "./enums";
|
|
|
19
19
|
import moment from "moment";
|
|
20
20
|
export const TableContext = createContext(null);
|
|
21
21
|
const TableProvider = (_a) => {
|
|
22
|
-
var { children, columns, tableInstanceRef, stateStorage, height, maxHeight, minHeight } = _a, props = __rest(_a, ["children", "columns", "tableInstanceRef", "stateStorage", "height", "maxHeight", "minHeight"]);
|
|
22
|
+
var { children, columns, tableInstanceRef, stateStorage, height, maxHeight, minHeight, focusedRowId } = _a, props = __rest(_a, ["children", "columns", "tableInstanceRef", "stateStorage", "height", "maxHeight", "minHeight", "focusedRowId"]);
|
|
23
23
|
const _columns = columns
|
|
24
24
|
.map((child, index) => {
|
|
25
25
|
if (child.dataField === "__key") {
|
|
@@ -515,8 +515,11 @@ const TableProvider = (_a) => {
|
|
|
515
515
|
return false;
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
|
+
const isRowFocused = (row) => {
|
|
519
|
+
const key = !!props.keyField ? row[props.keyField] : row.__key;
|
|
520
|
+
return focusedRowId === key;
|
|
521
|
+
};
|
|
518
522
|
if (tableInstanceRef) {
|
|
519
|
-
console.log("set table instance ref");
|
|
520
523
|
tableInstanceRef.current = {
|
|
521
524
|
columnState,
|
|
522
525
|
setColumnState: updateColumnState,
|
|
@@ -558,6 +561,7 @@ const TableProvider = (_a) => {
|
|
|
558
561
|
}, selectRow,
|
|
559
562
|
deselectRow,
|
|
560
563
|
isRowSelected,
|
|
564
|
+
isRowFocused,
|
|
561
565
|
selectedRowKeys,
|
|
562
566
|
getSelectedRowKeys,
|
|
563
567
|
selectAllRows,
|
package/dist/Table/TableRow.js
CHANGED
|
@@ -8,12 +8,13 @@ import ActionButton from "./ActionButton";
|
|
|
8
8
|
import CheckBox from "../CheckBox";
|
|
9
9
|
import { LoadingCellIndicator } from "./LoadingCellIndicator";
|
|
10
10
|
const TableRow = ({ rowData, loading, rowStyle }) => {
|
|
11
|
-
const { columnState, enableActionButton, onActionButtonClick, actionButtonIcon: Icon, enableSelection, selectRow, deselectRow, isRowSelected, onRowUpdated, } = useTable();
|
|
11
|
+
const { columnState, enableActionButton, onActionButtonClick, actionButtonIcon: Icon, enableSelection, selectRow, deselectRow, isRowSelected, isRowFocused, onRowUpdated, } = useTable();
|
|
12
12
|
const selected = isRowSelected(rowData);
|
|
13
|
+
const focused = isRowFocused(rowData);
|
|
13
14
|
const handleSelectionChange = (e) => {
|
|
14
15
|
e === true ? selectRow(rowData) : deselectRow(rowData);
|
|
15
16
|
};
|
|
16
|
-
return (_jsxs(TR, { className: "mfui-tr", style: rowStyle, "data-key": rowData.__key, "data-selected": selected, children: [enableSelection && (_jsx(ActionCell, { className: `mfui-td column-select`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(CheckBox, { className: `mfui-checkbox`, value: selected, onChange: (e) => handleSelectionChange(e) }) }) })), enableActionButton && (_jsx(ActionCell, { className: `mfui-td column-action`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(ActionButton, { variant: "subtle", onClick: () => onActionButtonClick === null || onActionButtonClick === void 0 ? void 0 : onActionButtonClick(rowData), children: Icon ? _jsx(Icon, { size: 14 }) : _jsx(Maximize2Icon, { size: 14 }) }) }) })), columnState.map((column, index) => {
|
|
17
|
+
return (_jsxs(TR, { className: "mfui-tr", style: rowStyle, "data-key": rowData.__key, "data-selected": selected, "data-focused": focused, children: [enableSelection && (_jsx(ActionCell, { className: `mfui-td column-select`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(CheckBox, { className: `mfui-checkbox`, value: selected, onChange: (e) => handleSelectionChange(e) }) }) })), enableActionButton && (_jsx(ActionCell, { className: `mfui-td column-action`, children: _jsx(InnerCellContent, { className: "mfui inner-cell-content row-action", children: _jsx(ActionButton, { variant: "subtle", onClick: () => onActionButtonClick === null || onActionButtonClick === void 0 ? void 0 : onActionButtonClick(rowData), children: Icon ? _jsx(Icon, { size: 14 }) : _jsx(Maximize2Icon, { size: 14 }) }) }) })), columnState.map((column, index) => {
|
|
17
18
|
if (column.visible === false)
|
|
18
19
|
return null;
|
|
19
20
|
if (loading) {
|
package/dist/Table/types.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export type TableContextType = {
|
|
|
126
126
|
manualSearch?: boolean;
|
|
127
127
|
manualExport?: boolean;
|
|
128
128
|
compactState: boolean;
|
|
129
|
+
focusedRowId?: string | number;
|
|
129
130
|
toggleCompact: () => void;
|
|
130
131
|
toggleColumnVisibility: (dataField: string) => void;
|
|
131
132
|
runSearch: (query: string) => void;
|
|
@@ -134,6 +135,7 @@ export type TableContextType = {
|
|
|
134
135
|
selectAllRows: () => void;
|
|
135
136
|
clearSelections: () => void;
|
|
136
137
|
isRowSelected: (row: any) => boolean;
|
|
138
|
+
isRowFocused: (row: any) => boolean;
|
|
137
139
|
onSelectionChange?: onSelectionChangeFn;
|
|
138
140
|
selectRow: (row: any) => void;
|
|
139
141
|
deselectRow: (row: any) => void;
|
|
@@ -180,6 +182,7 @@ export interface TableProviderProps {
|
|
|
180
182
|
manualExport?: boolean;
|
|
181
183
|
enableSorting?: boolean;
|
|
182
184
|
tableMenuOptions?: TableMenuOptions;
|
|
185
|
+
focusedRowId?: string | number;
|
|
183
186
|
onSelectionChange?: onSelectionChangeFn;
|
|
184
187
|
onActionButtonClick?: (rowData: any) => void;
|
|
185
188
|
onColumnResize?: (e: OnColumnChangeProps) => void;
|
|
@@ -286,6 +289,7 @@ export interface TableProps {
|
|
|
286
289
|
manualFiltering?: boolean;
|
|
287
290
|
manualExport?: boolean;
|
|
288
291
|
tableMenuOptions?: TableMenuOptions;
|
|
292
|
+
focusedRowId?: string | number;
|
|
289
293
|
children?: React.ReactNode;
|
|
290
294
|
onRowUpdated?: () => void;
|
|
291
295
|
onSelectionChange?: onSelectionChangeFn;
|
package/dist/theme/variants.js
CHANGED
|
@@ -177,11 +177,11 @@ const lightVariant = {
|
|
|
177
177
|
error: "#f44336",
|
|
178
178
|
},
|
|
179
179
|
text: {
|
|
180
|
-
default: "#
|
|
181
|
-
primary:
|
|
182
|
-
|
|
180
|
+
default: "#000",
|
|
181
|
+
primary: customBlue[500],
|
|
182
|
+
error: "#f44336",
|
|
183
|
+
secondary: "#a1a1a1",
|
|
183
184
|
alternate: "#000",
|
|
184
|
-
error: "#FFF",
|
|
185
185
|
},
|
|
186
186
|
},
|
|
187
187
|
};
|
|
@@ -294,7 +294,8 @@ const darkVariant = merge(lightVariant, {
|
|
|
294
294
|
error: "#f44336",
|
|
295
295
|
},
|
|
296
296
|
text: {
|
|
297
|
-
primary:
|
|
297
|
+
primary: customBlue[500],
|
|
298
|
+
error: "#f44336",
|
|
298
299
|
secondary: "rgba(255, 255, 255, 0.6)",
|
|
299
300
|
alternate: "rgba(255, 255, 255, 0.6)",
|
|
300
301
|
},
|