@patternfly/react-table 4.105.11 → 4.105.14
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 +30 -0
- package/dist/umd/react-table.css +15 -4
- package/dist/umd/react-table.js +1 -0
- package/dist/umd/react-table.min.css +1861 -1850
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/docs/demos/Table.md +4 -4
- package/src/docs/demos/table-demos/Compact.jsx +55 -44
- package/src/docs/demos/table-demos/ExpandCollapseAll.jsx +2 -2
- package/src/docs/examples/Data.jsx +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.105.
|
|
3
|
+
"version": "4.105.14",
|
|
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.236.
|
|
35
|
-
"@patternfly/react-icons": "^4.87.
|
|
36
|
-
"@patternfly/react-styles": "^4.86.
|
|
37
|
-
"@patternfly/react-tokens": "^4.88.
|
|
34
|
+
"@patternfly/react-core": "^4.236.14",
|
|
35
|
+
"@patternfly/react-icons": "^4.87.14",
|
|
36
|
+
"@patternfly/react-styles": "^4.86.14",
|
|
37
|
+
"@patternfly/react-tokens": "^4.88.14",
|
|
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": "903be22b53212eaa7d4b2aa290a790ce64a10d52"
|
|
50
50
|
}
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -302,17 +302,17 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
302
302
|
|
|
303
303
|
### Expand/collapse all
|
|
304
304
|
|
|
305
|
-
```js isFullscreen file="table-demos/ExpandCollapseAll.jsx"
|
|
305
|
+
```js isFullscreen file="./table-demos/ExpandCollapseAll.jsx"
|
|
306
306
|
```
|
|
307
307
|
|
|
308
308
|
### Compact
|
|
309
309
|
|
|
310
|
-
```js isFullscreen file="table-demos/Compact.jsx"
|
|
310
|
+
```js isFullscreen file="./table-demos/Compact.jsx"
|
|
311
311
|
```
|
|
312
312
|
|
|
313
313
|
### Compound expansion
|
|
314
314
|
|
|
315
|
-
```js isFullscreen file="table-demos/CompoundExpansion.jsx"
|
|
315
|
+
```js isFullscreen file="./table-demos/CompoundExpansion.jsx"
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
### Column management
|
|
@@ -2852,7 +2852,7 @@ class StickyHeaderTableDemo extends React.Component {
|
|
|
2852
2852
|
|
|
2853
2853
|
### Sticky first column
|
|
2854
2854
|
|
|
2855
|
-
```js isFullscreen file="table-demos/StickyFirstColumn.jsx"
|
|
2855
|
+
```js isFullscreen file="./table-demos/StickyFirstColumn.jsx"
|
|
2856
2856
|
```
|
|
2857
2857
|
|
|
2858
2858
|
### Sticky columns and header with toolbar
|
|
@@ -12,41 +12,35 @@ import {
|
|
|
12
12
|
SelectOption,
|
|
13
13
|
PageSection
|
|
14
14
|
} from '@patternfly/react-core';
|
|
15
|
-
import { TableComposable, Thead, Tr, Th, Tbody, Td
|
|
15
|
+
import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
16
16
|
|
|
17
17
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
18
|
-
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
19
18
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
19
|
+
import { rows, columns } from '../../examples/Data.jsx';
|
|
20
20
|
|
|
21
|
-
export const
|
|
21
|
+
export const CompactTable = () => {
|
|
22
22
|
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
|
23
|
+
const [page, setPage] = React.useState(1);
|
|
24
|
+
const [perPage, setPerPage] = React.useState(10);
|
|
25
|
+
const [paginatedRows, setPaginatedRows] = React.useState(rows.slice(0, 10));
|
|
26
|
+
const handleSetPage = (_evt, newPage, perPage, startIdx, endIdx) => {
|
|
27
|
+
setPaginatedRows(rows.slice(startIdx, endIdx));
|
|
28
|
+
setPage(newPage);
|
|
29
|
+
};
|
|
30
|
+
handlePerPageSelect = (_evt, newPerPage, newPage, startIdx, endIdx) => {
|
|
31
|
+
setPaginatedRows(rows.slice(startIdx, endIdx));
|
|
32
|
+
setPage(newPage);
|
|
33
|
+
setPerPage(newPerPage);
|
|
34
|
+
};
|
|
23
35
|
|
|
24
|
-
const columns = ['Contributor', 'Position', 'Location', 'Last seen', 'Numbers', 'Icons'];
|
|
25
|
-
const rows = [
|
|
26
|
-
['Sam Jones', 'CSS guru', 'Not too sure', 'May 9, 2018', '0556'],
|
|
27
|
-
['Amy Miller', 'Visual design', 'Raleigh', 'May 9, 2018', '9492'],
|
|
28
|
-
['Steve Wilson', 'Visual design lead', 'Westford', 'May 9, 2018', '9929'],
|
|
29
|
-
['Emma Jackson', 'Interaction design', 'Westford', 'May 9, 2018', '2217']
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
const defaultActions = () => [
|
|
33
|
-
{
|
|
34
|
-
title: 'Settings',
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
onClick: () => console.log(`clicked on Settings`)
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
title: 'Help',
|
|
40
|
-
// eslint-disable-next-line no-console
|
|
41
|
-
onClick: () => console.log(`clicked on Help`)
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
36
|
const renderPagination = (variant, isCompact) => (
|
|
45
37
|
<Pagination
|
|
46
38
|
isCompact={isCompact}
|
|
47
|
-
itemCount={
|
|
48
|
-
page={
|
|
49
|
-
perPage={
|
|
39
|
+
itemCount={rows.length}
|
|
40
|
+
page={page}
|
|
41
|
+
perPage={perPage}
|
|
42
|
+
onSetPage={handleSetPage}
|
|
43
|
+
onPerPageSelect={handlePerPageSelect}
|
|
50
44
|
variant={variant}
|
|
51
45
|
titles={{
|
|
52
46
|
paginationTitle: `${variant} pagination`
|
|
@@ -89,37 +83,54 @@ export const ComposableTable = () => {
|
|
|
89
83
|
</Toolbar>
|
|
90
84
|
);
|
|
91
85
|
|
|
86
|
+
const renderLabel = labelText => {
|
|
87
|
+
switch (labelText) {
|
|
88
|
+
case 'Running':
|
|
89
|
+
return <Label color="green">{labelText}</Label>;
|
|
90
|
+
case 'Stopped':
|
|
91
|
+
return <Label color="orange">{labelText}</Label>;
|
|
92
|
+
case 'Needs Maintenance':
|
|
93
|
+
return <Label color="blue">{labelText}</Label>;
|
|
94
|
+
case 'Down':
|
|
95
|
+
return <Label color="red">{labelText}</Label>;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
92
98
|
return (
|
|
93
99
|
<React.Fragment>
|
|
94
100
|
<DashboardWrapper hasPageTemplateTitle>
|
|
95
101
|
<PageSection isFilled>
|
|
96
102
|
<Card>
|
|
97
103
|
{tableToolbar}
|
|
98
|
-
<TableComposable variant="compact" aria-label="
|
|
104
|
+
<TableComposable variant="compact" aria-label="Compact Table">
|
|
99
105
|
<Thead>
|
|
100
106
|
<Tr>
|
|
101
|
-
{columns
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
<Th key={0}>{columns[0]}</Th>
|
|
108
|
+
<Th key={1}>{columns[1]}</Th>
|
|
109
|
+
<Th key={2}>{columns[2]}</Th>
|
|
110
|
+
<Th key={3}>{columns[3]}</Th>
|
|
111
|
+
<Th key={4}>{columns[4]}</Th>
|
|
112
|
+
<Th key={5}>{columns[5]}</Th>
|
|
113
|
+
<Th key={6}>{columns[6]}</Th>
|
|
114
|
+
<Th key={7} width={10}>
|
|
115
|
+
{columns[7]}
|
|
116
|
+
</Th>
|
|
104
117
|
</Tr>
|
|
105
118
|
</Thead>
|
|
106
119
|
<Tbody>
|
|
107
|
-
{
|
|
120
|
+
{paginatedRows.map((row, rowIndex) => (
|
|
108
121
|
<Tr key={rowIndex}>
|
|
109
122
|
<>
|
|
110
|
-
<Td dataLabel={columns[0]}>{row
|
|
111
|
-
<Td dataLabel={columns[1]}>{row
|
|
112
|
-
<Td dataLabel={columns[2]}>{row
|
|
113
|
-
<Td dataLabel={columns[3]}>{row
|
|
114
|
-
<Td dataLabel={columns[4]}>{row
|
|
115
|
-
<Td dataLabel={columns[5]}>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<Td isActionCell>
|
|
122
|
-
<ActionsColumn items={defaultActions()} />
|
|
123
|
+
<Td dataLabel={columns[0]}>{row.name}</Td>
|
|
124
|
+
<Td dataLabel={columns[1]}>{row.threads}</Td>
|
|
125
|
+
<Td dataLabel={columns[2]}>{row.applications}</Td>
|
|
126
|
+
<Td dataLabel={columns[3]}>{row.workspaces}</Td>
|
|
127
|
+
<Td dataLabel={columns[4]}>{renderLabel(row.status)}</Td>
|
|
128
|
+
<Td dataLabel={columns[5]}>{row.location}</Td>
|
|
129
|
+
<Td dataLabel={columns[6]}>{row.lastModified}</Td>
|
|
130
|
+
<Td dataLabel={columns[7]} modifier="truncate">
|
|
131
|
+
<TableText>
|
|
132
|
+
<a href="#">{row.url}</a>
|
|
133
|
+
</TableText>
|
|
123
134
|
</Td>
|
|
124
135
|
</>
|
|
125
136
|
</Tr>
|
|
@@ -3,7 +3,7 @@ import { Card, Label, PageSection, Table, TableHeader, TableBody, expandable } f
|
|
|
3
3
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
4
4
|
import { TextVariants } from '@patternfly/react-core';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const expandableColumns = [
|
|
7
7
|
{
|
|
8
8
|
title: 'Servers',
|
|
9
9
|
cellFormatters: [expandable]
|
|
@@ -202,7 +202,7 @@ class ExpandCollapseAllTableDemo extends React.Component {
|
|
|
202
202
|
aria-label="Collapsible table"
|
|
203
203
|
onCollapse={onCollapse}
|
|
204
204
|
rows={rows}
|
|
205
|
-
cells={
|
|
205
|
+
cells={expandableColumns}
|
|
206
206
|
canCollapseAll={true}
|
|
207
207
|
collapseAllAriaLabel={collapseAllAriaLabel}
|
|
208
208
|
expandId="expand-collapse-all-demo"
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
1
|
const getRandomInteger = (min, max) => (
|
|
5
2
|
Math.floor(Math.random() * (max - min + 1)) + min
|
|
6
3
|
);
|
|
@@ -737,7 +734,8 @@ export const rows = [
|
|
|
737
734
|
lastModified: '20 minutes ago',
|
|
738
735
|
url: 'http://www.redhat.com/en/office-locations/Bangalore-node13'
|
|
739
736
|
},
|
|
740
|
-
{
|
|
737
|
+
{
|
|
738
|
+
name: 'Bangalore-Node 14',
|
|
741
739
|
threads: getRandomInteger(1, 20),
|
|
742
740
|
applications: getRandomInteger(1, 50),
|
|
743
741
|
workspaces: getRandomInteger(1, 30),
|
|
@@ -746,7 +744,8 @@ export const rows = [
|
|
|
746
744
|
lastModified: '4 hours ago',
|
|
747
745
|
url: 'http://www.redhat.com/en/office-locations/Bangalore-node14'
|
|
748
746
|
},
|
|
749
|
-
{
|
|
747
|
+
{
|
|
748
|
+
name: 'Bangalore-Node 15',
|
|
750
749
|
threads: getRandomInteger(1, 20),
|
|
751
750
|
applications: getRandomInteger(1, 50),
|
|
752
751
|
workspaces: getRandomInteger(1, 30),
|