|
1 |
| -import { ThemingParameters, useStylesheet } from '@ui5/webcomponents-react-base'; |
| 1 | +import { useStylesheet } from '@ui5/webcomponents-react-base'; |
2 | 2 | import { clsx } from 'clsx';
|
3 | 3 | import type { CSSProperties, FC } from 'react';
|
| 4 | +import type { ColumnType } from '../../types/index.js'; |
4 | 5 | import { resolveCellAlignment } from '../../util/index.js';
|
5 |
| -import { classNames, styleData } from './TablePlaceholder.module.css.js'; |
| 6 | +import { classNames, content } from './TablePlaceholder.module.css.js'; |
6 | 7 |
|
7 |
| -const getArrayOfLength = (len) => Array.from(Array(len).keys()); |
| 8 | +const getArrayOfLength = (len: number) => Array.from(Array(len).keys()); |
8 | 9 |
|
9 | 10 | interface TablePlaceholderPropTypes {
|
10 |
| - columns: any[]; |
11 |
| - rows: number; |
12 | 11 | style: CSSProperties;
|
| 12 | + columns: ColumnType[]; |
| 13 | + rows: number; |
| 14 | + pleaseWaitText: string; |
13 | 15 | }
|
14 | 16 |
|
15 | 17 | export const TablePlaceholder: FC<TablePlaceholderPropTypes> = (props) => {
|
16 |
| - const { columns, rows = 5, style } = props; |
| 18 | + const { columns, rows = 5, style, pleaseWaitText } = props; |
17 | 19 |
|
18 |
| - useStylesheet(styleData, TablePlaceholder.displayName); |
| 20 | + useStylesheet(content, TablePlaceholder.displayName); |
19 | 21 |
|
20 | 22 | return (
|
21 |
| - <div |
22 |
| - style={{ |
23 |
| - backgroundColor: ThemingParameters.sapList_Background, |
24 |
| - width: '100%', |
25 |
| - ...style |
26 |
| - }} |
27 |
| - data-component-name="AnalyticalTableLoadingPlaceholder" |
28 |
| - > |
29 |
| - {getArrayOfLength(rows).map((_, index) => { |
30 |
| - return ( |
31 |
| - <div className={classNames.row} key={`row-${index}`}> |
32 |
| - {columns.map((col) => { |
33 |
| - return ( |
34 |
| - <div |
35 |
| - key={`row${index}-${col.id}`} |
36 |
| - className={classNames.cellContainer} |
37 |
| - style={{ width: col.totalWidth, ...resolveCellAlignment(col) }} |
38 |
| - > |
39 |
| - <div className={clsx(classNames.cell, classNames.animation)} /> |
40 |
| - </div> |
41 |
| - ); |
42 |
| - })} |
43 |
| - </div> |
44 |
| - ); |
45 |
| - })} |
| 23 | + <div role="gridcell"> |
| 24 | + <div |
| 25 | + style={style} |
| 26 | + className={classNames.container} |
| 27 | + title={pleaseWaitText} |
| 28 | + role="progressbar" |
| 29 | + aria-valuetext="Busy" |
| 30 | + data-component-name="AnalyticalTableLoadingPlaceholder" |
| 31 | + > |
| 32 | + {getArrayOfLength(rows).map((_, index) => { |
| 33 | + return ( |
| 34 | + <div className={classNames.row} key={`row-${index}`}> |
| 35 | + {columns.map((col) => { |
| 36 | + return ( |
| 37 | + <div |
| 38 | + key={`row${index}-${col.id}`} |
| 39 | + className={classNames.cellContainer} |
| 40 | + style={{ width: col.totalWidth, ...resolveCellAlignment(col) }} |
| 41 | + > |
| 42 | + <div className={clsx(classNames.cell, classNames.animation)} /> |
| 43 | + </div> |
| 44 | + ); |
| 45 | + })} |
| 46 | + </div> |
| 47 | + ); |
| 48 | + })} |
| 49 | + </div> |
46 | 50 | </div>
|
47 | 51 | );
|
48 | 52 | };
|
|
0 commit comments