Skip to content

Commit ffa1c13

Browse files
Merge branch 'master' into feat/stabilize-new-charts
2 parents d724486 + 6004c8c commit ffa1c13

24 files changed

+6053
-6155
lines changed

.storybook/preview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ContentDensity } from '@ui5/webcomponents-react/lib/ContentDensity';
1010
import { ThemeProvider } from '@ui5/webcomponents-react/lib/ThemeProvider';
1111
import { Themes } from '@ui5/webcomponents-react/lib/Themes';
1212
import '@ui5/webcomponents/dist/Assets';
13+
import '@ui5/webcomponents-react/dist/Assets';
1314
import '@ui5/webcomponents/dist/features/InputElementsFormSupport';
1415
import React, { useEffect } from 'react';
1516
import 'react-app-polyfill/ie11';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@rollup/plugin-node-resolve": "^7.1.3",
5151
"@rollup/plugin-replace": "^2.3.2",
5252
"@storybook/storybook-deployer": "^2.8.5",
53+
"@testing-library/react": "^10.0.4",
5354
"@types/enzyme": "^3.10.5",
5455
"@types/jest": "^25.2.1",
5556
"@types/react": "^16.9.34",

packages/main/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"react-content-loader": "^5.0.4",
3838
"react-jss": "10.1.1",
3939
"react-table": "7.0.4",
40-
"react-window": "^1.8.5"
40+
"react-virtual": "2.1.7"
4141
},
4242
"peerDependencies": {
4343
"@ui5/webcomponents": "1.0.0-rc.7",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const columns = [
5757
}
5858
];
5959

60-
const data = generateData(200);
60+
const data = generateData(10_000);
6161
const dataTree = generateData(20, true);
6262

