Skip to content

Commit 80382b8

Browse files
authored
feat(AnalyticalTable): introduce alwaysShowBusyIndicator prop (#7448)
Closes #7402
1 parent 5ebaf8f commit 80382b8

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,16 @@ describe('AnalyticalTable', () => {
15391539
'opacity',
15401540
'0.4',
15411541
);
1542+
cy.mount(<AnalyticalTable data={[]} columns={columns} loading loadingDelay={0} alwaysShowBusyIndicator />);
1543+
cy.get('[data-component-name="AnalyticalTableLoadingPlaceholder"]').should('not.exist');
1544+
cy.get('.ui5-busy-indicator-busy-area', { timeout: 2000 }).should('be.visible');
1545+
cy.get('[data-component-name="AnalyticalTableContainerWithScrollbar"] > :not([class*="busyIndicator"])').should(
1546+
'have.css',
1547+
'opacity',
1548+
'0.4',
1549+
);
15421550
cy.mount(<AnalyticalTable data={data} columns={columns} loading />);
1551+
cy.get('[data-component-name="AnalyticalTableLoadingPlaceholder"]').should('not.exist');
15431552
cy.get('.ui5-busy-indicator-busy-area', { timeout: 2000 }).should('be.visible');
15441553
cy.get('[data-component-name="AnalyticalTableContainerWithScrollbar"] > :not([class*="busyIndicator"])').should(
15451554
'have.css',

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ const measureElement = (el: HTMLElement) => {
107107
*/
108108
const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTypes>((props, ref) => {
109109
const {
110-
alternateRowColor,
111110
adjustTableHeightOnPopIn,
111+
alternateRowColor,
112+
alwaysShowBusyIndicator,
112113
className,
113114
columnOrder,
114115
columns,
@@ -749,7 +750,7 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
749750
className={classNames.tableContainerWithScrollBar}
750751
data-component-name="AnalyticalTableContainerWithScrollbar"
751752
>
752-
{loading && !!rows.length && (
753+
{loading && (!!rows.length || alwaysShowBusyIndicator) && (
753754
<BusyIndicator
754755
className={classNames.busyIndicator}
755756
active={true}
@@ -816,7 +817,7 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
816817
tabIndex={0}
817818
className={classNames.noDataContainer}
818819
>
819-
{loading ? (
820+
{loading && !alwaysShowBusyIndicator ? (
820821
<TablePlaceholder
821822
columns={visibleColumns}
822823
rows={minRows}

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ export interface AnalyticalTablePropTypes extends Omit<CommonProps, 'title'> {
707707
/**
708708
* Indicates whether a loading indicator should be shown.
709709
*
710-
* __Note:__ If the data array is not empty and loading is set to `true` a `BusyIndicator` will be displayed on top of the table, otherwise a skeleton placeholder will be shown.
710+
* __Note:__ If the data array is not empty and loading is set to `true` a `BusyIndicator` will be displayed on top of the table, otherwise a skeleton placeholder will be shown. You can control this behavior via the `alwaysShowBusyIndicator` prop.
711711
*/
712712
loading?: boolean;
713713
/**
@@ -720,6 +720,10 @@ export interface AnalyticalTablePropTypes extends Omit<CommonProps, 'title'> {
720720
* Setting this prop to `true` will show an overlay on top of the AnalyticalTable content preventing users from interacting with it.
721721
*/
722722
showOverlay?: boolean;
723+
/**
724+
* If `true`, always shows the `BusyIndicator` component when loading instead of the skeleton loader.
725+
*/
726+
alwaysShowBusyIndicator?: boolean;
723727
/**
724728
* Defines the text shown if the data array is empty or a filtered table doesn't return results.
725729
*

0 commit comments

Comments
 (0)