@patternfly/react-table 6.3.0-prerelease.3 → 6.3.0-prerelease.30
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 +116 -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 +3 -1
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +7 -4
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/esm/demos/DashboardHeader.d.ts.map +1 -1
- package/dist/esm/demos/DashboardHeader.js +1 -2
- package/dist/esm/demos/DashboardHeader.js.map +1 -1
- package/dist/esm/demos/sampleData.d.ts.map +1 -1
- package/dist/esm/demos/sampleData.js +359 -360
- package/dist/esm/demos/sampleData.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 +3 -1
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +7 -4
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/js/demos/DashboardHeader.d.ts.map +1 -1
- package/dist/js/demos/DashboardHeader.js +1 -2
- package/dist/js/demos/DashboardHeader.js.map +1 -1
- package/dist/js/demos/sampleData.d.ts.map +1 -1
- package/dist/js/demos/sampleData.js +359 -360
- package/dist/js/demos/sampleData.js.map +1 -1
- package/dist/umd/assets/{output-CLV1g6to.css → output-C-sBtw5n.css} +5230 -4833
- package/dist/umd/react-table.min.js +2 -2
- 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 +10 -4
- 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 +8 -3
- package/src/components/Table/examples/TableMisc.tsx +0 -1
- package/src/components/Table/examples/TableNestedExpandable.tsx +3 -3
- package/src/components/Table/examples/TableNestedTableExpandable.tsx +3 -3
- package/src/components/Table/examples/TableStripedExpandable.tsx +9 -3
- package/src/demos/DashboardHeader.tsx +2 -5
- package/src/demos/examples/TableCompoundExpansion.tsx +87 -84
- package/src/demos/examples/TableExpandCollapseAll.tsx +3 -3
- package/src/demos/sampleData.tsx +359 -361
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +0 -17
- package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +0 -1
|
@@ -112,7 +112,13 @@ export const TableStripedExpandable: React.FunctionComponent = () => {
|
|
|
112
112
|
id="toggle-compact-striped"
|
|
113
113
|
name="toggle-compact-striped"
|
|
114
114
|
/>
|
|
115
|
-
<Table
|
|
115
|
+
<Table
|
|
116
|
+
aria-label="Expandable table"
|
|
117
|
+
variant={isExampleCompact ? 'compact' : undefined}
|
|
118
|
+
isStriped
|
|
119
|
+
isExpandable
|
|
120
|
+
hasAnimations
|
|
121
|
+
>
|
|
116
122
|
<Thead>
|
|
117
123
|
<Tr>
|
|
118
124
|
<Th screenReaderText="Row expansion" />
|
|
@@ -148,7 +154,7 @@ export const TableStripedExpandable: React.FunctionComponent = () => {
|
|
|
148
154
|
}
|
|
149
155
|
return (
|
|
150
156
|
<Tbody key={repo.name} isExpanded={isRepoExpanded(repo)}>
|
|
151
|
-
<Tr>
|
|
157
|
+
<Tr isExpanded={isRepoExpanded(repo)}>
|
|
152
158
|
<Td
|
|
153
159
|
expand={
|
|
154
160
|
repo.details
|
|
@@ -167,7 +173,7 @@ export const TableStripedExpandable: React.FunctionComponent = () => {
|
|
|
167
173
|
<Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
|
|
168
174
|
</Tr>
|
|
169
175
|
{repo.details ? (
|
|
170
|
-
<Tr isExpanded={isRepoExpanded(repo)}>
|
|
176
|
+
<Tr isExpanded={isRepoExpanded(repo)} isExpandable>
|
|
171
177
|
{!childIsFullWidth ? <Td /> : null}
|
|
172
178
|
{repo.details.detail1 ? (
|
|
173
179
|
<Td dataLabel="Repo detail 1" noPadding={childHasNoPadding} colSpan={detail1Colspan}>
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
ToolbarItem,
|
|
24
24
|
PageToggleButton
|
|
25
25
|
} from '@patternfly/react-core';
|
|
26
|
-
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
27
26
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
28
27
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
29
28
|
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
@@ -132,9 +131,7 @@ export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBa
|
|
|
132
131
|
<Masthead>
|
|
133
132
|
<MastheadMain>
|
|
134
133
|
<MastheadToggle>
|
|
135
|
-
<PageToggleButton
|
|
136
|
-
<BarsIcon />
|
|
137
|
-
</PageToggleButton>
|
|
134
|
+
<PageToggleButton isHamburgerButton aria-label="Global navigation" />
|
|
138
135
|
</MastheadToggle>
|
|
139
136
|
<MastheadBrand>
|
|
140
137
|
<MastheadLogo>{patternflyLogo}</MastheadLogo>
|
|
@@ -159,7 +156,7 @@ export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBa
|
|
|
159
156
|
)}
|
|
160
157
|
<ToolbarGroup variant="action-group-plain" visibility={{ default: 'hidden', lg: 'visible' }}>
|
|
161
158
|
<ToolbarItem>
|
|
162
|
-
<Button aria-label="Settings" variant=
|
|
159
|
+
<Button aria-label="Settings" isSettings variant="plain" />
|
|
163
160
|
</ToolbarItem>
|
|
164
161
|
<ToolbarItem>
|
|
165
162
|
<Button aria-label="Help" variant={ButtonVariant.plain} icon={<QuestionCircleIcon />} />
|
|
@@ -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 aria-label="Collapsible table">
|
|
159
|
+
<Table isExpandable hasAnimations aria-label="Collapsible table">
|
|
160
160
|
<Thead>
|
|
161
161
|
<Tr>
|
|
162
162
|
<Th
|
|
@@ -175,7 +175,7 @@ export const TableExpandCollapseAll: React.FunctionComponent = () => {
|
|
|
175
175
|
|
|
176
176
|
{serverData.map((server, serverIndex) => (
|
|
177
177
|
<Tbody key={server.name} isExpanded={isServerExpanded(server)}>
|
|
178
|
-
<Tr>
|
|
178
|
+
<Tr isExpanded={isServerExpanded(server)}>
|
|
179
179
|
<Td
|
|
180
180
|
expand={
|
|
181
181
|
server.details
|
|
@@ -195,7 +195,7 @@ export const TableExpandCollapseAll: React.FunctionComponent = () => {
|
|
|
195
195
|
<Td>{server?.workspaces}</Td>
|
|
196
196
|
<Td>{server?.status?.title}</Td>
|
|
197
197
|
</Tr>
|
|
198
|
-
<Tr isExpanded={isServerExpanded(server)}>
|
|
198
|
+
<Tr isExpandable isExpanded={isServerExpanded(server)}>
|
|
199
199
|
<Td></Td>
|
|
200
200
|
<Td colSpan={expandableColumns.length}>
|
|
201
201
|
<ExpandableRowContent>{server?.details}</ExpandableRowContent>
|