6363
export const defaultTable = () => {
@@ -72,7 +72,7 @@ export const defaultTable = () => {
7272
alternateRowColor={boolean('alternateRowColor', false)}
7373
sortable={boolean('sortable', true)}
7474
filterable={boolean('filterable', true)}
75-
visibleRows={number('visibleRows', 5)}
75+
visibleRows={number('visibleRows', 15)}
7676
minRows={number('minRows', 5)}
7777
groupable={boolean('groupable', true)}
7878
selectionMode={select<TableSelectionMode>(

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { createPassThroughPropsTest } from '@shared/tests/utils';
2+
import { act, render } from '@testing-library/react';
23
import { AnalyticalTable } from '@ui5/webcomponents-react/lib/AnalyticalTable';
3-
import { AnalyticalTableScrollMode } from '@ui5/webcomponents-react/lib/AnalyticalTableScrollMode';
4+
import { TableSelectionBehavior } from '@ui5/webcomponents-react/lib/TableSelectionBehavior';
45
import { TableSelectionMode } from '@ui5/webcomponents-react/lib/TableSelectionMode';
56
import { ValueState } from '@ui5/webcomponents-react/lib/ValueState';
6-
import { TableSelectionBehavior } from '@ui5/webcomponents-react/lib/TableSelectionBehavior';
77
import { mount } from 'enzyme';
88
import React, { useRef } from 'react';
99

@@ -271,19 +271,29 @@ describe('AnalyticalTable', () => {
271271
let tableRef;
272272
const UsingTable = (props) => {
273273
tableRef = useRef(null);
274-
return <AnalyticalTable ref={tableRef} title="Table Title" data={data} columns={columns} />;
274+
return (
275+
<AnalyticalTable ref={tableRef} title="Table Title" data={data} columns={columns} visibleRows={1} minRows={1} />
276+
);
275277
};
276278

277-
mount(<UsingTable />);
279+
render(<UsingTable />);
278280

279281
// Check existence + type
280282
expect(typeof tableRef.current.scrollTo).toBe('function');
281283
expect(typeof tableRef.current.scrollToItem).toBe('function');
282284

283285
// call functions
284-
const tableInnerRef = tableRef.current.querySelector("div[class^='AnalyticalTable-table'] > div > div");
285-
tableRef.current.scrollToItem(2, AnalyticalTableScrollMode.end);
286-
tableRef.current.scrollTo(2);
286+
const tableInnerRef = tableRef.current.querySelector("div[class^='AnalyticalTable-table'] > div");
287+
act(() => {
288+
tableRef.current.scrollToItem(1, 'start');
289+
});
290+
291+
expect(tableInnerRef.scrollTop).toBe(44);
292+
293+
act(() => {
294+
tableRef.current.scrollTo(2);
295+
});
296+
287297
expect(tableInnerRef.scrollTop).toBe(2);
288298
});
289299

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

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ import { CssSizeVariables } from '@ui5/webcomponents-react-base/lib/CssSizeVaria
22
import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters';
33

44
const styles = {
5-
tableContainer: {
6-
width: '100%',
7-
height: `calc(100% - ${CssSizeVariables.sapWcrAnalyticalTableRowHeight})`,
8-
minHeight: '3rem'
9-
},
105
table: {
116
position: 'relative',
127
width: '100%',
138
maxWidth: '100%',
14-
overflowX: 'auto'
9+
overflowX: 'auto',
10+
height: `calc(100% - ${CssSizeVariables.sapWcrAnalyticalTableRowHeight})`,
11+
minHeight: '3rem',
12+
fontFamily: ThemingParameters.sapFontFamily,
13+
fontSize: ThemingParameters.sapFontSize,
14+
fontWeight: 'normal'
1515
},
1616
tableHeaderRow: {
17-
boxShadow: 'none !important',
1817
height: CssSizeVariables.sapWcrAnalyticalTableRowHeight,
19-
position: 'relative'
18+
position: 'relative',
19+
display: 'inline-flex'
2020
},
2121
th: {
2222
backgroundColor: ThemingParameters.sapList_HeaderBackground,
2323
height: CssSizeVariables.sapWcrAnalyticalTableRowHeight,
24-
fontFamily: ThemingParameters.sapFontFamily,
25-
fontSize: ThemingParameters.sapFontSize,
2624
fontWeight: 'normal',
2725
color: ThemingParameters.sapList_HeaderTextColor,
2826
borderTop: `1px solid ${ThemingParameters.sapList_BorderColor}`,
@@ -43,22 +41,27 @@ const styles = {
4341
position: 'relative',
4442
zIndex: 0,
4543
backgroundColor: ThemingParameters.sapList_Background,
46-
overflowX: 'hidden !important',
47-
overflowY: 'auto !important'
44+
overflowX: 'hidden',
45+
overflowY: 'auto'
4846
},
4947
alternateRowColor: {
5048
backgroundColor: ThemingParameters.sapList_HeaderBackground
5149
},
5250
emptyRow: {},
5351
tr: {
52+
position: 'absolute',
53+
top: 0,
54+
left: 0,
55+
width: '100%',
5456
zIndex: 0,
5557
color: ThemingParameters.sapList_TextColor,
58+
borderBottom: `1px solid ${ThemingParameters.sapList_BorderColor}`,
5659
boxSizing: 'border-box',
60+
display: 'flex',
61+
height: CssSizeVariables.sapWcrAnalyticalTableRowHeight,
5762
'&[data-is-selected]': {
58-
backgroundColor: `${ThemingParameters.sapList_SelectionBackgroundColor} !important`,
59-
'& $tableCell': {
60-
borderBottom: `1px solid ${ThemingParameters.sapList_SelectionBorderColor}`
61-
}
63+
borderBottom: `1px solid ${ThemingParameters.sapList_SelectionBorderColor}`,
64+
backgroundColor: `${ThemingParameters.sapList_SelectionBackgroundColor} !important`
6265
},
6366
'&[data-is-selected]:hover': {
6467
backgroundColor: `${ThemingParameters.sapList_Hover_SelectionBackground} !important`
@@ -93,22 +96,18 @@ const styles = {
9396
selectionModeRowSelector: {},
9497
tableCell: {
9598
height: CssSizeVariables.sapWcrAnalyticalTableRowHeight,
96-
fontFamily: ThemingParameters.sapFontFamily,
97-
fontSize: ThemingParameters.sapFontSize,
98-
fontWeight: 'normal',
99-
borderBottom: `1px solid ${ThemingParameters.sapList_BorderColor}`,
10099
boxSizing: 'border-box',
101100
borderRight: `1px solid ${ThemingParameters.sapList_BorderColor}`,
102-
display: 'flex',
101+
display: 'inline-flex',
103102
padding: '0 0.5rem',
104103
'&:first-child': {
105104
borderLeft: `1px solid ${ThemingParameters.sapList_BorderColor}`
106105
},
107106
overflow: 'hidden',
108-
position: 'relative',
109107
textOverflow: 'ellipsis',
110108
whiteSpace: 'nowrap',
111109
alignItems: 'center',
110+
position: 'relative',
112111
'&:focus': {
113112
outlineOffset: '-2px',
114113
outline: `1px dotted ${ThemingParameters.sapContent_FocusColor}`

packages/main/src/components/AnalyticalTable/ColumnHeader/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
155155
if (dragOver) {
156156
modifiedStyles.borderLeft = `3px solid ${ThemingParameters.sapSelectedColor}`;
157157
}
158-
if (column.id === '__ui5wcr__internal_highlight_column' || column.id === '__ui5wcr__internal_selection_column') {
159-
modifiedStyles.padding = 0;
160-
}
161158
return modifiedStyles;
162159
}, [dragOver, hasPopover]);
163160

0 commit comments

Comments
 (0)