Skip to content

fix(AnalyticalTable): ensure loading indicator displays correctly across all browsers #6244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -41,13 +41,17 @@
position: relative;
}

.busyIndicator {
position: absolute;
z-index: 1;
inset: 0;
height: 100%;
}

.overlay {
position: absolute;
z-index: 1;
top: 0;
bottom: 0;
left: 0;
right: 0;
inset: 0;
background: var(--sapGroup_ContentBackground);
opacity: 0.8;

@@ -158,7 +162,7 @@
color: var(--sapList_TextColor);
border-block-end: 1px solid var(--sapList_BorderColor);
/* needed for vertical virtualization*/
margin-bottom: -1px;
margin-block-end: -1px;
box-sizing: border-box;
display: flex;

279 changes: 137 additions & 142 deletions packages/main/src/components/AnalyticalTable/index.tsx
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@ import {
SELECT_PRESS_SPACE,
UNSELECT_PRESS_SPACE
} from '../../i18n/i18n-defaults.js';
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping.js';
import { BusyIndicator } from '../../webComponents/BusyIndicator/index.js';
import { Text } from '../../webComponents/Text/index.js';
import { FlexBox } from '../FlexBox/index.js';
@@ -95,19 +94,6 @@ const measureElement = (el: HTMLElement) => {
return el.offsetHeight;
};

//todo: add feature request for parts or even a fix if this turns out to be a bug
addCustomCSSWithScoping(
'ui5-busy-indicator',
`
:host([data-component-name="AnalyticalTableBusyIndicator"]) .ui5-busy-indicator-root {
display: initial;
}
:host([data-component-name="AnalyticalTableBusyIndicator"]) .ui5-busy-indicator-busy-area:focus {
border-radius: 0;
}
`
);

/**
* The `AnalyticalTable` provides a set of convenient functions for responsive table design, including virtualization of rows and columns, infinite scrolling and customizable columns that will, unless otherwise defined, distribute the available space equally among themselves.
* It also provides several possibilities for working with the data, including sorting, filtering, grouping and aggregation.
@@ -717,143 +703,152 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
</TitleBar>
)}
{extension && <div ref={extensionRef}>{extension}</div>}
<BusyIndicator active={loading} delay={loadingDelay} data-component-name="AnalyticalTableBusyIndicator">
<FlexBox
className={classNames.tableContainerWithScrollBar}
data-component-name="AnalyticalTableContainerWithScrollbar"
>
{showOverlay && (
<>
<span id={invalidTableTextId} className={classNames.hiddenA11yText} aria-hidden>
{invalidTableA11yText}
</span>
<div
tabIndex={0}
aria-labelledby={`${titleBarId} ${invalidTableTextId}`}
role="region"
data-component-name="AnalyticalTableOverlay"
className={classNames.overlay}
/>
</>
)}
<div
aria-labelledby={titleBarId}
{...getTableProps()}
tabIndex={showOverlay ? -1 : 0}
role="grid"
aria-rowcount={rows.length}
aria-colcount={visibleColumns.length}
data-per-page={internalVisibleRowCount}
data-component-name="AnalyticalTableContainer"
ref={tableRef}
className={tableClasses}
<FlexBox
className={classNames.tableContainerWithScrollBar}
data-component-name="AnalyticalTableContainerWithScrollbar"
>
{loading && (
<BusyIndicator
className={classNames.busyIndicator}
active={true}
delay={loadingDelay}
data-component-name="AnalyticalTableBusyIndicator"
>
<div className={classNames.tableHeaderBackgroundElement} />
<div className={classNames.tableBodyBackgroundElement} />
{headerGroups.map((headerGroup) => {
let headerProps: Record<string, unknown> = {};
if (headerGroup.getHeaderGroupProps) {
headerProps = headerGroup.getHeaderGroupProps();
}
return (
tableRef.current && (
<ColumnHeaderContainer
ref={headerRef}
key={headerProps.key as string}
resizeInfo={tableState.columnResizing}
headerProps={headerProps}
headerGroup={headerGroup}
onSort={onSort}
onGroupByChanged={onGroupByChanged}
isRtl={isRtl}
columnVirtualizer={columnVirtualizer}
uniqueId={uniqueId}
showVerticalEndBorder={showVerticalEndBorder}
/>
)
);
})}
{loading && rows?.length === 0 && (
<TablePlaceholder columns={visibleColumns} rows={minRows} style={noDataStyles} />
)}
{!loading && rows?.length === 0 && (
<NoDataComponent
noDataText={noDataTextLocal}
className={classNames.noDataContainer}
style={noDataStyles}
/>
)}
{rows?.length > 0 && tableRef.current && (
<VirtualTableBodyContainer
rowCollapsedFlag={tableState.rowCollapsed}
dispatch={dispatch}
tableBodyHeight={tableBodyHeight}
totalColumnsWidth={columnVirtualizer.getTotalSize()}
parentRef={parentRef}
classes={classNames}
infiniteScroll={infiniteScroll}
infiniteScrollThreshold={infiniteScrollThreshold}
onLoadMore={handleOnLoadMore}
internalRowHeight={internalRowHeight}
popInRowHeight={popInRowHeight}
rows={rows}
handleExternalScroll={handleBodyScroll}
visibleRows={internalVisibleRowCount}
>
<VirtualTableBody
scrollContainerRef={scrollContainerRef}
classes={classNames}
prepareRow={prepareRow}
rows={rows}
scrollToRef={scrollToRef}
isTreeTable={isTreeTable}
internalRowHeight={internalRowHeight}
popInRowHeight={popInRowHeight}
alternateRowColor={alternateRowColor}
visibleColumns={visibleColumns}
renderRowSubComponent={renderRowSubComponent}
alwaysShowSubComponent={alwaysShowSubComponent}
markNavigatedRow={markNavigatedRow}
{/*todo: This is necessary; otherwise, the overlay bg color will not be applied. https://github.com/SAP/ui5-webcomponents/issues/9723 */}
<span />
</BusyIndicator>
)}
{showOverlay && (
<>
<span id={invalidTableTextId} className={classNames.hiddenA11yText} aria-hidden>
{invalidTableA11yText}
</span>
<div
tabIndex={0}
aria-labelledby={`${titleBarId} ${invalidTableTextId}`}
role="region"
data-component-name="AnalyticalTableOverlay"
className={classNames.overlay}
/>
</>
)}
<div
aria-labelledby={titleBarId}
{...getTableProps()}
tabIndex={showOverlay ? -1 : 0}
role="grid"
aria-rowcount={rows.length}
aria-colcount={visibleColumns.length}
data-per-page={internalVisibleRowCount}
data-component-name="AnalyticalTableContainer"
ref={tableRef}
className={tableClasses}
>
<div className={classNames.tableHeaderBackgroundElement} />
<div className={classNames.tableBodyBackgroundElement} />
{headerGroups.map((headerGroup) => {
let headerProps: Record<string, unknown> = {};
if (headerGroup.getHeaderGroupProps) {
headerProps = headerGroup.getHeaderGroupProps();
}
return (
tableRef.current && (
<ColumnHeaderContainer
ref={headerRef}
key={headerProps.key as string}
resizeInfo={tableState.columnResizing}
headerProps={headerProps}
headerGroup={headerGroup}
onSort={onSort}
onGroupByChanged={onGroupByChanged}
isRtl={isRtl}
subComponentsHeight={tableState.subComponentsHeight}
dispatch={dispatch}
columnVirtualizer={columnVirtualizer}
manualGroupBy={reactTableOptions?.manualGroupBy as boolean | undefined}
subRowsKey={subRowsKey}
subComponentsBehavior={subComponentsBehavior}
triggerScroll={tableState.triggerScroll}
rowVirtualizer={rowVirtualizer}
uniqueId={uniqueId}
showVerticalEndBorder={showVerticalEndBorder}
/>
</VirtualTableBodyContainer>
)}
</div>
{(additionalEmptyRowsCount || tableState.isScrollable === undefined || tableState.isScrollable) && (
<VerticalScrollbar
)
);
})}
{loading && rows?.length === 0 && (
<TablePlaceholder columns={visibleColumns} rows={minRows} style={noDataStyles} />
)}
{!loading && rows?.length === 0 && (
<NoDataComponent
noDataText={noDataTextLocal}
className={classNames.noDataContainer}
style={noDataStyles}
/>
)}
{rows?.length > 0 && tableRef.current && (
<VirtualTableBodyContainer
rowCollapsedFlag={tableState.rowCollapsed}
dispatch={dispatch}
tableBodyHeight={tableBodyHeight}
internalRowHeight={internalHeaderRowHeight}
tableRef={tableRef}
handleVerticalScrollBarScroll={handleVerticalScrollBarScroll}
ref={verticalScrollBarRef}
scrollContainerRef={scrollContainerRef}
totalColumnsWidth={columnVirtualizer.getTotalSize()}
parentRef={parentRef}
nativeScrollbar={className?.includes('ui5-content-native-scrollbars')}
/>
classes={classNames}
infiniteScroll={infiniteScroll}
infiniteScrollThreshold={infiniteScrollThreshold}
onLoadMore={handleOnLoadMore}
internalRowHeight={internalRowHeight}
popInRowHeight={popInRowHeight}
rows={rows}
handleExternalScroll={handleBodyScroll}
visibleRows={internalVisibleRowCount}
>
<VirtualTableBody
scrollContainerRef={scrollContainerRef}
classes={classNames}
prepareRow={prepareRow}
rows={rows}
scrollToRef={scrollToRef}
isTreeTable={isTreeTable}
internalRowHeight={internalRowHeight}
popInRowHeight={popInRowHeight}
alternateRowColor={alternateRowColor}
visibleColumns={visibleColumns}
renderRowSubComponent={renderRowSubComponent}
alwaysShowSubComponent={alwaysShowSubComponent}
markNavigatedRow={markNavigatedRow}
isRtl={isRtl}
subComponentsHeight={tableState.subComponentsHeight}
dispatch={dispatch}
columnVirtualizer={columnVirtualizer}
manualGroupBy={reactTableOptions?.manualGroupBy as boolean | undefined}
subRowsKey={subRowsKey}
subComponentsBehavior={subComponentsBehavior}
triggerScroll={tableState.triggerScroll}
rowVirtualizer={rowVirtualizer}
/>
</VirtualTableBodyContainer>
)}
</FlexBox>
{visibleRowCountMode === AnalyticalTableVisibleRowCountMode.Interactive && (
<VerticalResizer
popInRowHeight={popInRowHeight}
hasPopInColumns={tableState?.popInColumns?.length > 0}
analyticalTableRef={analyticalTableRef}
dispatch={dispatch}
extensionsHeight={extensionsHeight}
internalRowHeight={internalRowHeight}
rowsLength={rows.length}
visibleRows={internalVisibleRowCount}
handleOnLoadMore={handleOnLoadMore}
</div>
{(additionalEmptyRowsCount || tableState.isScrollable === undefined || tableState.isScrollable) && (
<VerticalScrollbar
tableBodyHeight={tableBodyHeight}
internalRowHeight={internalHeaderRowHeight}
tableRef={tableRef}
handleVerticalScrollBarScroll={handleVerticalScrollBarScroll}
ref={verticalScrollBarRef}
scrollContainerRef={scrollContainerRef}
parentRef={parentRef}
nativeScrollbar={className?.includes('ui5-content-native-scrollbars')}
/>
)}
</BusyIndicator>
</FlexBox>
{visibleRowCountMode === AnalyticalTableVisibleRowCountMode.Interactive && (
<VerticalResizer
popInRowHeight={popInRowHeight}
hasPopInColumns={tableState?.popInColumns?.length > 0}
analyticalTableRef={analyticalTableRef}
dispatch={dispatch}
extensionsHeight={extensionsHeight}
internalRowHeight={internalRowHeight}
rowsLength={rows.length}
visibleRows={internalVisibleRowCount}
handleOnLoadMore={handleOnLoadMore}
/>
)}
</div>
<Text
aria-hidden="true"

Unchanged files with check annotations Beta

function ResizeTestComponent({ onChange }: { onChange: (event: { width: number; height: number }) => void }) {
useEffect(() => {
attachResizeHandler(onChange);
}, []);

Check warning on line 12 in packages/base/src/Device/index.cy.tsx

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array
const unregister = () => {
detachResizeHandler(onChange);
}) {
useEffect(() => {
attachOrientationChangeHandler(onChange);
}, []);

Check warning on line 32 in packages/base/src/Device/index.cy.tsx

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array
const unregister = () => {
detachOrientationChangeHandler(onChange);
* @param measure {IChartMeasure} Current measure object
* @param dataElement {object} Current data element
*/
highlightColor?: (value: number, measure: MeasureConfig, dataElement: Record<string, any>) => CSSProperties['color'];

Check warning on line 79 in packages/charts/src/components/BarChart/BarChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
}
interface DimensionConfig extends IChartDimension {
? dataKeys.findIndex((key) => key === chartConfig.secondYAxis?.dataKey)
: 0;
const [componentRef, chartRef] = useSyncRef<any>(ref);

Check warning on line 189 in packages/charts/src/components/BarChart/BarChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
const onItemLegendClick = useLegendItemClick(onLegendClick);
const labelFormatter = useLabelFormatter(primaryDimension);
speed={2}
backgroundColor={ThemingParameters.sapContent_ImagePlaceholderBackground}
foregroundColor={ThemingParameters.sapContent_ImagePlaceholderForegroundColor}
backgroundOpacity={ThemingParameters.sapContent_DisabledOpacity as any}

Check warning on line 15 in packages/charts/src/components/BarChart/Placeholder.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
>
<rect x="20" y="10" width="1" height="135" />
<rect x="20" y="20" width="85" height="15" />
* @param measure {IChartMeasure} Current measure object
* @param dataElement {object} Current data element
*/
highlightColor?: (value: number, measure: MeasureConfig, dataElement: Record<string, any>) => CSSProperties['color'];

Check warning on line 69 in packages/charts/src/components/BulletChart/BulletChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
}
interface DimensionConfig extends IChartDimension {
...rest
} = props;
const [componentRef, chartRef] = useSyncRef<any>(ref);

Check warning on line 149 in packages/charts/src/components/BulletChart/BulletChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
const chartConfig: BulletChartProps['chartConfig'] = {
yAxisVisible: false,
);
} else {
onDataPointClick(
enrichEventWithDetails({} as any, {

Check warning on line 228 in packages/charts/src/components/BulletChart/BulletChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
value: eventOrIndex.value,
dataKey: eventOrIndex.dataKey,
dataIndex: eventOrIndex.index,
{chartConfig.xAxisVisible &&
dimensions.map((dimension, index) => {
let AxisComponent;
const axisProps: any = {

Check warning on line 304 in packages/charts/src/components/BulletChart/BulletChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
dataKey: dimension.accessor,
interval: dimension?.interval ?? (isBigDataSet ? 'preserveStart' : 0),
tickLine: index < 1,
/>
)}
{sortedMeasures?.map((element, index) => {
const chartElementProps: any = {

Check warning on line 442 in packages/charts/src/components/BulletChart/BulletChart.tsx

GitHub Actions / lint

Unexpected any. Specify a different type
isAnimationActive: !noAnimation
};
let labelPosition = 'top';