@patternfly/react-table 4.84.0 → 4.85.0
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 +11 -0
- package/package.json +6 -6
- package/src/demos/Table.md +205 -191
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 4.85.0 (2022-05-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **table:** update sortable demo to align with core ([#7292](https://github.com/patternfly/patternfly-react/issues/7292)) ([6891764](https://github.com/patternfly/patternfly-react/commit/6891764f2507c775005878f6e74cc5c8e44a6c68))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 4.84.0 (2022-05-19)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.85.0",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.
|
|
35
|
-
"@patternfly/react-icons": "^4.
|
|
36
|
-
"@patternfly/react-styles": "^4.
|
|
37
|
-
"@patternfly/react-tokens": "^4.
|
|
34
|
+
"@patternfly/react-core": "^4.216.0",
|
|
35
|
+
"@patternfly/react-icons": "^4.67.0",
|
|
36
|
+
"@patternfly/react-styles": "^4.66.0",
|
|
37
|
+
"@patternfly/react-tokens": "^4.68.0",
|
|
38
38
|
"lodash": "^4.17.19",
|
|
39
39
|
"tslib": "^2.0.0"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "78b436c5a6bdae02a7a6b4bb8c6b94e2ab1586be"
|
|
50
50
|
}
|
package/src/demos/Table.md
CHANGED
|
@@ -5,12 +5,15 @@ section: components
|
|
|
5
5
|
|
|
6
6
|
import { Checkbox, PageSection, ToolbarExpandIconWrapper, ToolbarContent } from '@patternfly/react-core';
|
|
7
7
|
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
8
|
+
import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
|
|
8
9
|
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
9
10
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
10
11
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
12
|
+
import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
|
|
11
13
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
12
14
|
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
13
15
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
16
|
+
import SyncIcon from '@patternfly/react-icons/dist/esm/icons/sync-icon';
|
|
14
17
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
15
18
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
16
19
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
@@ -2067,20 +2070,22 @@ class FilterTableDemo extends React.Component {
|
|
|
2067
2070
|
|
|
2068
2071
|
### Sortable - responsive
|
|
2069
2072
|
|
|
2070
|
-
This is an example of a responive sortable table. When the screen size is small, the table will change to a compact format and a new toolbar item will be displayed to control sorting.
|
|
2071
|
-
|
|
2072
2073
|
```js isFullscreen
|
|
2073
2074
|
import React from 'react';
|
|
2074
2075
|
import {
|
|
2075
2076
|
Button,
|
|
2077
|
+
Card,
|
|
2078
|
+
Flex,
|
|
2079
|
+
FlexItem,
|
|
2080
|
+
InputGroup,
|
|
2076
2081
|
Toolbar,
|
|
2077
2082
|
ToolbarContent,
|
|
2078
2083
|
ToolbarGroup,
|
|
2079
2084
|
ToolbarItem,
|
|
2085
|
+
ToolbarToggleGroup,
|
|
2080
2086
|
OptionsMenu,
|
|
2081
2087
|
OptionsMenuToggle,
|
|
2082
2088
|
Pagination,
|
|
2083
|
-
PaginationVariant,
|
|
2084
2089
|
Text,
|
|
2085
2090
|
TextContent,
|
|
2086
2091
|
Select,
|
|
@@ -2099,25 +2104,29 @@ import {
|
|
|
2099
2104
|
OptionsMenuItem,
|
|
2100
2105
|
OptionsMenuSeparator,
|
|
2101
2106
|
OptionsMenuItemGroup,
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
MastheadContent,
|
|
2109
|
-
SkipToContent,
|
|
2107
|
+
OverflowMenu,
|
|
2108
|
+
OverflowMenuContent,
|
|
2109
|
+
OverflowMenuControl,
|
|
2110
|
+
OverflowMenuDropdownItem,
|
|
2111
|
+
OverflowMenuGroup,
|
|
2112
|
+
OverflowMenuItem,
|
|
2110
2113
|
PageSection
|
|
2111
2114
|
} from '@patternfly/react-core';
|
|
2112
|
-
import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
2115
|
+
import { ActionsColumn, TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
2113
2116
|
|
|
2114
2117
|
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
2115
2118
|
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
2116
|
-
import
|
|
2119
|
+
import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
|
|
2117
2120
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
2121
|
+
import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
|
|
2118
2122
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
2123
|
+
import SyncIcon from '@patternfly/react-icons/dist/esm/icons/sync-icon';
|
|
2119
2124
|
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
2120
2125
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
2126
|
+
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
2127
|
+
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
2128
|
+
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
2129
|
+
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
2121
2130
|
|
|
2122
2131
|
ComposableTableSortable = () => {
|
|
2123
2132
|
const [navActiveItem, setNavActiveItem] = React.useState(0);
|
|
@@ -2126,23 +2135,58 @@ ComposableTableSortable = () => {
|
|
|
2126
2135
|
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
|
2127
2136
|
const [isFullKebabDropdownOpen, setIsFullKebabDropdownOpen] = React.useState(false);
|
|
2128
2137
|
|
|
2129
|
-
const columns = ['
|
|
2138
|
+
const columns = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last commit'];
|
|
2139
|
+
|
|
2130
2140
|
const [rows, setRows] = React.useState([
|
|
2131
|
-
['
|
|
2132
|
-
['
|
|
2133
|
-
['
|
|
2141
|
+
['Node 1', 10, 25, 5, 2],
|
|
2142
|
+
['Node 2', 8, 30, 2, 2],
|
|
2143
|
+
['Node 3', 12, 48, 13, 30],
|
|
2144
|
+
['Node 4', 10, 25, 5, 8],
|
|
2145
|
+
['Node 5', 34, 21, 26, 2]
|
|
2134
2146
|
]);
|
|
2147
|
+
|
|
2135
2148
|
// index of the currently active column
|
|
2136
|
-
const [activeSortIndex, setActiveSortIndex] = React.useState(
|
|
2149
|
+
const [activeSortIndex, setActiveSortIndex] = React.useState(0);
|
|
2137
2150
|
// sort direction of the currently active column
|
|
2138
|
-
const [activeSortDirection, setActiveSortDirection] = React.useState('
|
|
2151
|
+
const [activeSortDirection, setActiveSortDirection] = React.useState('asc');
|
|
2139
2152
|
// sort dropdown expansion
|
|
2140
2153
|
const [isSortDropdownOpen, setIsSortDropdownOpen] = React.useState(false);
|
|
2141
2154
|
|
|
2155
|
+
const [selectedNodeNames, setSelectedNodeNames] = React.useState([]);
|
|
2156
|
+
const setNodeSelected = (node, isSelecting = true) => {
|
|
2157
|
+
if (!selectedNodeNames.includes(node)) {
|
|
2158
|
+
setSelectedNodeNames([...selectedNodeNames, node]);
|
|
2159
|
+
} else {
|
|
2160
|
+
setSelectedNodeNames(selectedNodeNames.filter(n => n !== node));
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
|
|
2164
|
+
const selectAllNodes = (isSelecting = true) => setSelectedNodeNames(isSelecting ? rows.map(r => r[0]) : []);
|
|
2165
|
+
const areAllReposSelected = selectedNodeNames.length === rows.length;
|
|
2166
|
+
const isNodeSelected = node => selectedNodeNames.includes(node[0]);
|
|
2167
|
+
|
|
2168
|
+
// To allow shift+click to select/deselect multiple rows
|
|
2169
|
+
const [recentSelectedRowIndex, setRecentSelectedRowIndex] = React.useState(null);
|
|
2170
|
+
const [shifting, setShifting] = React.useState(false);
|
|
2171
|
+
|
|
2172
|
+
const onSelectNode = (node, rowIndex, isSelecting) => {
|
|
2173
|
+
// If the user is shift + selecting the checkboxes, then all intermediate checkboxes should be selected
|
|
2174
|
+
if (shifting && recentSelectedRowIndex !== null) {
|
|
2175
|
+
const numberSelected = rowIndex - recentSelectedRowIndex;
|
|
2176
|
+
const intermediateIndexes =
|
|
2177
|
+
numberSelected > 0
|
|
2178
|
+
? Array.from(new Array(numberSelected + 1), (_x, i) => i + recentSelectedRowIndex)
|
|
2179
|
+
: Array.from(new Array(Math.abs(numberSelected) + 1), (_x, i) => i + rowIndex);
|
|
2180
|
+
intermediateIndexes.forEach(index => setNodeSelected(rows[index], isSelecting));
|
|
2181
|
+
} else {
|
|
2182
|
+
setNodeSelected(node[0], isSelecting);
|
|
2183
|
+
}
|
|
2184
|
+
setRecentSelectedRowIndex(rowIndex);
|
|
2185
|
+
};
|
|
2186
|
+
|
|
2142
2187
|
const onSort = (event, index, direction) => {
|
|
2143
2188
|
setActiveSortIndex(index);
|
|
2144
2189
|
setActiveSortDirection(direction);
|
|
2145
|
-
console.log('i; ', index, direction);
|
|
2146
2190
|
// sorts the rows
|
|
2147
2191
|
const updatedRows = rows.sort((a, b) => {
|
|
2148
2192
|
if (typeof a[index] === 'number') {
|
|
@@ -2184,14 +2228,32 @@ ComposableTableSortable = () => {
|
|
|
2184
2228
|
</Nav>
|
|
2185
2229
|
);
|
|
2186
2230
|
|
|
2187
|
-
const kebabDropdownItems = [
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2231
|
+
const kebabDropdownItems = [<OverflowMenuDropdownItem key="kebab-1">Some action</OverflowMenuDropdownItem>];
|
|
2232
|
+
|
|
2233
|
+
const defaultActions = () => [
|
|
2234
|
+
{
|
|
2235
|
+
title: 'Settings',
|
|
2236
|
+
onClick: () => console.log(`clicked on Settings`)
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
title: 'Help',
|
|
2240
|
+
onClick: () => console.log(`clicked on Help`)
|
|
2241
|
+
}
|
|
2194
2242
|
];
|
|
2243
|
+
|
|
2244
|
+
const renderPagination = (variant, isCompact) => (
|
|
2245
|
+
<Pagination
|
|
2246
|
+
isCompact={isCompact}
|
|
2247
|
+
itemCount={36}
|
|
2248
|
+
page={1}
|
|
2249
|
+
perPage={10}
|
|
2250
|
+
variant={variant}
|
|
2251
|
+
titles={{
|
|
2252
|
+
paginationTitle: `${variant} pagination`
|
|
2253
|
+
}}
|
|
2254
|
+
/>
|
|
2255
|
+
);
|
|
2256
|
+
|
|
2195
2257
|
const userDropdownItems = [
|
|
2196
2258
|
<DropdownGroup key="group 2">
|
|
2197
2259
|
<DropdownItem key="group 2 profile">My profile</DropdownItem>
|
|
@@ -2219,98 +2281,10 @@ ComposableTableSortable = () => {
|
|
|
2219
2281
|
</DropdownItem>
|
|
2220
2282
|
];
|
|
2221
2283
|
|
|
2222
|
-
const headerToolbar = (
|
|
2223
|
-
<Toolbar id="toolbar" isFullHeight isStatic>
|
|
2224
|
-
<ToolbarContent>
|
|
2225
|
-
<ToolbarGroup
|
|
2226
|
-
variant="icon-button-group"
|
|
2227
|
-
alignment={{ default: 'alignRight' }}
|
|
2228
|
-
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
2229
|
-
>
|
|
2230
|
-
<ToolbarItem>
|
|
2231
|
-
<Button aria-label="Notifications" variant={ButtonVariant.plain}>
|
|
2232
|
-
<AttentionBellIcon />
|
|
2233
|
-
</Button>
|
|
2234
|
-
</ToolbarItem>
|
|
2235
|
-
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
|
|
2236
|
-
<ToolbarItem>
|
|
2237
|
-
<Button aria-label="Settings actions" variant={ButtonVariant.plain}>
|
|
2238
|
-
<CogIcon />
|
|
2239
|
-
</Button>
|
|
2240
|
-
</ToolbarItem>
|
|
2241
|
-
<ToolbarItem>
|
|
2242
|
-
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
2243
|
-
<QuestionCircleIcon />
|
|
2244
|
-
</Button>
|
|
2245
|
-
</ToolbarItem>
|
|
2246
|
-
</ToolbarGroup>
|
|
2247
|
-
</ToolbarGroup>
|
|
2248
|
-
<ToolbarItem visibility={{ default: 'hidden', md: 'visible', lg: 'hidden' }}>
|
|
2249
|
-
<Dropdown
|
|
2250
|
-
isPlain
|
|
2251
|
-
position="right"
|
|
2252
|
-
onSelect={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
2253
|
-
toggle={<KebabToggle onToggle={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)} />}
|
|
2254
|
-
isOpen={isKebabDropdownOpen}
|
|
2255
|
-
dropdownItems={kebabDropdownItems}
|
|
2256
|
-
/>
|
|
2257
|
-
</ToolbarItem>
|
|
2258
|
-
<ToolbarItem visibility={{ default: 'visible', md: 'hidden', lg: 'hidden', xl: 'hidden', '2xl': 'hidden' }}>
|
|
2259
|
-
<Dropdown
|
|
2260
|
-
isPlain
|
|
2261
|
-
position="right"
|
|
2262
|
-
onSelect={() => setIsFullKebabDropdownOpen(!isFullKebabDropdownOpen)}
|
|
2263
|
-
toggle={<KebabToggle onToggle={() => setIsFullKebabDropdownOpen(!isFullKebabDropdownOpen)} />}
|
|
2264
|
-
isOpen={isFullKebabDropdownOpen}
|
|
2265
|
-
dropdownItems={fullKebabItems}
|
|
2266
|
-
/>
|
|
2267
|
-
</ToolbarItem>
|
|
2268
|
-
<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
|
|
2269
|
-
<Dropdown
|
|
2270
|
-
position="right"
|
|
2271
|
-
onSelect={() => setIsDropdownOpen(!isDropdownOpen)}
|
|
2272
|
-
isOpen={isDropdownOpen}
|
|
2273
|
-
toggle={
|
|
2274
|
-
<DropdownToggle
|
|
2275
|
-
icon={<Avatar src={imgAvatar} alt="Avatar" />}
|
|
2276
|
-
onToggle={() => setIsDropdownOpen(!isDropdownOpen)}
|
|
2277
|
-
>
|
|
2278
|
-
John Smith
|
|
2279
|
-
</DropdownToggle>
|
|
2280
|
-
}
|
|
2281
|
-
dropdownItems={userDropdownItems}
|
|
2282
|
-
/>
|
|
2283
|
-
</ToolbarItem>
|
|
2284
|
-
</ToolbarContent>
|
|
2285
|
-
</Toolbar>
|
|
2286
|
-
);
|
|
2287
|
-
|
|
2288
2284
|
const tableToolbar = (
|
|
2289
2285
|
<Toolbar id="sortable-toolbar">
|
|
2290
2286
|
<ToolbarContent>
|
|
2291
|
-
<ToolbarItem>
|
|
2292
|
-
<Select
|
|
2293
|
-
id="select-example"
|
|
2294
|
-
variant={SelectVariant.single}
|
|
2295
|
-
aria-label="Select Input"
|
|
2296
|
-
placeholderText={
|
|
2297
|
-
<>
|
|
2298
|
-
<FilterIcon /> Status
|
|
2299
|
-
</>
|
|
2300
|
-
}
|
|
2301
|
-
isOpen={isSelectOpen}
|
|
2302
|
-
onToggle={() => setIsSelectOpen(!isSelectOpen)}
|
|
2303
|
-
onSelect={() => setIsSelectOpen(!isSelectOpen)}
|
|
2304
|
-
>
|
|
2305
|
-
{[
|
|
2306
|
-
<SelectOption key={0} value="Debug" />,
|
|
2307
|
-
<SelectOption key={1} value="Info" />,
|
|
2308
|
-
<SelectOption key={2} value="Warn" />,
|
|
2309
|
-
<SelectOption key={3} value="Error" />
|
|
2310
|
-
]}
|
|
2311
|
-
</Select>
|
|
2312
|
-
</ToolbarItem>
|
|
2313
|
-
<ToolbarItem visibility={{ default: 'hidden', sm: 'visible', md: 'hidden' }}>
|
|
2287
|
+
<ToolbarItem visibility={{ md: 'hidden' }}>
|
|
2314
2288
|
<OptionsMenu
|
|
2315
2289
|
id="options-menu-multiple-options-example"
|
|
2316
2290
|
menuItems={[
|
|
@@ -2359,47 +2333,47 @@ ComposableTableSortable = () => {
|
|
|
2359
2333
|
isGrouped
|
|
2360
2334
|
/>
|
|
2361
2335
|
</ToolbarItem>
|
|
2362
|
-
<
|
|
2336
|
+
<OverflowMenu breakpoint="lg">
|
|
2337
|
+
<OverflowMenuContent isPersistent>
|
|
2338
|
+
<OverflowMenuGroup isPersistent groupType="button">
|
|
2339
|
+
<OverflowMenuItem>
|
|
2340
|
+
<Button variant="primary">Create instance</Button>
|
|
2341
|
+
</OverflowMenuItem>
|
|
2342
|
+
<OverflowMenuItem>
|
|
2343
|
+
<Button variant="secondary">Action</Button>
|
|
2344
|
+
</OverflowMenuItem>
|
|
2345
|
+
</OverflowMenuGroup>
|
|
2346
|
+
</OverflowMenuContent>
|
|
2347
|
+
<OverflowMenuControl hasAdditionalOptions>
|
|
2348
|
+
<Dropdown
|
|
2349
|
+
isPlain
|
|
2350
|
+
onSelect={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)}
|
|
2351
|
+
toggle={<KebabToggle onToggle={() => setIsKebabDropdownOpen(!isKebabDropdownOpen)} />}
|
|
2352
|
+
isOpen={isKebabDropdownOpen}
|
|
2353
|
+
dropdownItems={kebabDropdownItems}
|
|
2354
|
+
/>
|
|
2355
|
+
</OverflowMenuControl>
|
|
2356
|
+
</OverflowMenu>
|
|
2357
|
+
<ToolbarGroup variant="icon-button-group">
|
|
2363
2358
|
<ToolbarItem>
|
|
2364
|
-
<Button variant="
|
|
2359
|
+
<Button aria-label="Edit" variant="plain" icon={<EditIcon />} />
|
|
2365
2360
|
</ToolbarItem>
|
|
2366
|
-
<ToolbarItem
|
|
2367
|
-
<Button variant="
|
|
2361
|
+
<ToolbarItem>
|
|
2362
|
+
<Button aria-label="Clone" variant="plain" icon={<CloneIcon />} />
|
|
2363
|
+
</ToolbarItem>
|
|
2364
|
+
<ToolbarItem>
|
|
2365
|
+
<Button aria-label="Sync" variant="plain" icon={<SyncIcon />} />
|
|
2368
2366
|
</ToolbarItem>
|
|
2369
2367
|
</ToolbarGroup>
|
|
2370
|
-
<ToolbarItem variant="pagination">
|
|
2371
|
-
<Pagination
|
|
2372
|
-
itemCount={37}
|
|
2373
|
-
widgetId="pagination-options-menu-bottom"
|
|
2374
|
-
page={1}
|
|
2375
|
-
variant={PaginationVariant.top}
|
|
2376
|
-
isCompact
|
|
2377
|
-
/>
|
|
2378
|
-
</ToolbarItem>
|
|
2368
|
+
<ToolbarItem variant="pagination">{renderPagination('top', true)}</ToolbarItem>
|
|
2379
2369
|
</ToolbarContent>
|
|
2380
2370
|
</Toolbar>
|
|
2381
2371
|
);
|
|
2382
2372
|
|
|
2383
2373
|
return (
|
|
2384
2374
|
<React.Fragment>
|
|
2385
|
-
<
|
|
2386
|
-
|
|
2387
|
-
<Masthead>
|
|
2388
|
-
<MastheadToggle>
|
|
2389
|
-
<PageToggleButton variant="plain" aria-label="Global navigation">
|
|
2390
|
-
<BarsIcon />
|
|
2391
|
-
</PageToggleButton>
|
|
2392
|
-
</MastheadToggle>
|
|
2393
|
-
<MastheadMain></MastheadMain>
|
|
2394
|
-
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
2395
|
-
</Masthead>
|
|
2396
|
-
}
|
|
2397
|
-
sidebar={<PageSidebar nav={PageNav} />}
|
|
2398
|
-
isManagedSidebar
|
|
2399
|
-
skipToContent={<SkipToContent href={'#main-content-page-layout-default-nav'}>Skip to content</SkipToContent>}
|
|
2400
|
-
mainContainerId={'main-content-page-layout-default-nav'}
|
|
2401
|
-
>
|
|
2402
|
-
<PageSection variant={PageSectionVariants.light}>
|
|
2375
|
+
<DashboardWrapper>
|
|
2376
|
+
<PageSection isWidthLimited variant={PageSectionVariants.light}>
|
|
2403
2377
|
<TextContent>
|
|
2404
2378
|
<Text component="h1">Table demos</Text>
|
|
2405
2379
|
<Text component="p">
|
|
@@ -2408,52 +2382,92 @@ ComposableTableSortable = () => {
|
|
|
2408
2382
|
</Text>
|
|
2409
2383
|
</TextContent>
|
|
2410
2384
|
</PageSection>
|
|
2411
|
-
<PageSection
|
|
2412
|
-
{
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
)
|
|
2440
|
-
})}
|
|
2441
|
-
</Tr>
|
|
2442
|
-
</Thead>
|
|
2443
|
-
<Tbody>
|
|
2444
|
-
{rows.map((row, rowIndex) => (
|
|
2445
|
-
<Tr key={rowIndex}>
|
|
2446
|
-
{row.map((cell, cellIndex) => (
|
|
2447
|
-
<Td key={`${rowIndex}_${cellIndex}`} dataLabel={columns[cellIndex]}>
|
|
2448
|
-
{cell}
|
|
2449
|
-
</Td>
|
|
2450
|
-
))}
|
|
2385
|
+
<PageSection
|
|
2386
|
+
padding={{
|
|
2387
|
+
default: 'noPadding',
|
|
2388
|
+
xl: 'padding'
|
|
2389
|
+
}}
|
|
2390
|
+
>
|
|
2391
|
+
<Card component="div">
|
|
2392
|
+
{tableToolbar}
|
|
2393
|
+
<TableComposable aria-label="Sortable Table">
|
|
2394
|
+
<Thead>
|
|
2395
|
+
<Tr>
|
|
2396
|
+
<Th />
|
|
2397
|
+
{columns.map((column, columnIndex) => {
|
|
2398
|
+
const sortParams = {
|
|
2399
|
+
sort: {
|
|
2400
|
+
sortBy: {
|
|
2401
|
+
index: activeSortIndex,
|
|
2402
|
+
direction: activeSortDirection
|
|
2403
|
+
},
|
|
2404
|
+
onSort,
|
|
2405
|
+
columnIndex
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
return (
|
|
2409
|
+
<Th key={columnIndex} {...sortParams}>
|
|
2410
|
+
{column}
|
|
2411
|
+
</Th>
|
|
2412
|
+
);
|
|
2413
|
+
})}
|
|
2451
2414
|
</Tr>
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2415
|
+
</Thead>
|
|
2416
|
+
<Tbody>
|
|
2417
|
+
{rows.map((row, rowIndex) => (
|
|
2418
|
+
<Tr key={rowIndex}>
|
|
2419
|
+
<>
|
|
2420
|
+
<Td
|
|
2421
|
+
select={{
|
|
2422
|
+
rowIndex,
|
|
2423
|
+
onSelect: (_event, isSelecting) => onSelectNode(row, rowIndex, isSelecting),
|
|
2424
|
+
isSelected: isNodeSelected(row)
|
|
2425
|
+
}}
|
|
2426
|
+
/>
|
|
2427
|
+
<Td dataLabel={columns[0]}>
|
|
2428
|
+
<div>{row[0]}</div>
|
|
2429
|
+
<a href="#">siemur/test-space</a>
|
|
2430
|
+
</Td>
|
|
2431
|
+
<Td dataLabel={columns[1]}>
|
|
2432
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
2433
|
+
<FlexItem>
|
|
2434
|
+
<CodeBranchIcon key="icon" />
|
|
2435
|
+
</FlexItem>
|
|
2436
|
+
<FlexItem>{row[1]}</FlexItem>
|
|
2437
|
+
</Flex>
|
|
2438
|
+
</Td>
|
|
2439
|
+
<Td dataLabel={columns[2]}>
|
|
2440
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
2441
|
+
<FlexItem>
|
|
2442
|
+
<CodeIcon key="icon" />
|
|
2443
|
+
</FlexItem>
|
|
2444
|
+
<FlexItem>{row[2]}</FlexItem>
|
|
2445
|
+
</Flex>
|
|
2446
|
+
</Td>
|
|
2447
|
+
<Td dataLabel={columns[3]}>
|
|
2448
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
2449
|
+
<FlexItem>
|
|
2450
|
+
<CubeIcon key="icon" />
|
|
2451
|
+
</FlexItem>
|
|
2452
|
+
<FlexItem>{row[3]}</FlexItem>
|
|
2453
|
+
</Flex>
|
|
2454
|
+
</Td>
|
|
2455
|
+
<Td dataLabel={columns[4]}>{row[4]} days ago</Td>
|
|
2456
|
+
<Td dataLabel={'Action'}>
|
|
2457
|
+
<a href="#">Action link</a>
|
|
2458
|
+
</Td>
|
|
2459
|
+
<Td isActionCell>
|
|
2460
|
+
<ActionsColumn items={defaultActions()} />
|
|
2461
|
+
</Td>
|
|
2462
|
+
</>
|
|
2463
|
+
</Tr>
|
|
2464
|
+
))}
|
|
2465
|
+
</Tbody>
|
|
2466
|
+
</TableComposable>
|
|
2467
|
+
{renderPagination('bottom', false)}
|
|
2468
|
+
</Card>
|
|
2455
2469
|
</PageSection>
|
|
2456
|
-
</
|
|
2470
|
+
</DashboardWrapper>
|
|
2457
2471
|
</React.Fragment>
|
|
2458
2472
|
);
|
|
2459
2473
|
};
|