@patternfly/react-table 4.61.18 → 4.62.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 +41 -0
- package/dist/esm/components/Table/Body.d.ts +4 -0
- package/dist/esm/components/Table/Body.d.ts.map +1 -1
- package/dist/esm/components/Table/Body.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +4 -0
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/base/provider.d.ts +4 -4
- package/dist/esm/components/Table/base/types.d.ts +4 -4
- package/dist/esm/components/TableComposable/TableComposable.d.ts +6 -2
- package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.js +4 -12
- package/dist/esm/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/esm/components/TableComposable/Tbody.d.ts +5 -1
- package/dist/esm/components/TableComposable/Tbody.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tbody.js +2 -2
- package/dist/esm/components/TableComposable/Tbody.js.map +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts +3 -1
- package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tr.js +2 -2
- package/dist/esm/components/TableComposable/Tr.js.map +1 -1
- package/dist/js/components/Table/Body.d.ts +4 -0
- package/dist/js/components/Table/Body.d.ts.map +1 -1
- package/dist/js/components/Table/Body.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +4 -0
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +4 -4
- package/dist/js/components/Table/base/types.d.ts +4 -4
- package/dist/js/components/TableComposable/TableComposable.d.ts +6 -2
- package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.js +4 -12
- package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/js/components/TableComposable/Tbody.d.ts +5 -1
- package/dist/js/components/TableComposable/Tbody.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tbody.js +2 -2
- package/dist/js/components/TableComposable/Tbody.js.map +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts +3 -1
- package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tr.js +2 -2
- package/dist/js/components/TableComposable/Tr.js.map +1 -1
- package/dist/umd/react-table.css +76 -8
- package/dist/umd/react-table.js +9 -17
- package/dist/umd/react-table.min.css +76 -8
- package/dist/umd/react-table.min.js +6 -6
- package/package.json +6 -6
- package/src/components/Table/Body.tsx +4 -0
- package/src/components/Table/Table.tsx +4 -0
- package/src/components/Table/examples/LegacyTableStriped.tsx +52 -0
- package/src/components/Table/examples/LegacyTableStripedCustomTr.tsx +52 -0
- package/src/components/Table/examples/LegacyTableStripedExpandable.tsx +174 -0
- package/src/components/Table/examples/Table.md +21 -0
- package/src/components/TableComposable/TableComposable.tsx +10 -9
- package/src/components/TableComposable/Tbody.tsx +17 -1
- package/src/components/TableComposable/Tr.tsx +4 -0
- package/src/components/TableComposable/examples/ComposableTable.md +28 -0
- package/src/components/TableComposable/examples/ComposableTableNestedExpandable.tsx +1 -5
- package/src/components/TableComposable/examples/ComposableTableNestedHeaders.tsx +1 -5
- package/src/components/TableComposable/examples/ComposableTableStriped.tsx +54 -0
- package/src/components/TableComposable/examples/ComposableTableStripedExpandable.tsx +200 -0
- package/src/components/TableComposable/examples/ComposableTableStripedMultipleTbody.tsx +120 -0
- package/src/components/TableComposable/examples/ComposableTableStripedTr.tsx +54 -0
- package/src/demos/Table.md +2 -2
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableComposable, Thead, Tr, Th, Tbody, Td, ExpandableRowContent } from '@patternfly/react-table';
|
|
3
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
4
|
+
|
|
5
|
+
interface Repository {
|
|
6
|
+
name: string;
|
|
7
|
+
branches: string;
|
|
8
|
+
prs: string;
|
|
9
|
+
workspaces: string;
|
|
10
|
+
lastCommit: string;
|
|
11
|
+
details?: {
|
|
12
|
+
detail1?: string;
|
|
13
|
+
detail2?: string;
|
|
14
|
+
detail3?: string;
|
|
15
|
+
detailFormat: 0 | 1 | 2 | 3;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ComposableTableStripedExpandable: React.FunctionComponent = () => {
|
|
20
|
+
// In real usage, this data would come from some external source like an API via props.
|
|
21
|
+
const repositories: Repository[] = [
|
|
22
|
+
{ name: 'one', branches: 'two', prs: 'a', workspaces: 'four', lastCommit: 'five' },
|
|
23
|
+
{
|
|
24
|
+
name: 'parent 1',
|
|
25
|
+
branches: 'two',
|
|
26
|
+
prs: 'k',
|
|
27
|
+
workspaces: 'four',
|
|
28
|
+
lastCommit: 'five',
|
|
29
|
+
// This `details` structure is just for this example. You can drive expanded content from any kind of data.
|
|
30
|
+
details: { detailFormat: 0, detail1: 'single cell' }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'parent 2',
|
|
34
|
+
branches: 'two',
|
|
35
|
+
prs: 'b',
|
|
36
|
+
workspaces: 'four',
|
|
37
|
+
lastCommit: 'five',
|
|
38
|
+
details: { detailFormat: 1, detail1: 'single cell - fullWidth' }
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'parent 3',
|
|
42
|
+
branches: '2',
|
|
43
|
+
prs: 'b',
|
|
44
|
+
workspaces: 'four',
|
|
45
|
+
lastCommit: 'five',
|
|
46
|
+
details: { detailFormat: 2, detail1: 'single cell - noPadding' }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'parent 4',
|
|
50
|
+
branches: '2',
|
|
51
|
+
prs: 'b',
|
|
52
|
+
workspaces: 'four',
|
|
53
|
+
lastCommit: 'five',
|
|
54
|
+
details: { detailFormat: 3, detail1: 'single cell - fullWidth & noPadding' }
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'parent 5',
|
|
58
|
+
branches: '2',
|
|
59
|
+
prs: 'b',
|
|
60
|
+
workspaces: 'four',
|
|
61
|
+
lastCommit: 'five',
|
|
62
|
+
details: {
|
|
63
|
+
detailFormat: 0,
|
|
64
|
+
detail1: "spans 'Repositories and 'Branches'",
|
|
65
|
+
detail2: "spans 'Pull requests' and 'Workspaces', and 'Last commit'"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'parent 6',
|
|
70
|
+
branches: '2',
|
|
71
|
+
prs: 'b',
|
|
72
|
+
workspaces: 'four',
|
|
73
|
+
lastCommit: 'five',
|
|
74
|
+
details: {
|
|
75
|
+
detailFormat: 1,
|
|
76
|
+
detail1: "fullWidth, spans the collapsible column and 'Repositories'",
|
|
77
|
+
detail2: "fullWidth, spans 'Branches' and 'Pull requests'",
|
|
78
|
+
detail3: "fullWidth, spans 'Workspaces' and 'Last commit'"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const columnNames = {
|
|
84
|
+
name: 'Repositories',
|
|
85
|
+
branches: 'Branches',
|
|
86
|
+
prs: 'Pull requests',
|
|
87
|
+
workspaces: 'Workspaces',
|
|
88
|
+
lastCommit: 'Last commit'
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// In this example, expanded rows are tracked by the repo names from each row. This could be any unique identifier.
|
|
92
|
+
// This is to prevent state from being based on row order index in case we later add sorting.
|
|
93
|
+
// Note that this behavior is very similar to selection state.
|
|
94
|
+
const initialExpandedRepoNames = repositories.filter(repo => !!repo.details).map(repo => repo.name); // Default to all expanded
|
|
95
|
+
const [expandedRepoNames, setExpandedRepoNames] = React.useState<string[]>(initialExpandedRepoNames);
|
|
96
|
+
const setRepoExpanded = (repo: Repository, isExpanding = true) =>
|
|
97
|
+
setExpandedRepoNames(prevExpanded => {
|
|
98
|
+
const otherExpandedRepoNames = prevExpanded.filter(r => r !== repo.name);
|
|
99
|
+
return isExpanding ? [...otherExpandedRepoNames, repo.name] : otherExpandedRepoNames;
|
|
100
|
+
});
|
|
101
|
+
const isRepoExpanded = (repo: Repository) => expandedRepoNames.includes(repo.name);
|
|
102
|
+
|
|
103
|
+
const [isExampleCompact, setIsExampleCompact] = React.useState(true);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<React.Fragment>
|
|
107
|
+
<Checkbox
|
|
108
|
+
label="Compact"
|
|
109
|
+
isChecked={isExampleCompact}
|
|
110
|
+
onChange={checked => setIsExampleCompact(checked)}
|
|
111
|
+
aria-label="toggle striped compact variation"
|
|
112
|
+
id="toggle-compact-striped"
|
|
113
|
+
name="toggle-compact-striped"
|
|
114
|
+
/>
|
|
115
|
+
<TableComposable
|
|
116
|
+
aria-label="Expandable table"
|
|
117
|
+
variant={isExampleCompact ? 'compact' : undefined}
|
|
118
|
+
isStriped
|
|
119
|
+
isExpandable
|
|
120
|
+
>
|
|
121
|
+
<Thead>
|
|
122
|
+
<Tr>
|
|
123
|
+
<Th />
|
|
124
|
+
<Th>{columnNames.name}</Th>
|
|
125
|
+
<Th>{columnNames.branches}</Th>
|
|
126
|
+
<Th>{columnNames.prs}</Th>
|
|
127
|
+
<Th>{columnNames.workspaces}</Th>
|
|
128
|
+
<Th>{columnNames.lastCommit}</Th>
|
|
129
|
+
</Tr>
|
|
130
|
+
</Thead>
|
|
131
|
+
{repositories.map((repo, rowIndex) => {
|
|
132
|
+
// Some arbitrary examples of how you could customize the child row based on your needs
|
|
133
|
+
let childIsFullWidth = false;
|
|
134
|
+
let childHasNoPadding = false;
|
|
135
|
+
let detail1Colspan = 1;
|
|
136
|
+
let detail2Colspan = 1;
|
|
137
|
+
let detail3Colspan = 1;
|
|
138
|
+
if (repo.details) {
|
|
139
|
+
const { detail1, detail2, detail3, detailFormat } = repo.details;
|
|
140
|
+
const numColumns = 5;
|
|
141
|
+
childIsFullWidth = [1, 3].includes(detailFormat);
|
|
142
|
+
childHasNoPadding = [2, 3].includes(detailFormat);
|
|
143
|
+
if (detail1 && !detail2 && !detail3) {
|
|
144
|
+
detail1Colspan = childIsFullWidth ? numColumns : numColumns + 1; // Account for toggle column
|
|
145
|
+
} else if (detail1 && detail2 && !detail3) {
|
|
146
|
+
detail1Colspan = 2;
|
|
147
|
+
detail2Colspan = childIsFullWidth ? 3 : 4;
|
|
148
|
+
} else if (detail1 && detail2 && detail3) {
|
|
149
|
+
detail1Colspan = 2;
|
|
150
|
+
detail2Colspan = 2;
|
|
151
|
+
detail3Colspan = childIsFullWidth ? 1 : 2;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return (
|
|
155
|
+
<Tbody key={repo.name} isExpanded={isRepoExpanded(repo)}>
|
|
156
|
+
<Tr>
|
|
157
|
+
<Td
|
|
158
|
+
expand={
|
|
159
|
+
repo.details
|
|
160
|
+
? {
|
|
161
|
+
rowIndex,
|
|
162
|
+
isExpanded: isRepoExpanded(repo),
|
|
163
|
+
onToggle: () => setRepoExpanded(repo, !isRepoExpanded(repo))
|
|
164
|
+
}
|
|
165
|
+
: undefined
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
<Td dataLabel={columnNames.name}>{repo.name}</Td>
|
|
169
|
+
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|
|
170
|
+
<Td dataLabel={columnNames.prs}>{repo.prs}</Td>
|
|
171
|
+
<Td dataLabel={columnNames.workspaces}>{repo.workspaces}</Td>
|
|
172
|
+
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
173
|
+
</Tr>
|
|
174
|
+
{repo.details ? (
|
|
175
|
+
<Tr isExpanded={isRepoExpanded(repo)}>
|
|
176
|
+
{!childIsFullWidth ? <Td /> : null}
|
|
177
|
+
{repo.details.detail1 ? (
|
|
178
|
+
<Td dataLabel="Repo detail 1" noPadding={childHasNoPadding} colSpan={detail1Colspan}>
|
|
179
|
+
<ExpandableRowContent>{repo.details.detail1}</ExpandableRowContent>
|
|
180
|
+
</Td>
|
|
181
|
+
) : null}
|
|
182
|
+
{repo.details.detail2 ? (
|
|
183
|
+
<Td dataLabel="Repo detail 2" noPadding={childHasNoPadding} colSpan={detail2Colspan}>
|
|
184
|
+
<ExpandableRowContent>{repo.details.detail2}</ExpandableRowContent>
|
|
185
|
+
</Td>
|
|
186
|
+
) : null}
|
|
187
|
+
{repo.details.detail3 ? (
|
|
188
|
+
<Td dataLabel="Repo detail 3" noPadding={childHasNoPadding} colSpan={detail3Colspan}>
|
|
189
|
+
<ExpandableRowContent>{repo.details.detail3}</ExpandableRowContent>
|
|
190
|
+
</Td>
|
|
191
|
+
) : null}
|
|
192
|
+
</Tr>
|
|
193
|
+
) : null}
|
|
194
|
+
</Tbody>
|
|
195
|
+
);
|
|
196
|
+
})}
|
|
197
|
+
</TableComposable>
|
|
198
|
+
</React.Fragment>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableComposable, Caption, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
3
|
+
|
|
4
|
+
interface Repository {
|
|
5
|
+
name: string;
|
|
6
|
+
branches: number;
|
|
7
|
+
description?: string;
|
|
8
|
+
prs: number;
|
|
9
|
+
workspaces: number;
|
|
10
|
+
lastCommit: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ComposableTableStripedMultipleTbody: React.FunctionComponent = () => {
|
|
14
|
+
// In real usage, this data would come from some external source like an API via props.
|
|
15
|
+
const repositories1: Repository[] = [
|
|
16
|
+
{
|
|
17
|
+
name: 'tbody 1 - Repository 1',
|
|
18
|
+
description: '(odd rows striped)',
|
|
19
|
+
branches: 10,
|
|
20
|
+
prs: 25,
|
|
21
|
+
workspaces: 5,
|
|
22
|
+
lastCommit: '2 days ago'
|
|
23
|
+
},
|
|
24
|
+
{ name: 'tbody 1 - Repository 2', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
25
|
+
{
|
|
26
|
+
name: 'tbody 1 - Repository 3',
|
|
27
|
+
description: '(odd rows striped)',
|
|
28
|
+
branches: 10,
|
|
29
|
+
prs: 25,
|
|
30
|
+
workspaces: 5,
|
|
31
|
+
lastCommit: '2 days ago'
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const repositories2: Repository[] = [
|
|
36
|
+
{ name: 'tbody 2 - Repository 4', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
37
|
+
{
|
|
38
|
+
name: 'tbody 2 - Repository 5',
|
|
39
|
+
description: '(even rows striped)',
|
|
40
|
+
branches: 10,
|
|
41
|
+
prs: 25,
|
|
42
|
+
workspaces: 5,
|
|
43
|
+
lastCommit: '2 days ago'
|
|
44
|
+
},
|
|
45
|
+
{ name: 'tbody 2 - Repository 6', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
46
|
+
{
|
|
47
|
+
name: 'tbody 2 - Repository 7',
|
|
48
|
+
description: '(even rows striped)',
|
|
49
|
+
branches: 10,
|
|
50
|
+
prs: 25,
|
|
51
|
+
workspaces: 5,
|
|
52
|
+
lastCommit: '2 days ago'
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const columnNames = {
|
|
57
|
+
name: 'Repositories',
|
|
58
|
+
branches: 'Branches',
|
|
59
|
+
prs: 'Pull requests',
|
|
60
|
+
workspaces: 'Workspaces',
|
|
61
|
+
lastCommit: 'Last commit'
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<TableComposable aria-label="Simple table">
|
|
66
|
+
<Caption>Striped table using multiple tbody components</Caption>
|
|
67
|
+
<Thead>
|
|
68
|
+
<Tr>
|
|
69
|
+
<Th>{columnNames.name}</Th>
|
|
70
|
+
<Th>{columnNames.branches}</Th>
|
|
71
|
+
<Th>{columnNames.prs}</Th>
|
|
72
|
+
<Th>{columnNames.workspaces}</Th>
|
|
73
|
+
<Th>{columnNames.lastCommit}</Th>
|
|
74
|
+
</Tr>
|
|
75
|
+
</Thead>
|
|
76
|
+
<Tbody isOddStriped>
|
|
77
|
+
{repositories1.map(repo => (
|
|
78
|
+
<Tr key={repo.name}>
|
|
79
|
+
<Td dataLabel={columnNames.name}>
|
|
80
|
+
{repo.description ? (
|
|
81
|
+
<React.Fragment>
|
|
82
|
+
{repo.name}
|
|
83
|
+
<br />
|
|
84
|
+
<small>{repo.description}</small>
|
|
85
|
+
</React.Fragment>
|
|
86
|
+
) : (
|
|
87
|
+
repo.name
|
|
88
|
+
)}
|
|
89
|
+
</Td>
|
|
90
|
+
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|
|
91
|
+
<Td dataLabel={columnNames.prs}>{repo.prs}</Td>
|
|
92
|
+
<Td dataLabel={columnNames.workspaces}>{repo.workspaces}</Td>
|
|
93
|
+
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
94
|
+
</Tr>
|
|
95
|
+
))}
|
|
96
|
+
</Tbody>
|
|
97
|
+
<Tbody isEvenStriped>
|
|
98
|
+
{repositories2.map(repo => (
|
|
99
|
+
<Tr key={repo.name}>
|
|
100
|
+
<Td dataLabel={columnNames.name}>
|
|
101
|
+
{repo.description ? (
|
|
102
|
+
<React.Fragment>
|
|
103
|
+
{repo.name}
|
|
104
|
+
<br />
|
|
105
|
+
<small>{repo.description}</small>
|
|
106
|
+
</React.Fragment>
|
|
107
|
+
) : (
|
|
108
|
+
repo.name
|
|
109
|
+
)}
|
|
110
|
+
</Td>
|
|
111
|
+
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|
|
112
|
+
<Td dataLabel={columnNames.prs}>{repo.prs}</Td>
|
|
113
|
+
<Td dataLabel={columnNames.workspaces}>{repo.workspaces}</Td>
|
|
114
|
+
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
115
|
+
</Tr>
|
|
116
|
+
))}
|
|
117
|
+
</Tbody>
|
|
118
|
+
</TableComposable>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableComposable, Caption, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
3
|
+
|
|
4
|
+
interface Repository {
|
|
5
|
+
name: string;
|
|
6
|
+
branches: number;
|
|
7
|
+
prs: number;
|
|
8
|
+
workspaces: number;
|
|
9
|
+
lastCommit: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ComposableTableStripedTr: React.FunctionComponent = () => {
|
|
13
|
+
// In real usage, this data would come from some external source like an API via props.
|
|
14
|
+
const repositories: Repository[] = [
|
|
15
|
+
{ name: 'Repository 1', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
16
|
+
{ name: 'Repository 2', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
17
|
+
{ name: 'Repository 3', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' },
|
|
18
|
+
{ name: 'Repository 4', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const columnNames = {
|
|
22
|
+
name: 'Repositories',
|
|
23
|
+
branches: 'Branches',
|
|
24
|
+
prs: 'Pull requests',
|
|
25
|
+
workspaces: 'Workspaces',
|
|
26
|
+
lastCommit: 'Last commit'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TableComposable aria-label="Simple table">
|
|
31
|
+
<Caption>Manually striped table using composable components</Caption>
|
|
32
|
+
<Thead>
|
|
33
|
+
<Tr>
|
|
34
|
+
<Th>{columnNames.name}</Th>
|
|
35
|
+
<Th>{columnNames.branches}</Th>
|
|
36
|
+
<Th>{columnNames.prs}</Th>
|
|
37
|
+
<Th>{columnNames.workspaces}</Th>
|
|
38
|
+
<Th>{columnNames.lastCommit}</Th>
|
|
39
|
+
</Tr>
|
|
40
|
+
</Thead>
|
|
41
|
+
<Tbody>
|
|
42
|
+
{repositories.map((repo, index) => (
|
|
43
|
+
<Tr key={repo.name} {...(index % 2 === 0 && { isStriped: true })}>
|
|
44
|
+
<Td dataLabel={columnNames.name}>{repo.name}</Td>
|
|
45
|
+
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|
|
46
|
+
<Td dataLabel={columnNames.prs}>{repo.prs}</Td>
|
|
47
|
+
<Td dataLabel={columnNames.workspaces}>{repo.workspaces}</Td>
|
|
48
|
+
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
49
|
+
</Tr>
|
|
50
|
+
))}
|
|
51
|
+
</Tbody>
|
|
52
|
+
</TableComposable>
|
|
53
|
+
);
|
|
54
|
+
};
|
package/src/demos/Table.md
CHANGED
|
@@ -2234,11 +2234,11 @@ class FilterTableDemo extends React.Component {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
];
|
|
2236
2236
|
}
|
|
2237
|
-
|
|
2237
|
+
const onSelect = loading || filteredRows.length === 0 ? null : this.onRowSelect; // To remove the select box when there are no rows
|
|
2238
2238
|
return (
|
|
2239
2239
|
<React.Fragment>
|
|
2240
2240
|
{this.renderToolbar()}
|
|
2241
|
-
<Table cells={columns} rows={tableRows} onSelect={
|
|
2241
|
+
<Table cells={columns} rows={tableRows} onSelect={onSelect} aria-label="Filterable Table Demo">
|
|
2242
2242
|
<TableHeader />
|
|
2243
2243
|
<TableBody />
|
|
2244
2244
|
</Table>
|