@patternfly/react-table 6.6.2 → 6.7.0-prerelease.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -2
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -1
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
- package/dist/dynamic/components/Table/utils/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic-modules.json +2 -0
- package/dist/esm/components/Table/EditColumn.js +2 -2
- package/dist/esm/components/Table/EditColumn.js.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js +2 -2
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/esm/components/Table/SortColumn.js +5 -5
- package/dist/esm/components/Table/SortColumn.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +2 -0
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +3 -3
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/Tfoot.d.ts +11 -0
- package/dist/esm/components/Table/Tfoot.d.ts.map +1 -0
- package/dist/esm/components/Table/Tfoot.js +12 -0
- package/dist/esm/components/Table/Tfoot.js.map +1 -0
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +2 -1
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/esm/components/Table/index.d.ts +1 -0
- package/dist/esm/components/Table/index.d.ts.map +1 -1
- package/dist/esm/components/Table/index.js +1 -0
- package/dist/esm/components/Table/index.js.map +1 -1
- package/dist/esm/components/Table/utils/inert.d.ts +6 -0
- package/dist/esm/components/Table/utils/inert.d.ts.map +1 -0
- package/dist/esm/components/Table/utils/inert.js +7 -0
- package/dist/esm/components/Table/utils/inert.js.map +1 -0
- package/dist/esm/demos/DashboardHeader.js +3 -3
- package/dist/esm/demos/DashboardHeader.js.map +1 -1
- package/dist/esm/deprecated/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Table/Table.js +1 -0
- package/dist/esm/deprecated/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/EditColumn.js +2 -2
- package/dist/js/components/Table/EditColumn.js.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.js +2 -2
- package/dist/js/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/js/components/Table/SortColumn.js +5 -5
- package/dist/js/components/Table/SortColumn.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +2 -0
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +3 -3
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/Tfoot.d.ts +11 -0
- package/dist/js/components/Table/Tfoot.d.ts.map +1 -0
- package/dist/js/components/Table/Tfoot.js +15 -0
- package/dist/js/components/Table/Tfoot.js.map +1 -0
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +2 -1
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/index.d.ts +1 -0
- package/dist/js/components/Table/index.d.ts.map +1 -1
- package/dist/js/components/Table/index.js +1 -0
- package/dist/js/components/Table/index.js.map +1 -1
- package/dist/js/components/Table/utils/inert.d.ts +6 -0
- package/dist/js/components/Table/utils/inert.d.ts.map +1 -0
- package/dist/js/components/Table/utils/inert.js +10 -0
- package/dist/js/components/Table/utils/inert.js.map +1 -0
- package/dist/js/demos/DashboardHeader.js +3 -3
- package/dist/js/demos/DashboardHeader.js.map +1 -1
- package/dist/js/deprecated/components/Table/Table.d.ts.map +1 -1
- package/dist/js/deprecated/components/Table/Table.js +1 -0
- package/dist/js/deprecated/components/Table/Table.js.map +1 -1
- package/dist/umd/assets/{output-DWpq4Q2w.css → output-BNLyshf1.css} +3026 -2901
- package/dist/umd/react-table.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Table/EditColumn.tsx +2 -2
- package/src/components/Table/HeaderCellInfoWrapper.tsx +3 -3
- package/src/components/Table/SortColumn.tsx +5 -5
- package/src/components/Table/Table.tsx +4 -0
- package/src/components/Table/Tfoot.tsx +23 -0
- package/src/components/Table/Tr.tsx +2 -1
- package/src/components/Table/__tests__/Table.test.tsx +12 -0
- package/src/components/Table/__tests__/Tfoot.test.tsx +65 -0
- package/src/components/Table/examples/Table.md +13 -4
- package/src/components/Table/examples/TableEditable.tsx +35 -37
- package/src/components/Table/examples/TableEmptyState.tsx +7 -2
- package/src/components/Table/examples/TableStickyFooter.tsx +33 -0
- package/src/components/Table/examples/TableTree.tsx +3 -3
- package/src/components/Table/index.ts +1 -0
- package/src/components/Table/utils/inert.ts +7 -0
- package/src/demos/DashboardHeader.tsx +3 -3
- package/src/demos/Table.md +5 -6
- package/src/demos/examples/TableColumnManagement.tsx +7 -6
- package/src/demos/examples/TableColumnManagementWithDraggable.tsx +7 -6
- package/src/demos/examples/TableCompact.tsx +8 -7
- package/src/demos/examples/TableCompoundExpansion.tsx +2 -2
- package/src/demos/examples/TableEmptyStateDefault.tsx +2 -2
- package/src/demos/examples/TableExpandCollapseAll.tsx +6 -6
- package/src/demos/examples/TableFilterable.tsx +10 -9
- package/src/demos/examples/TableSortableResponsive.tsx +10 -9
- package/src/demos/examples/TableStaticBottomPagination.tsx +8 -7
- package/src/demos/examples/TableStickyHeader.tsx +6 -6
- package/src/deprecated/components/Table/Table.tsx +1 -0
- package/src/deprecated/components/Table/__tests__/Table.test.tsx +19 -0
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +869 -326
- package/src/deprecated/components/Table/examples/LegacyTableEmptyState.tsx +2 -2
- package/src/deprecated/components/Table/examples/LegacyTableTree.tsx +3 -3
- package/src/deprecated/components/Table/examples/Table.md +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0-prerelease.2",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@patternfly/react-core": "^6.
|
|
44
|
-
"@patternfly/react-icons": "^6.
|
|
45
|
-
"@patternfly/react-styles": "^6.
|
|
46
|
-
"@patternfly/react-tokens": "^6.
|
|
43
|
+
"@patternfly/react-core": "^6.7.0-prerelease.2",
|
|
44
|
+
"@patternfly/react-icons": "^6.7.0-prerelease.0",
|
|
45
|
+
"@patternfly/react-styles": "^6.7.0-prerelease.0",
|
|
46
|
+
"@patternfly/react-tokens": "^6.7.0-prerelease.1",
|
|
47
47
|
"lodash": "^4.18.1",
|
|
48
48
|
"tslib": "^2.8.1"
|
|
49
49
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react": "^17 || ^18 || ^19",
|
|
52
52
|
"react-dom": "^17 || ^18 || ^19"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "6a486021829bef4ba8c6a772c035b364ab5f0686"
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
|
|
3
3
|
import RhUiEditFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-edit-fill-icon';
|
|
4
|
-
import
|
|
4
|
+
import RhMicronsCheckmarkIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-checkmark-icon';
|
|
5
5
|
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
|
|
6
6
|
import { OnRowEdit } from './TableTypes';
|
|
7
7
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
@@ -38,7 +38,7 @@ export const EditColumn: React.FunctionComponent<EditColumnProps> = ({
|
|
|
38
38
|
{...props}
|
|
39
39
|
onClick={(e) => onClick(e, 'save')}
|
|
40
40
|
variant="plain"
|
|
41
|
-
icon={<
|
|
41
|
+
icon={<RhMicronsCheckmarkIcon />}
|
|
42
42
|
/>
|
|
43
43
|
</div>
|
|
44
44
|
<div className={css(inlineStyles.inlineEditAction)}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import RhUiQuestionMarkCircleIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-icon';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
4
4
|
import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
@@ -55,7 +55,7 @@ export const HeaderCellInfoWrapper: React.FunctionComponent<ColumnHelpWrapperPro
|
|
|
55
55
|
variant="plain"
|
|
56
56
|
hasNoPadding
|
|
57
57
|
aria-label={ariaLabel || (typeof info === 'string' && info) || 'More info'}
|
|
58
|
-
icon={<
|
|
58
|
+
icon={<RhUiQuestionMarkCircleIcon />}
|
|
59
59
|
/>
|
|
60
60
|
</Tooltip>
|
|
61
61
|
) : (
|
|
@@ -64,7 +64,7 @@ export const HeaderCellInfoWrapper: React.FunctionComponent<ColumnHelpWrapperPro
|
|
|
64
64
|
variant="plain"
|
|
65
65
|
hasNoPadding
|
|
66
66
|
aria-label={ariaLabel || (typeof info === 'string' && info) || 'More info'}
|
|
67
|
-
icon={<
|
|
67
|
+
icon={<RhUiQuestionMarkCircleIcon />}
|
|
68
68
|
/>
|
|
69
69
|
</Popover>
|
|
70
70
|
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import RhMicronsArrowUpIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-arrow-up-icon';
|
|
3
|
+
import RhMicronsArrowDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-arrow-down-icon';
|
|
4
|
+
import RhUiArrowUpDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-up-down-icon';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
7
7
|
import { TableText } from './TableText';
|
|
@@ -43,9 +43,9 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
|
|
|
43
43
|
let SortedByIcon;
|
|
44
44
|
const [focused, setFocused] = useState(false);
|
|
45
45
|
if (isSortedBy) {
|
|
46
|
-
SortedByIcon = sortDirection === SortByDirection.asc ?
|
|
46
|
+
SortedByIcon = sortDirection === SortByDirection.asc ? RhMicronsArrowUpIcon : RhMicronsArrowDownIcon;
|
|
47
47
|
} else {
|
|
48
|
-
SortedByIcon =
|
|
48
|
+
SortedByIcon = RhUiArrowUpDownIcon;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (favoriteButtonProps) {
|
|
@@ -58,6 +58,8 @@ export interface TableProps extends React.HTMLProps<HTMLTableElement>, OUIAProps
|
|
|
58
58
|
isStickyHeaderBase?: boolean;
|
|
59
59
|
/** @beta Flag indicating the table header should have stuck styling, when the header is not at the top of the scroll container. */
|
|
60
60
|
isStickyHeaderStuck?: boolean;
|
|
61
|
+
/** Flag indicating the table footer should stick to the bottom of its scroll container. */
|
|
62
|
+
isStickyFooter?: boolean;
|
|
61
63
|
/** @hide Forwarded ref */
|
|
62
64
|
innerRef?: React.RefObject<any>;
|
|
63
65
|
/** Flag indicating table is a tree table */
|
|
@@ -104,6 +106,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
104
106
|
isStickyHeader = false,
|
|
105
107
|
isStickyHeaderBase = false,
|
|
106
108
|
isStickyHeaderStuck = false,
|
|
109
|
+
isStickyFooter = false,
|
|
107
110
|
isPlain = false,
|
|
108
111
|
isNoPlainOnGlass = false,
|
|
109
112
|
gridBreakPoint = TableGridBreakpoint.gridMd,
|
|
@@ -233,6 +236,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
233
236
|
isStickyHeader && styles.modifiers.stickyHeader,
|
|
234
237
|
isStickyHeaderBase && styles.modifiers.stickyHeaderBase,
|
|
235
238
|
isStickyHeaderStuck && styles.modifiers.stickyHeaderStuck,
|
|
239
|
+
isStickyFooter && styles.modifiers.stickyFooter,
|
|
236
240
|
isTreeTable && stylesTreeView.modifiers.treeView,
|
|
237
241
|
isStriped && styles.modifiers.striped,
|
|
238
242
|
isExpandable && styles.modifiers.expandable,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
4
|
+
|
|
5
|
+
export interface TfootProps extends React.HTMLProps<HTMLTableSectionElement> {
|
|
6
|
+
/** Content rendered inside the <tfoot> row group */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Additional classes added to the <tfoot> element */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** @hide Forwarded ref */
|
|
11
|
+
innerRef?: React.Ref<any>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TfootBase: React.FunctionComponent<TfootProps> = ({ children, className, innerRef, ...props }: TfootProps) => (
|
|
15
|
+
<tfoot className={css(styles.tableTfoot, className)} ref={innerRef} {...props}>
|
|
16
|
+
{children}
|
|
17
|
+
</tfoot>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Tfoot = forwardRef((props: TfootProps, ref: React.Ref<HTMLTableSectionElement>) => (
|
|
21
|
+
<TfootBase {...props} innerRef={ref} />
|
|
22
|
+
));
|
|
23
|
+
Tfoot.displayName = 'Tfoot';
|
|
@@ -4,6 +4,7 @@ import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
|
4
4
|
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import { TableContext } from './Table';
|
|
7
|
+
import { IS_INERT } from './utils/inert';
|
|
7
8
|
|
|
8
9
|
export interface TrProps extends Omit<React.HTMLProps<HTMLTableRowElement>, 'onResize'>, OUIAProps {
|
|
9
10
|
/** Content rendered inside the <tr> row */
|
|
@@ -115,7 +116,7 @@ const TrBase: React.FunctionComponent<TrProps> = ({
|
|
|
115
116
|
{...(isClickable && { tabIndex: 0 })}
|
|
116
117
|
aria-label={ariaLabel}
|
|
117
118
|
ref={innerRef}
|
|
118
|
-
{...(hasAnimations && rowIsHidden && { inert:
|
|
119
|
+
{...(hasAnimations && rowIsHidden && { inert: IS_INERT })}
|
|
119
120
|
{...(onRowClick && { onClick: onRowClick, onKeyDown })}
|
|
120
121
|
{...ouiaProps}
|
|
121
122
|
{...props}
|
|
@@ -222,3 +222,15 @@ test(`Does not render with class ${styles.modifiers.stickyHeaderStuck} when isSt
|
|
|
222
222
|
|
|
223
223
|
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.stickyHeaderStuck);
|
|
224
224
|
});
|
|
225
|
+
|
|
226
|
+
test(`Renders with class ${styles.modifiers.stickyFooter} when isStickyFooter is true`, () => {
|
|
227
|
+
render(<Table isStickyFooter aria-label="Test table" />);
|
|
228
|
+
|
|
229
|
+
expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.stickyFooter);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test(`Does not render with class ${styles.modifiers.stickyFooter} when isStickyFooter is false`, () => {
|
|
233
|
+
render(<Table isStickyFooter={false} aria-label="Test table" />);
|
|
234
|
+
|
|
235
|
+
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.stickyFooter);
|
|
236
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Tfoot } from '../Tfoot';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<table>
|
|
8
|
+
<Tfoot />
|
|
9
|
+
</table>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(screen.getByRole('rowgroup')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Renders with children', () => {
|
|
16
|
+
render(
|
|
17
|
+
<table>
|
|
18
|
+
<Tfoot>Footer content</Tfoot>
|
|
19
|
+
</table>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByRole('rowgroup')).toHaveTextContent('Footer content');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test(`Renders with class ${styles.tableTfoot} only by default`, () => {
|
|
26
|
+
render(
|
|
27
|
+
<table>
|
|
28
|
+
<Tfoot />
|
|
29
|
+
</table>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(screen.getByRole('rowgroup')).toHaveClass(styles.tableTfoot, { exact: true });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('Forwards refs to the tfoot element', () => {
|
|
36
|
+
const ref = { current: null } as React.RefObject<HTMLTableSectionElement>;
|
|
37
|
+
|
|
38
|
+
render(
|
|
39
|
+
<table>
|
|
40
|
+
<Tfoot ref={ref} />
|
|
41
|
+
</table>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
expect(ref.current).toBe(screen.getByRole('rowgroup'));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Renders with custom class names provided via prop', () => {
|
|
48
|
+
render(
|
|
49
|
+
<table>
|
|
50
|
+
<Tfoot className="custom-footer" />
|
|
51
|
+
</table>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
expect(screen.getByRole('rowgroup')).toHaveClass('custom-footer');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('Spreads additional props', () => {
|
|
58
|
+
render(
|
|
59
|
+
<table>
|
|
60
|
+
<Tfoot data-custom="true" />
|
|
61
|
+
</table>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
expect(screen.getByRole('rowgroup')).toHaveAttribute('data-custom', 'true');
|
|
65
|
+
});
|
|
@@ -10,6 +10,7 @@ propComponents:
|
|
|
10
10
|
'Tr',
|
|
11
11
|
'Th',
|
|
12
12
|
'Td',
|
|
13
|
+
'Tfoot',
|
|
13
14
|
'Caption',
|
|
14
15
|
'TableText',
|
|
15
16
|
'TdActionsType',
|
|
@@ -42,18 +43,18 @@ The `Table` component takes an explicit and declarative approach, and its implem
|
|
|
42
43
|
The documentation for the deprecated table implementation can be found under the [React deprecated](/components/table/react-deprecated) tab. It is configuration based and takes a less declarative and more implicit approach to laying out the table structure, such as the rows and cells within it.
|
|
43
44
|
|
|
44
45
|
import { Fragment, isValidElement, useCallback, useEffect, useRef, useState, useLayoutEffect } from 'react';
|
|
45
|
-
import
|
|
46
|
+
import RhMicronsSearchIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-search-icon';
|
|
46
47
|
import RhUiCodeIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-code-icon';
|
|
47
48
|
import RhUiBranchFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-branch-fill-icon';
|
|
48
49
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
49
50
|
import LeafIcon from '@patternfly/react-icons/dist/esm/icons/leaf-icon';
|
|
50
|
-
import
|
|
51
|
-
import
|
|
51
|
+
import RhUiFolderFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-fill-icon';
|
|
52
|
+
import RhUiFolderOpenFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-open-fill-icon';
|
|
52
53
|
import RhMicronsSortDownLargeToSmallIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-sort-down-large-to-small-icon';
|
|
53
54
|
import RhUiBlueprintIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-blueprint-icon';
|
|
54
55
|
import RhUiEditFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-edit-fill-icon';
|
|
55
56
|
import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
|
|
56
|
-
import
|
|
57
|
+
import RhMicronsCheckmarkIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-checkmark-icon';
|
|
57
58
|
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
|
|
58
59
|
|
|
59
60
|
import { css } from '@patternfly/react-styles';
|
|
@@ -480,6 +481,14 @@ The second `Tr` represents the second level of sub columns. The `Th` in this row
|
|
|
480
481
|
|
|
481
482
|
```
|
|
482
483
|
|
|
484
|
+
### Sticky footer
|
|
485
|
+
|
|
486
|
+
Use `Tfoot` for semantic table footer rows. Set `isStickyFooter` on `Table` to keep the footer visible while its scroll container is scrolling.
|
|
487
|
+
|
|
488
|
+
```ts file="TableStickyFooter.tsx"
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
|
|
483
492
|
### Striped
|
|
484
493
|
|
|
485
494
|
To apply striping to a basic table, add the `isStriped` property to `Table`.
|
|
@@ -2,7 +2,7 @@ import { isValidElement, useRef, useState } from 'react';
|
|
|
2
2
|
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
3
3
|
import { Button, Checkbox, Radio, TextInput, KeyTypes, getUniqueId } from '@patternfly/react-core';
|
|
4
4
|
import RhUiEditFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-edit-fill-icon';
|
|
5
|
-
import
|
|
5
|
+
import RhMicronsCheckmarkIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-checkmark-icon';
|
|
6
6
|
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
|
|
7
7
|
import inlineEditStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
|
|
8
8
|
import { css } from '@patternfly/react-styles';
|
|
@@ -35,49 +35,47 @@ const EditButtonsCell: React.FunctionComponent<EditButtonsCellProps> = ({
|
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<>
|
|
38
|
-
<Td
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
<Td dataLabel="Edit row data" hasAction>
|
|
39
|
+
<div
|
|
40
|
+
className={css(
|
|
41
|
+
inlineEditStyles.inlineEditGroup,
|
|
42
|
+
inlineEditStyles.modifiers.iconGroup,
|
|
43
|
+
inlineEditStyles.modifiers.actionGroup
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<div className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.valid)}>
|
|
47
|
+
<Button
|
|
48
|
+
aria-label={`Save edits of ${rowAriaLabel}`}
|
|
49
|
+
onClick={() => onClick('save')}
|
|
50
|
+
onKeyDown={(event) => onKeyDown(event, 'stopEditing')}
|
|
51
|
+
variant="plain"
|
|
52
|
+
>
|
|
53
|
+
<RhMicronsCheckmarkIcon />
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
<div className={css(inlineEditStyles.inlineEditAction)}>
|
|
57
|
+
<Button
|
|
58
|
+
aria-label={`Discard edits of ${rowAriaLabel}`}
|
|
59
|
+
onClick={() => onClick('cancel')}
|
|
60
|
+
onKeyDown={(event) => onKeyDown(event, 'stopEditing')}
|
|
61
|
+
variant="plain"
|
|
62
|
+
>
|
|
63
|
+
<RhMicronsCloseIcon />
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
55
66
|
</div>
|
|
56
|
-
<div className={css(inlineEditStyles.inlineEditAction)}>
|
|
67
|
+
<div className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.enableEditable)}>
|
|
57
68
|
<Button
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
ref={editButtonRef}
|
|
70
|
+
aria-label={`Edit ${rowAriaLabel}`}
|
|
71
|
+
onClick={() => onClick('edit')}
|
|
72
|
+
onKeyDown={(event) => onKeyDown(event, 'edit')}
|
|
61
73
|
variant="plain"
|
|
62
74
|
>
|
|
63
|
-
<
|
|
75
|
+
<RhUiEditFillIcon />
|
|
64
76
|
</Button>
|
|
65
77
|
</div>
|
|
66
78
|
</Td>
|
|
67
|
-
<Td
|
|
68
|
-
dataLabel="Edit button"
|
|
69
|
-
className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.enableEditable)}
|
|
70
|
-
>
|
|
71
|
-
<Button
|
|
72
|
-
ref={editButtonRef}
|
|
73
|
-
aria-label={`Edit ${rowAriaLabel}`}
|
|
74
|
-
onClick={() => onClick('edit')}
|
|
75
|
-
onKeyDown={(event) => onKeyDown(event, 'edit')}
|
|
76
|
-
variant="plain"
|
|
77
|
-
>
|
|
78
|
-
<RhUiEditFillIcon />
|
|
79
|
-
</Button>
|
|
80
|
-
</Td>
|
|
81
79
|
</>
|
|
82
80
|
);
|
|
83
81
|
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
EmptyStateFooter,
|
|
9
9
|
EmptyStateActions
|
|
10
10
|
} from '@patternfly/react-core';
|
|
11
|
-
import
|
|
11
|
+
import RhMicronsSearchIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-search-icon';
|
|
12
12
|
|
|
13
13
|
// This example has been simplified to focus on the empty state. In real usage,
|
|
14
14
|
// you may want to derive your rows from typed underlying data and minimal state. See other examples.
|
|
@@ -28,7 +28,12 @@ export const TableEmptyState: React.FunctionComponent = () => (
|
|
|
28
28
|
<Tr>
|
|
29
29
|
<Td colSpan={8}>
|
|
30
30
|
<Bullseye>
|
|
31
|
-
<EmptyState
|
|
31
|
+
<EmptyState
|
|
32
|
+
headingLevel="h2"
|
|
33
|
+
titleText="No results found"
|
|
34
|
+
icon={RhMicronsSearchIcon}
|
|
35
|
+
variant={EmptyStateVariant.sm}
|
|
36
|
+
>
|
|
32
37
|
<EmptyStateBody>Clear all filters and try again.</EmptyStateBody>
|
|
33
38
|
<EmptyStateFooter>
|
|
34
39
|
<EmptyStateActions>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Table, Thead, Tfoot, Tr, Th, Tbody, Td, InnerScrollContainer } from '@patternfly/react-table';
|
|
2
|
+
|
|
3
|
+
export const TableStickyFooter: React.FunctionComponent = () => {
|
|
4
|
+
const rows = Array.from({ length: 12 }, (_, index) => index + 1);
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div style={{ height: '400px' }}>
|
|
8
|
+
<InnerScrollContainer>
|
|
9
|
+
<Table aria-label="Sticky footer table" isStickyFooter>
|
|
10
|
+
<Thead>
|
|
11
|
+
<Tr>
|
|
12
|
+
<Th>Item</Th>
|
|
13
|
+
<Th>Value</Th>
|
|
14
|
+
</Tr>
|
|
15
|
+
</Thead>
|
|
16
|
+
<Tbody>
|
|
17
|
+
{rows.map((row) => (
|
|
18
|
+
<Tr key={row}>
|
|
19
|
+
<Td dataLabel="Item">Item {row}</Td>
|
|
20
|
+
<Td dataLabel="Value">Value {row}</Td>
|
|
21
|
+
</Tr>
|
|
22
|
+
))}
|
|
23
|
+
</Tbody>
|
|
24
|
+
<Tfoot>
|
|
25
|
+
<Tr>
|
|
26
|
+
<Td colSpan={2}>Total: {rows.length} items</Td>
|
|
27
|
+
</Tr>
|
|
28
|
+
</Tfoot>
|
|
29
|
+
</Table>
|
|
30
|
+
</InnerScrollContainer>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Table, Thead, Tr, Th, Tbody, Td, TreeRowWrapper, TdProps } from '@patternfly/react-table';
|
|
3
3
|
import LeafIcon from '@patternfly/react-icons/dist/esm/icons/leaf-icon';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import RhUiFolderFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-fill-icon';
|
|
5
|
+
import RhUiFolderOpenFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-open-fill-icon';
|
|
6
6
|
|
|
7
7
|
interface RepositoriesTreeNode {
|
|
8
8
|
name: string;
|
|
@@ -139,7 +139,7 @@ export const TableTree: React.FunctionComponent = () => {
|
|
|
139
139
|
const isChecked = isNodeChecked(node);
|
|
140
140
|
let icon = <LeafIcon />;
|
|
141
141
|
if (node.children) {
|
|
142
|
-
icon = isExpanded ? <
|
|
142
|
+
icon = isExpanded ? <RhUiFolderOpenFillIcon /> : <RhUiFolderFillIcon />;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
const treeRow: TdProps['treeRow'] = {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { version } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Before React 19, React JSX treats empty string "" as truthy for inert prop.
|
|
5
|
+
* @see {@link https://stackoverflow.com/questions/72720469}
|
|
6
|
+
*/
|
|
7
|
+
export const IS_INERT = Number(version.split('.')[0]) >= 19 ? true : ('' as unknown as boolean);
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
PageToggleButton
|
|
25
25
|
} from '@patternfly/react-core';
|
|
26
26
|
import RhUiSettingsFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-settings-fill-icon';
|
|
27
|
-
import
|
|
27
|
+
import RhUiQuestionMarkCircleIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-icon';
|
|
28
28
|
import RhUiQuestionMarkCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-fill-icon';
|
|
29
29
|
import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
|
|
30
30
|
import imgAvatar from '@patternfly/react-table/src/demos/assets/avatarImg.svg';
|
|
@@ -90,7 +90,7 @@ export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBa
|
|
|
90
90
|
<RhUiSettingsFillIcon /> Settings
|
|
91
91
|
</DropdownItem>
|
|
92
92
|
<DropdownItem>
|
|
93
|
-
<
|
|
93
|
+
<RhUiQuestionMarkCircleIcon /> Help
|
|
94
94
|
</DropdownItem>
|
|
95
95
|
</>
|
|
96
96
|
);
|
|
@@ -149,7 +149,7 @@ export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBa
|
|
|
149
149
|
<ToolbarItem>
|
|
150
150
|
<NotificationBadge
|
|
151
151
|
aria-label="Notifications"
|
|
152
|
-
variant={NotificationBadgeVariant.
|
|
152
|
+
variant={NotificationBadgeVariant.plain}
|
|
153
153
|
onClick={() => {}}
|
|
154
154
|
/>
|
|
155
155
|
</ToolbarItem>
|
package/src/demos/Table.md
CHANGED
|
@@ -48,19 +48,18 @@ ModalBody,
|
|
|
48
48
|
ModalFooter,
|
|
49
49
|
} from '@patternfly/react-core';
|
|
50
50
|
import { DragDropSort } from '@patternfly/react-drag-drop';
|
|
51
|
-
import
|
|
52
|
-
import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
|
|
51
|
+
import RhUiCopyFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-copy-fill-icon';
|
|
53
52
|
import RhUiCodeIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-code-icon';
|
|
54
53
|
import RhUiBranchFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-branch-fill-icon';
|
|
55
54
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
56
55
|
import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
|
|
57
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
58
56
|
import RhMicronsSortDownLargeToSmallIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-sort-down-large-to-small-icon';
|
|
59
|
-
import
|
|
60
|
-
import
|
|
57
|
+
import RhUiFilterFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-filter-fill-icon';
|
|
58
|
+
import RhMicronsSearchIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-search-icon';
|
|
59
|
+
import RhUiSyncIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-sync-icon';
|
|
61
60
|
import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';
|
|
62
61
|
import RhUiSettingsFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-settings-fill-icon';
|
|
63
|
-
import
|
|
62
|
+
import RhUiQuestionMarkCircleIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-icon';
|
|
64
63
|
import RhUiQuestionMarkCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-fill-icon';
|
|
65
64
|
import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
|
|
66
65
|
import RhMicronsCaretRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-right-icon';
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
DataListCell,
|
|
11
11
|
DataListItemCells,
|
|
12
12
|
Label,
|
|
13
|
+
LabelStatus,
|
|
13
14
|
Toolbar,
|
|
14
15
|
ToolbarContent,
|
|
15
16
|
ToolbarItem,
|
|
@@ -26,8 +27,8 @@ import {
|
|
|
26
27
|
PaginationVariant
|
|
27
28
|
} from '@patternfly/react-core';
|
|
28
29
|
import { Table, TableText, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
29
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
30
30
|
import RhMicronsSortDownLargeToSmallIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-sort-down-large-to-small-icon';
|
|
31
|
+
import RhUiFilterFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-filter-fill-icon';
|
|
31
32
|
import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
|
|
32
33
|
import { capitalize } from '@patternfly/react-table/src/components/Table/utils/utils';
|
|
33
34
|
import { rows, columns, SampleDataRow } from '@patternfly/react-table/dist/esm/demos/sampleData';
|
|
@@ -389,13 +390,13 @@ export const TableColumnManagement: React.FunctionComponent = () => {
|
|
|
389
390
|
const renderLabel = (labelText: string): React.JSX.Element => {
|
|
390
391
|
switch (labelText) {
|
|
391
392
|
case 'Running':
|
|
392
|
-
return <Label
|
|
393
|
+
return <Label status={LabelStatus.success}>{labelText}</Label>;
|
|
393
394
|
case 'Stopped':
|
|
394
|
-
return <Label
|
|
395
|
+
return <Label status={LabelStatus.warning}>{labelText}</Label>;
|
|
395
396
|
case 'Needs maintenance':
|
|
396
|
-
return <Label
|
|
397
|
+
return <Label status={LabelStatus.info}>{labelText}</Label>;
|
|
397
398
|
case 'Down':
|
|
398
|
-
return <Label
|
|
399
|
+
return <Label status={LabelStatus.danger}>{labelText}</Label>;
|
|
399
400
|
default:
|
|
400
401
|
return <></>;
|
|
401
402
|
}
|
|
@@ -411,7 +412,7 @@ export const TableColumnManagement: React.FunctionComponent = () => {
|
|
|
411
412
|
<ToolbarItem>
|
|
412
413
|
<OverflowMenu breakpoint="md">
|
|
413
414
|
<OverflowMenuItem>
|
|
414
|
-
<MenuToggle icon={<
|
|
415
|
+
<MenuToggle icon={<RhUiFilterFillIcon />}>Name</MenuToggle>
|
|
415
416
|
</OverflowMenuItem>
|
|
416
417
|
<OverflowMenuItem>
|
|
417
418
|
<MenuToggle variant="plain" aria-label="Sort columns" icon={<RhMicronsSortDownLargeToSmallIcon />} />
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
DataListItemCells,
|
|
10
10
|
DataListControl,
|
|
11
11
|
Label,
|
|
12
|
+
LabelStatus,
|
|
12
13
|
Toolbar,
|
|
13
14
|
ToolbarContent,
|
|
14
15
|
ToolbarItem,
|
|
@@ -26,8 +27,8 @@ import {
|
|
|
26
27
|
} from '@patternfly/react-core';
|
|
27
28
|
import { Table, TableText, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
28
29
|
import { DragDropSort } from '@patternfly/react-drag-drop';
|
|
29
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
30
30
|
import RhMicronsSortDownLargeToSmallIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-sort-down-large-to-small-icon';
|
|
31
|
+
import RhUiFilterFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-filter-fill-icon';
|
|
31
32
|
import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
|
|
32
33
|
import { capitalize } from '@patternfly/react-table/src/components/Table/utils/utils';
|
|
33
34
|
import { rows, columns, SampleDataRow } from '@patternfly/react-table/dist/esm/demos/sampleData';
|
|
@@ -284,13 +285,13 @@ export const TableColumnManagement: React.FunctionComponent = () => {
|
|
|
284
285
|
const renderLabel = (labelText: string): React.JSX.Element => {
|
|
285
286
|
switch (labelText) {
|
|
286
287
|
case 'Running':
|
|
287
|
-
return <Label
|
|
288
|
+
return <Label status={LabelStatus.success}>{labelText}</Label>;
|
|
288
289
|
case 'Stopped':
|
|
289
|
-
return <Label
|
|
290
|
+
return <Label status={LabelStatus.warning}>{labelText}</Label>;
|
|
290
291
|
case 'Needs maintenance':
|
|
291
|
-
return <Label
|
|
292
|
+
return <Label status={LabelStatus.info}>{labelText}</Label>;
|
|
292
293
|
case 'Down':
|
|
293
|
-
return <Label
|
|
294
|
+
return <Label status={LabelStatus.danger}>{labelText}</Label>;
|
|
294
295
|
default:
|
|
295
296
|
return <></>;
|
|
296
297
|
}
|
|
@@ -306,7 +307,7 @@ export const TableColumnManagement: React.FunctionComponent = () => {
|
|
|
306
307
|
<ToolbarItem>
|
|
307
308
|
<OverflowMenu breakpoint="md">
|
|
308
309
|
<OverflowMenuItem>
|
|
309
|
-
<MenuToggle icon={<
|
|
310
|
+
<MenuToggle icon={<RhUiFilterFillIcon />}>Name</MenuToggle>
|
|
310
311
|
</OverflowMenuItem>
|
|
311
312
|
<OverflowMenuItem>
|
|
312
313
|
<MenuToggle
|