Skip to content

Commit c6b64ba

Browse files
feat(AnalyticalTable): add infiniteScroll and keyboard navigation for cells (#397)
BREAKING CHANGE: column option `groupable` replaced by `disableGroupBy: boolean` BREAKING CHANGE: column option `sortable` replaced by `disableSortBy: boolean` BREAKING CHANGE: column option `filterable` replaced by `disableFilters: boolean` BREAKING CHANGE: Enabling grouping, sorting or filtering on column level by e.g `disableGroupBy: false` will not overwrite the table overall setting in case e.g. `groupable={false}`
1 parent 8ea4eaa commit c6b64ba

12 files changed

+754
-146
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ const styles = {
9696
position: 'relative',
9797
textOverflow: 'ellipsis',
9898
whiteSpace: 'nowrap',
99-
alignItems: 'center'
99+
alignItems: 'center',
100+
'&:focus': {
101+
outlineOffset: '-2px',
102+
outline: `1px dotted ${ThemingParameters.sapContent_FocusColor}`
103+
}
100104
},
101105
noDataContainer: {
102106
display: 'flex',

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import { ColumnType } from '../types/ColumnType';
1616

1717
export interface ColumnHeaderModalProperties {
1818
openBy: ReactNode;
19-
showSort?: boolean;
20-
showFilter?: boolean;
21-
showGroup?: boolean;
2219
column: ColumnType;
2320
style: CSSProperties;
2421
onSort?: (e: CustomEvent<{ column: unknown; sortDirection: string }>) => void;
@@ -28,7 +25,10 @@ export interface ColumnHeaderModalProperties {
2825
const staticStyle = { fontWeight: 'normal' };
2926

3027
export const ColumnHeaderModal: FC<ColumnHeaderModalProperties> = (props: ColumnHeaderModalProperties) => {
31-
const { showGroup, showSort, showFilter, column, style, openBy, onSort, onGroupBy } = props;
28+
const { column, style, openBy, onSort, onGroupBy } = props;
29+
const showFilter = column.canFilter;
30+
const showGroup = column.canGroupBy;
31+
const showSort = column.canSort;
3232

3333
const { Filter } = column;
3434

@@ -143,9 +143,3 @@ export const ColumnHeaderModal: FC<ColumnHeaderModalProperties> = (props: Column
143143
</Popover>
144144
);
145145
};
146-
147-
ColumnHeaderModal.defaultProps = {
148-
showSort: true,
149-
showFilter: false,
150-
showGroup: false
151-
};

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

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import '@ui5/webcomponents-icons/dist/icons/group-2';
33
import '@ui5/webcomponents-icons/dist/icons/sort-ascending';
44
import '@ui5/webcomponents-icons/dist/icons/sort-descending';
55
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles';
6-
import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters';
76
import { StyleClassHelper } from '@ui5/webcomponents-react-base/lib/StyleClassHelper';
7+
import { ThemingParameters } from '@ui5/webcomponents-react-base/lib/ThemingParameters';
88
import { Icon } from '@ui5/webcomponents-react/lib/Icon';
99
import React, { CSSProperties, DragEventHandler, FC, ReactNode, ReactNodeArray, useMemo } from 'react';
1010
import { ColumnType } from '../types/ColumnType';
@@ -18,12 +18,9 @@ export interface ColumnHeaderProps {
1818
className: string;
1919
column: ColumnType;
2020
style: CSSProperties;
21-
groupable: boolean;
22-
sortable: boolean;
23-
filterable: boolean;
2421
isLastColumn?: boolean;
25-
onSort?: (e: CustomEvent<{column: unknown; sortDirection: string}>) => void;
26-
onGroupBy?: (e: CustomEvent<{column: unknown; isGrouped: boolean}>) => void;
22+
onSort?: (e: CustomEvent<{ column: unknown; sortDirection: string }>) => void;
23+
onGroupBy?: (e: CustomEvent<{ column: unknown; isGrouped: boolean }>) => void;
2724
onDragStart: DragEventHandler<HTMLDivElement>;
2825
onDragOver: DragEventHandler<HTMLDivElement>;
2926
onDrop: DragEventHandler<HTMLDivElement>;
@@ -32,6 +29,7 @@ export interface ColumnHeaderProps {
3229
dragOver: boolean;
3330
isResizing: boolean;
3431
isDraggable: boolean;
32+
role: string;
3533
}
3634

3735
const styles = {
@@ -91,9 +89,6 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
9189
column,
9290
className,
9391
style,
94-
groupable,
95-
sortable,
96-
filterable,
9792
isLastColumn,
9893
onSort,
9994
onGroupBy,
@@ -103,7 +98,8 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
10398
onDrop,
10499
onDragEnd,
105100
isDraggable,
106-
dragOver
101+
dragOver,
102+
role
107103
} = props;
108104

109105
const openBy = useMemo(() => {
@@ -179,18 +175,9 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props: ColumnHeaderProps) =>
179175
if (!column) return null;
180176

181177
return (
182-
<div id={id} className={className} style={style} role="columnheader">
183-
{groupable || sortable || filterable ? (
184-
<ColumnHeaderModal
185-
openBy={openBy}
186-
showFilter={filterable}
187-
showGroup={groupable && column.disableGrouping !== true}
188-
showSort={sortable}
189-
column={column}
190-
style={innerStyle}
191-
onSort={onSort}
192-
onGroupBy={onGroupBy}
193-
/>
178+
<div id={id} className={className} style={style} role={role}>
179+
{column.canGroupBy || column.canSort || column.canFilter ? (
180+
<ColumnHeaderModal openBy={openBy} column={column} style={innerStyle} onSort={onSort} onGroupBy={onGroupBy} />
194181
) : (
195182
<div style={{ ...innerStyle, display: 'inline-block', cursor: 'auto' }}>{openBy}</div>
196183
)}

0 commit comments

Comments
 (0)