@patternfly/react-table 5.0.0-alpha.92 → 5.0.0-alpha.94
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/esm/components/Table/SortColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/SortColumn.js +3 -2
- package/dist/esm/components/Table/SortColumn.js.map +1 -1
- package/dist/esm/components/Table/TableText.d.ts +2 -0
- package/dist/esm/components/Table/TableText.d.ts.map +1 -1
- package/dist/esm/components/Table/TableText.js +17 -1
- package/dist/esm/components/Table/TableText.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +12 -5
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +10 -3
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.js +5 -5
- package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/components/Table/SortColumn.d.ts.map +1 -1
- package/dist/js/components/Table/SortColumn.js +3 -2
- package/dist/js/components/Table/SortColumn.js.map +1 -1
- package/dist/js/components/Table/TableText.d.ts +2 -0
- package/dist/js/components/Table/TableText.d.ts.map +1 -1
- package/dist/js/components/Table/TableText.js +17 -1
- package/dist/js/components/Table/TableText.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +12 -5
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +10 -3
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/package.json +1 -1
- package/dist/js/components/Table/utils/decorators/package.json +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.js +5 -5
- package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/components/Table/utils/package.json +1 -1
- package/dist/js/components/package.json +1 -1
- package/dist/js/deprecated/components/Table/base/package.json +1 -1
- package/dist/js/deprecated/components/Table/package.json +1 -1
- package/dist/js/deprecated/components/package.json +1 -1
- package/dist/js/deprecated/package.json +1 -1
- package/dist/js/package.json +1 -1
- package/dist/umd/react-table.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Table/SortColumn.tsx +5 -2
- package/src/components/Table/TableText.tsx +21 -2
- package/src/components/Table/Td.tsx +24 -8
- package/src/components/Table/Th.tsx +21 -5
- package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +1 -1
- package/src/components/Table/examples/Table.md +2 -0
- package/src/components/Table/examples/TableCompoundExpandable.tsx +1 -1
- package/src/components/Table/examples/TableMisc.tsx +1 -1
- package/src/components/Table/examples/TableNestedHeaders.tsx +4 -4
- package/src/components/Table/examples/TableNestedStickyHeader.tsx +4 -4
- package/src/components/Table/examples/TableTextModifiers.tsx +33 -22
- package/src/components/Table/utils/__snapshots__/transformers.test.tsx.snap +2 -2
- package/src/components/Table/utils/decorators/treeRow.tsx +85 -87
- package/src/components/Table/utils/transformers.test.tsx +7 -7
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1445 -300
- package/src/deprecated/components/Table/examples/LegacyTableCompoundExpandable.tsx +4 -4
- package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +2 -2
- package/src/deprecated/components/Table/examples/LegacyTableSelectable.tsx +6 -6
- package/src/docs/demos/Table.md +28 -22
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +17 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.94",
|
|
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",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"subpaths": "node scripts/createSubpaths.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
44
|
-
"@patternfly/react-icons": "^5.0.0-alpha.
|
|
45
|
-
"@patternfly/react-styles": "^5.0.0-alpha.
|
|
46
|
-
"@patternfly/react-tokens": "^5.0.0-alpha.
|
|
43
|
+
"@patternfly/react-core": "^5.0.0-alpha.92",
|
|
44
|
+
"@patternfly/react-icons": "^5.0.0-alpha.14",
|
|
45
|
+
"@patternfly/react-styles": "^5.0.0-alpha.10",
|
|
46
|
+
"@patternfly/react-tokens": "^5.0.0-alpha.9",
|
|
47
47
|
"lodash": "^4.17.19",
|
|
48
48
|
"tslib": "^2.5.0"
|
|
49
49
|
},
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": "^17 || ^18",
|
|
56
56
|
"react-dom": "^17 || ^18"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "887e5bc7e32dfb539c2006177eafcbafe12bb3d2"
|
|
59
59
|
}
|
|
@@ -29,6 +29,7 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
|
|
|
29
29
|
...props
|
|
30
30
|
}: SortColumnProps) => {
|
|
31
31
|
let SortedByIcon;
|
|
32
|
+
const [focused, setFocused] = React.useState(false);
|
|
32
33
|
if (isSortedBy) {
|
|
33
34
|
SortedByIcon = sortDirection === SortByDirection.asc ? LongArrowAltUpIcon : LongArrowAltDownIcon;
|
|
34
35
|
} else {
|
|
@@ -39,10 +40,12 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
|
|
|
39
40
|
{...props}
|
|
40
41
|
type={type}
|
|
41
42
|
className={css(className, styles.tableButton)}
|
|
42
|
-
onClick={event => onSort && onSort(event)}
|
|
43
|
+
onClick={(event) => onSort && onSort(event)}
|
|
44
|
+
onFocus={() => setFocused(true)}
|
|
45
|
+
onBlur={() => setFocused(false)}
|
|
43
46
|
>
|
|
44
47
|
<div className={css(className, styles.tableButtonContent)}>
|
|
45
|
-
<TableText>{children}</TableText>
|
|
48
|
+
<TableText focused={focused}>{children}</TableText>
|
|
46
49
|
<span className={css(styles.tableSortIndicator)}>
|
|
47
50
|
<SortedByIcon />
|
|
48
51
|
</span>
|
|
@@ -31,6 +31,8 @@ export interface TableTextProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
31
31
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
|
32
32
|
/** callback used to create the tooltip if text is truncated */
|
|
33
33
|
onMouseEnter?: (event: any) => void;
|
|
34
|
+
/** Determines if the TableText is focused by parent component */
|
|
35
|
+
focused?: boolean;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export const TableText: React.FunctionComponent<TableTextProps> = ({
|
|
@@ -41,10 +43,11 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
|
|
|
41
43
|
tooltip: tooltipProp = '',
|
|
42
44
|
tooltipProps = {},
|
|
43
45
|
onMouseEnter: onMouseEnterProp = () => {},
|
|
46
|
+
focused = false,
|
|
44
47
|
...props
|
|
45
48
|
}: TableTextProps) => {
|
|
46
49
|
const Component: TableTextVariant | 'span' | 'div' = variant;
|
|
47
|
-
const textRef = React.createRef<
|
|
50
|
+
const textRef = React.createRef<HTMLElement>();
|
|
48
51
|
|
|
49
52
|
const [tooltip, setTooltip] = React.useState('');
|
|
50
53
|
const onMouseEnter = (event: any) => {
|
|
@@ -56,9 +59,17 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
|
|
|
56
59
|
onMouseEnterProp(event);
|
|
57
60
|
};
|
|
58
61
|
|
|
62
|
+
const onFocus = (element: HTMLElement) => {
|
|
63
|
+
if (element.offsetWidth < element.scrollWidth) {
|
|
64
|
+
setTooltip(tooltipProp || element.innerText);
|
|
65
|
+
} else {
|
|
66
|
+
setTooltip('');
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
59
70
|
const text = (
|
|
60
71
|
<Component
|
|
61
|
-
ref={textRef}
|
|
72
|
+
ref={textRef as React.Ref<HTMLDivElement>}
|
|
62
73
|
onMouseEnter={onMouseEnter}
|
|
63
74
|
className={css(className, wrapModifier && styles.modifiers[wrapModifier], styles.tableText)}
|
|
64
75
|
{...props}
|
|
@@ -67,6 +78,14 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
|
|
|
67
78
|
</Component>
|
|
68
79
|
);
|
|
69
80
|
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (focused) {
|
|
83
|
+
onFocus(textRef.current);
|
|
84
|
+
} else {
|
|
85
|
+
setTooltip('');
|
|
86
|
+
}
|
|
87
|
+
}, [focused]);
|
|
88
|
+
|
|
70
89
|
return tooltip !== '' ? (
|
|
71
90
|
<Tooltip triggerRef={textRef} content={tooltip} isVisible {...tooltipProps}>
|
|
72
91
|
{text}
|
|
@@ -105,14 +105,15 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
105
105
|
...props
|
|
106
106
|
}: TdProps) => {
|
|
107
107
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
108
|
+
const [truncated, setTruncated] = React.useState(false);
|
|
108
109
|
const cellRef = innerRef ? innerRef : React.createRef();
|
|
109
|
-
|
|
110
110
|
const onMouseEnter = (event: any) => {
|
|
111
111
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
112
112
|
!showTooltip && setShowTooltip(true);
|
|
113
113
|
} else {
|
|
114
114
|
showTooltip && setShowTooltip(false);
|
|
115
115
|
}
|
|
116
|
+
|
|
116
117
|
onMouseEnterProp(event);
|
|
117
118
|
};
|
|
118
119
|
|
|
@@ -252,12 +253,22 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
252
253
|
} = merged;
|
|
253
254
|
|
|
254
255
|
const treeTableTitleCell =
|
|
255
|
-
(className && className.includes('pf-c-table__tree-view-title-cell')) ||
|
|
256
|
-
(mergedClassName && mergedClassName.includes('pf-c-table__tree-view-title-cell'));
|
|
256
|
+
(className && className.includes('pf-v5-c-table__tree-view-title-cell')) ||
|
|
257
|
+
(mergedClassName && mergedClassName.includes('pf-v5-c-table__tree-view-title-cell'));
|
|
258
|
+
|
|
259
|
+
React.useEffect(() => {
|
|
260
|
+
setTruncated(
|
|
261
|
+
(cellRef as React.RefObject<HTMLElement>).current.offsetWidth <
|
|
262
|
+
(cellRef as React.RefObject<HTMLElement>).current.scrollWidth
|
|
263
|
+
);
|
|
264
|
+
}, [cellRef]);
|
|
257
265
|
|
|
258
266
|
const cell = (
|
|
259
267
|
<MergedComponent
|
|
268
|
+
tabIndex={(select || !truncated) && modifier !== 'truncate' ? -1 : 0}
|
|
260
269
|
{...(!treeTableTitleCell && { 'data-label': dataLabel })}
|
|
270
|
+
onFocus={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
271
|
+
onBlur={() => setShowTooltip(false)}
|
|
261
272
|
onMouseEnter={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
262
273
|
className={css(
|
|
263
274
|
className,
|
|
@@ -276,9 +287,9 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
276
287
|
{...props}
|
|
277
288
|
{...(isStickyColumn && {
|
|
278
289
|
style: {
|
|
279
|
-
'--pf-c-table__sticky-cell--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
280
|
-
'--pf-c-table__sticky-cell--Left': stickyLeftOffset ? stickyLeftOffset : 0,
|
|
281
|
-
'--pf-c-table__sticky-cell--Right': stickyRightOffset ? stickyRightOffset : 0,
|
|
290
|
+
'--pf-v5-c-table__sticky-cell--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
291
|
+
'--pf-v5-c-table__sticky-cell--Left': stickyLeftOffset ? stickyLeftOffset : 0,
|
|
292
|
+
'--pf-v5-c-table__sticky-cell--Right': stickyRightOffset ? stickyRightOffset : 0,
|
|
282
293
|
...props.style
|
|
283
294
|
} as React.CSSProperties
|
|
284
295
|
})}
|
|
@@ -289,9 +300,14 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
289
300
|
|
|
290
301
|
const canMakeDefaultTooltip = tooltip === '' ? typeof children === 'string' : true;
|
|
291
302
|
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (
|
|
292
|
-
|
|
303
|
+
<>
|
|
293
304
|
{cell}
|
|
294
|
-
|
|
305
|
+
<Tooltip
|
|
306
|
+
triggerRef={cellRef as React.RefObject<any>}
|
|
307
|
+
content={tooltip || (tooltip === '' && children)}
|
|
308
|
+
isVisible
|
|
309
|
+
/>
|
|
310
|
+
</>
|
|
295
311
|
) : (
|
|
296
312
|
cell
|
|
297
313
|
);
|
|
@@ -80,6 +80,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
80
80
|
...props
|
|
81
81
|
}: ThProps) => {
|
|
82
82
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
83
|
+
const [truncated, setTruncated] = React.useState(false);
|
|
83
84
|
const cellRef = innerRef ? innerRef : React.createRef();
|
|
84
85
|
const onMouseEnter = (event: any) => {
|
|
85
86
|
if (event.target.offsetWidth < event.target.scrollWidth) {
|
|
@@ -161,8 +162,18 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
161
162
|
...mergedProps
|
|
162
163
|
} = merged;
|
|
163
164
|
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
setTruncated(
|
|
167
|
+
(cellRef as React.RefObject<HTMLElement>).current.offsetWidth <
|
|
168
|
+
(cellRef as React.RefObject<HTMLElement>).current.scrollWidth
|
|
169
|
+
);
|
|
170
|
+
}, [cellRef]);
|
|
171
|
+
|
|
164
172
|
const cell = (
|
|
165
173
|
<MergedComponent
|
|
174
|
+
tabIndex={sort || select || !truncated ? -1 : 0}
|
|
175
|
+
onFocus={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
176
|
+
onBlur={() => setShowTooltip(false)}
|
|
166
177
|
data-label={dataLabel}
|
|
167
178
|
onMouseEnter={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
168
179
|
scope={component === 'th' && children ? scope : null}
|
|
@@ -181,9 +192,9 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
181
192
|
{...props}
|
|
182
193
|
{...(isStickyColumn && {
|
|
183
194
|
style: {
|
|
184
|
-
'--pf-c-table__sticky-cell--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
185
|
-
'--pf-c-table__sticky-cell--Left': stickyLeftOffset ? stickyLeftOffset : 0,
|
|
186
|
-
'--pf-c-table__sticky-cell--Right': stickyRightOffset ? stickyRightOffset : 0,
|
|
195
|
+
'--pf-v5-c-table__sticky-cell--MinWidth': stickyMinWidth ? stickyMinWidth : undefined,
|
|
196
|
+
'--pf-v5-c-table__sticky-cell--Left': stickyLeftOffset ? stickyLeftOffset : 0,
|
|
197
|
+
'--pf-v5-c-table__sticky-cell--Right': stickyRightOffset ? stickyRightOffset : 0,
|
|
187
198
|
...props.style
|
|
188
199
|
} as React.CSSProperties
|
|
189
200
|
})}
|
|
@@ -194,9 +205,14 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
194
205
|
|
|
195
206
|
const canMakeDefaultTooltip = tooltip === '' ? typeof transformedChildren === 'string' : true;
|
|
196
207
|
return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (
|
|
197
|
-
|
|
208
|
+
<>
|
|
198
209
|
{cell}
|
|
199
|
-
|
|
210
|
+
<Tooltip
|
|
211
|
+
triggerRef={cellRef as React.RefObject<any>}
|
|
212
|
+
content={tooltip || (tooltip === '' && children)}
|
|
213
|
+
isVisible
|
|
214
|
+
/>
|
|
215
|
+
</>
|
|
200
216
|
) : (
|
|
201
217
|
cell
|
|
202
218
|
);
|
|
@@ -20,7 +20,7 @@ exports[`RowWrapper renders expanded correctly 1`] = `
|
|
|
20
20
|
<table>
|
|
21
21
|
<tbody>
|
|
22
22
|
<tr
|
|
23
|
-
class="pf-c-table__expandable-row pf-m-expanded"
|
|
23
|
+
class="pf-v5-c-table__expandable-row pf-m-expanded"
|
|
24
24
|
data-ouia-component-id="OUIA-Generated-TableRow-2"
|
|
25
25
|
data-ouia-component-type="PF4/TableRow"
|
|
26
26
|
data-ouia-safe="true"
|
|
@@ -233,6 +233,8 @@ export type OnExpand = (
|
|
|
233
233
|
|
|
234
234
|
### Modifiers with table text
|
|
235
235
|
|
|
236
|
+
If the "wrapModifier" property is set to "truncate", it's needed to ensure that the corresponding tooltip can be opened using both keyboard and screen reader. Since this particular Td element is generic and doesn't have any predefined decorators, the focus management required to trigger the tooltip needs to be handled manually by defining and manipulating the requisite props.
|
|
237
|
+
|
|
236
238
|
```ts file="TableTextModifiers.tsx"
|
|
237
239
|
```
|
|
238
240
|
|
|
@@ -110,7 +110,7 @@ export const TableCompoundExpandable: React.FunctionComponent = () => {
|
|
|
110
110
|
<Tr isExpanded={isRowExpanded}>
|
|
111
111
|
<Td dataLabel={columnNames[expandedCellKey]} noPadding colSpan={6}>
|
|
112
112
|
<ExpandableRowContent>
|
|
113
|
-
<div className="pf-u-m-md">
|
|
113
|
+
<div className="pf-v5-u-m-md">
|
|
114
114
|
Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem
|
|
115
115
|
ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum
|
|
116
116
|
sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit dolor. Lorem ipsum sit
|
|
@@ -65,7 +65,7 @@ export const TableMisc: React.FunctionComponent = () => {
|
|
|
65
65
|
{repositories.map((repo, rowIndex) => {
|
|
66
66
|
const isOddRow = (rowIndex + 1) % 2;
|
|
67
67
|
const customStyle = {
|
|
68
|
-
backgroundColor: 'var(--pf-global--palette--blue-50)'
|
|
68
|
+
backgroundColor: 'var(--pf-v5-global--palette--blue-50)'
|
|
69
69
|
};
|
|
70
70
|
// Some arbitrary logic to demonstrate that cell styles can be based on anything
|
|
71
71
|
const nameColSpan = repo.branches === null && repo.prs === null ? 3 : 1;
|
|
@@ -155,14 +155,14 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
155
155
|
</Tr>
|
|
156
156
|
</Thead>
|
|
157
157
|
<Tbody>
|
|
158
|
-
{sortedConnections.map(connection => (
|
|
158
|
+
{sortedConnections.map((connection) => (
|
|
159
159
|
<Tr key={connection.source.podName}>
|
|
160
160
|
<Td dataLabel={columnNames.source}>{connection.source.podName}</Td>
|
|
161
161
|
<Td dataLabel={columnNames.destination}>{connection.destination.podName}</Td>\
|
|
162
162
|
<Td dataLabel={columnNames.datetime}>
|
|
163
163
|
<div>
|
|
164
164
|
<span>{new Date(connection.timestamp).toDateString()}</span>{' '}
|
|
165
|
-
<span className="pf-u-color-200">{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
165
|
+
<span className="pf-v5-u-color-200">{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
166
166
|
</div>
|
|
167
167
|
</Td>
|
|
168
168
|
<Td dataLabel={columnNames.source}>
|
|
@@ -171,7 +171,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
171
171
|
<span>{connection.source.port.num}</span>
|
|
172
172
|
</StackItem>
|
|
173
173
|
<StackItem>
|
|
174
|
-
<span className="pf-u-color-200">({connection.source.port.protocol})</span>
|
|
174
|
+
<span className="pf-v5-u-color-200">({connection.source.port.protocol})</span>
|
|
175
175
|
</StackItem>
|
|
176
176
|
</Stack>
|
|
177
177
|
</Td>
|
|
@@ -181,7 +181,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
181
181
|
<span>{connection.destination.port.num}</span>
|
|
182
182
|
</StackItem>
|
|
183
183
|
<StackItem>
|
|
184
|
-
<span className="pf-u-color-200">({connection.destination.port.protocol})</span>
|
|
184
|
+
<span className="pf-v5-u-color-200">({connection.destination.port.protocol})</span>
|
|
185
185
|
</StackItem>
|
|
186
186
|
</Stack>
|
|
187
187
|
</Td>
|
|
@@ -158,14 +158,14 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
158
158
|
</Tr>
|
|
159
159
|
</Thead>
|
|
160
160
|
<Tbody>
|
|
161
|
-
{sortedConnections.map(connection => (
|
|
161
|
+
{sortedConnections.map((connection) => (
|
|
162
162
|
<Tr key={connection.source.podName}>
|
|
163
163
|
<Td dataLabel={columnNames.source}>{connection.source.podName}</Td>
|
|
164
164
|
<Td dataLabel={columnNames.destination}>{connection.destination.podName}</Td>\
|
|
165
165
|
<Td dataLabel={columnNames.datetime}>
|
|
166
166
|
<div>
|
|
167
167
|
<span>{new Date(connection.timestamp).toDateString()}</span>{' '}
|
|
168
|
-
<span className="pf-u-color-200">{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
168
|
+
<span className="pf-v5-u-color-200">{new Date(connection.timestamp).toLocaleTimeString()}</span>
|
|
169
169
|
</div>
|
|
170
170
|
</Td>
|
|
171
171
|
<Td dataLabel={columnNames.source}>
|
|
@@ -174,7 +174,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
174
174
|
<span>{connection.source.port.num}</span>
|
|
175
175
|
</StackItem>
|
|
176
176
|
<StackItem>
|
|
177
|
-
<span className="pf-u-color-200">({connection.source.port.protocol})</span>
|
|
177
|
+
<span className="pf-v5-u-color-200">({connection.source.port.protocol})</span>
|
|
178
178
|
</StackItem>
|
|
179
179
|
</Stack>
|
|
180
180
|
</Td>
|
|
@@ -184,7 +184,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
|
|
|
184
184
|
<span>{connection.destination.port.num}</span>
|
|
185
185
|
</StackItem>
|
|
186
186
|
<StackItem>
|
|
187
|
-
<span className="pf-u-color-200">({connection.destination.port.protocol})</span>
|
|
187
|
+
<span className="pf-v5-u-color-200">({connection.destination.port.protocol})</span>
|
|
188
188
|
</StackItem>
|
|
189
189
|
</Stack>
|
|
190
190
|
</Td>
|
|
@@ -9,25 +9,36 @@ const columnNames = {
|
|
|
9
9
|
wrap: 'Wrapping table header text. This th text will wrap instead of truncate.'
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const TableTextModifiers: React.FunctionComponent = () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
export const TableTextModifiers: React.FunctionComponent = () => {
|
|
13
|
+
const [focused, setFocused] = React.useState(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Table aria-label="Table text">
|
|
17
|
+
<Thead>
|
|
18
|
+
<Tr>
|
|
19
|
+
<Th width={30}>{columnNames.truncate}</Th>
|
|
20
|
+
<Th>{columnNames.wrap}</Th>
|
|
21
|
+
</Tr>
|
|
22
|
+
</Thead>
|
|
23
|
+
<Tbody>
|
|
24
|
+
<Tr>
|
|
25
|
+
<Td
|
|
26
|
+
onFocus={() => setFocused(true)}
|
|
27
|
+
onBlur={() => setFocused(false)}
|
|
28
|
+
tabIndex={0}
|
|
29
|
+
dataLabel={columnNames.truncate}
|
|
30
|
+
>
|
|
31
|
+
<TableText focused={focused} wrapModifier="truncate">
|
|
32
|
+
This text will truncate instead of wrap.
|
|
33
|
+
</TableText>
|
|
34
|
+
</Td>
|
|
35
|
+
<Td dataLabel={columnNames.wrap}>
|
|
36
|
+
<TableText wrapModifier="nowrap">
|
|
37
|
+
<a href="#">This is a link that needs to be on one line and fully readable.</a>
|
|
38
|
+
</TableText>
|
|
39
|
+
</Td>
|
|
40
|
+
</Tr>
|
|
41
|
+
</Tbody>
|
|
42
|
+
</Table>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -10,7 +10,7 @@ Object {
|
|
|
10
10
|
>
|
|
11
11
|
|
|
12
12
|
</SelectColumn>,
|
|
13
|
-
"className": "pf-c-table__check",
|
|
13
|
+
"className": "pf-v5-c-table__check",
|
|
14
14
|
"component": "td",
|
|
15
15
|
"isVisible": true,
|
|
16
16
|
}
|
|
@@ -26,6 +26,6 @@ Object {
|
|
|
26
26
|
>
|
|
27
27
|
|
|
28
28
|
</SortColumn>,
|
|
29
|
-
"className": "pf-c-table__sort pf-m-selected",
|
|
29
|
+
"className": "pf-v5-c-table__sort pf-m-selected",
|
|
30
30
|
}
|
|
31
31
|
`;
|
|
@@ -8,92 +8,90 @@ import { Checkbox } from '@patternfly/react-core/dist/esm/components/Checkbox';
|
|
|
8
8
|
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
9
9
|
import EllipsisHIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-h-icon';
|
|
10
10
|
|
|
11
|
-
export const treeRow =
|
|
12
|
-
onCollapse: OnTreeRowCollapse,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
export const treeRow =
|
|
12
|
+
(onCollapse: OnTreeRowCollapse, onCheckChange?: OnCheckChange, onToggleRowDetails?: OnToggleRowDetails) =>
|
|
13
|
+
(value: IFormatterValueType, { rowIndex, rowData }: IExtra) => {
|
|
14
|
+
const {
|
|
15
|
+
isExpanded,
|
|
16
|
+
isDetailsExpanded,
|
|
17
|
+
'aria-level': level,
|
|
18
|
+
'aria-setsize': setsize,
|
|
19
|
+
toggleAriaLabel,
|
|
20
|
+
checkAriaLabel,
|
|
21
|
+
showDetailsAriaLabel,
|
|
22
|
+
isChecked,
|
|
23
|
+
checkboxId,
|
|
24
|
+
icon
|
|
25
|
+
} = rowData.props;
|
|
26
|
+
const content = value.title || value;
|
|
27
|
+
const text = (
|
|
28
|
+
<div className={css(stylesTreeView.tableTreeViewText)} key="tree-view-text">
|
|
29
|
+
{icon && (
|
|
30
|
+
<span className={css(stylesTreeView.tableTreeViewIcon)} key="tree-view-text-icon">
|
|
31
|
+
{icon}
|
|
32
|
+
</span>
|
|
33
|
+
)}
|
|
34
|
+
<span className="pf-v5-c-table__text" key="table-text">
|
|
35
|
+
{content as React.ReactNode}
|
|
34
36
|
</span>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
const onChange = (isChecked: boolean, event: React.FormEvent<HTMLInputElement>) => {
|
|
40
|
+
onCheckChange(event, isChecked, rowIndex, content as React.ReactNode, rowData);
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
component: 'th',
|
|
44
|
+
className: 'pf-v5-c-table__tree-view-title-cell',
|
|
45
|
+
children:
|
|
46
|
+
level !== undefined ? (
|
|
47
|
+
<div className={css(stylesTreeView.tableTreeViewMain)}>
|
|
48
|
+
{setsize > 0 && (
|
|
49
|
+
<span className={css(stylesTreeView.tableToggle)} key="table-toggle">
|
|
50
|
+
<Button
|
|
51
|
+
variant="plain"
|
|
52
|
+
onClick={(event) => onCollapse && onCollapse(event, rowIndex, content as React.ReactNode, rowData)}
|
|
53
|
+
className={css(isExpanded && styles.modifiers.expanded)}
|
|
54
|
+
aria-expanded={isExpanded}
|
|
55
|
+
aria-label={toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`}
|
|
56
|
+
>
|
|
57
|
+
<div className={css(stylesTreeView.tableToggleIcon)}>
|
|
58
|
+
<AngleDownIcon aria-hidden="true" />
|
|
59
|
+
</div>
|
|
60
|
+
</Button>
|
|
61
|
+
</span>
|
|
62
|
+
)}
|
|
63
|
+
{!!onCheckChange && (
|
|
64
|
+
<span className={css(stylesTreeView.tableCheck)} key="table-check">
|
|
65
|
+
<label htmlFor={checkboxId || `checkbox_${rowIndex}`}>
|
|
66
|
+
<Checkbox
|
|
67
|
+
id={checkboxId || `checkbox_${rowIndex}`}
|
|
68
|
+
aria-label={checkAriaLabel || `Row ${rowIndex} checkbox`}
|
|
69
|
+
isChecked={isChecked}
|
|
70
|
+
onChange={(event, checked) => onChange(checked, event)}
|
|
71
|
+
/>
|
|
72
|
+
</label>
|
|
73
|
+
</span>
|
|
74
|
+
)}
|
|
75
|
+
{text}
|
|
76
|
+
{!!onToggleRowDetails && (
|
|
77
|
+
<span className={css(stylesTreeView.tableTreeViewDetailsToggle)} key="view-details-toggle">
|
|
78
|
+
<Button
|
|
79
|
+
variant="plain"
|
|
80
|
+
aria-expanded={isDetailsExpanded}
|
|
81
|
+
aria-label={showDetailsAriaLabel || 'Show row details'}
|
|
82
|
+
onClick={(event) =>
|
|
83
|
+
onToggleRowDetails && onToggleRowDetails(event, rowIndex, content as React.ReactNode, rowData)
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
<span className="pf-v5-c-table__details-toggle-icon">
|
|
87
|
+
<EllipsisHIcon aria-hidden />
|
|
88
|
+
</span>
|
|
89
|
+
</Button>
|
|
90
|
+
</span>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
) : (
|
|
94
|
+
text
|
|
95
|
+
)
|
|
96
|
+
};
|
|
43
97
|
};
|
|
44
|
-
return {
|
|
45
|
-
component: 'th',
|
|
46
|
-
className: 'pf-c-table__tree-view-title-cell',
|
|
47
|
-
children:
|
|
48
|
-
level !== undefined ? (
|
|
49
|
-
<div className={css(stylesTreeView.tableTreeViewMain)}>
|
|
50
|
-
{setsize > 0 && (
|
|
51
|
-
<span className={css(stylesTreeView.tableToggle)} key="table-toggle">
|
|
52
|
-
<Button
|
|
53
|
-
variant="plain"
|
|
54
|
-
onClick={event => onCollapse && onCollapse(event, rowIndex, content as React.ReactNode, rowData)}
|
|
55
|
-
className={css(isExpanded && styles.modifiers.expanded)}
|
|
56
|
-
aria-expanded={isExpanded}
|
|
57
|
-
aria-label={toggleAriaLabel || `${isExpanded ? 'Collapse' : 'Expand'} row ${rowIndex}`}
|
|
58
|
-
>
|
|
59
|
-
<div className={css(stylesTreeView.tableToggleIcon)}>
|
|
60
|
-
<AngleDownIcon aria-hidden="true" />
|
|
61
|
-
</div>
|
|
62
|
-
</Button>
|
|
63
|
-
</span>
|
|
64
|
-
)}
|
|
65
|
-
{!!onCheckChange && (
|
|
66
|
-
<span className={css(stylesTreeView.tableCheck)} key="table-check">
|
|
67
|
-
<label htmlFor={checkboxId || `checkbox_${rowIndex}`}>
|
|
68
|
-
<Checkbox
|
|
69
|
-
id={checkboxId || `checkbox_${rowIndex}`}
|
|
70
|
-
aria-label={checkAriaLabel || `Row ${rowIndex} checkbox`}
|
|
71
|
-
isChecked={isChecked}
|
|
72
|
-
onChange={(event, checked) => onChange(checked, event)}
|
|
73
|
-
/>
|
|
74
|
-
</label>
|
|
75
|
-
</span>
|
|
76
|
-
)}
|
|
77
|
-
{text}
|
|
78
|
-
{!!onToggleRowDetails && (
|
|
79
|
-
<span className={css(stylesTreeView.tableTreeViewDetailsToggle)} key="view-details-toggle">
|
|
80
|
-
<Button
|
|
81
|
-
variant="plain"
|
|
82
|
-
aria-expanded={isDetailsExpanded}
|
|
83
|
-
aria-label={showDetailsAriaLabel || 'Show row details'}
|
|
84
|
-
onClick={event =>
|
|
85
|
-
onToggleRowDetails && onToggleRowDetails(event, rowIndex, content as React.ReactNode, rowData)
|
|
86
|
-
}
|
|
87
|
-
>
|
|
88
|
-
<span className="pf-c-table__details-toggle-icon">
|
|
89
|
-
<EllipsisHIcon aria-hidden />
|
|
90
|
-
</span>
|
|
91
|
-
</Button>
|
|
92
|
-
</span>
|
|
93
|
-
)}
|
|
94
|
-
</div>
|
|
95
|
-
) : (
|
|
96
|
-
text
|
|
97
|
-
)
|
|
98
|
-
};
|
|
99
|
-
};
|