@patternfly/react-table 5.0.0-alpha.64 → 5.0.0-alpha.65
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/dist/esm/components/Table/EditableSelectInputCell.d.ts +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/esm/components/Table/base/types.d.ts +1 -1
- package/dist/esm/components/Table/base/types.d.ts.map +1 -1
- package/dist/esm/components/Table/base/types.js.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.d.ts +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.d.ts.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.js +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/js/components/Table/base/types.d.ts +1 -1
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/base/types.js +1 -1
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/umd/react-table.min.js +2 -2
- package/package.json +3 -3
- package/src/components/Table/EditableSelectInputCell.tsx +4 -1
- package/src/components/Table/base/types.tsx +4 -1
- package/src/components/Table/examples/TableSortableCustom.tsx +57 -40
- package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +66 -46
- package/src/deprecated/components/Table/examples/Table.md +19 -7
- package/src/docs/demos/Table.md +123 -63
- package/src/docs/demos/table-demos/ColumnManagement.jsx +6 -28
- package/src/docs/demos/table-demos/Compact.jsx +20 -16
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +17 -13
- package/src/docs/demos/table-demos/SortableResponsive.jsx +86 -80
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +18 -14
package/src/docs/demos/Table.md
CHANGED
|
@@ -362,8 +362,7 @@ import {
|
|
|
362
362
|
PaginationVariant,
|
|
363
363
|
Text,
|
|
364
364
|
TextContent,
|
|
365
|
-
|
|
366
|
-
SelectVariant
|
|
365
|
+
MenuToggle
|
|
367
366
|
} from '@patternfly/react-core';
|
|
368
367
|
import { Table as TableDeprecated, TableHeader, TableBody } from '@patternfly/react-table/deprecated';
|
|
369
368
|
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
@@ -1003,33 +1002,11 @@ class ColumnManagementAction extends React.Component {
|
|
|
1003
1002
|
<ToolbarItem variant="overflow-menu">
|
|
1004
1003
|
<OverflowMenu breakpoint="md">
|
|
1005
1004
|
<OverflowMenuItem isPersistent>
|
|
1006
|
-
<
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
aria-label="Select Input"
|
|
1011
|
-
aria-labelledby="page-layout-table-draggable-column-management-action-toolbar-top-select-checkbox-label page-layout-table-column-management-action-toolbar-top-select-checkbox-toggle"
|
|
1012
|
-
placeholderText={
|
|
1013
|
-
<>
|
|
1014
|
-
<FilterIcon /> Name
|
|
1015
|
-
</>
|
|
1016
|
-
}
|
|
1017
|
-
/>
|
|
1005
|
+
<MenuToggle><FilterIcon /> Name</MenuToggle>
|
|
1006
|
+
</OverflowMenuItem>
|
|
1007
|
+
<OverflowMenuItem>
|
|
1008
|
+
<MenuToggle variant="plain" aria-label="Sort columns"><SortAmountDownIcon aria-hidden="true" /></MenuToggle>
|
|
1018
1009
|
</OverflowMenuItem>
|
|
1019
|
-
{/*<OverflowMenuItem> TODO: replace with select after #8073
|
|
1020
|
-
<OptionsMenu
|
|
1021
|
-
id="page-layout-table-draggable-column-management-action-toolbar-top-options-menu-toggle"
|
|
1022
|
-
isPlain
|
|
1023
|
-
menuItems={[]}
|
|
1024
|
-
toggle={
|
|
1025
|
-
<OptionsMenuToggle
|
|
1026
|
-
toggleTemplate={<SortAmountDownIcon aria-hidden="true" />}
|
|
1027
|
-
aria-label="Sort by"
|
|
1028
|
-
hideCaret
|
|
1029
|
-
/>
|
|
1030
|
-
}
|
|
1031
|
-
/>
|
|
1032
|
-
</OverflowMenuItem> */}
|
|
1033
1010
|
<OverflowMenuGroup groupType="button" isPersistent>
|
|
1034
1011
|
<OverflowMenuItem>
|
|
1035
1012
|
<Button variant="primary">Action</Button>
|
|
@@ -1116,7 +1093,6 @@ import {
|
|
|
1116
1093
|
Title,
|
|
1117
1094
|
Select,
|
|
1118
1095
|
SelectOption,
|
|
1119
|
-
SelectVariant,
|
|
1120
1096
|
SearchInput,
|
|
1121
1097
|
EmptyState,
|
|
1122
1098
|
EmptyStateActions,
|
|
@@ -1184,22 +1160,22 @@ class FilterTableDemo extends React.Component {
|
|
|
1184
1160
|
}
|
|
1185
1161
|
};
|
|
1186
1162
|
|
|
1187
|
-
this.onCategoryToggle = (
|
|
1163
|
+
this.onCategoryToggle = () => {
|
|
1188
1164
|
this.setState({
|
|
1189
|
-
isCategoryDropdownOpen:
|
|
1165
|
+
isCategoryDropdownOpen: !this.state.isCategoryDropdownOpen
|
|
1190
1166
|
});
|
|
1191
1167
|
};
|
|
1192
1168
|
|
|
1193
1169
|
this.onCategorySelect = (event) => {
|
|
1194
1170
|
this.setState({
|
|
1195
1171
|
currentCategory: event.target.innerText,
|
|
1196
|
-
isCategoryDropdownOpen:
|
|
1172
|
+
isCategoryDropdownOpen: false
|
|
1197
1173
|
});
|
|
1198
1174
|
};
|
|
1199
1175
|
|
|
1200
|
-
this.onFilterToggle = (
|
|
1176
|
+
this.onFilterToggle = () => {
|
|
1201
1177
|
this.setState({
|
|
1202
|
-
isFilterDropdownOpen:
|
|
1178
|
+
isFilterDropdownOpen: !this.state.isFilterDropdownOpen
|
|
1203
1179
|
});
|
|
1204
1180
|
};
|
|
1205
1181
|
|
|
@@ -1237,7 +1213,8 @@ class FilterTableDemo extends React.Component {
|
|
|
1237
1213
|
filters: {
|
|
1238
1214
|
...prevState.filters,
|
|
1239
1215
|
status: checked ? [...prevSelections, selection] : prevSelections.filter((value) => value !== selection)
|
|
1240
|
-
}
|
|
1216
|
+
},
|
|
1217
|
+
isFilterDropdownOpen: false
|
|
1241
1218
|
};
|
|
1242
1219
|
});
|
|
1243
1220
|
};
|
|
@@ -1266,7 +1243,8 @@ class FilterTableDemo extends React.Component {
|
|
|
1266
1243
|
filters: {
|
|
1267
1244
|
...prevState.filters,
|
|
1268
1245
|
['location']: [selection]
|
|
1269
|
-
}
|
|
1246
|
+
},
|
|
1247
|
+
isFilterDropdownOpen: false
|
|
1270
1248
|
};
|
|
1271
1249
|
});
|
|
1272
1250
|
this.onFilterSelect();
|
|
@@ -1277,21 +1255,33 @@ class FilterTableDemo extends React.Component {
|
|
|
1277
1255
|
const { isCategoryDropdownOpen, currentCategory } = this.state;
|
|
1278
1256
|
|
|
1279
1257
|
const categoryMenuItems = [
|
|
1280
|
-
<SelectOption key="cat1"
|
|
1281
|
-
<SelectOption key="cat2"
|
|
1282
|
-
<SelectOption key="cat3"
|
|
1258
|
+
<SelectOption key="cat1" itemId="Location">Location</SelectOption>,
|
|
1259
|
+
<SelectOption key="cat2" itemId="Name">Name</SelectOption>,
|
|
1260
|
+
<SelectOption key="cat3" itemId="Status">Status</SelectOption>
|
|
1283
1261
|
];
|
|
1284
1262
|
|
|
1285
1263
|
return (
|
|
1286
1264
|
<ToolbarItem>
|
|
1287
1265
|
<Select
|
|
1288
1266
|
onSelect={this.onCategorySelect}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1267
|
+
selected={currentCategory}
|
|
1268
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
1269
|
+
<MenuToggle
|
|
1270
|
+
ref={toggleRef}
|
|
1271
|
+
onClick={this.onCategoryToggle}
|
|
1272
|
+
isExpanded={isCategoryDropdownOpen}
|
|
1273
|
+
icon={<FilterIcon />}
|
|
1274
|
+
style={
|
|
1275
|
+
{
|
|
1276
|
+
width: '100%',
|
|
1277
|
+
verticalAlign: 'text-bottom'
|
|
1278
|
+
} as React.CSSProperties
|
|
1279
|
+
}
|
|
1280
|
+
>
|
|
1281
|
+
{currentCategory}
|
|
1282
|
+
</MenuToggle>
|
|
1283
|
+
)}
|
|
1292
1284
|
isOpen={isCategoryDropdownOpen}
|
|
1293
|
-
toggleIcon={<FilterIcon />}
|
|
1294
|
-
style={{ width: '100%' }}
|
|
1295
1285
|
>
|
|
1296
1286
|
{categoryMenuItems}
|
|
1297
1287
|
</Select>
|
|
@@ -1303,19 +1293,54 @@ class FilterTableDemo extends React.Component {
|
|
|
1303
1293
|
const { currentCategory, isFilterDropdownOpen, inputValue, filters } = this.state;
|
|
1304
1294
|
|
|
1305
1295
|
const locationMenuItems = [
|
|
1306
|
-
<SelectOption key="raleigh"
|
|
1307
|
-
<SelectOption key="westford"
|
|
1308
|
-
<SelectOption key="boston"
|
|
1309
|
-
<SelectOption key="brno"
|
|
1310
|
-
<SelectOption key="bangalore"
|
|
1296
|
+
<SelectOption key="raleigh" itemId="Raleigh">Raleigh</SelectOption>,
|
|
1297
|
+
<SelectOption key="westford" itemId="Westford">Westford</SelectOption>,
|
|
1298
|
+
<SelectOption key="boston" itemId="Boston">Boston</SelectOption>,
|
|
1299
|
+
<SelectOption key="brno" itemId="Brno">Brno</SelectOption>,
|
|
1300
|
+
<SelectOption key="bangalore" itemId="Bangalore">Bangalore</SelectOption>
|
|
1311
1301
|
];
|
|
1312
1302
|
|
|
1313
1303
|
const statusMenuItems = [
|
|
1314
|
-
<SelectOption
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1304
|
+
<SelectOption
|
|
1305
|
+
hasCheckbox
|
|
1306
|
+
key="statusRunning"
|
|
1307
|
+
itemId="Running"
|
|
1308
|
+
isSelected={filters.status.includes("Running")}
|
|
1309
|
+
>
|
|
1310
|
+
Running
|
|
1311
|
+
</SelectOption>,
|
|
1312
|
+
<SelectOption
|
|
1313
|
+
hasCheckbox
|
|
1314
|
+
key="statusStopped"
|
|
1315
|
+
itemId="Stopped"
|
|
1316
|
+
isSelected={filters.status.includes("Stopped")}
|
|
1317
|
+
>
|
|
1318
|
+
Stopped
|
|
1319
|
+
</SelectOption>,
|
|
1320
|
+
<SelectOption
|
|
1321
|
+
hasCheckbox
|
|
1322
|
+
key="statusDown"
|
|
1323
|
+
itemId="Down"
|
|
1324
|
+
isSelected={filters.status.includes("Down")}
|
|
1325
|
+
>
|
|
1326
|
+
Down
|
|
1327
|
+
</SelectOption>,
|
|
1328
|
+
<SelectOption
|
|
1329
|
+
hasCheckbox
|
|
1330
|
+
key="statusDegraded"
|
|
1331
|
+
itemId="Degraded"
|
|
1332
|
+
isSelected={filters.status.includes("Degraded")}
|
|
1333
|
+
>
|
|
1334
|
+
Degraded
|
|
1335
|
+
</SelectOption>,
|
|
1336
|
+
<SelectOption
|
|
1337
|
+
hasCheckbox
|
|
1338
|
+
key="statusMaint"
|
|
1339
|
+
itemId="Needs Maintainence"
|
|
1340
|
+
isSelected={filters.status.includes("Needs Maintainence")}
|
|
1341
|
+
>
|
|
1342
|
+
Needs Maintainence
|
|
1343
|
+
</SelectOption>
|
|
1319
1344
|
];
|
|
1320
1345
|
|
|
1321
1346
|
return (
|
|
@@ -1328,11 +1353,25 @@ class FilterTableDemo extends React.Component {
|
|
|
1328
1353
|
>
|
|
1329
1354
|
<Select
|
|
1330
1355
|
aria-label="Location"
|
|
1331
|
-
onToggle={this.onFilterToggle}
|
|
1332
1356
|
onSelect={this.onLocationSelect}
|
|
1333
|
-
|
|
1357
|
+
selected={filters.location[0]}
|
|
1334
1358
|
isOpen={isFilterDropdownOpen}
|
|
1335
|
-
|
|
1359
|
+
minWidth="100px"
|
|
1360
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
1361
|
+
<MenuToggle
|
|
1362
|
+
ref={toggleRef}
|
|
1363
|
+
onClick={this.onFilterToggle}
|
|
1364
|
+
isExpanded={isFilterDropdownOpen}
|
|
1365
|
+
style={
|
|
1366
|
+
{
|
|
1367
|
+
width: '100%',
|
|
1368
|
+
verticalAlign: 'text-bottom'
|
|
1369
|
+
} as React.CSSProperties
|
|
1370
|
+
}
|
|
1371
|
+
>
|
|
1372
|
+
{filters.location[0] || `Any`}
|
|
1373
|
+
</MenuToggle>
|
|
1374
|
+
)}
|
|
1336
1375
|
>
|
|
1337
1376
|
{locationMenuItems}
|
|
1338
1377
|
</Select>
|
|
@@ -1361,13 +1400,28 @@ class FilterTableDemo extends React.Component {
|
|
|
1361
1400
|
showToolbarItem={currentCategory === 'Status'}
|
|
1362
1401
|
>
|
|
1363
1402
|
<Select
|
|
1364
|
-
variant={SelectVariant.checkbox}
|
|
1365
1403
|
aria-label="Status"
|
|
1366
|
-
onToggle={this.onFilterToggle}
|
|
1367
|
-
onSelect={this.onStatusSelect}
|
|
1368
|
-
selections={filters.status}
|
|
1369
1404
|
isOpen={isFilterDropdownOpen}
|
|
1370
|
-
|
|
1405
|
+
minWidth="100px"
|
|
1406
|
+
onSelect={this.onStatusSelect}
|
|
1407
|
+
selected={filters.status}
|
|
1408
|
+
minWidth="200px"
|
|
1409
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
1410
|
+
<MenuToggle
|
|
1411
|
+
ref={toggleRef}
|
|
1412
|
+
onClick={this.onFilterToggle}
|
|
1413
|
+
isExpanded={isFilterDropdownOpen}
|
|
1414
|
+
style={
|
|
1415
|
+
{
|
|
1416
|
+
width: '100%',
|
|
1417
|
+
verticalAlign: 'text-bottom'
|
|
1418
|
+
} as React.CSSProperties
|
|
1419
|
+
}
|
|
1420
|
+
>
|
|
1421
|
+
Filter by status
|
|
1422
|
+
{filters.status.length > 0 && <Badge isRead>{filters.status.length}</Badge>}
|
|
1423
|
+
</MenuToggle>
|
|
1424
|
+
)}
|
|
1371
1425
|
>
|
|
1372
1426
|
{statusMenuItems}
|
|
1373
1427
|
</Select>
|
|
@@ -1382,7 +1436,13 @@ class FilterTableDemo extends React.Component {
|
|
|
1382
1436
|
<Toolbar id="toolbar-with-chip-groups" clearAllFilters={this.onDelete} collapseListedFiltersBreakpoint="xl">
|
|
1383
1437
|
<ToolbarContent>
|
|
1384
1438
|
<ToolbarToggleGroup toggleIcon={<FilterIcon />} breakpoint="xl">
|
|
1385
|
-
<ToolbarGroup
|
|
1439
|
+
<ToolbarGroup
|
|
1440
|
+
variant="filter-group"
|
|
1441
|
+
style={{
|
|
1442
|
+
lineHeight: '22px',
|
|
1443
|
+
alignItems: 'center'
|
|
1444
|
+
} as React.CSSProperties}
|
|
1445
|
+
>
|
|
1386
1446
|
{this.buildCategoryDropdown()}
|
|
1387
1447
|
{this.buildFilterDropdown()}
|
|
1388
1448
|
</ToolbarGroup>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Toolbar,
|
|
12
12
|
ToolbarContent,
|
|
13
13
|
ToolbarItem,
|
|
14
|
+
MenuToggle,
|
|
14
15
|
Modal,
|
|
15
16
|
OverflowMenu,
|
|
16
17
|
OverflowMenuGroup,
|
|
@@ -20,9 +21,7 @@ import {
|
|
|
20
21
|
Pagination,
|
|
21
22
|
PaginationVariant,
|
|
22
23
|
Text,
|
|
23
|
-
TextContent
|
|
24
|
-
Select,
|
|
25
|
-
SelectVariant
|
|
24
|
+
TextContent
|
|
26
25
|
} from '@patternfly/react-core';
|
|
27
26
|
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
28
27
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
@@ -390,32 +389,11 @@ export const ColumnManagementAction = () => {
|
|
|
390
389
|
<ToolbarItem variant="overflow-menu">
|
|
391
390
|
<OverflowMenu breakpoint="md">
|
|
392
391
|
<OverflowMenuItem>
|
|
393
|
-
<
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
aria-labelledby="page-layout-table-column-management-action-toolbar-top-select-checkbox-label page-layout-table-column-management-action-toolbar-top-select-checkbox-toggle"
|
|
398
|
-
placeholderText={
|
|
399
|
-
<>
|
|
400
|
-
<FilterIcon /> Name
|
|
401
|
-
</>
|
|
402
|
-
}
|
|
403
|
-
/>
|
|
392
|
+
<MenuToggle><FilterIcon /> Name</MenuToggle>
|
|
393
|
+
</OverflowMenuItem>
|
|
394
|
+
<OverflowMenuItem>
|
|
395
|
+
<MenuToggle variant="plain" aria-label="Sort columns"><SortAmountDownIcon aria-hidden="true" /></MenuToggle>
|
|
404
396
|
</OverflowMenuItem>
|
|
405
|
-
{/* <OverflowMenuItem> TODO: replace with select after #8073
|
|
406
|
-
<OptionsMenu
|
|
407
|
-
id="page-layout-table-column-management-action-toolbar-top-options-menu-toggle"
|
|
408
|
-
isPlain
|
|
409
|
-
menuItems={[]}
|
|
410
|
-
toggle={
|
|
411
|
-
<OptionsMenuToggle
|
|
412
|
-
toggleTemplate={<SortAmountDownIcon aria-hidden="true" />}
|
|
413
|
-
aria-label="Sort by"
|
|
414
|
-
hideCaret
|
|
415
|
-
/>
|
|
416
|
-
}
|
|
417
|
-
/>
|
|
418
|
-
</OverflowMenuItem> */}
|
|
419
397
|
<OverflowMenuGroup groupType="button" isPersistent>
|
|
420
398
|
<OverflowMenuItem>
|
|
421
399
|
<Button variant="primary">Action</Button>
|
|
@@ -2,15 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Card,
|
|
5
|
+
MenuToggle,
|
|
6
|
+
MenuToggleElement,
|
|
7
|
+
Pagination,
|
|
8
|
+
PageSection,
|
|
9
|
+
Select,
|
|
10
|
+
SelectOptionm,
|
|
5
11
|
Toolbar,
|
|
6
12
|
ToolbarContent,
|
|
7
13
|
ToolbarGroup,
|
|
8
|
-
ToolbarItem
|
|
9
|
-
Pagination,
|
|
10
|
-
Select,
|
|
11
|
-
SelectVariant,
|
|
12
|
-
SelectOption,
|
|
13
|
-
PageSection
|
|
14
|
+
ToolbarItem
|
|
14
15
|
} from '@patternfly/react-core';
|
|
15
16
|
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
16
17
|
|
|
@@ -54,22 +55,25 @@ export const CompactTable = () => {
|
|
|
54
55
|
<ToolbarItem>
|
|
55
56
|
<Select
|
|
56
57
|
id="select-example"
|
|
57
|
-
variant={SelectVariant.single}
|
|
58
58
|
aria-label="Select Input"
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
60
|
+
<MenuToggle
|
|
61
|
+
ref={toggleRef}
|
|
62
|
+
onClick={() => setIsSelectOpen(!isSelectOpen)}
|
|
63
|
+
isExpanded={isSelectOpen}
|
|
64
|
+
>
|
|
61
65
|
<FilterIcon /> Status
|
|
62
|
-
|
|
63
|
-
}
|
|
66
|
+
</MenuToggle>
|
|
67
|
+
)}
|
|
64
68
|
isOpen={isSelectOpen}
|
|
65
|
-
|
|
69
|
+
onOpenChange={isOpen => setIsSelectOpen(isOpen)}
|
|
66
70
|
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
67
71
|
>
|
|
68
72
|
{[
|
|
69
|
-
<SelectOption key={0}
|
|
70
|
-
<SelectOption key={1}
|
|
71
|
-
<SelectOption key={2}
|
|
72
|
-
<SelectOption key={3}
|
|
73
|
+
<SelectOption key={0} itemId="Debug">Debug</SelectOption>,
|
|
74
|
+
<SelectOption key={1} itemId="Info">Info</SelectOption>,
|
|
75
|
+
<SelectOption key={2} itemId="Warn">Warn</SelectOption>,
|
|
76
|
+
<SelectOption key={3} itemId="Error">Error</SelectOption>
|
|
73
77
|
]}
|
|
74
78
|
</Select>
|
|
75
79
|
</ToolbarItem>
|
|
@@ -14,15 +14,16 @@ import {
|
|
|
14
14
|
Card,
|
|
15
15
|
Flex,
|
|
16
16
|
FlexItem,
|
|
17
|
+
MenuToggle,
|
|
18
|
+
MenuToggleElement,
|
|
17
19
|
Toolbar,
|
|
18
20
|
ToolbarContent,
|
|
19
21
|
ToolbarGroup,
|
|
20
22
|
ToolbarItem,
|
|
21
23
|
Pagination,
|
|
24
|
+
PageSection,
|
|
22
25
|
Select,
|
|
23
|
-
|
|
24
|
-
SelectOption,
|
|
25
|
-
PageSection
|
|
26
|
+
SelectOption
|
|
26
27
|
} from '@patternfly/react-core';
|
|
27
28
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
28
29
|
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
@@ -95,22 +96,25 @@ export const CompoundExpandable = () => {
|
|
|
95
96
|
<ToolbarItem>
|
|
96
97
|
<Select
|
|
97
98
|
id="select-example"
|
|
98
|
-
variant={SelectVariant.single}
|
|
99
99
|
aria-label="Select Input"
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
101
|
+
<MenuToggle
|
|
102
|
+
ref={toggleRef}
|
|
103
|
+
onClick={() => setIsSelectOpen(!isSelectOpen)}
|
|
104
|
+
isExpanded={isSelectOpen}
|
|
105
|
+
>
|
|
102
106
|
<FilterIcon /> Status
|
|
103
|
-
|
|
104
|
-
}
|
|
107
|
+
</MenuToggle>
|
|
108
|
+
)}
|
|
105
109
|
isOpen={isSelectOpen}
|
|
106
|
-
|
|
110
|
+
onOpenChange={isOpen => setIsSelectOpen(isOpen)}
|
|
107
111
|
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
108
112
|
>
|
|
109
113
|
{[
|
|
110
|
-
<SelectOption key={0}
|
|
111
|
-
<SelectOption key={1}
|
|
112
|
-
<SelectOption key={2}
|
|
113
|
-
<SelectOption key={3}
|
|
114
|
+
<SelectOption key={0} itemId="Debug">Debug</SelectOption>,
|
|
115
|
+
<SelectOption key={1} itemId="Info">Info</SelectOption>,
|
|
116
|
+
<SelectOption key={2} itemId="Warn">Warn</SelectOption>,
|
|
117
|
+
<SelectOption key={3} itemId="Error">Error</SelectOption>
|
|
114
118
|
]}
|
|
115
119
|
</Select>
|
|
116
120
|
</ToolbarItem>
|
|
@@ -7,20 +7,18 @@ import {
|
|
|
7
7
|
Flex,
|
|
8
8
|
FlexItem,
|
|
9
9
|
MenuToggle,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ToolbarGroup,
|
|
13
|
-
ToolbarItem,
|
|
10
|
+
MenuToggleElement,
|
|
11
|
+
PageSection,
|
|
14
12
|
Pagination,
|
|
13
|
+
SelectOption,
|
|
14
|
+
SelectList,
|
|
15
|
+
SelectGroup,
|
|
15
16
|
Text,
|
|
16
17
|
TextContent,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
OverflowMenuGroup,
|
|
22
|
-
OverflowMenuItem,
|
|
23
|
-
PageSection
|
|
18
|
+
Toolbar,
|
|
19
|
+
ToolbarContent,
|
|
20
|
+
ToolbarGroup,
|
|
21
|
+
ToolbarItem
|
|
24
22
|
} from '@patternfly/react-core';
|
|
25
23
|
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
26
24
|
import { rows, columns } from '../../examples/Data.jsx';
|
|
@@ -29,6 +27,7 @@ import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
|
|
|
29
27
|
import SyncIcon from '@patternfly/react-icons/dist/esm/icons/sync-icon';
|
|
30
28
|
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
31
29
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
30
|
+
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
32
31
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
33
32
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
34
33
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
@@ -125,89 +124,96 @@ export const ComposableTableSortable = () => {
|
|
|
125
124
|
const tableToolbar = (
|
|
126
125
|
<Toolbar id="sortable-toolbar">
|
|
127
126
|
<ToolbarContent>
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
<ToolbarItem visibility={{ md: 'hidden' }}>
|
|
128
|
+
<Select
|
|
129
|
+
isOpen={isSortDropdownOpen}
|
|
130
|
+
selected={[activeSortDirection, activeSortIndex]}
|
|
131
|
+
onOpenChange={isOpen => setIsSortDropdownOpen(isOpen)}
|
|
132
|
+
onSelect={(event, itemId) => {
|
|
133
|
+
if (itemId === 'asc' || itemId === 'desc') {
|
|
134
|
+
onSort(event, activeSortIndex, itemId);
|
|
135
|
+
} else {
|
|
136
|
+
onSort(event, itemId, activeSortDirection !== 'none' ? activeSortDirection : 'asc');
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
140
|
+
<MenuToggle
|
|
141
|
+
ref={toggleRef}
|
|
142
|
+
onClick={() => setIsSortDropdownOpen(!isSortDropdownOpen)}
|
|
143
|
+
isExpanded={isSortDropdownOpen}
|
|
144
|
+
variant="plain"
|
|
145
|
+
>
|
|
146
|
+
<SortAmountDownIcon />
|
|
147
|
+
</MenuToggle>
|
|
148
|
+
)}
|
|
149
|
+
>
|
|
150
|
+
<SelectGroup label="Sort column">
|
|
151
|
+
<SelectList>
|
|
133
152
|
{columns.map((column, columnIndex) => (
|
|
134
|
-
<
|
|
153
|
+
<SelectOption
|
|
135
154
|
key={column}
|
|
155
|
+
itemId={columnIndex}
|
|
136
156
|
isSelected={activeSortIndex === columnIndex}
|
|
137
|
-
onSelect={evt =>
|
|
138
|
-
onSort(evt, columnIndex, activeSortDirection !== 'none' ? activeSortDirection : 'asc')
|
|
139
|
-
}
|
|
140
157
|
>
|
|
141
158
|
{column}
|
|
142
|
-
</
|
|
159
|
+
</SelectOption>
|
|
143
160
|
))}
|
|
144
|
-
</
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
</SelectList>
|
|
162
|
+
</SelectGroup>
|
|
163
|
+
<SelectGroup label="Sort direction">
|
|
164
|
+
<SelectList>
|
|
165
|
+
<SelectOption
|
|
149
166
|
isSelected={activeSortDirection === 'asc'}
|
|
150
|
-
|
|
167
|
+
itemId="asc"
|
|
151
168
|
key="ascending"
|
|
152
169
|
>
|
|
153
170
|
Ascending
|
|
154
|
-
</
|
|
155
|
-
<
|
|
156
|
-
onSelect={evt => onSort(evt, activeSortIndex, 'desc')}
|
|
171
|
+
</SelectOption>
|
|
172
|
+
<SelectOption
|
|
157
173
|
isSelected={activeSortDirection === 'desc'}
|
|
158
|
-
|
|
174
|
+
itemId="desc"
|
|
159
175
|
key="descending"
|
|
160
176
|
>
|
|
161
177
|
Descending
|
|
162
|
-
</
|
|
163
|
-
</
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
>
|
|
202
|
-
<EllipsisVIcon />
|
|
203
|
-
</MenuToggle>
|
|
204
|
-
)}
|
|
205
|
-
isOpen={isKebabDropdownOpen}
|
|
206
|
-
>
|
|
207
|
-
<DropdownList>{kebabDropdownItems}</DropdownList>
|
|
208
|
-
</Dropdown>
|
|
209
|
-
</OverflowMenuControl>
|
|
210
|
-
</OverflowMenu>
|
|
178
|
+
</SelectOption>
|
|
179
|
+
</SelectList>
|
|
180
|
+
</SelectGroup>
|
|
181
|
+
</Select>
|
|
182
|
+
</ToolbarItem>
|
|
183
|
+
<ToolbarItem>
|
|
184
|
+
<OverflowMenu breakpoint="lg">
|
|
185
|
+
<OverflowMenuContent isPersistent>
|
|
186
|
+
<OverflowMenuGroup isPersistent groupType="button">
|
|
187
|
+
<OverflowMenuItem>
|
|
188
|
+
<Button variant="primary">Create instance</Button>
|
|
189
|
+
</OverflowMenuItem>
|
|
190
|
+
<OverflowMenuItem>
|
|
191
|
+
<Button variant="secondary">Action</Button>
|
|
192
|
+
</OverflowMenuItem>
|
|
193
|
+
</OverflowMenuGroup>
|
|
194
|
+
</OverflowMenuContent>
|
|
195
|
+
<OverflowMenuControl hasAdditionalOptions>
|
|
196
|
+
<Dropdown
|
|
197
|
+
onSelect={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
198
|
+
onOpenChange={(isKebabDropdownOpen) => setIsKebabDropdownOpen(isKebabDropdownOpen)}
|
|
199
|
+
toggle={(toggleRef) => (
|
|
200
|
+
<MenuToggle
|
|
201
|
+
ref={toggleRef}
|
|
202
|
+
aria-label="overflow menu"
|
|
203
|
+
variant="plain"
|
|
204
|
+
onClick={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
205
|
+
isExpanded={false}
|
|
206
|
+
>
|
|
207
|
+
<EllipsisVIcon />
|
|
208
|
+
</MenuToggle>
|
|
209
|
+
)}
|
|
210
|
+
isOpen={isKebabDropdownOpen}
|
|
211
|
+
>
|
|
212
|
+
<DropdownList>{kebabDropdownItems}</DropdownList>
|
|
213
|
+
</Dropdown>
|
|
214
|
+
</OverflowMenuControl>
|
|
215
|
+
</OverflowMenu>
|
|
216
|
+
</ToolbarItem>
|
|
211
217
|
<ToolbarGroup variant="icon-button-group">
|
|
212
218
|
<ToolbarItem>
|
|
213
219
|
<Button aria-label="Edit" variant="plain" icon={<EditIcon />} />
|