@patternfly/react-table 4.96.7 → 4.97.0
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 +27 -0
- package/dist/esm/components/TableComposable/Tr.js +1 -1
- package/dist/esm/components/TableComposable/Tr.js.map +1 -1
- package/dist/js/components/TableComposable/Tr.js +1 -1
- package/dist/js/components/TableComposable/Tr.js.map +1 -1
- package/dist/umd/react-table.css +21 -31
- package/dist/umd/react-table.js +1 -1
- package/dist/umd/react-table.min.css +21 -31
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/components/Table/examples/LegacyTableHoverable.tsx +3 -10
- package/src/components/TableComposable/Tr.tsx +1 -1
- package/src/components/TableComposable/examples/ComposableTableHoverable.tsx +3 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.97.0",
|
|
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",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.
|
|
35
|
-
"@patternfly/react-icons": "^4.
|
|
36
|
-
"@patternfly/react-styles": "^4.
|
|
37
|
-
"@patternfly/react-tokens": "^4.
|
|
34
|
+
"@patternfly/react-core": "^4.228.0",
|
|
35
|
+
"@patternfly/react-icons": "^4.79.0",
|
|
36
|
+
"@patternfly/react-styles": "^4.78.0",
|
|
37
|
+
"@patternfly/react-tokens": "^4.80.0",
|
|
38
38
|
"lodash": "^4.17.19",
|
|
39
39
|
"tslib": "^2.0.0"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f02b0e0e72ea0aa326e1d512b1da0397b10e7f9a"
|
|
50
50
|
}
|
|
@@ -32,14 +32,7 @@ export const LegacyTableHoverable: React.FunctionComponent = () => {
|
|
|
32
32
|
|
|
33
33
|
// In this example, selected rows are tracked by the repo names from each row. This could be any unique identifier.
|
|
34
34
|
// This is to prevent state from being based on row order index in case we later add sorting.
|
|
35
|
-
const [
|
|
36
|
-
const setRepoSelected = (repo: Repository, isSelecting = true) =>
|
|
37
|
-
setSelectedRepoNames(prevSelected => {
|
|
38
|
-
const otherSelectedRepoNames = prevSelected.filter(r => r !== repo.name);
|
|
39
|
-
return isSelecting ? [...otherSelectedRepoNames, repo.name] : otherSelectedRepoNames;
|
|
40
|
-
});
|
|
41
|
-
const isRepoSelected = (repo: Repository) => selectedRepoNames.includes(repo.name);
|
|
42
|
-
|
|
35
|
+
const [selectedRepoName, setSelectedRepoName] = React.useState('');
|
|
43
36
|
const columns: TableProps['cells'] = [
|
|
44
37
|
{
|
|
45
38
|
title: 'Repositories',
|
|
@@ -105,7 +98,7 @@ export const LegacyTableHoverable: React.FunctionComponent = () => {
|
|
|
105
98
|
return {
|
|
106
99
|
cells,
|
|
107
100
|
isHoverable: true,
|
|
108
|
-
isRowSelected:
|
|
101
|
+
isRowSelected: selectedRepoName === repo.name
|
|
109
102
|
};
|
|
110
103
|
});
|
|
111
104
|
|
|
@@ -116,7 +109,7 @@ export const LegacyTableHoverable: React.FunctionComponent = () => {
|
|
|
116
109
|
onRowClick={(_event, row, rowProps) => {
|
|
117
110
|
if (rowProps) {
|
|
118
111
|
const repo = repositories[rowProps.rowIndex];
|
|
119
|
-
|
|
112
|
+
setSelectedRepoName(repo.name);
|
|
120
113
|
}
|
|
121
114
|
}}
|
|
122
115
|
/>
|
|
@@ -74,7 +74,7 @@ const TrBase: React.FunctionComponent<TrProps> = ({
|
|
|
74
74
|
|
|
75
75
|
React.useEffect(() => {
|
|
76
76
|
if (isSelectable && !rowIsHidden) {
|
|
77
|
-
setComputedAriaLabel(`${isRowSelected ? '
|
|
77
|
+
setComputedAriaLabel(`${isRowSelected ? 'Row selected' : ''}`);
|
|
78
78
|
registerSelectableRow();
|
|
79
79
|
} else {
|
|
80
80
|
setComputedAriaLabel(undefined);
|
|
@@ -27,13 +27,7 @@ export const ComposableTableHoverable: React.FunctionComponent = () => {
|
|
|
27
27
|
|
|
28
28
|
// In this example, selected rows are tracked by the repo names from each row. This could be any unique identifier.
|
|
29
29
|
// This is to prevent state from being based on row order index in case we later add sorting.
|
|
30
|
-
const [
|
|
31
|
-
const setRepoSelected = (repo: Repository, isSelecting = true) =>
|
|
32
|
-
setSelectedRepoNames(prevSelected => {
|
|
33
|
-
const otherSelectedRepoNames = prevSelected.filter(r => r !== repo.name);
|
|
34
|
-
return isSelecting ? [...otherSelectedRepoNames, repo.name] : otherSelectedRepoNames;
|
|
35
|
-
});
|
|
36
|
-
const isRepoSelected = (repo: Repository) => selectedRepoNames.includes(repo.name);
|
|
30
|
+
const [selectedRepoName, setSelectedRepoName] = React.useState('');
|
|
37
31
|
|
|
38
32
|
return (
|
|
39
33
|
<TableComposable aria-label="Hoverable table" hasSelectableRowCaption>
|
|
@@ -50,10 +44,10 @@ export const ComposableTableHoverable: React.FunctionComponent = () => {
|
|
|
50
44
|
{repositories.map(repo => (
|
|
51
45
|
<Tr
|
|
52
46
|
key={repo.name}
|
|
53
|
-
onRowClick={() =>
|
|
47
|
+
onRowClick={() => setSelectedRepoName(repo.name)}
|
|
54
48
|
isSelectable
|
|
55
49
|
isHoverable
|
|
56
|
-
isRowSelected={
|
|
50
|
+
isRowSelected={selectedRepoName === repo.name}
|
|
57
51
|
>
|
|
58
52
|
<Td dataLabel={columnNames.name}>{repo.name}</Td>
|
|
59
53
|
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|