@patternfly/react-table 4.91.10 → 4.91.13
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/esm/components/Table/utils/decorators/collapsible.d.ts +1 -1
- package/dist/esm/components/Table/utils/decorators/collapsible.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/collapsible.js +2 -3
- package/dist/esm/components/Table/utils/decorators/collapsible.js.map +1 -1
- package/dist/esm/components/Table/utils/headerUtils.d.ts +1 -0
- package/dist/esm/components/Table/utils/headerUtils.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/headerUtils.js +2 -2
- package/dist/esm/components/Table/utils/headerUtils.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.map +1 -1
- package/dist/js/components/Table/utils/decorators/collapsible.d.ts +1 -1
- package/dist/js/components/Table/utils/decorators/collapsible.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/collapsible.js +2 -3
- package/dist/js/components/Table/utils/decorators/collapsible.js.map +1 -1
- package/dist/js/components/Table/utils/headerUtils.d.ts +1 -0
- package/dist/js/components/Table/utils/headerUtils.d.ts.map +1 -1
- package/dist/js/components/Table/utils/headerUtils.js +2 -2
- package/dist/js/components/Table/utils/headerUtils.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.map +1 -1
- package/dist/umd/react-table.css +51 -11
- package/dist/umd/react-table.js +7 -7
- package/dist/umd/react-table.min.css +471 -431
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
- package/src/components/Table/utils/decorators/collapsible.tsx +3 -3
- package/src/components/Table/utils/headerUtils.tsx +7 -2
- package/src/components/TableComposable/Tr.tsx +3 -1
- package/src/components/TableComposable/examples/ComposableTable.md +2 -0
- package/src/components/TableComposable/examples/ComposableTableCompoundExpandable.tsx +20 -7
- package/src/components/TableComposable/examples/ComposableTableExpandable.tsx +13 -9
- package/src/components/TableComposable/examples/ComposableTableNestedExpandable.tsx +4 -2
- package/src/components/TableComposable/examples/ComposableTableNestedTableExpandable.tsx +1 -1
- package/src/components/TableComposable/examples/ComposableTableStripedExpandable.tsx +5 -5
- package/src/components/TableComposable/examples/ComposableTableTree.tsx +1 -1
- package/src/demos/Table.md +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.91.
|
|
3
|
+
"version": "4.91.13",
|
|
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.222.
|
|
35
|
-
"@patternfly/react-icons": "^4.73.
|
|
36
|
-
"@patternfly/react-styles": "^4.72.
|
|
37
|
-
"@patternfly/react-tokens": "^4.74.
|
|
34
|
+
"@patternfly/react-core": "^4.222.13",
|
|
35
|
+
"@patternfly/react-icons": "^4.73.13",
|
|
36
|
+
"@patternfly/react-styles": "^4.72.13",
|
|
37
|
+
"@patternfly/react-tokens": "^4.74.13",
|
|
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": "12411175163290e8c6dd598cfb5ce53ba58688b3"
|
|
50
50
|
}
|
|
@@ -71,7 +71,7 @@ export const expandable: IFormatter = (value: IFormatterValueType, { rowData }:
|
|
|
71
71
|
value
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
export const expandedRow = (colSpan?: number) => {
|
|
74
|
+
export const expandedRow = (colSpan?: number, additionalColSpan: number = 0) => {
|
|
75
75
|
const expandedRowFormatter = (
|
|
76
76
|
value: IFormatterValueType,
|
|
77
77
|
{
|
|
@@ -85,8 +85,8 @@ export const expandedRow = (colSpan?: number) => {
|
|
|
85
85
|
): decoratorReturnType =>
|
|
86
86
|
value &&
|
|
87
87
|
rowData.hasOwnProperty('parent') && {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
colSpan:
|
|
89
|
+
!rowData.cells || rowData.cells.length === 1 ? colSpan + (rowData.fullWidth ? additionalColSpan + 1 : 0) : 1,
|
|
90
90
|
id: contentId + rowIndex + (columnIndex ? '-' + columnIndex : ''),
|
|
91
91
|
className: rowData.noPadding && css(styles.modifiers.noPadding)
|
|
92
92
|
};
|
|
@@ -211,6 +211,8 @@ const actionsTransforms = ({
|
|
|
211
211
|
export interface ICollapseTranform {
|
|
212
212
|
onCollapse: OnCollapse;
|
|
213
213
|
canCollapseAll: boolean;
|
|
214
|
+
// Account for additional added columns for full width
|
|
215
|
+
firstUserColumnIndex: number;
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
/**
|
|
@@ -220,13 +222,16 @@ export interface ICollapseTranform {
|
|
|
220
222
|
* @param {*} extraObject with onCollapse callback.
|
|
221
223
|
* @returns {*} object with empty title, tranforms - Array, cellTransforms - Array.
|
|
222
224
|
*/
|
|
223
|
-
const collapsibleTransforms = (
|
|
225
|
+
const collapsibleTransforms = (
|
|
226
|
+
header: (ICell | string)[],
|
|
227
|
+
{ onCollapse, canCollapseAll, firstUserColumnIndex }: ICollapseTranform
|
|
228
|
+
) => [
|
|
224
229
|
...(onCollapse
|
|
225
230
|
? [
|
|
226
231
|
{
|
|
227
232
|
title: '',
|
|
228
233
|
transforms: (canCollapseAll && [collapsible]) || null,
|
|
229
|
-
cellTransforms: [collapsible, expandedRow(header.length)]
|
|
234
|
+
cellTransforms: [collapsible, expandedRow(header.length, firstUserColumnIndex)]
|
|
230
235
|
}
|
|
231
236
|
]
|
|
232
237
|
: [])
|
|
@@ -14,7 +14,9 @@ export interface TrProps extends React.HTMLProps<HTMLTableRowElement>, OUIAProps
|
|
|
14
14
|
innerRef?: React.Ref<any>;
|
|
15
15
|
/** Flag indicating the Tr is hidden */
|
|
16
16
|
isHidden?: boolean;
|
|
17
|
-
/** Only applicable to Tr within the Tbody: Makes the row expandable and determines if it's expanded or not
|
|
17
|
+
/** Only applicable to Tr within the Tbody: Makes the row expandable and determines if it's expanded or not.
|
|
18
|
+
* To prevent column widths from responding automatically when expandable rows are toggled, the width prop must also be passed into either the th or td component
|
|
19
|
+
*/
|
|
18
20
|
isExpanded?: boolean;
|
|
19
21
|
/** Only applicable to Tr within the Tbody: Whether the row is editable */
|
|
20
22
|
isEditable?: boolean;
|
|
@@ -194,6 +194,8 @@ type OnCollapse = (
|
|
|
194
194
|
) => void;
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
+
Note: Table column widths will respond automatically when toggling expanded rows. To retain column widths between expanded and collapsed states, column header and/or data cell widths must be set.
|
|
198
|
+
|
|
197
199
|
```ts file="ComposableTableExpandable.tsx"
|
|
198
200
|
```
|
|
199
201
|
|
|
@@ -67,20 +67,26 @@ export const ComposableTableCompoundExpandable: React.FunctionComponent = () =>
|
|
|
67
67
|
return (
|
|
68
68
|
<Tbody key={repo.name} isExpanded={isRowExpanded}>
|
|
69
69
|
<Tr>
|
|
70
|
-
<Td dataLabel={columnNames.name} component="th">
|
|
70
|
+
<Td width={25} dataLabel={columnNames.name} component="th">
|
|
71
71
|
<a href="#">{repo.name}</a>
|
|
72
72
|
</Td>
|
|
73
|
-
<Td dataLabel={columnNames.branches} compoundExpand={compoundExpandParams(repo, 'branches')}>
|
|
73
|
+
<Td width={10} dataLabel={columnNames.branches} compoundExpand={compoundExpandParams(repo, 'branches')}>
|
|
74
74
|
<CodeBranchIcon key="icon" /> {repo.branches}
|
|
75
75
|
</Td>
|
|
76
|
-
<Td dataLabel={columnNames.prs} compoundExpand={compoundExpandParams(repo, 'prs')}>
|
|
76
|
+
<Td width={10} dataLabel={columnNames.prs} compoundExpand={compoundExpandParams(repo, 'prs')}>
|
|
77
77
|
<CodeIcon key="icon" /> {repo.prs}
|
|
78
78
|
</Td>
|
|
79
|
-
<Td
|
|
79
|
+
<Td
|
|
80
|
+
width={10}
|
|
81
|
+
dataLabel={columnNames.workspaces}
|
|
82
|
+
compoundExpand={compoundExpandParams(repo, 'workspaces')}
|
|
83
|
+
>
|
|
80
84
|
<CubeIcon key="icon" /> {repo.workspaces}
|
|
81
85
|
</Td>
|
|
82
|
-
<Td dataLabel={columnNames.lastCommit}>
|
|
83
|
-
|
|
86
|
+
<Td width={15} dataLabel={columnNames.lastCommit}>
|
|
87
|
+
{repo.lastCommit}
|
|
88
|
+
</Td>
|
|
89
|
+
<Td width={30}>
|
|
84
90
|
<a href="#">Open in GitHub</a>
|
|
85
91
|
</Td>
|
|
86
92
|
</Tr>
|
|
@@ -89,7 +95,14 @@ export const ComposableTableCompoundExpandable: React.FunctionComponent = () =>
|
|
|
89
95
|
<Td dataLabel={columnNames[expandedCellKey]} noPadding colSpan={6}>
|
|
90
96
|
<ExpandableRowContent>
|
|
91
97
|
<div className="pf-u-m-md">
|
|
92
|
-
|
|
98
|
+
Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem
|
|
99
|
+
ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum
|
|
100
|
+
sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit
|
|
101
|
+
dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor.
|
|
102
|
+
Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem
|
|
103
|
+
ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum
|
|
104
|
+
sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit
|
|
105
|
+
dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor.
|
|
93
106
|
</div>
|
|
94
107
|
</ExpandableRowContent>
|
|
95
108
|
</Td>
|
|
@@ -36,7 +36,11 @@ export const ComposableTableExpandable: React.FunctionComponent = () => {
|
|
|
36
36
|
prs: 'b',
|
|
37
37
|
workspaces: 'four',
|
|
38
38
|
lastCommit: 'five',
|
|
39
|
-
details: {
|
|
39
|
+
details: {
|
|
40
|
+
detailFormat: 1,
|
|
41
|
+
detail1:
|
|
42
|
+
'Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. '
|
|
43
|
+
}
|
|
40
44
|
},
|
|
41
45
|
{
|
|
42
46
|
name: 'parent 3',
|
|
@@ -117,11 +121,11 @@ export const ComposableTableExpandable: React.FunctionComponent = () => {
|
|
|
117
121
|
<Thead>
|
|
118
122
|
<Tr>
|
|
119
123
|
<Th />
|
|
120
|
-
<Th>{columnNames.name}</Th>
|
|
121
|
-
<Th>{columnNames.branches}</Th>
|
|
122
|
-
<Th>{columnNames.prs}</Th>
|
|
123
|
-
<Th>{columnNames.workspaces}</Th>
|
|
124
|
-
<Th>{columnNames.lastCommit}</Th>
|
|
124
|
+
<Th width={25}>{columnNames.name}</Th>
|
|
125
|
+
<Th width={10}>{columnNames.branches}</Th>
|
|
126
|
+
<Th width={15}>{columnNames.prs}</Th>
|
|
127
|
+
<Th width={30}>{columnNames.workspaces}</Th>
|
|
128
|
+
<Th width={10}>{columnNames.lastCommit}</Th>
|
|
125
129
|
</Tr>
|
|
126
130
|
</Thead>
|
|
127
131
|
{repositories.map((repo, rowIndex) => {
|
|
@@ -137,14 +141,14 @@ export const ComposableTableExpandable: React.FunctionComponent = () => {
|
|
|
137
141
|
childIsFullWidth = [1, 3].includes(detailFormat);
|
|
138
142
|
childHasNoPadding = [2, 3].includes(detailFormat);
|
|
139
143
|
if (detail1 && !detail2 && !detail3) {
|
|
140
|
-
detail1Colspan = childIsFullWidth ? numColumns : numColumns + 1; // Account for toggle column
|
|
144
|
+
detail1Colspan = !childIsFullWidth ? numColumns : numColumns + 1; // Account for toggle column
|
|
141
145
|
} else if (detail1 && detail2 && !detail3) {
|
|
142
146
|
detail1Colspan = 2;
|
|
143
|
-
detail2Colspan = childIsFullWidth ? 3 : 4;
|
|
147
|
+
detail2Colspan = !childIsFullWidth ? 3 : 4;
|
|
144
148
|
} else if (detail1 && detail2 && detail3) {
|
|
145
149
|
detail1Colspan = 2;
|
|
146
150
|
detail2Colspan = 2;
|
|
147
|
-
detail3Colspan = childIsFullWidth ? 1 : 2;
|
|
151
|
+
detail3Colspan = !childIsFullWidth ? 1 : 2;
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
return (
|
|
@@ -74,13 +74,15 @@ export const ComposableTableNestedExpandable: React.FunctionComponent = () => {
|
|
|
74
74
|
<Thead hasNestedHeader>
|
|
75
75
|
<Tr>
|
|
76
76
|
<Th rowSpan={2} />
|
|
77
|
-
<Th rowSpan={2} hasRightBorder>
|
|
77
|
+
<Th width={35} rowSpan={2} hasRightBorder>
|
|
78
78
|
{columnNames.team}
|
|
79
79
|
</Th>
|
|
80
80
|
<Th colSpan={3} hasRightBorder>
|
|
81
81
|
{columnNames.members}
|
|
82
82
|
</Th>
|
|
83
|
-
<Th rowSpan={2}>
|
|
83
|
+
<Th width={25} rowSpan={2}>
|
|
84
|
+
{columnNames.contact}
|
|
85
|
+
</Th>
|
|
84
86
|
</Tr>
|
|
85
87
|
<Tr resetOffset>
|
|
86
88
|
<Th isSubheader>{columnNames.lead}</Th>
|
|
@@ -142,7 +142,7 @@ export const ComposableTableExpandable: React.FunctionComponent = () => {
|
|
|
142
142
|
<Thead>
|
|
143
143
|
<Tr>
|
|
144
144
|
<Td />
|
|
145
|
-
<Th>{columnNames.name}</Th>
|
|
145
|
+
<Th width={20}>{columnNames.name}</Th>
|
|
146
146
|
<Th>{columnNames.branches}</Th>
|
|
147
147
|
<Th>{columnNames.prs}</Th>
|
|
148
148
|
<Th>{columnNames.link}</Th>
|
|
@@ -121,11 +121,11 @@ export const ComposableTableStripedExpandable: React.FunctionComponent = () => {
|
|
|
121
121
|
<Thead>
|
|
122
122
|
<Tr>
|
|
123
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>
|
|
124
|
+
<Th width={25}>{columnNames.name}</Th>
|
|
125
|
+
<Th width={10}>{columnNames.branches}</Th>
|
|
126
|
+
<Th width={15}>{columnNames.prs}</Th>
|
|
127
|
+
<Th width={30}>{columnNames.workspaces}</Th>
|
|
128
|
+
<Th width={10}>{columnNames.lastCommit}</Th>
|
|
129
129
|
</Tr>
|
|
130
130
|
</Thead>
|
|
131
131
|
{repositories.map((repo, rowIndex) => {
|
|
@@ -187,7 +187,7 @@ export const ComposableTableTree: React.FunctionComponent = () => {
|
|
|
187
187
|
<TableComposable isTreeTable aria-label="Tree table">
|
|
188
188
|
<Thead>
|
|
189
189
|
<Tr>
|
|
190
|
-
<Th>{columnNames.name}</Th>
|
|
190
|
+
<Th width={40}>{columnNames.name}</Th>
|
|
191
191
|
<Th>{columnNames.branches}</Th>
|
|
192
192
|
<Th>{columnNames.prs}</Th>
|
|
193
193
|
<Th>{columnNames.workspaces}</Th>
|
package/src/demos/Table.md
CHANGED
|
@@ -2332,6 +2332,8 @@ ComposableTableSortable = () => {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
isPlain
|
|
2334
2334
|
isGrouped
|
|
2335
|
+
menuAppendTo='parent'
|
|
2336
|
+
isFlipEnabled
|
|
2335
2337
|
/>
|
|
2336
2338
|
</ToolbarItem>
|
|
2337
2339
|
<OverflowMenu breakpoint="lg">
|
|
@@ -2352,6 +2354,8 @@ ComposableTableSortable = () => {
|
|
|
2352
2354
|
toggle={<KebabToggle onToggle={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)} />}
|
|
2353
2355
|
isOpen={isKebabDropdownOpen}
|
|
2354
2356
|
dropdownItems={kebabDropdownItems}
|
|
2357
|
+
isFlipEnabled
|
|
2358
|
+
menuAppendTo="parent"
|
|
2355
2359
|
/>
|
|
2356
2360
|
</OverflowMenuControl>
|
|
2357
2361
|
</OverflowMenu>
|