@patternfly/react-table 6.3.0-prerelease.25 → 6.3.0-prerelease.27
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 +10 -0
- 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/esm/components/Table/ExpandableRowContent.d.ts +5 -0
- package/dist/esm/components/Table/ExpandableRowContent.d.ts.map +1 -1
- package/dist/esm/components/Table/ExpandableRowContent.js +2 -2
- package/dist/esm/components/Table/ExpandableRowContent.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +6 -1
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +5 -4
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +23 -2
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +2 -2
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/ExpandableRowContent.d.ts +5 -0
- package/dist/js/components/Table/ExpandableRowContent.d.ts.map +1 -1
- package/dist/js/components/Table/ExpandableRowContent.js +2 -2
- package/dist/js/components/Table/ExpandableRowContent.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +6 -1
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +5 -4
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +22 -1
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +2 -2
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/umd/assets/{output-pufR2XmY.css → output-DxG-OdPA.css} +5241 -5204
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/components/Table/ExpandableRowContent.tsx +7 -1
- package/src/components/Table/Table.tsx +12 -4
- package/src/components/Table/Td.tsx +37 -2
- package/src/components/Table/Tr.tsx +2 -1
- package/src/components/Table/__tests__/ExpandableRowContent.test.tsx +39 -0
- package/src/components/Table/__tests__/Table.test.tsx +62 -0
- package/src/components/Table/__tests__/Tr.test.tsx +79 -0
- package/src/components/Table/__tests__/__snapshots__/ExpandableRowContent.test.tsx.snap +11 -0
- package/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +13 -0
- package/src/components/Table/__tests__/__snapshots__/Tr.test.tsx.snap +35 -0
- package/src/components/Table/examples/Table.md +2 -0
- package/src/components/Table/examples/TableCompoundExpandable.tsx +23 -21
- package/src/components/Table/examples/TableExpandable.tsx +6 -1
- package/src/components/Table/examples/TableNestedExpandable.tsx +3 -3
- package/src/components/Table/examples/TableNestedTableExpandable.tsx +1 -1
- package/src/components/Table/examples/TableStripedExpandable.tsx +9 -3
- package/src/demos/examples/TableCompoundExpansion.tsx +87 -84
- package/src/demos/examples/TableExpandCollapseAll.tsx +1 -1
|
@@ -2,7 +2,6 @@ import { useState } from 'react';
|
|
|
2
2
|
import { ActionsColumn, Table, Thead, Tr, Th, Tbody, Td, ExpandableRowContent } from '@patternfly/react-table';
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
|
-
Card,
|
|
6
5
|
Flex,
|
|
7
6
|
FlexItem,
|
|
8
7
|
MenuToggle,
|
|
@@ -22,7 +21,6 @@ import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
|
22
21
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
23
22
|
import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
|
|
24
23
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
25
|
-
import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing';
|
|
26
24
|
|
|
27
25
|
export const TableCompoundExpansion: React.FunctionComponent = () => {
|
|
28
26
|
// In real usage, this data would come from some external source like an API via props.
|
|
@@ -200,88 +198,93 @@ export const TableCompoundExpansion: React.FunctionComponent = () => {
|
|
|
200
198
|
return (
|
|
201
199
|
<DashboardWrapper hasPageTemplateTitle>
|
|
202
200
|
<PageSection padding={{ default: 'noPadding', xl: 'padding' }} aria-label="Compound expandable table data ">
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<
|
|
206
|
-
<
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<
|
|
222
|
-
<
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
>
|
|
230
|
-
<
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
<
|
|
238
|
-
<
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
>
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
<
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
201
|
+
{tableToolbar}
|
|
202
|
+
<Table isExpandable hasAnimations aria-label="Compound expandable table">
|
|
203
|
+
<Thead>
|
|
204
|
+
<Tr>
|
|
205
|
+
<Th>{columnNames.name}</Th>
|
|
206
|
+
<Th>{columnNames.branches}</Th>
|
|
207
|
+
<Th>{columnNames.prs}</Th>
|
|
208
|
+
<Th>{columnNames.workspaces}</Th>
|
|
209
|
+
<Th>{columnNames.lastCommit}</Th>
|
|
210
|
+
<Th screenReaderText="URL" />
|
|
211
|
+
<Th screenReaderText="Actions" />
|
|
212
|
+
</Tr>
|
|
213
|
+
</Thead>
|
|
214
|
+
{repositories.map((repo, rowIndex) => {
|
|
215
|
+
const expandedCellKey = expandedCells[repo.name];
|
|
216
|
+
const isRowExpanded = !!expandedCellKey;
|
|
217
|
+
return (
|
|
218
|
+
<Tbody key={repo.name} isExpanded={isRowExpanded}>
|
|
219
|
+
<Tr isExpanded={isRowExpanded} isControlRow>
|
|
220
|
+
<Td dataLabel={columnNames.name} component="th">
|
|
221
|
+
<a href="#">{repo.name}</a>
|
|
222
|
+
</Td>
|
|
223
|
+
<Td
|
|
224
|
+
dataLabel={columnNames.branches}
|
|
225
|
+
compoundExpand={compoundExpandParams(repo, 'branches', rowIndex, 1)}
|
|
226
|
+
>
|
|
227
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
228
|
+
<FlexItem>
|
|
229
|
+
<CodeBranchIcon key="icon" />
|
|
230
|
+
</FlexItem>
|
|
231
|
+
<FlexItem>{repo.branches}</FlexItem>
|
|
232
|
+
</Flex>
|
|
233
|
+
</Td>
|
|
234
|
+
<Td dataLabel={columnNames.prs} compoundExpand={compoundExpandParams(repo, 'prs', rowIndex, 2)}>
|
|
235
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
236
|
+
<FlexItem>
|
|
237
|
+
<CodeIcon key="icon" />
|
|
238
|
+
</FlexItem>
|
|
239
|
+
<FlexItem>{repo.prs}</FlexItem>
|
|
240
|
+
</Flex>{' '}
|
|
241
|
+
</Td>
|
|
242
|
+
<Td
|
|
243
|
+
dataLabel={columnNames.workspaces}
|
|
244
|
+
compoundExpand={compoundExpandParams(repo, 'workspaces', rowIndex, 3)}
|
|
245
|
+
>
|
|
246
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
247
|
+
<FlexItem>
|
|
248
|
+
<CubeIcon key="icon" />
|
|
249
|
+
</FlexItem>
|
|
250
|
+
<FlexItem>{repo.workspaces}</FlexItem>
|
|
251
|
+
</Flex>
|
|
252
|
+
</Td>
|
|
253
|
+
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
254
|
+
<Td>
|
|
255
|
+
<a href="#">Open in GitHub</a>
|
|
256
|
+
</Td>
|
|
257
|
+
<Td isActionCell>
|
|
258
|
+
<ActionsColumn items={defaultActions()} />
|
|
259
|
+
</Td>
|
|
260
|
+
</Tr>
|
|
261
|
+
|
|
262
|
+
<Tr isExpanded={isRowExpanded && columnNames[expandedCellKey] === columnNames.branches} isExpandable>
|
|
263
|
+
<Td dataLabel={columnNames[expandedCellKey]} noPadding colSpan={7}>
|
|
264
|
+
<ExpandableRowContent hasNoBackground>
|
|
265
|
+
<NestedItemsTable />
|
|
266
|
+
</ExpandableRowContent>
|
|
267
|
+
</Td>
|
|
268
|
+
</Tr>
|
|
269
|
+
<Tr isExpanded={isRowExpanded && columnNames[expandedCellKey] === columnNames.prs} isExpandable>
|
|
270
|
+
<Td dataLabel={columnNames[expandedCellKey]} colSpan={7}>
|
|
271
|
+
<ExpandableRowContent>
|
|
272
|
+
<div>Expanded content for {repo.name}: prs goes here!</div>
|
|
273
|
+
</ExpandableRowContent>
|
|
274
|
+
</Td>
|
|
275
|
+
</Tr>
|
|
276
|
+
<Tr isExpanded={isRowExpanded && columnNames[expandedCellKey] === columnNames.workspaces} isExpandable>
|
|
277
|
+
<Td dataLabel={columnNames[expandedCellKey]} colSpan={7}>
|
|
278
|
+
<ExpandableRowContent>
|
|
279
|
+
<div>Expanded content for {repo.name}: workspaces goes here!</div>
|
|
280
|
+
</ExpandableRowContent>
|
|
281
|
+
</Td>
|
|
282
|
+
</Tr>
|
|
283
|
+
</Tbody>
|
|
284
|
+
);
|
|
285
|
+
})}
|
|
286
|
+
</Table>
|
|
287
|
+
{renderPagination('bottom', false)}
|
|
285
288
|
</PageSection>
|
|
286
289
|
</DashboardWrapper>
|
|
287
290
|
);
|
|
@@ -156,7 +156,7 @@ export const TableExpandCollapseAll: React.FunctionComponent = () => {
|
|
|
156
156
|
aria-label="Collapsible table data"
|
|
157
157
|
>
|
|
158
158
|
<Card component="div">
|
|
159
|
-
<Table isExpandable aria-label="Collapsible table">
|
|
159
|
+
<Table isExpandable hasAnimations aria-label="Collapsible table">
|
|
160
160
|
<Thead>
|
|
161
161
|
<Tr>
|
|
162
162
|
<Th
|