@patternfly/react-table 4.112.39 → 5.0.0-alpha.10
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 +3439 -10266
- package/components/Table/ActionsColumn.d.ts +13 -27
- package/components/Table/ActionsColumn.d.ts.map +1 -1
- package/components/Table/ActionsColumn.js +43 -60
- package/components/Table/ActionsColumn.js.map +1 -1
- package/components/Table/TableTypes.d.ts +2 -1
- package/components/Table/TableTypes.d.ts.map +1 -1
- package/components/Table/base/provider.d.ts +6 -6
- package/components/Table/base/types.d.ts +7 -7
- package/components/Table/base/types.d.ts.map +1 -1
- package/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
- package/components/Table/utils/decorators/cellActions.js +2 -2
- package/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/components/TableComposable/TableComposable.d.ts +4 -6
- package/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/components/TableComposable/TableComposable.js +2 -2
- package/components/TableComposable/TableComposable.js.map +1 -1
- package/components/TableComposable/Tbody.d.ts +2 -2
- package/components/TableComposable/Tbody.d.ts.map +1 -1
- package/components/TableComposable/Td.d.ts +1 -1
- package/components/TableComposable/Th.d.ts +1 -1
- package/components/TableComposable/Thead.d.ts +1 -1
- package/components/TableComposable/Thead.d.ts.map +1 -1
- package/components/TableComposable/Tr.d.ts +2 -2
- package/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.d.ts +13 -27
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/ActionsColumn.js +43 -60
- package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +2 -1
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/base/provider.d.ts +6 -6
- package/dist/esm/components/Table/base/types.d.ts +7 -7
- package/dist/esm/components/Table/base/types.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/cellActions.js +2 -2
- package/dist/esm/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.d.ts +4 -6
- package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.js +2 -2
- package/dist/esm/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/esm/components/TableComposable/Tbody.d.ts +2 -2
- package/dist/esm/components/TableComposable/Tbody.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Td.d.ts +1 -1
- package/dist/esm/components/TableComposable/Th.d.ts +1 -1
- package/dist/esm/components/TableComposable/Thead.d.ts +1 -1
- package/dist/esm/components/TableComposable/Thead.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts +2 -2
- package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts +13 -27
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +43 -61
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +2 -1
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js +0 -1
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +6 -6
- package/dist/js/components/Table/base/types.d.ts +7 -7
- package/dist/js/components/Table/base/types.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/cellActions.js +2 -2
- package/dist/js/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.d.ts +4 -6
- package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.js +2 -2
- package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/js/components/TableComposable/Tbody.d.ts +2 -2
- package/dist/js/components/TableComposable/Tbody.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Td.d.ts +1 -1
- package/dist/js/components/TableComposable/Th.d.ts +1 -1
- package/dist/js/components/TableComposable/Thead.d.ts +1 -1
- package/dist/js/components/TableComposable/Thead.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts +2 -2
- package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/umd/react-table.min.js +6 -6
- package/package.json +7 -7
- package/src/components/Table/ActionsColumn.tsx +92 -103
- package/src/components/Table/TableTypes.tsx +2 -1
- package/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +419 -400
- package/src/components/Table/base/types.tsx +1 -1
- package/src/components/Table/examples/LegacyTableActions.tsx +4 -4
- package/src/components/Table/utils/decorators/cellActions.tsx +2 -4
- package/src/components/TableComposable/TableComposable.tsx +4 -7
- package/src/components/TableComposable/Tbody.tsx +1 -1
- package/src/components/TableComposable/Thead.tsx +1 -1
- package/src/components/TableComposable/Tr.tsx +1 -1
- package/src/components/TableComposable/examples/ComposableTableActions.tsx +4 -4
- package/src/components/TableComposable/examples/ComposableTableHoverable.tsx +1 -1
- package/src/docs/demos/Table.md +7 -7
- package/src/docs/demos/table-demos/ColumnManagement.jsx +2 -4
- package/src/docs/demos/table-demos/Compact.jsx +1 -1
- package/src/docs/demos/table-demos/CompoundExpansion.jsx +1 -1
- package/src/docs/demos/table-demos/SortableResponsive.jsx +47 -49
- package/src/docs/demos/table-demos/StaticBottomPagination.jsx +33 -18
- package/src/docs/examples/ComposableTableStickyToolbar.tsx +1 -1
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
Checkbox,
|
|
6
|
-
|
|
6
|
+
MenuToggle,
|
|
7
7
|
ToggleGroup,
|
|
8
8
|
ToggleGroupItem,
|
|
9
9
|
ToggleGroupItemProps,
|
|
@@ -62,9 +62,9 @@ export const LegacyTableActions: React.FunctionComponent = () => {
|
|
|
62
62
|
const [useCustomToggle, setUseCustomToggle] = React.useState(false);
|
|
63
63
|
|
|
64
64
|
const customActionsToggle = (props: CustomActionsToggleProps) => (
|
|
65
|
-
<
|
|
65
|
+
<MenuToggle ref={props.toggleRef} onClick={props.onToggle} isDisabled={props.isDisabled}>
|
|
66
66
|
Actions
|
|
67
|
-
</
|
|
67
|
+
</MenuToggle>
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
const columns: TableProps['cells'] = [
|
|
@@ -77,7 +77,7 @@ export const LegacyTableActions: React.FunctionComponent = () => {
|
|
|
77
77
|
];
|
|
78
78
|
|
|
79
79
|
const rows: TableProps['rows'] = repositories.map(repo => {
|
|
80
|
-
let singleActionButton = null;
|
|
80
|
+
let singleActionButton: React.ReactNode = null;
|
|
81
81
|
if (repo.singleAction !== '') {
|
|
82
82
|
singleActionButton = (
|
|
83
83
|
<TableText>
|
|
@@ -33,7 +33,7 @@ export const cellActions = (
|
|
|
33
33
|
rowIndex,
|
|
34
34
|
columnIndex,
|
|
35
35
|
column: {
|
|
36
|
-
extraParams: {
|
|
36
|
+
extraParams: { actionsToggle, actionsPopperProps }
|
|
37
37
|
},
|
|
38
38
|
property
|
|
39
39
|
}: IExtra
|
|
@@ -58,13 +58,11 @@ export const cellActions = (
|
|
|
58
58
|
children: (
|
|
59
59
|
<ActionsColumn
|
|
60
60
|
items={resolvedActions}
|
|
61
|
-
dropdownPosition={dropdownPosition}
|
|
62
|
-
dropdownDirection={dropdownDirection}
|
|
63
|
-
menuAppendTo={menuAppendTo}
|
|
64
61
|
isDisabled={resolvedIsDisabled}
|
|
65
62
|
rowData={rowData}
|
|
66
63
|
extraData={extraData}
|
|
67
64
|
actionsToggle={actionsToggle}
|
|
65
|
+
popperProps={actionsPopperProps}
|
|
68
66
|
>
|
|
69
67
|
{label as React.ReactNode}
|
|
70
68
|
</ActionsColumn>
|
|
@@ -23,7 +23,7 @@ export interface BaseCellProps {
|
|
|
23
23
|
width?: 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 60 | 70 | 80 | 90 | 100;
|
|
24
24
|
/** Visibility breakpoint modifiers */
|
|
25
25
|
visibility?: (keyof IVisibility)[];
|
|
26
|
-
/** Forwarded ref */
|
|
26
|
+
/** @hide Forwarded ref */
|
|
27
27
|
innerRef?: React.Ref<any>;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -47,7 +47,7 @@ export interface TableComposableProps extends React.HTMLProps<HTMLTableElement>,
|
|
|
47
47
|
role?: string;
|
|
48
48
|
/** If set to true, the table header sticks to the top of its container */
|
|
49
49
|
isStickyHeader?: boolean;
|
|
50
|
-
/** Forwarded ref */
|
|
50
|
+
/** @hide Forwarded ref */
|
|
51
51
|
innerRef?: React.RefObject<any>;
|
|
52
52
|
/** Flag indicating table is a tree table */
|
|
53
53
|
isTreeTable?: boolean;
|
|
@@ -59,9 +59,7 @@ export interface TableComposableProps extends React.HTMLProps<HTMLTableElement>,
|
|
|
59
59
|
isExpandable?: boolean;
|
|
60
60
|
/** Collection of column spans for nested headers. Deprecated: see https://github.com/patternfly/patternfly/issues/4584 */
|
|
61
61
|
nestedHeaderColumnSpans?: number[];
|
|
62
|
-
/**
|
|
63
|
-
hasSelectableRowCaption?: boolean;
|
|
64
|
-
/** Visible text to add alongside the hidden a11y caption for tables with selectable rows. This prop must be used to add custom caption content to the table when the hasSelectableRowCaption prop is set to true. */
|
|
62
|
+
/** Visible text to add alongside the hidden a11y caption for tables with selectable rows. */
|
|
65
63
|
selectableRowCaptionText?: string;
|
|
66
64
|
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
67
65
|
ouiaId?: number | string;
|
|
@@ -95,7 +93,6 @@ const TableComposableBase: React.FunctionComponent<TableComposableProps> = ({
|
|
|
95
93
|
isExpandable = false,
|
|
96
94
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
97
95
|
nestedHeaderColumnSpans,
|
|
98
|
-
hasSelectableRowCaption,
|
|
99
96
|
selectableRowCaptionText,
|
|
100
97
|
...props
|
|
101
98
|
}: TableComposableProps) => {
|
|
@@ -216,7 +213,7 @@ const TableComposableBase: React.FunctionComponent<TableComposableProps> = ({
|
|
|
216
213
|
{...ouiaProps}
|
|
217
214
|
{...props}
|
|
218
215
|
>
|
|
219
|
-
{
|
|
216
|
+
{hasSelectableRows && tableCaption}
|
|
220
217
|
{children}
|
|
221
218
|
</table>
|
|
222
219
|
</TableComposableContext.Provider>
|
|
@@ -9,7 +9,7 @@ export interface TbodyProps extends React.HTMLProps<HTMLTableSectionElement> {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Modifies the body to allow for expandable rows */
|
|
11
11
|
isExpanded?: boolean;
|
|
12
|
-
/** Forwarded ref */
|
|
12
|
+
/** @hide Forwarded ref */
|
|
13
13
|
innerRef?: React.Ref<any>;
|
|
14
14
|
/** Flag indicating the <tbody> contains oddly striped rows. */
|
|
15
15
|
isOddStriped?: boolean;
|
|
@@ -9,7 +9,7 @@ export interface TheadProps extends React.HTMLProps<HTMLTableSectionElement> {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Won't wrap the table head if true */
|
|
11
11
|
noWrap?: boolean;
|
|
12
|
-
/** Forwarded ref */
|
|
12
|
+
/** @hide Forwarded ref */
|
|
13
13
|
innerRef?: React.Ref<any>;
|
|
14
14
|
/** Indicates the <thead> contains a nested header */
|
|
15
15
|
hasNestedHeader?: boolean;
|
|
@@ -10,7 +10,7 @@ export interface TrProps extends React.HTMLProps<HTMLTableRowElement>, OUIAProps
|
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
/** Additional classes added to the <tr> row */
|
|
12
12
|
className?: string;
|
|
13
|
-
/** Forwarded ref */
|
|
13
|
+
/** @hide Forwarded ref */
|
|
14
14
|
innerRef?: React.Ref<any>;
|
|
15
15
|
/** Flag indicating the Tr is hidden */
|
|
16
16
|
isHidden?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, MenuToggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps } from '@patternfly/react-core';
|
|
4
4
|
import {
|
|
5
5
|
TableComposable,
|
|
6
6
|
TableText,
|
|
@@ -52,9 +52,9 @@ export const ComposableTableActions: React.FunctionComponent = () => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const customActionsToggle = (props: CustomActionsToggleProps) => (
|
|
55
|
-
<
|
|
55
|
+
<MenuToggle ref={props.toggleRef} onClick={props.onToggle} isDisabled={props.isDisabled}>
|
|
56
56
|
Actions
|
|
57
|
-
</
|
|
57
|
+
</MenuToggle>
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const defaultActions = (repo: Repository): IAction[] => [
|
|
@@ -130,7 +130,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
|
|
|
130
130
|
if (repo.name === '5') {
|
|
131
131
|
rowActions = lastRowActions(repo);
|
|
132
132
|
}
|
|
133
|
-
let singleActionButton = null;
|
|
133
|
+
let singleActionButton: React.ReactNode = null;
|
|
134
134
|
if (repo.singleAction !== '') {
|
|
135
135
|
singleActionButton = (
|
|
136
136
|
<TableText>
|
|
@@ -30,7 +30,7 @@ export const ComposableTableHoverable: React.FunctionComponent = () => {
|
|
|
30
30
|
const [selectedRepoName, setSelectedRepoName] = React.useState('');
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<TableComposable aria-label="Hoverable table"
|
|
33
|
+
<TableComposable aria-label="Hoverable table">
|
|
34
34
|
<Thead>
|
|
35
35
|
<Tr>
|
|
36
36
|
<Th>{columnNames.name}</Th>
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -192,7 +192,7 @@ class BulkSelectTableDemo extends React.Component {
|
|
|
192
192
|
}}
|
|
193
193
|
variant={variant}
|
|
194
194
|
titles={{
|
|
195
|
-
|
|
195
|
+
paginationAriaLabel: `${variant} pagination`
|
|
196
196
|
}}
|
|
197
197
|
/>
|
|
198
198
|
);
|
|
@@ -1036,7 +1036,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
1036
1036
|
variant={PaginationVariant.top}
|
|
1037
1037
|
isCompact
|
|
1038
1038
|
titles={{
|
|
1039
|
-
|
|
1039
|
+
paginationAriaLabel: `Draggable column management top pagination`
|
|
1040
1040
|
}}
|
|
1041
1041
|
/>
|
|
1042
1042
|
</ToolbarItem>
|
|
@@ -1072,7 +1072,7 @@ class ColumnManagementAction extends React.Component {
|
|
|
1072
1072
|
page={1}
|
|
1073
1073
|
variant={PaginationVariant.bottom}
|
|
1074
1074
|
titles={{
|
|
1075
|
-
|
|
1075
|
+
paginationAriaLabel: `Draggable column management bottom pagination`
|
|
1076
1076
|
}}
|
|
1077
1077
|
/>
|
|
1078
1078
|
{this.renderModal()}
|
|
@@ -1464,14 +1464,14 @@ class FilterTableDemo extends React.Component {
|
|
|
1464
1464
|
|
|
1465
1465
|
### Automatic pagination
|
|
1466
1466
|
|
|
1467
|
-
The below example illustrates the `
|
|
1467
|
+
The below example illustrates the `isLastFullPageShown` prop, which makes the following changes when the user sets the number of items to display per page to an amount that exceeds the remaining amount of data:
|
|
1468
1468
|
|
|
1469
1469
|
- The component automatically changes the page back to the last full page of results, rather than defaulting to the final page of results.
|
|
1470
1470
|
|
|
1471
1471
|
To demonstrate this, navigate to the last page of data below using the `>>` navigation arrows, then use the dropdown selector to change the view to 5 per page.
|
|
1472
1472
|
|
|
1473
1473
|
- The default behavior would show the last page of results, which would only contain the last two rows (rows 11 - 12).
|
|
1474
|
-
- The `
|
|
1474
|
+
- The `isLastFullPageShown` prop navigates you back to the previous page which does contain a full page of 5 rows (rows 6 - 10).
|
|
1475
1475
|
|
|
1476
1476
|
```js
|
|
1477
1477
|
import React from 'react';
|
|
@@ -1529,7 +1529,7 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
1529
1529
|
itemCount={this.defaultRows.length}
|
|
1530
1530
|
page={page}
|
|
1531
1531
|
perPage={perPage}
|
|
1532
|
-
|
|
1532
|
+
isLastFullPageShown
|
|
1533
1533
|
onSetPage={this.handleSetPage}
|
|
1534
1534
|
onPerPageSelect={this.handlePerPageSelect}
|
|
1535
1535
|
perPageOptions={[
|
|
@@ -1539,7 +1539,7 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
1539
1539
|
{ title: '20', value: 20 }
|
|
1540
1540
|
]}
|
|
1541
1541
|
titles={{
|
|
1542
|
-
|
|
1542
|
+
paginationAriaLabel: `${variant} pagination`
|
|
1543
1543
|
}}
|
|
1544
1544
|
/>
|
|
1545
1545
|
);
|
|
@@ -105,7 +105,7 @@ export const ColumnManagementAction = () => {
|
|
|
105
105
|
onPerPageSelect={handlePerPageSelect}
|
|
106
106
|
variant={variant}
|
|
107
107
|
titles={{
|
|
108
|
-
|
|
108
|
+
paginationAriaLabel: `${variant} pagination`
|
|
109
109
|
}}
|
|
110
110
|
/>
|
|
111
111
|
);
|
|
@@ -463,9 +463,7 @@ export const ColumnManagementAction = () => {
|
|
|
463
463
|
) : (
|
|
464
464
|
<Td
|
|
465
465
|
width={key === 'name' ? 15 : 10}
|
|
466
|
-
dataLabel={
|
|
467
|
-
key === 'lastModified' ? 'Last modified' : capitalize(key)
|
|
468
|
-
}
|
|
466
|
+
dataLabel={key === 'lastModified' ? 'Last modified' : capitalize(key)}
|
|
469
467
|
>
|
|
470
468
|
{value}
|
|
471
469
|
</Td>
|
|
@@ -44,7 +44,7 @@ export const ComposableTableSortable = () => {
|
|
|
44
44
|
return [...r].sort((a, b) => {
|
|
45
45
|
let returnValue = 0;
|
|
46
46
|
if (sortIndex === 0 || sortIndex === 7) {
|
|
47
|
-
returnValue = 1
|
|
47
|
+
returnValue = 1;
|
|
48
48
|
} else if (typeof Object.values(a)[sortIndex] === 'number') {
|
|
49
49
|
// numeric sort
|
|
50
50
|
returnValue = Object.values(a)[sortIndex] - Object.values(b)[sortIndex];
|
|
@@ -56,15 +56,11 @@ export const ComposableTableSortable = () => {
|
|
|
56
56
|
return returnValue * -1;
|
|
57
57
|
}
|
|
58
58
|
return returnValue;
|
|
59
|
-
})
|
|
59
|
+
});
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const [sortedData, setSortedData] = React.useState([
|
|
63
|
-
|
|
64
|
-
]);
|
|
65
|
-
const [sortedRows, setSortedRows] = React.useState([
|
|
66
|
-
...sortedData
|
|
67
|
-
]);
|
|
62
|
+
const [sortedData, setSortedData] = React.useState([...sortRows(rows, 0, 'asc')]);
|
|
63
|
+
const [sortedRows, setSortedRows] = React.useState([...sortedData]);
|
|
68
64
|
const [page, setPage] = React.useState(1);
|
|
69
65
|
const [perPage, setPerPage] = React.useState(10);
|
|
70
66
|
|
|
@@ -85,50 +81,50 @@ const [sortedRows, setSortedRows] = React.useState([
|
|
|
85
81
|
const kebabDropdownItems = [<OverflowMenuDropdownItem key="kebab-1">Some action</OverflowMenuDropdownItem>];
|
|
86
82
|
|
|
87
83
|
React.useEffect(() => {
|
|
88
|
-
setSortedRows(sortedData.slice((page - 1) * perPage, page * perPage -1));
|
|
84
|
+
setSortedRows(sortedData.slice((page - 1) * perPage, page * perPage - 1));
|
|
89
85
|
}, [sortedData, page, perPage]);
|
|
90
86
|
|
|
91
87
|
const handleSetPage = (_evt, newPage) => {
|
|
92
88
|
setPage(newPage);
|
|
93
|
-
}
|
|
89
|
+
};
|
|
94
90
|
|
|
95
91
|
const handlePerPageSelect = (_evt, newPerPage) => {
|
|
96
92
|
setPerPage(newPerPage);
|
|
97
|
-
}
|
|
93
|
+
};
|
|
98
94
|
|
|
99
|
-
renderPagination =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
renderPagination = variant => (
|
|
96
|
+
<Pagination
|
|
97
|
+
isCompact
|
|
98
|
+
itemCount={rows.length}
|
|
99
|
+
page={page}
|
|
100
|
+
perPage={perPage}
|
|
101
|
+
onSetPage={handleSetPage}
|
|
102
|
+
onPerPageSelect={handlePerPageSelect}
|
|
103
|
+
perPageOptions={[
|
|
104
|
+
{ title: '10', value: 10 },
|
|
105
|
+
{ title: '20', value: 20 },
|
|
106
|
+
{ title: '50', value: 50 },
|
|
107
|
+
{ title: '100', value: 100 }
|
|
108
|
+
]}
|
|
109
|
+
variant={variant}
|
|
110
|
+
titles={{
|
|
111
|
+
paginationAriaLabel: `${variant} pagination`
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
const renderLabel = labelText => {
|
|
117
|
+
switch (labelText) {
|
|
118
|
+
case 'Running':
|
|
119
|
+
return <Label color="green">{labelText}</Label>;
|
|
120
|
+
case 'Stopped':
|
|
121
|
+
return <Label color="orange">{labelText}</Label>;
|
|
122
|
+
case 'Needs Maintenance':
|
|
123
|
+
return <Label color="blue">{labelText}</Label>;
|
|
124
|
+
case 'Down':
|
|
125
|
+
return <Label color="red">{labelText}</Label>;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
132
128
|
|
|
133
129
|
const tableToolbar = (
|
|
134
130
|
<Toolbar id="sortable-toolbar">
|
|
@@ -258,7 +254,7 @@ const [sortedRows, setSortedRows] = React.useState([
|
|
|
258
254
|
}
|
|
259
255
|
};
|
|
260
256
|
return (
|
|
261
|
-
<Th modifier={columnIndex !== 6 ?
|
|
257
|
+
<Th modifier={columnIndex !== 6 ? 'wrap' : undefined} key={columnIndex} {...sortParams}>
|
|
262
258
|
{column}
|
|
263
259
|
</Th>
|
|
264
260
|
);
|
|
@@ -269,7 +265,7 @@ const [sortedRows, setSortedRows] = React.useState([
|
|
|
269
265
|
{sortedRows.map((row, rowIndex) => (
|
|
270
266
|
<Tr key={rowIndex}>
|
|
271
267
|
<>
|
|
272
|
-
<Td dataLabel={columns[0]} width={15}
|
|
268
|
+
<Td dataLabel={columns[0]} width={15}>
|
|
273
269
|
<div>{row.name}</div>
|
|
274
270
|
</Td>
|
|
275
271
|
<Td dataLabel={columns[1]} width={10}>
|
|
@@ -296,22 +292,24 @@ const [sortedRows, setSortedRows] = React.useState([
|
|
|
296
292
|
<FlexItem>{row.workspaces}</FlexItem>
|
|
297
293
|
</Flex>
|
|
298
294
|
</Td>
|
|
299
|
-
|
|
295
|
+
<Td dataLabel={columns[4]} width={15}>
|
|
300
296
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
301
297
|
<FlexItem>{renderLabel(row.status)}</FlexItem>
|
|
302
298
|
</Flex>
|
|
303
299
|
</Td>
|
|
304
|
-
|
|
300
|
+
<Td dataLabel={columns[5]} width={10}>
|
|
305
301
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
306
302
|
<FlexItem>{row.location}</FlexItem>
|
|
307
303
|
</Flex>
|
|
308
304
|
</Td>
|
|
309
|
-
|
|
305
|
+
<Td dataLabel={columns[6]} width={10}>
|
|
310
306
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
311
307
|
<FlexItem>{row.lastModified[0]} days ago</FlexItem>
|
|
312
308
|
</Flex>
|
|
313
309
|
</Td>
|
|
314
|
-
<Td dataLabel={columns[7]} modifier="truncate"
|
|
310
|
+
<Td dataLabel={columns[7]} modifier="truncate">
|
|
311
|
+
<a href="#">{row.url}</a>
|
|
312
|
+
</Td>
|
|
315
313
|
</>
|
|
316
314
|
</Tr>
|
|
317
315
|
))}
|
|
@@ -34,7 +34,6 @@ export const StaticBottomPagination = () => {
|
|
|
34
34
|
setPerPage(newPerPage);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
|
|
38
37
|
const renderPagination = (variant, isCompact) => (
|
|
39
38
|
<Pagination
|
|
40
39
|
isCompact={isCompact}
|
|
@@ -45,7 +44,7 @@ export const StaticBottomPagination = () => {
|
|
|
45
44
|
onPerPageSelect={handlePerPageSelect}
|
|
46
45
|
variant={variant}
|
|
47
46
|
titles={{
|
|
48
|
-
|
|
47
|
+
paginationAriaLabel: `${variant} pagination`
|
|
49
48
|
}}
|
|
50
49
|
isStatic
|
|
51
50
|
/>
|
|
@@ -54,13 +53,29 @@ export const StaticBottomPagination = () => {
|
|
|
54
53
|
const renderLabel = labelText => {
|
|
55
54
|
switch (labelText) {
|
|
56
55
|
case 'Running':
|
|
57
|
-
return
|
|
56
|
+
return (
|
|
57
|
+
<span>
|
|
58
|
+
<Label color="green">{labelText}</Label>
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
58
61
|
case 'Stopped':
|
|
59
|
-
return
|
|
62
|
+
return (
|
|
63
|
+
<span>
|
|
64
|
+
<Label color="orange">{labelText}</Label>
|
|
65
|
+
</span>
|
|
66
|
+
);
|
|
60
67
|
case 'Needs Maintenance':
|
|
61
|
-
return
|
|
68
|
+
return (
|
|
69
|
+
<span>
|
|
70
|
+
<Label color="blue">{labelText}</Label>
|
|
71
|
+
</span>
|
|
72
|
+
);
|
|
62
73
|
case 'Down':
|
|
63
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<span>
|
|
76
|
+
<Label color="red">{labelText}</Label>
|
|
77
|
+
</span>
|
|
78
|
+
);
|
|
64
79
|
}
|
|
65
80
|
};
|
|
66
81
|
|
|
@@ -116,18 +131,18 @@ export const StaticBottomPagination = () => {
|
|
|
116
131
|
<Tbody>
|
|
117
132
|
{paginatedRows.map((row, rowIndex) => (
|
|
118
133
|
<Tr key={rowIndex}>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
<Td dataLabel={columns[0]}>{row.name}</Td>
|
|
135
|
+
<Td dataLabel={columns[1]}>{row.threads}</Td>
|
|
136
|
+
<Td dataLabel={columns[2]}>{row.applications}</Td>
|
|
137
|
+
<Td dataLabel={columns[3]}>{row.workspaces}</Td>
|
|
138
|
+
<Td dataLabel={columns[4]}>{renderLabel(row.status)}</Td>
|
|
139
|
+
<Td dataLabel={columns[5]}>{row.location}</Td>
|
|
140
|
+
<Td dataLabel={columns[6]}>{row.lastModified}</Td>
|
|
141
|
+
<Td dataLabel={columns[7]} modifier="truncate">
|
|
142
|
+
<TableText>
|
|
143
|
+
<a href="#">{row.url}</a>
|
|
144
|
+
</TableText>
|
|
145
|
+
</Td>
|
|
131
146
|
</Tr>
|
|
132
147
|
))}
|
|
133
148
|
</Tbody>
|