@patternfly/react-table 5.0.0-alpha.98 → 5.0.0-prerelease.1
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 +172 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/esm/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +6 -6
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/Caption.d.ts.map +1 -1
- package/dist/esm/components/Table/Caption.js +3 -1
- package/dist/esm/components/Table/Caption.js.map +1 -1
- package/dist/esm/components/Table/RowWrapper.js +2 -2
- package/dist/esm/components/Table/Table.js +3 -3
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +1 -1
- package/dist/esm/components/Table/Tbody.d.ts.map +1 -1
- package/dist/esm/components/Table/Tbody.js +1 -1
- package/dist/esm/components/Table/Tbody.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +1 -1
- 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 +1 -1
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/Thead.d.ts.map +1 -1
- package/dist/esm/components/Table/Thead.js +1 -1
- package/dist/esm/components/Table/Thead.js.map +1 -1
- package/dist/esm/components/Table/Tr.d.ts +3 -3
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +2 -3
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/esm/components/Table/base/provider.d.ts +2 -2
- package/dist/esm/components/Table/base/types.d.ts +2 -2
- package/dist/js/components/Table/ActionsColumn.d.ts +4 -2
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +6 -6
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/Caption.d.ts.map +1 -1
- package/dist/js/components/Table/Caption.js +3 -1
- package/dist/js/components/Table/Caption.js.map +1 -1
- package/dist/js/components/Table/RowWrapper.js +2 -2
- package/dist/js/components/Table/Table.js +3 -3
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +1 -1
- package/dist/js/components/Table/Tbody.d.ts.map +1 -1
- package/dist/js/components/Table/Tbody.js +1 -1
- package/dist/js/components/Table/Tbody.js.map +1 -1
- package/dist/js/components/Table/Td.d.ts +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +1 -1
- 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 +1 -1
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Thead.d.ts.map +1 -1
- package/dist/js/components/Table/Thead.js +1 -1
- package/dist/js/components/Table/Thead.js.map +1 -1
- package/dist/js/components/Table/Tr.d.ts +3 -3
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +2 -3
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +2 -2
- package/dist/js/components/Table/base/types.d.ts +2 -2
- 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/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 +5 -5
- package/package.json +6 -6
- package/src/components/Table/ActionsColumn.tsx +12 -6
- package/src/components/Table/Caption.tsx +3 -1
- package/src/components/Table/RowWrapper.tsx +2 -2
- package/src/components/Table/Table.tsx +3 -3
- package/src/components/Table/TableTypes.tsx +1 -1
- package/src/components/Table/Tbody.tsx +1 -0
- package/src/components/Table/Td.tsx +2 -1
- package/src/components/Table/Th.tsx +1 -0
- package/src/components/Table/Thead.tsx +1 -0
- package/src/components/Table/Tr.tsx +6 -6
- package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +2 -2
- package/src/components/Table/examples/Table.md +2 -2
- package/src/components/Table/examples/{TableHoverable.tsx → TableClickable.tsx} +3 -3
- package/src/components/Table/examples/TableSortableCustom.tsx +10 -21
- package/src/components/Table/utils/transformers.test.tsx +1 -1
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1547 -1523
- package/src/deprecated/components/Table/examples/{LegacyTableHoverable.tsx → LegacyTableClickable.tsx} +2 -2
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +12 -29
- package/src/deprecated/components/Table/examples/Table.md +2 -2
- package/src/docs/demos/Table.md +32 -344
- package/src/docs/demos/table-demos/BulkSelect.jsx +167 -0
- package/src/docs/demos/table-demos/ColumnManagement.jsx +10 -4
- package/src/docs/demos/table-demos/Compact.jsx +19 -14
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +4 -4
- package/src/docs/demos/table-demos/ExpandCollapseAll.jsx +88 -106
- package/src/docs/demos/table-demos/SortableResponsive.jsx +11 -21
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +18 -13
- package/src/docs/demos/table-demos/StickyHeader.jsx +63 -0
- package/src/docs/{examples/Data.jsx → demos/table-demos/sampleData.js} +6 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-prerelease.1",
|
|
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-
|
|
44
|
-
"@patternfly/react-icons": "^5.0.0-
|
|
45
|
-
"@patternfly/react-styles": "^5.0.0-
|
|
46
|
-
"@patternfly/react-tokens": "^5.0.0-
|
|
43
|
+
"@patternfly/react-core": "^5.0.0-prerelease.1",
|
|
44
|
+
"@patternfly/react-icons": "^5.0.0-prerelease.1",
|
|
45
|
+
"@patternfly/react-styles": "^5.0.0-prerelease.1",
|
|
46
|
+
"@patternfly/react-tokens": "^5.0.0-prerelease.1",
|
|
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": "0661f17cb3b7b78f9d190b4790c6b64f5e2af118"
|
|
59
59
|
}
|
|
@@ -8,7 +8,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
8
8
|
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
|
|
9
9
|
|
|
10
10
|
export interface CustomActionsToggleProps {
|
|
11
|
-
onToggle: (event: React.MouseEvent) => void;
|
|
11
|
+
onToggle: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
12
12
|
isOpen: boolean;
|
|
13
13
|
isDisabled: boolean;
|
|
14
14
|
toggleRef: React.Ref<any>;
|
|
@@ -28,6 +28,8 @@ export interface ActionsColumnProps extends Omit<React.HTMLProps<HTMLElement>, '
|
|
|
28
28
|
popperProps?: any;
|
|
29
29
|
/** @hide Forwarded ref */
|
|
30
30
|
innerRef?: React.Ref<any>;
|
|
31
|
+
/** Ref to forward to the first item in the popup menu */
|
|
32
|
+
firstActionItemRef?: React.Ref<HTMLButtonElement>;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
@@ -40,6 +42,8 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
40
42
|
position: 'right',
|
|
41
43
|
direction: 'down'
|
|
42
44
|
},
|
|
45
|
+
innerRef,
|
|
46
|
+
firstActionItemRef,
|
|
43
47
|
...props
|
|
44
48
|
}: ActionsColumnProps) => {
|
|
45
49
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -103,15 +107,16 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
103
107
|
)
|
|
104
108
|
}
|
|
105
109
|
{...(rowData && rowData.actionProps)}
|
|
110
|
+
ref={innerRef}
|
|
106
111
|
{...props}
|
|
107
112
|
popperProps={popperProps}
|
|
108
113
|
>
|
|
109
114
|
<DropdownList>
|
|
110
115
|
{items
|
|
111
116
|
.filter((item) => !item.isOutsideDropdown)
|
|
112
|
-
.map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props },
|
|
117
|
+
.map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props }, index) => {
|
|
113
118
|
if (isSeparator) {
|
|
114
|
-
return <Divider key={itemKey ||
|
|
119
|
+
return <Divider key={itemKey || index} data-key={itemKey || index} />;
|
|
115
120
|
}
|
|
116
121
|
const item = (
|
|
117
122
|
<DropdownItem
|
|
@@ -120,8 +125,9 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
120
125
|
onToggle();
|
|
121
126
|
}}
|
|
122
127
|
{...props}
|
|
123
|
-
key={itemKey ||
|
|
124
|
-
data-key={itemKey ||
|
|
128
|
+
key={itemKey || index}
|
|
129
|
+
data-key={itemKey || index}
|
|
130
|
+
ref={index === 0 ? firstActionItemRef : undefined}
|
|
125
131
|
>
|
|
126
132
|
{title}
|
|
127
133
|
</DropdownItem>
|
|
@@ -129,7 +135,7 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
|
|
|
129
135
|
|
|
130
136
|
if (tooltip) {
|
|
131
137
|
return (
|
|
132
|
-
<Tooltip key={itemKey ||
|
|
138
|
+
<Tooltip key={itemKey || index} content={tooltip} {...tooltipProps}>
|
|
133
139
|
{item}
|
|
134
140
|
</Tooltip>
|
|
135
141
|
);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/Table/table';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
2
4
|
|
|
3
5
|
export interface CaptionProps {
|
|
4
6
|
/** Content rendered inside the caption */
|
|
@@ -8,7 +10,7 @@ export interface CaptionProps {
|
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export const Caption: React.FunctionComponent<CaptionProps> = ({ children, className, ...props }: CaptionProps) => (
|
|
11
|
-
<caption className={className} {...props}>
|
|
13
|
+
<caption className={css(styles.tableCaption, className)} {...props}>
|
|
12
14
|
{children}
|
|
13
15
|
</caption>
|
|
14
16
|
);
|
|
@@ -94,7 +94,7 @@ export class RowWrapper extends React.Component<RowWrapperProps> {
|
|
|
94
94
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
95
95
|
onScroll,
|
|
96
96
|
onResize,
|
|
97
|
-
row: { isExpanded, isEditable,
|
|
97
|
+
row: { isExpanded, isEditable, isClickable, isRowSelected },
|
|
98
98
|
rowProps,
|
|
99
99
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
100
100
|
trRef,
|
|
@@ -111,7 +111,7 @@ export class RowWrapper extends React.Component<RowWrapperProps> {
|
|
|
111
111
|
isEditable={isEditable}
|
|
112
112
|
className={className}
|
|
113
113
|
ouiaId={ouiaId}
|
|
114
|
-
|
|
114
|
+
isClickable={isClickable}
|
|
115
115
|
isRowSelected={isRowSelected}
|
|
116
116
|
/>
|
|
117
117
|
);
|
|
@@ -121,7 +121,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
121
121
|
setTableCaption(
|
|
122
122
|
<caption>
|
|
123
123
|
{selectableRowCaptionText}
|
|
124
|
-
<div className="pf-screen-reader">
|
|
124
|
+
<div className="pf-v5-screen-reader">
|
|
125
125
|
This table has selectable rows. It can be navigated by row using tab, and each row can be selected using
|
|
126
126
|
space or enter.
|
|
127
127
|
</div>
|
|
@@ -129,7 +129,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
129
129
|
);
|
|
130
130
|
} else {
|
|
131
131
|
setTableCaption(
|
|
132
|
-
<caption className="pf-screen-reader">
|
|
132
|
+
<caption className="pf-v5-screen-reader">
|
|
133
133
|
This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space
|
|
134
134
|
or enter.
|
|
135
135
|
</caption>
|
|
@@ -157,7 +157,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
|
|
|
157
157
|
if (
|
|
158
158
|
isNested ||
|
|
159
159
|
!(tableRef && tableRef.current && tableRef.current.classList.contains('pf-m-tree-view')) || // implements roving tab-index to tree tables only
|
|
160
|
-
(tableRef && tableRef.current !== (event.target as HTMLElement).closest('.pf-c-table:not(.pf-m-nested)'))
|
|
160
|
+
(tableRef && tableRef.current !== (event.target as HTMLElement).closest('.pf-v5-c-table:not(.pf-m-nested)'))
|
|
161
161
|
) {
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
@@ -238,7 +238,7 @@ export interface IRow extends RowType {
|
|
|
238
238
|
cells?: (React.ReactNode | IRowCell)[];
|
|
239
239
|
isOpen?: boolean;
|
|
240
240
|
isEditable?: boolean;
|
|
241
|
-
|
|
241
|
+
isClickable?: boolean;
|
|
242
242
|
isRowSelected?: boolean;
|
|
243
243
|
isValid?: boolean;
|
|
244
244
|
/** An array of validation functions to run against every cell for a given row */
|
|
@@ -50,7 +50,7 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
|
|
|
50
50
|
draggableRow?: TdDraggableType;
|
|
51
51
|
/** True to remove padding */
|
|
52
52
|
noPadding?: boolean;
|
|
53
|
-
/** Applies pf-c-table__action to td */
|
|
53
|
+
/** Applies pf-v5-c-table__action to td */
|
|
54
54
|
isActionCell?: boolean;
|
|
55
55
|
/**
|
|
56
56
|
* Tooltip to show on the body cell.
|
|
@@ -271,6 +271,7 @@ const TdBase: React.FunctionComponent<TdProps> = ({
|
|
|
271
271
|
onBlur={() => setShowTooltip(false)}
|
|
272
272
|
onMouseEnter={tooltip !== null ? onMouseEnter : onMouseEnterProp}
|
|
273
273
|
className={css(
|
|
274
|
+
styles.tableTd,
|
|
274
275
|
className,
|
|
275
276
|
isActionCell && styles.tableAction,
|
|
276
277
|
textCenter && styles.modifiers.center,
|
|
@@ -179,6 +179,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
|
|
|
179
179
|
scope={component === 'th' && children ? scope : null}
|
|
180
180
|
ref={cellRef}
|
|
181
181
|
className={css(
|
|
182
|
+
styles.tableTh,
|
|
182
183
|
className,
|
|
183
184
|
textCenter && styles.modifiers.center,
|
|
184
185
|
isSubheader && styles.tableSubhead,
|
|
@@ -20,8 +20,8 @@ export interface TrProps extends React.HTMLProps<HTMLTableRowElement>, OUIAProps
|
|
|
20
20
|
isExpanded?: boolean;
|
|
21
21
|
/** Only applicable to Tr within the Tbody: Whether the row is editable */
|
|
22
22
|
isEditable?: boolean;
|
|
23
|
-
/** Flag which adds hover styles for the table row */
|
|
24
|
-
|
|
23
|
+
/** Flag which adds hover styles for the clickable table row */
|
|
24
|
+
isClickable?: boolean;
|
|
25
25
|
/** Flag indicating the row is selected - adds selected styling */
|
|
26
26
|
isRowSelected?: boolean;
|
|
27
27
|
/** Flag indicating the row is striped */
|
|
@@ -46,7 +46,7 @@ const TrBase: React.FunctionComponent<TrProps> = ({
|
|
|
46
46
|
isExpanded,
|
|
47
47
|
isEditable,
|
|
48
48
|
isHidden = false,
|
|
49
|
-
|
|
49
|
+
isClickable = false,
|
|
50
50
|
isRowSelected = false,
|
|
51
51
|
isStriped = false,
|
|
52
52
|
isBorderRow = false,
|
|
@@ -89,21 +89,21 @@ const TrBase: React.FunctionComponent<TrProps> = ({
|
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
91
|
<>
|
|
92
|
-
{isSelectable && <output className="pf-screen-reader">{ariaLabel}</output>}
|
|
93
92
|
<tr
|
|
94
93
|
className={css(
|
|
94
|
+
styles.tableTr,
|
|
95
95
|
className,
|
|
96
96
|
isExpanded !== undefined && styles.tableExpandableRow,
|
|
97
97
|
isExpanded && styles.modifiers.expanded,
|
|
98
98
|
isEditable && inlineStyles.modifiers.inlineEditable,
|
|
99
|
-
|
|
99
|
+
isClickable && styles.modifiers.clickable,
|
|
100
100
|
isRowSelected && styles.modifiers.selected,
|
|
101
101
|
isStriped && styles.modifiers.striped,
|
|
102
102
|
isBorderRow && styles.modifiers.borderRow,
|
|
103
103
|
resetOffset && styles.modifiers.firstCellOffsetReset
|
|
104
104
|
)}
|
|
105
105
|
hidden={rowIsHidden}
|
|
106
|
-
{...(
|
|
106
|
+
{...(isClickable && { tabIndex: 0 })}
|
|
107
107
|
aria-label={ariaLabel}
|
|
108
108
|
ref={innerRef}
|
|
109
109
|
{...(onRowClick && { onClick: onRowClick, onKeyDown })}
|
|
@@ -5,7 +5,7 @@ exports[`RowWrapper renders correctly 1`] = `
|
|
|
5
5
|
<table>
|
|
6
6
|
<tbody>
|
|
7
7
|
<tr
|
|
8
|
-
class=""
|
|
8
|
+
class="pf-v5-c-table__tr"
|
|
9
9
|
data-ouia-component-id="OUIA-Generated-TableRow-1"
|
|
10
10
|
data-ouia-component-type="PF4/TableRow"
|
|
11
11
|
data-ouia-safe="true"
|
|
@@ -20,7 +20,7 @@ exports[`RowWrapper renders expanded correctly 1`] = `
|
|
|
20
20
|
<table>
|
|
21
21
|
<tbody>
|
|
22
22
|
<tr
|
|
23
|
-
class="pf-v5-c-table__expandable-row pf-m-expanded"
|
|
23
|
+
class="pf-v5-c-table__tr 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"
|
|
@@ -147,11 +147,11 @@ Similarly to the selectable example above, the radio buttons use the first colum
|
|
|
147
147
|
```ts file="TableSelectableRadio.tsx"
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
### Row click handler,
|
|
150
|
+
### Row click handler, clickable rows
|
|
151
151
|
|
|
152
152
|
This selectable rows feature is intended for use when a table is used to present a list of objects in a Primary-detail view.
|
|
153
153
|
|
|
154
|
-
```ts file="
|
|
154
|
+
```ts file="TableClickable.tsx"
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
### Actions
|
|
@@ -9,7 +9,7 @@ interface Repository {
|
|
|
9
9
|
lastCommit: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const TableClickable: React.FunctionComponent = () => {
|
|
13
13
|
// In real usage, this data would come from some external source like an API via props.
|
|
14
14
|
const repositories: Repository[] = [
|
|
15
15
|
{ name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
|
|
@@ -30,7 +30,7 @@ export const TableHoverable: React.FunctionComponent = () => {
|
|
|
30
30
|
const [selectedRepoName, setSelectedRepoName] = React.useState('');
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<Table aria-label="
|
|
33
|
+
<Table aria-label="Clickable table">
|
|
34
34
|
<Thead>
|
|
35
35
|
<Tr>
|
|
36
36
|
<Th>{columnNames.name}</Th>
|
|
@@ -46,7 +46,7 @@ export const TableHoverable: React.FunctionComponent = () => {
|
|
|
46
46
|
key={repo.name}
|
|
47
47
|
onRowClick={() => setSelectedRepoName(repo.name)}
|
|
48
48
|
isSelectable
|
|
49
|
-
|
|
49
|
+
isClickable
|
|
50
50
|
isRowSelected={selectedRepoName === repo.name}
|
|
51
51
|
>
|
|
52
52
|
<Td dataLabel={columnNames.name}>{repo.name}</Td>
|
|
@@ -101,13 +101,14 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
101
101
|
<Select
|
|
102
102
|
isOpen={isSortDropdownOpen}
|
|
103
103
|
selected={[activeSortDirection, activeSortIndex]}
|
|
104
|
-
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
105
|
-
onSelect={(event,
|
|
106
|
-
if (
|
|
107
|
-
setActiveSortDirection(
|
|
104
|
+
onOpenChange={(isOpen) => setIsSortDropdownOpen(isOpen)}
|
|
105
|
+
onSelect={(event, value) => {
|
|
106
|
+
if (value === 'asc' || value === 'desc') {
|
|
107
|
+
setActiveSortDirection(value as 'desc' | 'asc');
|
|
108
108
|
} else {
|
|
109
|
-
setActiveSortIndex(
|
|
110
|
-
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
109
|
+
setActiveSortIndex(value as number);
|
|
110
|
+
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
111
|
+
}
|
|
111
112
|
}}
|
|
112
113
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
113
114
|
<MenuToggle
|
|
@@ -124,11 +125,7 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
124
125
|
<SelectGroup label="Sort column">
|
|
125
126
|
<SelectList>
|
|
126
127
|
{Object.values(columnNames).map((column, columnIndex) => (
|
|
127
|
-
<SelectOption
|
|
128
|
-
key={column}
|
|
129
|
-
itemId={columnIndex}
|
|
130
|
-
isSelected={activeSortIndex === columnIndex}
|
|
131
|
-
>
|
|
128
|
+
<SelectOption key={column} value={columnIndex} isSelected={activeSortIndex === columnIndex}>
|
|
132
129
|
{column}
|
|
133
130
|
</SelectOption>
|
|
134
131
|
))}
|
|
@@ -136,18 +133,10 @@ export const TableSortableCustom: React.FunctionComponent = () => {
|
|
|
136
133
|
</SelectGroup>
|
|
137
134
|
<SelectGroup label="Sort direction">
|
|
138
135
|
<SelectList>
|
|
139
|
-
<SelectOption
|
|
140
|
-
isSelected={activeSortDirection === 'asc'}
|
|
141
|
-
itemId="asc"
|
|
142
|
-
key="ascending"
|
|
143
|
-
>
|
|
136
|
+
<SelectOption isSelected={activeSortDirection === 'asc'} value="asc" key="ascending">
|
|
144
137
|
Ascending
|
|
145
138
|
</SelectOption>
|
|
146
|
-
<SelectOption
|
|
147
|
-
isSelected={activeSortDirection === 'desc'}
|
|
148
|
-
itemId="desc"
|
|
149
|
-
key="descending"
|
|
150
|
-
>
|
|
139
|
+
<SelectOption isSelected={activeSortDirection === 'desc'} value="desc" key="descending">
|
|
151
140
|
Descending
|
|
152
141
|
</SelectOption>
|
|
153
142
|
</SelectList>
|
|
@@ -73,7 +73,7 @@ const testCellActions = async ({
|
|
|
73
73
|
const { container } = render(returnedData.children as React.ReactElement<any>);
|
|
74
74
|
await user.click(screen.getAllByRole('button')[0]);
|
|
75
75
|
await waitFor(() =>
|
|
76
|
-
expect(container.querySelectorAll('.pf-c-dropdown__menu li button')).toHaveLength(expectDisabled ? 0 : 1)
|
|
76
|
+
expect(container.querySelectorAll('.pf-v5-c-dropdown__menu li button')).toHaveLength(expectDisabled ? 0 : 1)
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
};
|