@patternfly/react-table 5.0.0-alpha.121 → 5.0.0-alpha.122
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 +6 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +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/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 +1 -1
- package/package.json +3 -3
- package/src/components/Table/examples/TableSortableCustom.tsx +10 -21
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +12 -29
- package/src/docs/demos/Table.md +28 -28
- package/src/docs/demos/table-demos/BulkSelect.jsx +15 -22
- package/src/docs/demos/table-demos/Compact.jsx +16 -12
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +4 -4
- package/src/docs/demos/table-demos/SortableResponsive.jsx +8 -20
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +15 -11
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.122",
|
|
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,7 +40,7 @@
|
|
|
40
40
|
"subpaths": "node scripts/createSubpaths.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
43
|
+
"@patternfly/react-core": "^5.0.0-alpha.119",
|
|
44
44
|
"@patternfly/react-icons": "^5.0.0-alpha.19",
|
|
45
45
|
"@patternfly/react-styles": "^5.0.0-alpha.16",
|
|
46
46
|
"@patternfly/react-tokens": "^5.0.0-alpha.14",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": "^17 || ^18",
|
|
56
56
|
"react-dom": "^17 || ^18"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "3d9d04381ec62d8aa02b8eb1e3977f951fbfdeb3"
|
|
59
59
|
}
|
|
@@ -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>
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { sortable, info } from '@patternfly/react-table';
|
|
3
3
|
import { Table, TableHeader, TableBody, TableProps } from '@patternfly/react-table/deprecated';
|
|
4
|
-
import {
|
|
5
|
-
Toolbar,
|
|
6
|
-
ToolbarContent,
|
|
7
|
-
ToolbarItem,
|
|
8
|
-
MenuToggle,
|
|
9
|
-
MenuToggleElement
|
|
10
|
-
} from '@patternfly/react-core';
|
|
4
|
+
import { Toolbar, ToolbarContent, ToolbarItem, MenuToggle, MenuToggleElement } from '@patternfly/react-core';
|
|
11
5
|
import {
|
|
12
6
|
Select as NewSelect,
|
|
13
7
|
SelectGroup as NewSelectGroup,
|
|
@@ -111,7 +105,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
111
105
|
]
|
|
112
106
|
}
|
|
113
107
|
];
|
|
114
|
-
const rows: TableProps['rows'] = sortedRepositories.map(repo => [
|
|
108
|
+
const rows: TableProps['rows'] = sortedRepositories.map((repo) => [
|
|
115
109
|
repo.name,
|
|
116
110
|
repo.branches,
|
|
117
111
|
repo.prs,
|
|
@@ -127,13 +121,14 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
127
121
|
<NewSelect
|
|
128
122
|
isOpen={isSortDropdownOpen}
|
|
129
123
|
selected={[activeSortDirection, activeSortIndex]}
|
|
130
|
-
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
131
|
-
onSelect={(event,
|
|
132
|
-
if (
|
|
133
|
-
setActiveSortDirection(
|
|
124
|
+
onOpenChange={(isOpen) => setIsSortDropdownOpen(isOpen)}
|
|
125
|
+
onSelect={(event, value) => {
|
|
126
|
+
if (value === 'asc' || value === 'desc') {
|
|
127
|
+
setActiveSortDirection(value as 'desc' | 'asc');
|
|
134
128
|
} else {
|
|
135
|
-
setActiveSortIndex(
|
|
136
|
-
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
129
|
+
setActiveSortIndex(value as number);
|
|
130
|
+
setActiveSortDirection(activeSortDirection !== null ? activeSortDirection : 'asc');
|
|
131
|
+
}
|
|
137
132
|
}}
|
|
138
133
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
139
134
|
<MenuToggle
|
|
@@ -150,11 +145,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
150
145
|
<NewSelectGroup label="Sort column">
|
|
151
146
|
<NewSelectList>
|
|
152
147
|
{Object.values(columnNames).map((column, columnIndex) => (
|
|
153
|
-
<NewSelectOption
|
|
154
|
-
key={column}
|
|
155
|
-
itemId={columnIndex}
|
|
156
|
-
isSelected={activeSortIndex === columnIndex}
|
|
157
|
-
>
|
|
148
|
+
<NewSelectOption key={column} value={columnIndex} isSelected={activeSortIndex === columnIndex}>
|
|
158
149
|
{column}
|
|
159
150
|
</NewSelectOption>
|
|
160
151
|
))}
|
|
@@ -162,18 +153,10 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
|
|
|
162
153
|
</NewSelectGroup>
|
|
163
154
|
<NewSelectGroup label="Sort direction">
|
|
164
155
|
<NewSelectList>
|
|
165
|
-
<NewSelectOption
|
|
166
|
-
isSelected={activeSortDirection === 'asc'}
|
|
167
|
-
itemId="asc"
|
|
168
|
-
key="ascending"
|
|
169
|
-
>
|
|
156
|
+
<NewSelectOption isSelected={activeSortDirection === 'asc'} value="asc" key="ascending">
|
|
170
157
|
Ascending
|
|
171
158
|
</NewSelectOption>
|
|
172
|
-
<NewSelectOption
|
|
173
|
-
isSelected={activeSortDirection === 'desc'}
|
|
174
|
-
itemId="desc"
|
|
175
|
-
key="descending"
|
|
176
|
-
>
|
|
159
|
+
<NewSelectOption isSelected={activeSortDirection === 'desc'} value="desc" key="descending">
|
|
177
160
|
Descending
|
|
178
161
|
</NewSelectOption>
|
|
179
162
|
</NewSelectList>
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -972,9 +972,9 @@ class FilterTableDemo extends React.Component {
|
|
|
972
972
|
const { isCategoryDropdownOpen, currentCategory } = this.state;
|
|
973
973
|
|
|
974
974
|
const categoryMenuItems = [
|
|
975
|
-
<SelectOption key="cat1"
|
|
976
|
-
<SelectOption key="cat2"
|
|
977
|
-
<SelectOption key="cat3"
|
|
975
|
+
<SelectOption key="cat1" value="Location">Location</SelectOption>,
|
|
976
|
+
<SelectOption key="cat2" value="Name">Name</SelectOption>,
|
|
977
|
+
<SelectOption key="cat3" value="Status">Status</SelectOption>
|
|
978
978
|
];
|
|
979
979
|
|
|
980
980
|
return (
|
|
@@ -1010,17 +1010,17 @@ class FilterTableDemo extends React.Component {
|
|
|
1010
1010
|
const { currentCategory, isFilterDropdownOpen, inputValue, filters } = this.state;
|
|
1011
1011
|
|
|
1012
1012
|
const locationMenuItems = [
|
|
1013
|
-
<SelectOption key="raleigh"
|
|
1014
|
-
<SelectOption key="san francisco"
|
|
1015
|
-
<SelectOption key="boston"
|
|
1016
|
-
<SelectOption key="atlanta"
|
|
1013
|
+
<SelectOption key="raleigh" value="Raleigh">Raleigh</SelectOption>,
|
|
1014
|
+
<SelectOption key="san francisco" value="San Francisco">San Francisco</SelectOption>,
|
|
1015
|
+
<SelectOption key="boston" value="Boston">Boston</SelectOption>,
|
|
1016
|
+
<SelectOption key="atlanta" value="Atlanta">Atlanta</SelectOption>,
|
|
1017
1017
|
];
|
|
1018
1018
|
|
|
1019
1019
|
const statusMenuItems = [
|
|
1020
1020
|
<SelectOption
|
|
1021
1021
|
hasCheckbox
|
|
1022
1022
|
key="statusRunning"
|
|
1023
|
-
|
|
1023
|
+
value="Running"
|
|
1024
1024
|
isSelected={filters.status.includes("Running")}
|
|
1025
1025
|
>
|
|
1026
1026
|
Running
|
|
@@ -1028,7 +1028,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1028
1028
|
<SelectOption
|
|
1029
1029
|
hasCheckbox
|
|
1030
1030
|
key="statusStopped"
|
|
1031
|
-
|
|
1031
|
+
value="Stopped"
|
|
1032
1032
|
isSelected={filters.status.includes("Stopped")}
|
|
1033
1033
|
>
|
|
1034
1034
|
Stopped
|
|
@@ -1036,7 +1036,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1036
1036
|
<SelectOption
|
|
1037
1037
|
hasCheckbox
|
|
1038
1038
|
key="statusDown"
|
|
1039
|
-
|
|
1039
|
+
value="Down"
|
|
1040
1040
|
isSelected={filters.status.includes("Down")}
|
|
1041
1041
|
>
|
|
1042
1042
|
Down
|
|
@@ -1044,7 +1044,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1044
1044
|
<SelectOption
|
|
1045
1045
|
hasCheckbox
|
|
1046
1046
|
key="statusDegraded"
|
|
1047
|
-
|
|
1047
|
+
value="Degraded"
|
|
1048
1048
|
isSelected={filters.status.includes("Degraded")}
|
|
1049
1049
|
>
|
|
1050
1050
|
Degraded
|
|
@@ -1052,7 +1052,7 @@ class FilterTableDemo extends React.Component {
|
|
|
1052
1052
|
<SelectOption
|
|
1053
1053
|
hasCheckbox
|
|
1054
1054
|
key="statusMaint"
|
|
1055
|
-
|
|
1055
|
+
value="Needs maintenance"
|
|
1056
1056
|
isSelected={filters.status.includes("Needs maintenance")}
|
|
1057
1057
|
>
|
|
1058
1058
|
Needs maintenance
|
|
@@ -1320,25 +1320,25 @@ import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
|
1320
1320
|
class ComplexPaginationTableDemo extends React.Component {
|
|
1321
1321
|
constructor(props) {
|
|
1322
1322
|
super(props);
|
|
1323
|
-
this.columns = {
|
|
1323
|
+
(this.columns = {
|
|
1324
1324
|
firstColumn: 'First column',
|
|
1325
1325
|
secondColumn: 'Second column',
|
|
1326
1326
|
thirdColumn: 'Third column'
|
|
1327
|
-
},
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1327
|
+
}),
|
|
1328
|
+
(this.defaultRows = [
|
|
1329
|
+
{ firstColumn: 'Row 1 column 1', secondColumn: 'Row 1 column 2', thirdColumn: 'Row 1 column 3' },
|
|
1330
|
+
{ firstColumn: 'Row 2 column 1', secondColumn: 'Row 2 column 2', thirdColumn: 'Row 2 column 3' },
|
|
1331
|
+
{ firstColumn: 'Row 3 column 1', secondColumn: 'Row 3 column 2', thirdColumn: 'Row 3 column 3' },
|
|
1332
|
+
{ firstColumn: 'Row 4 column 1', secondColumn: 'Row 4 column 2', thirdColumn: 'Row 4 column 3' },
|
|
1333
|
+
{ firstColumn: 'Row 5 column 1', secondColumn: 'Row 5 column 2', thirdColumn: 'Row 5 column 3' },
|
|
1334
|
+
{ firstColumn: 'Row 6 column 1', secondColumn: 'Row 6 column 2', thirdColumn: 'Row 6 column 3' },
|
|
1335
|
+
{ firstColumn: 'Row 7 column 1', secondColumn: 'Row 7 column 2', thirdColumn: 'Row 7 column 3' },
|
|
1336
|
+
{ firstColumn: 'Row 8 column 1', secondColumn: 'Row 8 column 2', thirdColumn: 'Row 8 column 3' },
|
|
1337
|
+
{ firstColumn: 'Row 9 column 1', secondColumn: 'Row 9 column 2', thirdColumn: 'Row 9 column 3' },
|
|
1338
|
+
{ firstColumn: 'Row 10 column 1', secondColumn: 'Row 10 column 2', thirdColumn: 'Row 10 column 3' },
|
|
1339
|
+
{ firstColumn: 'Row 11 column 1', secondColumn: 'Row 11 column 2', thirdColumn: 'Row 11 column 3' },
|
|
1340
|
+
{ firstColumn: 'Row 12 column 1', secondColumn: 'Row 12 column 2', thirdColumn: 'Row 12 column 3' }
|
|
1341
|
+
]);
|
|
1342
1342
|
this.defaultPerPage = 10;
|
|
1343
1343
|
this.state = {
|
|
1344
1344
|
perPage: this.defaultPerPage,
|
|
@@ -34,13 +34,12 @@ export const BulkSelectTableDemo = () => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const setRowSelected = (row, isSelecting = true) =>
|
|
37
|
-
setSelectedRows(prevSelected => {
|
|
38
|
-
const otherSelectedRows = prevSelected.filter(r => r !== row.name);
|
|
37
|
+
setSelectedRows((prevSelected) => {
|
|
38
|
+
const otherSelectedRows = prevSelected.filter((r) => r !== row.name);
|
|
39
39
|
return isSelecting ? [...otherSelectedRows, row.name] : otherSelectedRows;
|
|
40
40
|
});
|
|
41
|
-
const selectAllRows = (isSelecting = true) =>
|
|
42
|
-
|
|
43
|
-
const selectPageRows = (isSelecting = true) => setSelectedRows(isSelecting ? paginatedRows.map(r => r.name) : []);
|
|
41
|
+
const selectAllRows = (isSelecting = true) => setSelectedRows(isSelecting ? rows.map((r) => r.name) : []);
|
|
42
|
+
const selectPageRows = (isSelecting = true) => setSelectedRows(isSelecting ? paginatedRows.map((r) => r.name) : []);
|
|
44
43
|
const isRowSelected = (row) => selectedRows.includes(row.name);
|
|
45
44
|
|
|
46
45
|
const buildPagination = (variant, isCompact) => (
|
|
@@ -67,29 +66,23 @@ export const BulkSelectTableDemo = () => {
|
|
|
67
66
|
|
|
68
67
|
const items = (
|
|
69
68
|
<>
|
|
70
|
-
<DropdownItem
|
|
71
|
-
|
|
72
|
-
</DropdownItem>
|
|
73
|
-
<DropdownItem itemId="page">
|
|
74
|
-
Select page ({perPage} items)
|
|
75
|
-
</DropdownItem>
|
|
76
|
-
<DropdownItem itemId="all">
|
|
77
|
-
Select all ({rows.length} items)
|
|
78
|
-
</DropdownItem>
|
|
69
|
+
<DropdownItem value="none">Select none (0 items)</DropdownItem>
|
|
70
|
+
<DropdownItem value="page">Select page ({perPage} items)</DropdownItem>
|
|
71
|
+
<DropdownItem value="all">Select all ({rows.length} items)</DropdownItem>
|
|
79
72
|
</>
|
|
80
73
|
);
|
|
81
74
|
return (
|
|
82
75
|
<Dropdown
|
|
83
76
|
role="menu"
|
|
84
|
-
onSelect={(_ev,
|
|
85
|
-
if (
|
|
77
|
+
onSelect={(_ev, value) => {
|
|
78
|
+
if (value === 'all') {
|
|
86
79
|
selectAllRows(bulkSelection !== 'all');
|
|
87
|
-
} else if (
|
|
80
|
+
} else if (value === 'page') {
|
|
88
81
|
selectPageRows(bulkSelection !== 'page');
|
|
89
82
|
} else {
|
|
90
83
|
setSelectedRows([]);
|
|
91
84
|
}
|
|
92
|
-
setBulkSelection(
|
|
85
|
+
setBulkSelection(value);
|
|
93
86
|
}}
|
|
94
87
|
isOpen={isBulkSelectDropdownOpen}
|
|
95
88
|
onOpenChange={(isOpen) => setIsBulkSelectDropdownOpen(isOpen)}
|
|
@@ -120,9 +113,9 @@ export const BulkSelectTableDemo = () => {
|
|
|
120
113
|
<DropdownList>{items}</DropdownList>
|
|
121
114
|
</Dropdown>
|
|
122
115
|
);
|
|
123
|
-
}
|
|
116
|
+
};
|
|
124
117
|
|
|
125
|
-
const toolbar=(
|
|
118
|
+
const toolbar = (
|
|
126
119
|
<Toolbar>
|
|
127
120
|
<ToolbarContent>
|
|
128
121
|
<ToolbarGroup>
|
|
@@ -140,7 +133,7 @@ export const BulkSelectTableDemo = () => {
|
|
|
140
133
|
<Table aria-label="Selectable table">
|
|
141
134
|
<Thead>
|
|
142
135
|
<Tr>
|
|
143
|
-
<Th/>
|
|
136
|
+
<Th />
|
|
144
137
|
<Th key={0}>{columns[0]}</Th>
|
|
145
138
|
<Th key={1}>{columns[1]}</Th>
|
|
146
139
|
<Th key={2}>{columns[2]}</Th>
|
|
@@ -169,4 +162,4 @@ export const BulkSelectTableDemo = () => {
|
|
|
169
162
|
</PageSection>
|
|
170
163
|
</DashboardWrapper>
|
|
171
164
|
);
|
|
172
|
-
}
|
|
165
|
+
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Pagination,
|
|
8
8
|
PageSection,
|
|
9
9
|
Select,
|
|
10
|
-
|
|
10
|
+
SelectOption,
|
|
11
11
|
Toolbar,
|
|
12
12
|
ToolbarContent,
|
|
13
13
|
ToolbarGroup,
|
|
@@ -57,23 +57,27 @@ export const CompactTable = () => {
|
|
|
57
57
|
id="select-example"
|
|
58
58
|
aria-label="Select Input"
|
|
59
59
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
60
|
-
<MenuToggle
|
|
61
|
-
ref={toggleRef}
|
|
62
|
-
onClick={() => setIsSelectOpen(!isSelectOpen)}
|
|
63
|
-
isExpanded={isSelectOpen}
|
|
64
|
-
>
|
|
60
|
+
<MenuToggle ref={toggleRef} onClick={() => setIsSelectOpen(!isSelectOpen)} isExpanded={isSelectOpen}>
|
|
65
61
|
<FilterIcon /> Status
|
|
66
62
|
</MenuToggle>
|
|
67
63
|
)}
|
|
68
64
|
isOpen={isSelectOpen}
|
|
69
|
-
onOpenChange={isOpen => setIsSelectOpen(isOpen)}
|
|
65
|
+
onOpenChange={(isOpen) => setIsSelectOpen(isOpen)}
|
|
70
66
|
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
71
67
|
>
|
|
72
68
|
{[
|
|
73
|
-
<SelectOption key={0}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<SelectOption key={
|
|
69
|
+
<SelectOption key={0} value="Debug">
|
|
70
|
+
Debug
|
|
71
|
+
</SelectOption>,
|
|
72
|
+
<SelectOption key={1} value="Info">
|
|
73
|
+
Info
|
|
74
|
+
</SelectOption>,
|
|
75
|
+
<SelectOption key={2} value="Warn">
|
|
76
|
+
Warn
|
|
77
|
+
</SelectOption>,
|
|
78
|
+
<SelectOption key={3} value="Error">
|
|
79
|
+
Error
|
|
80
|
+
</SelectOption>
|
|
77
81
|
]}
|
|
78
82
|
</Select>
|
|
79
83
|
</ToolbarItem>
|
|
@@ -87,7 +91,7 @@ export const CompactTable = () => {
|
|
|
87
91
|
</Toolbar>
|
|
88
92
|
);
|
|
89
93
|
|
|
90
|
-
const renderLabel = labelText => {
|
|
94
|
+
const renderLabel = (labelText) => {
|
|
91
95
|
switch (labelText) {
|
|
92
96
|
case 'Running':
|
|
93
97
|
return <Label color="green">{labelText}</Label>;
|
|
@@ -98,16 +98,16 @@ export const CompoundExpandable = () => {
|
|
|
98
98
|
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
99
99
|
>
|
|
100
100
|
{[
|
|
101
|
-
<SelectOption key={0}
|
|
101
|
+
<SelectOption key={0} value="Debug">
|
|
102
102
|
Debug
|
|
103
103
|
</SelectOption>,
|
|
104
|
-
<SelectOption key={1}
|
|
104
|
+
<SelectOption key={1} value="Info">
|
|
105
105
|
Info
|
|
106
106
|
</SelectOption>,
|
|
107
|
-
<SelectOption key={2}
|
|
107
|
+
<SelectOption key={2} value="Warn">
|
|
108
108
|
Warn
|
|
109
109
|
</SelectOption>,
|
|
110
|
-
<SelectOption key={3}
|
|
110
|
+
<SelectOption key={3} value="Error">
|
|
111
111
|
Error
|
|
112
112
|
</SelectOption>
|
|
113
113
|
]}
|
|
@@ -128,12 +128,12 @@ export const ComposableTableSortable = () => {
|
|
|
128
128
|
<Select
|
|
129
129
|
isOpen={isSortDropdownOpen}
|
|
130
130
|
selected={[activeSortDirection, activeSortIndex]}
|
|
131
|
-
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
132
|
-
onSelect={(event,
|
|
133
|
-
if (
|
|
134
|
-
onSort(event, activeSortIndex,
|
|
131
|
+
onOpenChange={(isOpen) => setIsSortDropdownOpen(isOpen)}
|
|
132
|
+
onSelect={(event, value) => {
|
|
133
|
+
if (value === 'asc' || value === 'desc') {
|
|
134
|
+
onSort(event, activeSortIndex, value);
|
|
135
135
|
} else {
|
|
136
|
-
onSort(event,
|
|
136
|
+
onSort(event, value, activeSortDirection !== 'none' ? activeSortDirection : 'asc');
|
|
137
137
|
}
|
|
138
138
|
}}
|
|
139
139
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
@@ -150,11 +150,7 @@ export const ComposableTableSortable = () => {
|
|
|
150
150
|
<SelectGroup label="Sort column">
|
|
151
151
|
<SelectList>
|
|
152
152
|
{columns.map((column, columnIndex) => (
|
|
153
|
-
<SelectOption
|
|
154
|
-
key={column}
|
|
155
|
-
itemId={columnIndex}
|
|
156
|
-
isSelected={activeSortIndex === columnIndex}
|
|
157
|
-
>
|
|
153
|
+
<SelectOption key={column} value={columnIndex} isSelected={activeSortIndex === columnIndex}>
|
|
158
154
|
{column}
|
|
159
155
|
</SelectOption>
|
|
160
156
|
))}
|
|
@@ -162,18 +158,10 @@ export const ComposableTableSortable = () => {
|
|
|
162
158
|
</SelectGroup>
|
|
163
159
|
<SelectGroup label="Sort direction">
|
|
164
160
|
<SelectList>
|
|
165
|
-
<SelectOption
|
|
166
|
-
isSelected={activeSortDirection === 'asc'}
|
|
167
|
-
itemId="asc"
|
|
168
|
-
key="ascending"
|
|
169
|
-
>
|
|
161
|
+
<SelectOption isSelected={activeSortDirection === 'asc'} value="asc" key="ascending">
|
|
170
162
|
Ascending
|
|
171
163
|
</SelectOption>
|
|
172
|
-
<SelectOption
|
|
173
|
-
isSelected={activeSortDirection === 'desc'}
|
|
174
|
-
itemId="desc"
|
|
175
|
-
key="descending"
|
|
176
|
-
>
|
|
164
|
+
<SelectOption isSelected={activeSortDirection === 'desc'} value="desc" key="descending">
|
|
177
165
|
Descending
|
|
178
166
|
</SelectOption>
|
|
179
167
|
</SelectList>
|
|
@@ -51,7 +51,7 @@ export const StaticBottomPagination = () => {
|
|
|
51
51
|
/>
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
const renderLabel = labelText => {
|
|
54
|
+
const renderLabel = (labelText) => {
|
|
55
55
|
switch (labelText) {
|
|
56
56
|
case 'Running':
|
|
57
57
|
return (
|
|
@@ -88,23 +88,27 @@ export const StaticBottomPagination = () => {
|
|
|
88
88
|
id="select-example"
|
|
89
89
|
aria-label="Select Input"
|
|
90
90
|
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
91
|
-
<MenuToggle
|
|
92
|
-
ref={toggleRef}
|
|
93
|
-
onClick={() => setIsSelectOpen(!isSelectOpen)}
|
|
94
|
-
isExpanded={isSelectOpen}
|
|
95
|
-
>
|
|
91
|
+
<MenuToggle ref={toggleRef} onClick={() => setIsSelectOpen(!isSelectOpen)} isExpanded={isSelectOpen}>
|
|
96
92
|
<FilterIcon /> Status
|
|
97
93
|
</MenuToggle>
|
|
98
94
|
)}
|
|
99
95
|
isOpen={isSelectOpen}
|
|
100
|
-
onOpenChange={isOpen => setIsSelectOpen(isOpen)}
|
|
96
|
+
onOpenChange={(isOpen) => setIsSelectOpen(isOpen)}
|
|
101
97
|
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
102
98
|
>
|
|
103
99
|
{[
|
|
104
|
-
<SelectOption key={0}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<SelectOption key={
|
|
100
|
+
<SelectOption key={0} value="Debug">
|
|
101
|
+
Debug
|
|
102
|
+
</SelectOption>,
|
|
103
|
+
<SelectOption key={1} value="Info">
|
|
104
|
+
Info
|
|
105
|
+
</SelectOption>,
|
|
106
|
+
<SelectOption key={2} value="Warn">
|
|
107
|
+
Warn
|
|
108
|
+
</SelectOption>,
|
|
109
|
+
<SelectOption key={3} value="Error">
|
|
110
|
+
Error
|
|
111
|
+
</SelectOption>
|
|
108
112
|
]}
|
|
109
113
|
</Select>
|
|
110
114
|
</ToolbarItem>
|