Skip to content

Commit e24561c

Browse files
feat(AnalyticalTable): Update to react-table rc.10 (#253)
Support Multi Selection of rows BREAKING CHANGE: replaced prop `selectedRowKey` with `selectedRowIds` (Object of rowIds) BREAKING CHANGE: Update to react-table `7.0.0-rc.10`
1 parent d2bc4c5 commit e24561c

22 files changed

+498
-278
lines changed

packages/main/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"lodash.debounce": "^4.0.8",
3030
"react-content-loader": "^4.3.2",
3131
"react-jss": "10.0.0",
32-
"react-table": "7.0.0-rc.5",
32+
"react-table": "7.0.0-rc.10",
3333
"react-toastify": "^5.4.1",
3434
"react-window": "^1.8.5"
3535
},

packages/main/src/components/AnalyticalTable/AnalyticalTable.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,13 @@ describe('AnalyticalTable', () => {
250250

251251
expect(wrapper.render()).toMatchSnapshot();
252252
});
253+
254+
test('render without data', () => {
255+
const data = [];
256+
const wrapper = mountThemedComponent(
257+
<AnalyticalTable title="Table Title" data={data} columns={columns} alternateRowColor />
258+
);
259+
260+
expect(wrapper.render()).toMatchSnapshot();
261+
});
253262
});

packages/main/src/components/AnalyticalTable/AnayticalTable.jss.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,23 @@ const styles = ({ parameters }: JSSTheme) => ({
3838
position: 'relative',
3939
zIndex: 0,
4040
overflowX: 'auto',
41+
backgroundColor: parameters.sapUiListBackground
42+
},
43+
tr: {
44+
zIndex: 0,
4145
backgroundColor: parameters.sapUiListBackground,
42-
'&$selectable $tr:hover': {
43-
backgroundColor: parameters.sapUiListHoverBackground
44-
},
45-
'& $selectedRow': {
46+
color: parameters.sapUiListTextColor,
47+
'&[data-is-selected]': {
4648
backgroundColor: parameters.sapUiListSelectionBackgroundColor
4749
},
48-
'& $selectedRow:hover': {
50+
'&[data-is-selected]:hover': {
4951
backgroundColor: `${parameters.sapUiListSelectionHoverBackground} !important`
50-
},
51-
'&$selectable $tr:active:not($selectedRow):not($tableGroupHeader)': {
52-
backgroundColor: parameters.sapUiListActiveBackground,
53-
color: parameters.sapUiListActiveTextColor
54-
},
55-
'&$selectable $tr:active:not($selectedRow):not($tableGroupHeader) $tableCell': {
56-
borderRight: `1px solid ${parameters.sapUiListActiveBackground}`
5752
}
5853
},
59-
tr: {
60-
zIndex: 0,
61-
backgroundColor: parameters.sapUiListBackground,
62-
color: parameters.sapUiListTextColor
63-
},
6454
alternateRowColor: {
65-
backgroundColor: parameters.sapUiListHeaderBackground
55+
'& $tr:nth-child(even)': {
56+
backgroundColor: parameters.sapUiListHeaderBackground
57+
}
6658
},
6759
tableGroupHeader: {
6860
'&$tr': {
@@ -74,8 +66,20 @@ const styles = ({ parameters }: JSSTheme) => ({
7466
}
7567
}
7668
},
77-
selectable: {},
78-
selectedRow: {},
69+
selectable: {
70+
'& $tr:hover': {
71+
backgroundColor: parameters.sapUiListHoverBackground,
72+
cursor: 'pointer'
73+
},
74+
'& $tr:active:not([data-is-selected]):not($tableGroupHeader)': {
75+
backgroundColor: parameters.sapUiListActiveBackground,
76+
'& $tableCell': {
77+
borderRight: `1px solid ${parameters.sapUiListActiveBackground}`,
78+
color: `${parameters.sapUiListActiveTextColor}`,
79+
'--sapUiBaseText': parameters.sapUiListActiveTextColor
80+
}
81+
}
82+
},
7983
tableCell: {
8084
height: '2.75rem',
8185
fontFamily: parameters.sapUiFontFamily,

0 commit comments

Comments
 (0)