@patternfly/react-table 5.0.0-alpha.99 → 5.0.0-prerelease.10
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 +210 -7991
- package/README.md +48 -87
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -0
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -0
- package/dist/dynamic/components/Table/utils/package.json +1 -0
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -0
- package/dist/dynamic/deprecated/components/Table/package.json +1 -0
- package/dist/dynamic/deprecated/components/package.json +1 -0
- package/dist/esm/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +6 -6
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/Caption.d.ts.map +1 -1
- package/dist/esm/components/Table/Caption.js +3 -1
- package/dist/esm/components/Table/Caption.js.map +1 -1
- package/dist/esm/components/Table/Table.js +1 -1
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/Tbody.d.ts.map +1 -1
- package/dist/esm/components/Table/Tbody.js +1 -1
- package/dist/esm/components/Table/Tbody.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +1 -1
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +1 -1
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/Thead.d.ts.map +1 -1
- package/dist/esm/components/Table/Thead.js +1 -1
- package/dist/esm/components/Table/Thead.js.map +1 -1
- package/dist/esm/components/Table/Tr.js +1 -2
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +6 -6
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/Caption.d.ts.map +1 -1
- package/dist/js/components/Table/Caption.js +3 -1
- package/dist/js/components/Table/Caption.js.map +1 -1
- package/dist/js/components/Table/Table.js +1 -1
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/Tbody.d.ts.map +1 -1
- package/dist/js/components/Table/Tbody.js +1 -1
- package/dist/js/components/Table/Tbody.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +1 -1
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +1 -1
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Thead.d.ts.map +1 -1
- package/dist/js/components/Table/Thead.js +1 -1
- package/dist/js/components/Table/Thead.js.map +1 -1
- package/dist/js/components/Table/Tr.js +1 -2
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/umd/react-table.min.js +5 -5
- package/package.json +8 -8
- package/single-packages.config.json +0 -14
- package/src/components/Table/ActionsColumn.tsx +12 -6
- package/src/components/Table/Caption.tsx +3 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Table/Tbody.tsx +1 -0
- package/src/components/Table/Td.tsx +2 -1
- package/src/components/Table/Th.tsx +1 -0
- package/src/components/Table/Thead.tsx +1 -0
- package/src/components/Table/Tr.tsx +1 -1
- package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +4 -4
- package/src/components/Table/examples/TableSortableCustom.tsx +10 -21
- package/src/components/Table/utils/transformers.test.tsx +1 -1
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1896 -1780
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +12 -29
- package/src/deprecated/components/Table/examples/Table.md +1 -0
- package/src/docs/demos/Table.md +32 -344
- package/src/docs/demos/table-demos/BulkSelect.jsx +167 -0
- package/src/docs/demos/table-demos/ColumnManagement.jsx +10 -4
- package/src/docs/demos/table-demos/Compact.jsx +19 -14
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +4 -4
- package/src/docs/demos/table-demos/ExpandCollapseAll.jsx +88 -106
- package/src/docs/demos/table-demos/SortableResponsive.jsx +11 -21
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +18 -13
- package/src/docs/demos/table-demos/StickyHeader.jsx +63 -0
- package/src/docs/{examples/Data.jsx → demos/table-demos/sampleData.js} +6 -8
- package/subpaths.config.json +4 -0
- package/components/index.d.ts +0 -2
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -2
- package/components/index.js.map +0 -1
- package/deprecated/index.d.ts +0 -2
- package/deprecated/index.d.ts.map +0 -1
- package/deprecated/index.js +0 -2
- package/deprecated/index.js.map +0 -1
- package/dist/js/components/Table/package.json +0 -1
- package/dist/js/components/Table/utils/decorators/package.json +0 -1
- package/dist/js/components/Table/utils/package.json +0 -1
- package/dist/js/components/package.json +0 -1
- package/dist/js/deprecated/components/Table/base/package.json +0 -1
- package/dist/js/deprecated/components/Table/package.json +0 -1
- package/dist/js/deprecated/components/package.json +0 -1
- package/dist/js/deprecated/package.json +0 -1
- package/dist/js/package.json +0 -1
- package/scripts/createSubpaths.js +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-prerelease.10",
|
|
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",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build:umd": "rollup -c --environment IS_PRODUCTION",
|
|
38
38
|
"build:single:packages": "node ../../scripts/build-single-packages.js --config single-packages.config.json",
|
|
39
|
-
"clean": "rimraf dist",
|
|
40
|
-
"subpaths": "node scripts/
|
|
39
|
+
"clean": "rimraf dist components deprecated",
|
|
40
|
+
"subpaths": "node ../../scripts/exportSubpaths.js --config subpaths.config.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@patternfly/react-core": "^5.0.0-
|
|
44
|
-
"@patternfly/react-icons": "^5.0.0-
|
|
45
|
-
"@patternfly/react-styles": "^5.0.0-
|
|
46
|
-
"@patternfly/react-tokens": "^5.0.0-
|
|
43
|
+
"@patternfly/react-core": "^5.0.0-prerelease.10",
|
|
44
|
+
"@patternfly/react-icons": "^5.0.0-prerelease.5",
|
|
45
|
+
"@patternfly/react-styles": "^5.0.0-prerelease.3",
|
|
46
|
+
"@patternfly/react-tokens": "^5.0.0-prerelease.3",
|
|
47
47
|
"lodash": "^4.17.19",
|
|
48
48
|
"tslib": "^2.5.0"
|
|
49
49
|
},
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": "^17 || ^18",
|
|
56
56
|
"react-dom": "^17 || ^18"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c4d03d3286d6a642009fe92e6d184c82ac2eac9b"
|
|
59
59
|
}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "@patternfly/react-table",
|
|
3
|
-
"modules": [
|
|
4
|
-
{
|
|
5
|
-
"name": "components",
|
|
6
|
-
"type": "esm"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"name": "deprecated",
|
|
10
|
-
"type": "esm"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"name": "dist/js",
|
|
14
|
-
"type": "cjs"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
3
|
"exclude": [
|
|
18
4
|
"dist/esm/deprecated/index.js",
|
|
19
5
|
"dist/esm/next/index.js"
|
|
@@ -8,7 +8,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
8
8
|
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
9
9
|
|
|
10
10
|
export interface CustomActionsToggleProps {
|
|
11
|
-
onToggle: (event: React.MouseEvent) => void;
|
|
11
|
+
onToggle: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
12
12
|
isOpen: boolean;
|
|
13
13
|
isDisabled: boolean;
|
|
14
14
|
toggleRef: React.Ref<any>;
|
|
@@ -28,6 +28,8 @@ export interface ActionsColumnProps extends Omit<React.HTMLProps<HTMLElement>, '
|
|
|
28
28
|
popperProps?: any;
|
|
29
29
|
/** @hide Forwarded ref */
|
|
30
30
|
innerRef?: React.Ref<any>;
|
|
31
|
+
/** Ref to forward to the first item in the popup menu */
|
|
32
|
+
firstActionItemRef?: React.Ref<HTMLButtonElement>;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
@@ -40,6 +42,8 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
40
42
|
position: 'right',
|
|
41
43
|
direction: 'down'
|
|
42
44
|
},
|
|
45
|
+
innerRef,
|
|
46
|
+
firstActionItemRef,
|
|
43
47
|
...props
|
|
44
48
|
}: ActionsColumnProps) => {
|
|
45
49
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -103,15 +107,16 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
103
107
|
)
|
|
104
108
|
}
|
|
105
109
|
{...(rowData && rowData.actionProps)}
|
|
110
|
+
ref={innerRef}
|
|
106
111
|
{...props}
|
|
107
112
|
popperProps={popperProps}
|
|
108
113
|
>
|
|
109
114
|
<DropdownList>
|
|
110
115
|
{items
|
|
111
116
|
.filter((item) => !item.isOutsideDropdown)
|
|
112
|
-
.map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props },
|
|
117
|
+
.map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props }, index) => {
|
|
113
118
|
if (isSeparator) {
|
|
114
|
-
return <Divider key={itemKey ||
|
|
119
|
+
return <Divider key={itemKey || index} data-key={itemKey || index} />;
|
|
115
120
|
}
|
|
116
121
|
const item = (
|
|
117
122
|
<DropdownItem
|
|
@@ -120,8 +125,9 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
120
125
|
onToggle();
|
|
121
126
|
}}
|
|
122
127
|
{...props}
|
|
123
|
-
key={itemKey ||
|
|
124
|
-
data-key={itemKey ||
|
|
128
|
+
key={itemKey || index}
|
|
129
|
+
data-key={itemKey || index}
|
|
130
|
+
ref={index === 0 ? firstActionItemRef : undefined}
|
|
125
131
|
>
|
|
126
132
|
{title}
|
|
127
133
|
</DropdownItem>
|
|
@@ -129,7 +135,7 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
129
135
|
|
|
130
136
|
if (tooltip) {
|
|
131
137
|
return (
|
|
132
|
-
<Tooltip key={itemKey ||
|
|
138
|
+
<Tooltip key={itemKey || index} content={tooltip} {...tooltipProps}>
|
|
133
139
|
{item}
|
|
134
140
|
</Tooltip>
|
|
135
141
|
);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
2
4
|
|
|
3
5
|
export interface CaptionProps {
|
|
4
6
|
/** Content rendered inside the caption */
|
|
@@ -8,7 +10,7 @@ export interface CaptionProps {
|
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export const Caption: React.FunctionComponent<CaptionProps> = ({ children, className, ...props }: CaptionProps) => (
|
|
11
|
-
<caption className={className} {...props}>
|
|
13
|
+
<caption className={css(styles.tableCaption, className)} {...props}>
|
|
12
14
|
{children}
|
|
13
15
|
</caption>
|
|
14
16
|
);
|
|
@@ -157,7 +157,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
157
157
|
if (
|
|
158
158
|
isNested ||
|
|
159
159
|
!(tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) || // implements roving tab-index to tree tables only
|
|
160
|
-
(tableRef && tableRef.current !== (event.target as HTMLElement).closest('.pf-c-table:not(.pf-m-nested)'))
|
|
160
|
+
(tableRef && tableRef.current !== (event.target as HTMLElement).closest('.pf-v5-c-table:not(.pf-m-nested)'))
|
|
161
161
|
) {
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
@@ -50,7 +50,7 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
|
|
|
50
50
|
draggableRow?: TdDraggableType;
|
|
51
51
|
/** True to remove padding */
|
|
52
52
|
noPadding?: boolean;
|
|
53
|
-
/** Applies pf-c-table__action to td */
|
|
53
|
+
/** Applies pf-v5-c-table__action to td */
|
|
54
54
|
isActionCell?: boolean;
|
|
55
55
|
/**
|
|
56
56
|
* Tooltip to show on the body cell.
|
|
@@ -271,6 +271,7 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
271
271
|
onBlur={() => setShowTooltip(false)}
|
|
272
272
|
onMouseEnter={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
273
273
|
className={css(
|
|
274
|
+
styles.tableTd,
|
|
274
275
|
className,
|
|
275
276
|
isActionCell && styles.tableAction,
|
|
276
277
|
textCenter && styles.modifiers.center,
|
|
@@ -179,6 +179,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
179
179
|
scope={component === 'th' && children ? scope : null}
|
|
180
180
|
ref={cellRef}
|
|
181
181
|
className={css(
|
|
182
|
+
styles.tableTh,
|
|
182
183
|
className,
|
|
183
184
|
textCenter && styles.modifiers.center,
|
|
184
185
|
isSubheader && styles.tableSubhead,
|
|
@@ -89,9 +89,9 @@ const TrBase: React.FunctionComponent<TrProps> = ({
|
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
91
|
<>
|
|
92
|
-
{isSelectable && <output className="pf-v5-screen-reader">{ariaLabel}</output>}
|
|
93
92
|
<tr
|
|
94
93
|
className={css(
|
|
94
|
+
styles.tableTr,
|
|
95
95
|
className,
|
|
96
96
|
isExpanded !== undefined && styles.tableExpandableRow,
|
|
97
97
|
isExpanded && styles.modifiers.expanded,
|
|
@@ -5,9 +5,9 @@ exports[`RowWrapper renders correctly 1`] = `
|
|
|
5
5
|
<table>
|
|
6
6
|
<tbody>
|
|
7
7
|
<tr
|
|
8
|
-
class=""
|
|
8
|
+
class="pf-v5-c-table__tr"
|
|
9
9
|
data-ouia-component-id="OUIA-Generated-TableRow-1"
|
|
10
|
-
data-ouia-component-type="
|
|
10
|
+
data-ouia-component-type="PF5/TableRow"
|
|
11
11
|
data-ouia-safe="true"
|
|
12
12
|
/>
|
|
13
13
|
</tbody>
|
|
@@ -20,9 +20,9 @@ exports[`RowWrapper renders expanded correctly 1`] = `
|
|
|
20
20
|
<table>
|
|
21
21
|
<tbody>
|
|
22
22
|
<tr
|
|
23
|
-
class="pf-v5-c-table__expandable-row pf-m-expanded"
|
|
23
|
+
class="pf-v5-c-table__tr pf-v5-c-table__expandable-row pf-m-expanded"
|
|
24
24
|
data-ouia-component-id="OUIA-Generated-TableRow-2"
|
|
25
|
-
data-ouia-component-type="
|
|
25
|
+
data-ouia-component-type="PF5/TableRow"
|
|
26
26
|
data-ouia-safe="true"
|
|
27
27
|
/>
|
|
28
28
|
</tbody>
|
|
@@ -101,13 +101,14 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
101
101
|
<Select
|
|
102
102
|
isOpen={isSortDropdownOpen}
|
|
103
103
|
selected={[activeSortDirection, activeSortIndex]}
|
|
104
|
-
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
105
|
-
onSelect={(event,
|
|
106
|
-
if (
|
|
107
|
-
setActiveSortDirection(
|
|
104
|
+
onOpenChange={(isOpen) => setIsSortDropdownOpen(isOpen)}
|
|
105
|
+
onSelect={(event, value) => {
|
|
106
|
+
if (value === 'asc' || value === 'desc') {
|
|
107
|
+
setActiveSortDirection(value as 'desc' | 'asc');
|
|
108
108
|
} else {
|
|
109
|
-
setActiveSortIndex(
|
|
110
|
-
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
109
|
+
setActiveSortIndex(value as number);
|
|
110
|
+
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
111
|
+
}
|
|
111
112
|
}}
|
|
112
113
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
113
114
|
<MenuToggle
|
|
@@ -124,11 +125,7 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
124
125
|
<SelectGroup label="Sort column">
|
|
125
126
|
<SelectList>
|
|
126
127
|
{Object.values(columnNames).map((column, columnIndex) => (
|
|
127
|
-
<SelectOption
|
|
128
|
-
key={column}
|
|
129
|
-
itemId={columnIndex}
|
|
130
|
-
isSelected={activeSortIndex === columnIndex}
|
|
131
|
-
>
|
|
128
|
+
<SelectOption key={column} value={columnIndex} isSelected={activeSortIndex === columnIndex}>
|
|
132
129
|
{column}
|
|
133
130
|
</SelectOption>
|
|
134
131
|
))}
|
|
@@ -136,18 +133,10 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
136
133
|
</SelectGroup>
|
|
137
134
|
<SelectGroup label="Sort direction">
|
|
138
135
|
<SelectList>
|
|
139
|
-
<SelectOption
|
|
140
|
-
isSelected={activeSortDirection === 'asc'}
|
|
141
|
-
itemId="asc"
|
|
142
|
-
key="ascending"
|
|
143
|
-
>
|
|
136
|
+
<SelectOption isSelected={activeSortDirection === 'asc'} value="asc" key="ascending">
|
|
144
137
|
Ascending
|
|
145
138
|
</SelectOption>
|
|
146
|
-
<SelectOption
|
|
147
|
-
isSelected={activeSortDirection === 'desc'}
|
|
148
|
-
itemId="desc"
|
|
149
|
-
key="descending"
|
|
150
|
-
>
|
|
139
|
+
<SelectOption isSelected={activeSortDirection === 'desc'} value="desc" key="descending">
|
|
151
140
|
Descending
|
|
152
141
|
</SelectOption>
|
|
153
142
|
</SelectList>
|
|
@@ -73,7 +73,7 @@ const testCellActions = async ({
|
|
|
73
73
|
const { container } = render(returnedData.children as React.ReactElement<any>);
|
|
74
74
|
await user.click(screen.getAllByRole('button')[0]);
|
|
75
75
|
await waitFor(() =>
|
|
76
|
-
expect(container.querySelectorAll('.pf-c-dropdown__menu li button')).toHaveLength(expectDisabled ? 0 : 1)
|
|
76
|
+
expect(container.querySelectorAll('.pf-v5-c-dropdown__menu li button')).toHaveLength(expectDisabled ? 0 : 1)
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
};
|