@patternfly/react-table 6.0.0-alpha.1 → 6.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 +286 -0
- package/README.md +2 -2
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/Table/package.json +1 -1
- package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
- package/dist/dynamic/components/Table/utils/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
- package/dist/dynamic/deprecated/components/Table/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/esm/components/Table/ActionsColumn.d.ts +1 -1
- package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/Caption.js +1 -1
- package/dist/esm/components/Table/Caption.js.map +1 -1
- package/dist/esm/components/Table/CollapseColumn.js +1 -1
- package/dist/esm/components/Table/CollapseColumn.js.map +1 -1
- package/dist/esm/components/Table/DraggableRowWrapper.js +2 -2
- package/dist/esm/components/Table/DraggableRowWrapper.js.map +1 -1
- package/dist/esm/components/Table/EditColumn.js +1 -1
- package/dist/esm/components/Table/EditColumn.js.map +1 -1
- package/dist/esm/components/Table/EditableSelectInputCell.js +3 -3
- package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/esm/components/Table/EditableTextCell.js +3 -3
- package/dist/esm/components/Table/EditableTextCell.js.map +1 -1
- package/dist/esm/components/Table/ExpandableRowContent.js +1 -1
- package/dist/esm/components/Table/ExpandableRowContent.js.map +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js +1 -1
- package/dist/esm/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/esm/components/Table/InnerScrollContainer.js +1 -1
- package/dist/esm/components/Table/InnerScrollContainer.js.map +1 -1
- package/dist/esm/components/Table/OuterScrollContainer.js +1 -1
- package/dist/esm/components/Table/OuterScrollContainer.js.map +1 -1
- package/dist/esm/components/Table/RowWrapper.d.ts +1 -1
- package/dist/esm/components/Table/SelectColumn.d.ts +5 -0
- package/dist/esm/components/Table/SelectColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/SelectColumn.js +6 -3
- package/dist/esm/components/Table/SelectColumn.js.map +1 -1
- package/dist/esm/components/Table/SortColumn.d.ts +4 -0
- package/dist/esm/components/Table/SortColumn.d.ts.map +1 -1
- package/dist/esm/components/Table/SortColumn.js +3 -3
- package/dist/esm/components/Table/SortColumn.js.map +1 -1
- package/dist/esm/components/Table/Table.d.ts +1 -1
- package/dist/esm/components/Table/Table.d.ts.map +1 -1
- package/dist/esm/components/Table/Table.js +5 -5
- package/dist/esm/components/Table/Table.js.map +1 -1
- package/dist/esm/components/Table/TableText.d.ts +3 -1
- package/dist/esm/components/Table/TableText.d.ts.map +1 -1
- package/dist/esm/components/Table/TableText.js +13 -11
- package/dist/esm/components/Table/TableText.js.map +1 -1
- package/dist/esm/components/Table/TableTypes.d.ts +3 -0
- package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/esm/components/Table/Tbody.d.ts +1 -1
- package/dist/esm/components/Table/Tbody.d.ts.map +1 -1
- package/dist/esm/components/Table/Tbody.js +1 -1
- package/dist/esm/components/Table/Tbody.js.map +1 -1
- package/dist/esm/components/Table/Td.d.ts +1 -1
- package/dist/esm/components/Table/Td.d.ts.map +1 -1
- package/dist/esm/components/Table/Td.js +9 -5
- package/dist/esm/components/Table/Td.js.map +1 -1
- package/dist/esm/components/Table/Th.d.ts +4 -1
- package/dist/esm/components/Table/Th.d.ts.map +1 -1
- package/dist/esm/components/Table/Th.js +20 -10
- package/dist/esm/components/Table/Th.js.map +1 -1
- package/dist/esm/components/Table/Thead.d.ts +1 -1
- package/dist/esm/components/Table/Thead.d.ts.map +1 -1
- package/dist/esm/components/Table/Thead.js +1 -1
- package/dist/esm/components/Table/Thead.js.map +1 -1
- package/dist/esm/components/Table/Tr.d.ts +2 -2
- package/dist/esm/components/Table/Tr.d.ts.map +1 -1
- package/dist/esm/components/Table/Tr.js +2 -2
- package/dist/esm/components/Table/Tr.js.map +1 -1
- package/dist/esm/components/Table/TreeRowWrapper.js +2 -2
- package/dist/esm/components/Table/TreeRowWrapper.js.map +1 -1
- package/dist/esm/components/Table/base/provider.d.ts +8 -8
- package/dist/esm/components/Table/base/types.d.ts +7 -7
- package/dist/esm/components/Table/utils/decorators/cellActions.js +1 -1
- package/dist/esm/components/Table/utils/decorators/cellActions.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/cellWidth.js +1 -1
- package/dist/esm/components/Table/utils/decorators/cellWidth.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/classNames.js +1 -1
- package/dist/esm/components/Table/utils/decorators/classNames.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/collapsible.js +1 -1
- package/dist/esm/components/Table/utils/decorators/collapsible.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/compoundExpand.js +1 -1
- package/dist/esm/components/Table/utils/decorators/compoundExpand.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/editable.js +1 -1
- package/dist/esm/components/Table/utils/decorators/editable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/favoritable.js +1 -1
- package/dist/esm/components/Table/utils/decorators/favoritable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/info.js +1 -1
- package/dist/esm/components/Table/utils/decorators/info.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/selectable.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/selectable.js +4 -4
- package/dist/esm/components/Table/utils/decorators/selectable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/sortable.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/sortable.js +7 -4
- package/dist/esm/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts +3 -3
- package/dist/esm/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/esm/components/Table/utils/decorators/treeRow.js +5 -5
- package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/esm/components/Table/utils/decorators/wrappable.js +1 -1
- package/dist/esm/components/Table/utils/decorators/wrappable.js.map +1 -1
- package/dist/esm/demos/index.d.ts +2 -0
- package/dist/esm/demos/index.d.ts.map +1 -0
- package/dist/esm/demos/index.js +2 -0
- package/dist/esm/demos/index.js.map +1 -0
- package/dist/esm/demos/sampleData.d.ts +13 -0
- package/dist/esm/demos/sampleData.d.ts.map +1 -0
- package/dist/esm/demos/sampleData.js +764 -0
- package/dist/esm/demos/sampleData.js.map +1 -0
- package/dist/esm/deprecated/components/Table/Body.d.ts +1 -1
- package/dist/esm/deprecated/components/Table/Body.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Table/Table.d.ts +1 -1
- package/dist/esm/deprecated/components/Table/Table.js +1 -1
- package/dist/esm/deprecated/components/Table/Table.js.map +1 -1
- package/dist/esm/deprecated/components/Table/base/body.d.ts +8 -2
- package/dist/esm/deprecated/components/Table/base/body.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Table/base/header.d.ts +1 -1
- package/dist/esm/deprecated/components/Table/base/header.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts +1 -1
- package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
- package/dist/js/components/Table/ActionsColumn.js +6 -6
- package/dist/js/components/Table/ActionsColumn.js.map +1 -1
- package/dist/js/components/Table/CollapseColumn.js +2 -2
- package/dist/js/components/Table/CollapseColumn.js.map +1 -1
- package/dist/js/components/Table/DraggableCell.js +2 -2
- package/dist/js/components/Table/DraggableCell.js.map +1 -1
- package/dist/js/components/Table/EditColumn.js +4 -4
- package/dist/js/components/Table/EditColumn.js.map +1 -1
- package/dist/js/components/Table/EditableSelectInputCell.js +2 -2
- package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
- package/dist/js/components/Table/EditableTextCell.js +2 -2
- package/dist/js/components/Table/EditableTextCell.js.map +1 -1
- package/dist/js/components/Table/FavoritesCell.js +2 -2
- package/dist/js/components/Table/FavoritesCell.js.map +1 -1
- package/dist/js/components/Table/HeaderCellInfoWrapper.js +4 -4
- package/dist/js/components/Table/HeaderCellInfoWrapper.js.map +1 -1
- package/dist/js/components/Table/RowWrapper.d.ts +1 -1
- package/dist/js/components/Table/RowWrapper.js +2 -1
- package/dist/js/components/Table/RowWrapper.js.map +1 -1
- package/dist/js/components/Table/SelectColumn.d.ts +5 -0
- package/dist/js/components/Table/SelectColumn.d.ts.map +1 -1
- package/dist/js/components/Table/SelectColumn.js +6 -3
- package/dist/js/components/Table/SelectColumn.js.map +1 -1
- package/dist/js/components/Table/SortColumn.d.ts +4 -0
- package/dist/js/components/Table/SortColumn.d.ts.map +1 -1
- package/dist/js/components/Table/SortColumn.js +6 -5
- package/dist/js/components/Table/SortColumn.js.map +1 -1
- package/dist/js/components/Table/Table.d.ts +1 -1
- package/dist/js/components/Table/Table.d.ts.map +1 -1
- package/dist/js/components/Table/Table.js +2 -2
- package/dist/js/components/Table/Table.js.map +1 -1
- package/dist/js/components/Table/TableText.d.ts +3 -1
- package/dist/js/components/Table/TableText.d.ts.map +1 -1
- package/dist/js/components/Table/TableText.js +13 -11
- package/dist/js/components/Table/TableText.js.map +1 -1
- package/dist/js/components/Table/TableTypes.d.ts +3 -0
- package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
- package/dist/js/components/Table/TableTypes.js +4 -0
- package/dist/js/components/Table/TableTypes.js.map +1 -1
- package/dist/js/components/Table/Tbody.d.ts +1 -1
- package/dist/js/components/Table/Tbody.d.ts.map +1 -1
- package/dist/js/components/Table/Td.d.ts +1 -1
- package/dist/js/components/Table/Td.d.ts.map +1 -1
- package/dist/js/components/Table/Td.js +8 -4
- package/dist/js/components/Table/Td.js.map +1 -1
- package/dist/js/components/Table/Th.d.ts +4 -1
- package/dist/js/components/Table/Th.d.ts.map +1 -1
- package/dist/js/components/Table/Th.js +18 -8
- package/dist/js/components/Table/Th.js.map +1 -1
- package/dist/js/components/Table/Thead.d.ts +1 -1
- package/dist/js/components/Table/Thead.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.d.ts +2 -2
- package/dist/js/components/Table/Tr.d.ts.map +1 -1
- package/dist/js/components/Table/Tr.js +1 -1
- package/dist/js/components/Table/Tr.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +8 -8
- package/dist/js/components/Table/base/types.d.ts +7 -7
- package/dist/js/components/Table/base/types.js +4 -0
- package/dist/js/components/Table/base/types.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/selectable.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/selectable.js +2 -2
- package/dist/js/components/Table/utils/decorators/selectable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/sortable.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/sortable.js +7 -4
- package/dist/js/components/Table/utils/decorators/sortable.js.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts +3 -3
- package/dist/js/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
- package/dist/js/components/Table/utils/decorators/treeRow.js +7 -7
- package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
- package/dist/js/demos/index.d.ts +2 -0
- package/dist/js/demos/index.d.ts.map +1 -0
- package/dist/js/demos/index.js +5 -0
- package/dist/js/demos/index.js.map +1 -0
- package/dist/js/demos/sampleData.d.ts +13 -0
- package/dist/js/demos/sampleData.d.ts.map +1 -0
- package/dist/js/demos/sampleData.js +767 -0
- package/dist/js/demos/sampleData.js.map +1 -0
- package/dist/js/deprecated/components/Table/Body.d.ts +1 -1
- package/dist/js/deprecated/components/Table/Body.d.ts.map +1 -1
- package/dist/js/deprecated/components/Table/BodyCell.js +4 -3
- package/dist/js/deprecated/components/Table/BodyCell.js.map +1 -1
- package/dist/js/deprecated/components/Table/Table.d.ts +1 -1
- package/dist/js/deprecated/components/Table/Table.js +1 -1
- package/dist/js/deprecated/components/Table/Table.js.map +1 -1
- package/dist/js/deprecated/components/Table/base/body.d.ts +8 -2
- package/dist/js/deprecated/components/Table/base/body.d.ts.map +1 -1
- package/dist/js/deprecated/components/Table/base/header.d.ts +1 -1
- package/dist/js/deprecated/components/Table/base/header.d.ts.map +1 -1
- package/dist/js/index.d.ts +1 -0
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -0
- package/dist/js/index.js.map +1 -1
- package/dist/umd/react-table.min.js +9 -9
- package/package.json +6 -6
- package/src/components/Table/EditableSelectInputCell.tsx +1 -1
- package/src/components/Table/EditableTextCell.tsx +1 -1
- package/src/components/Table/SelectColumn.tsx +27 -8
- package/src/components/Table/SortColumn.tsx +15 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Table/TableText.tsx +19 -9
- package/src/components/Table/TableTypes.tsx +3 -0
- package/src/components/Table/Td.tsx +10 -5
- package/src/components/Table/Th.tsx +22 -8
- package/src/components/Table/Tr.tsx +1 -1
- package/src/components/Table/examples/Table.md +3 -0
- package/src/components/Table/examples/TableCompoundExpandable.tsx +2 -1
- package/src/components/Table/examples/TableMisc.tsx +3 -1
- package/src/components/Table/examples/TableNestedHeaders.tsx +4 -3
- package/src/components/Table/examples/TableNestedStickyHeader.tsx +4 -3
- package/src/components/Table/examples/TableStickyColumnsAndHeader.tsx +5 -4
- package/src/components/Table/utils/decorators/selectable.tsx +2 -1
- package/src/components/Table/utils/decorators/sortable.tsx +8 -2
- package/src/components/Table/utils/decorators/treeRow.tsx +3 -3
- package/src/components/Table/utils/transformers.test.tsx +14 -8
- package/src/demos/Table.md +159 -0
- package/src/demos/examples/TableAutomaticPagination.tsx +101 -0
- package/src/{docs/demos/table-demos/BulkSelect.jsx → demos/examples/TableBulkSelect.tsx} +41 -20
- package/src/demos/examples/TableColumnManagement.tsx +486 -0
- package/src/demos/examples/TableColumnManagementWithDraggable.tsx +641 -0
- package/src/{docs/demos/table-demos/Compact.jsx → demos/examples/TableCompact.tsx} +32 -16
- package/src/{docs/demos/table-demos/CompoundExpansion.jsx → demos/examples/TableCompoundExpansion.tsx} +27 -13
- package/src/demos/examples/TableEmptyStateDefault.tsx +60 -0
- package/src/demos/examples/TableEmptyStateError.tsx +53 -0
- package/src/demos/examples/TableEmptyStateLoading.tsx +43 -0
- package/src/{docs/demos/table-demos/ExpandCollapseAll.jsx → demos/examples/TableExpandCollapseAll.tsx} +17 -10
- package/src/demos/examples/TableFilterable.tsx +394 -0
- package/src/{docs/demos/table-demos/SortableResponsive.jsx → demos/examples/TableSortableResponsive.tsx} +30 -28
- package/src/{docs/demos/table-demos/StaticBottomPagination.jsx → demos/examples/TableStaticBottomPagination.tsx} +22 -9
- package/src/{docs/demos/table-demos/StickyFirstColumn.jsx → demos/examples/TableStickyFirstColumn.tsx} +31 -9
- package/src/{docs/demos/table-demos/StickyHeader.jsx → demos/examples/TableStickyHeader.tsx} +3 -3
- package/src/demos/index.ts +1 -0
- package/src/{docs/demos/table-demos/sampleData.js → demos/sampleData.tsx} +88 -77
- package/src/deprecated/components/Table/__tests__/Table.test.tsx +4 -9
- package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +8 -8
- package/src/deprecated/components/Table/examples/LegacyTableCompoundExpandable.tsx +4 -3
- package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +4 -3
- package/src/deprecated/components/Table/examples/LegacyTableSelectable.tsx +2 -1
- package/src/deprecated/components/Table/examples/LegacyTableStripedCustomTr.tsx +2 -6
- package/src/deprecated/components/Table/examples/Table.md +2 -0
- package/src/index.ts +1 -0
- package/src/docs/demos/Table.md +0 -1622
- package/src/docs/demos/table-demos/ColumnManagement.jsx +0 -471
package/src/docs/demos/Table.md
DELETED
|
@@ -1,1622 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Table
|
|
3
|
-
section: components
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
Checkbox,
|
|
8
|
-
Label,
|
|
9
|
-
PageSection,
|
|
10
|
-
ToolbarExpandIconWrapper,
|
|
11
|
-
ToolbarContent,
|
|
12
|
-
Toolbar,
|
|
13
|
-
ToolbarItem,
|
|
14
|
-
SearchInput,
|
|
15
|
-
Masthead,
|
|
16
|
-
MastheadToggle,
|
|
17
|
-
MastheadMain,
|
|
18
|
-
MastheadContent,
|
|
19
|
-
SkipToContent,
|
|
20
|
-
Breadcrumb,
|
|
21
|
-
BreadcrumbItem,
|
|
22
|
-
Page,
|
|
23
|
-
PageSectionVariants,
|
|
24
|
-
TextContent,
|
|
25
|
-
Text,
|
|
26
|
-
Divider } from '@patternfly/react-core';
|
|
27
|
-
import { Table as TableDeprecated, TableHeader, TableBody } from '@patternfly/react-table/deprecated';
|
|
28
|
-
|
|
29
|
-
import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
|
30
|
-
import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
|
|
31
|
-
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
32
|
-
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
33
|
-
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
34
|
-
import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
|
|
35
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
36
|
-
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
37
|
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
38
|
-
import SyncIcon from '@patternfly/react-icons/dist/esm/icons/sync-icon';
|
|
39
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
40
|
-
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
41
|
-
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
42
|
-
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
43
|
-
import globalDangerColor200 from '@patternfly/react-tokens/dist/esm/global_danger_color_200';
|
|
44
|
-
import imgBrand from '@patternfly/react-core/src/components/assets/pfLogo.svg';
|
|
45
|
-
import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';
|
|
46
|
-
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
47
|
-
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
48
|
-
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
49
|
-
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
50
|
-
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
51
|
-
import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
|
|
52
|
-
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
53
|
-
import { rows, columns } from '@patternfly/react-table/src/docs/demos/table-demos/sampleData';
|
|
54
|
-
|
|
55
|
-
## Demos
|
|
56
|
-
|
|
57
|
-
### Bulk select
|
|
58
|
-
|
|
59
|
-
```js isFullscreen file="./table-demos/BulkSelect.jsx"
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Expand/collapse all
|
|
64
|
-
|
|
65
|
-
```js isFullscreen file="./table-demos/ExpandCollapseAll.jsx"
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Compact
|
|
70
|
-
|
|
71
|
-
```js isFullscreen file="./table-demos/Compact.jsx"
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Compound expansion
|
|
76
|
-
|
|
77
|
-
```js isFullscreen file="./table-demos/CompoundExpansion.jsx"
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Column management
|
|
82
|
-
|
|
83
|
-
```js isFullscreen file="./table-demos/ColumnManagement.jsx"
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Column management with draggable
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
import React from 'react';
|
|
91
|
-
import {
|
|
92
|
-
Button,
|
|
93
|
-
DataList,
|
|
94
|
-
DataListCheck,
|
|
95
|
-
DataListControl,
|
|
96
|
-
DataListDragButton,
|
|
97
|
-
DataListItem,
|
|
98
|
-
DataListItemRow,
|
|
99
|
-
DataListCell,
|
|
100
|
-
DataListItemCells,
|
|
101
|
-
Toolbar,
|
|
102
|
-
ToolbarContent,
|
|
103
|
-
ToolbarItem,
|
|
104
|
-
Modal,
|
|
105
|
-
OverflowMenu,
|
|
106
|
-
OverflowMenuGroup,
|
|
107
|
-
OverflowMenuItem,
|
|
108
|
-
Pagination,
|
|
109
|
-
PaginationVariant,
|
|
110
|
-
Text,
|
|
111
|
-
TextContent,
|
|
112
|
-
TextVariants,
|
|
113
|
-
MenuToggle
|
|
114
|
-
} from '@patternfly/react-core';
|
|
115
|
-
import { Table as TableDeprecated, TableHeader, TableBody, TableText } from '@patternfly/react-table/deprecated';
|
|
116
|
-
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
|
|
117
|
-
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
118
|
-
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
119
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
120
|
-
import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
|
|
121
|
-
|
|
122
|
-
class ColumnManagementAction extends React.Component {
|
|
123
|
-
constructor(props) {
|
|
124
|
-
super(props);
|
|
125
|
-
this.actions = [
|
|
126
|
-
{
|
|
127
|
-
title: <a href="#">Link</a>
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
title: 'Action'
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
isSeparator: true
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
title: <a href="#">Separated link</a>
|
|
137
|
-
}
|
|
138
|
-
];
|
|
139
|
-
this.defaultColumns = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last commit', ''];
|
|
140
|
-
this.defaultRows = [
|
|
141
|
-
{
|
|
142
|
-
cells: [
|
|
143
|
-
{
|
|
144
|
-
title: (
|
|
145
|
-
<React.Fragment>
|
|
146
|
-
<div>Node 1</div>
|
|
147
|
-
<a href="#">siemur/test-space</a>
|
|
148
|
-
</React.Fragment>
|
|
149
|
-
),
|
|
150
|
-
props: { column: 'Repositories' }
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
title: (
|
|
154
|
-
<React.Fragment>
|
|
155
|
-
<CodeBranchIcon key="icon" /> 10
|
|
156
|
-
</React.Fragment>
|
|
157
|
-
),
|
|
158
|
-
props: { column: 'Branches' }
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: (
|
|
162
|
-
<React.Fragment>
|
|
163
|
-
<CodeIcon key="icon" /> 25
|
|
164
|
-
</React.Fragment>
|
|
165
|
-
),
|
|
166
|
-
props: { column: 'Pull requests' }
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
title: (
|
|
170
|
-
<React.Fragment>
|
|
171
|
-
<CubeIcon key="icon" /> 5
|
|
172
|
-
</React.Fragment>
|
|
173
|
-
),
|
|
174
|
-
props: { column: 'Workspaces' }
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
title: '2 days ago',
|
|
178
|
-
props: { column: 'Last commit' }
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
title: (
|
|
182
|
-
<React.Fragment>
|
|
183
|
-
<a href="#">Action link</a>
|
|
184
|
-
</React.Fragment>
|
|
185
|
-
),
|
|
186
|
-
props: { column: '' }
|
|
187
|
-
}
|
|
188
|
-
]
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
cells: [
|
|
192
|
-
{
|
|
193
|
-
title: (
|
|
194
|
-
<React.Fragment>
|
|
195
|
-
<div>Node 2</div>
|
|
196
|
-
<a href="#">siemur/test-space</a>
|
|
197
|
-
</React.Fragment>
|
|
198
|
-
),
|
|
199
|
-
props: { column: 'Repositories' }
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
title: (
|
|
203
|
-
<React.Fragment>
|
|
204
|
-
<CodeBranchIcon key="icon" /> 8
|
|
205
|
-
</React.Fragment>
|
|
206
|
-
),
|
|
207
|
-
props: { column: 'Branches' }
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
title: (
|
|
211
|
-
<React.Fragment>
|
|
212
|
-
<CodeIcon key="icon" /> 30
|
|
213
|
-
</React.Fragment>
|
|
214
|
-
),
|
|
215
|
-
props: { column: 'Pull requests' }
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
title: (
|
|
219
|
-
<React.Fragment>
|
|
220
|
-
<CubeIcon key="icon" /> 2
|
|
221
|
-
</React.Fragment>
|
|
222
|
-
),
|
|
223
|
-
props: { column: 'Workspaces' }
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
title: '2 days ago',
|
|
227
|
-
props: { column: 'Last commit' }
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
title: (
|
|
231
|
-
<React.Fragment>
|
|
232
|
-
<a href="#">Action link</a>
|
|
233
|
-
</React.Fragment>
|
|
234
|
-
),
|
|
235
|
-
props: { column: '' }
|
|
236
|
-
}
|
|
237
|
-
]
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
cells: [
|
|
241
|
-
{
|
|
242
|
-
title: (
|
|
243
|
-
<React.Fragment>
|
|
244
|
-
<div>Node 3</div>
|
|
245
|
-
<a href="#">siemur/test-space</a>
|
|
246
|
-
</React.Fragment>
|
|
247
|
-
),
|
|
248
|
-
props: { column: 'Repositories' }
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
title: (
|
|
252
|
-
<React.Fragment>
|
|
253
|
-
<CodeBranchIcon key="icon" /> 12
|
|
254
|
-
</React.Fragment>
|
|
255
|
-
),
|
|
256
|
-
props: { column: 'Branches' }
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
title: (
|
|
260
|
-
<React.Fragment>
|
|
261
|
-
<CodeIcon key="icon" /> 48
|
|
262
|
-
</React.Fragment>
|
|
263
|
-
),
|
|
264
|
-
props: { column: 'Pull requests' }
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
title: (
|
|
268
|
-
<React.Fragment>
|
|
269
|
-
<CubeIcon key="icon" /> 13
|
|
270
|
-
</React.Fragment>
|
|
271
|
-
),
|
|
272
|
-
props: { column: 'Workspaces' }
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
title: '30 days ago',
|
|
276
|
-
props: { column: 'Last commit' }
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
title: (
|
|
280
|
-
<React.Fragment>
|
|
281
|
-
<a href="#">Action link</a>
|
|
282
|
-
</React.Fragment>
|
|
283
|
-
),
|
|
284
|
-
props: { column: '' }
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
cells: [
|
|
290
|
-
{
|
|
291
|
-
title: (
|
|
292
|
-
<React.Fragment>
|
|
293
|
-
<div>Node 4</div>
|
|
294
|
-
<a href="#">siemur/test-space</a>
|
|
295
|
-
</React.Fragment>
|
|
296
|
-
),
|
|
297
|
-
props: { column: 'Repositories' }
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
title: (
|
|
301
|
-
<React.Fragment>
|
|
302
|
-
<CodeBranchIcon key="icon" /> 3
|
|
303
|
-
</React.Fragment>
|
|
304
|
-
),
|
|
305
|
-
props: { column: 'Branches' }
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
title: (
|
|
309
|
-
<React.Fragment>
|
|
310
|
-
<CodeIcon key="icon" /> 8
|
|
311
|
-
</React.Fragment>
|
|
312
|
-
),
|
|
313
|
-
props: { column: 'Pull requests' }
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
title: (
|
|
317
|
-
<React.Fragment>
|
|
318
|
-
<CubeIcon key="icon" /> 20
|
|
319
|
-
</React.Fragment>
|
|
320
|
-
),
|
|
321
|
-
props: { column: 'Workspaces' }
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
title: '8 days ago',
|
|
325
|
-
props: { column: 'Last commit' }
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
title: (
|
|
329
|
-
<React.Fragment>
|
|
330
|
-
<a href="#">Action link</a>
|
|
331
|
-
</React.Fragment>
|
|
332
|
-
),
|
|
333
|
-
props: { column: '' }
|
|
334
|
-
}
|
|
335
|
-
]
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
cells: [
|
|
339
|
-
{
|
|
340
|
-
title: (
|
|
341
|
-
<React.Fragment>
|
|
342
|
-
<div>Node 5</div>
|
|
343
|
-
<a href="#">siemur/test-space</a>
|
|
344
|
-
</React.Fragment>
|
|
345
|
-
),
|
|
346
|
-
props: { column: 'Repositories' }
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
title: (
|
|
350
|
-
<React.Fragment>
|
|
351
|
-
<CodeBranchIcon key="icon" /> 34
|
|
352
|
-
</React.Fragment>
|
|
353
|
-
),
|
|
354
|
-
props: { column: 'Branches' }
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
title: (
|
|
358
|
-
<React.Fragment>
|
|
359
|
-
<CodeIcon key="icon" /> 21
|
|
360
|
-
</React.Fragment>
|
|
361
|
-
),
|
|
362
|
-
props: { column: 'Pull requests' }
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
title: (
|
|
366
|
-
<React.Fragment>
|
|
367
|
-
<CubeIcon key="icon" /> 26
|
|
368
|
-
</React.Fragment>
|
|
369
|
-
),
|
|
370
|
-
props: { column: 'Workspaces' }
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
title: '2 days ago',
|
|
374
|
-
props: { column: 'Last commit' }
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
title: (
|
|
378
|
-
<React.Fragment>
|
|
379
|
-
<a href="#">Action link</a>
|
|
380
|
-
</React.Fragment>
|
|
381
|
-
),
|
|
382
|
-
props: { column: '' }
|
|
383
|
-
}
|
|
384
|
-
]
|
|
385
|
-
}
|
|
386
|
-
];
|
|
387
|
-
this.state = {
|
|
388
|
-
filters: [],
|
|
389
|
-
filteredColumns: [],
|
|
390
|
-
columns: this.defaultColumns,
|
|
391
|
-
rows: this.defaultRows,
|
|
392
|
-
canSelectAll: true,
|
|
393
|
-
isModalOpen: false,
|
|
394
|
-
check1: true,
|
|
395
|
-
check2: true,
|
|
396
|
-
check3: true,
|
|
397
|
-
check4: true,
|
|
398
|
-
check5: true,
|
|
399
|
-
liveText: '',
|
|
400
|
-
id: '',
|
|
401
|
-
itemOrder: ['data1', 'data2', 'data3', 'data4', 'data5']
|
|
402
|
-
};
|
|
403
|
-
this.onSelect = this.onSelect.bind(this);
|
|
404
|
-
this.toggleSelect = this.toggleSelect.bind(this);
|
|
405
|
-
this.renderModal = this.renderModal.bind(this);
|
|
406
|
-
this.matchCheckboxNameToColumn = (name) => {
|
|
407
|
-
switch (name) {
|
|
408
|
-
case 'check1':
|
|
409
|
-
return 'Repositories';
|
|
410
|
-
case 'check2':
|
|
411
|
-
return 'Branches';
|
|
412
|
-
case 'check3':
|
|
413
|
-
return 'Pull requests';
|
|
414
|
-
case 'check4':
|
|
415
|
-
return 'Workspaces';
|
|
416
|
-
case 'check5':
|
|
417
|
-
return 'Last commit';
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
this.matchDataListNameToColumn = (name) => {
|
|
421
|
-
switch (name) {
|
|
422
|
-
case 'data1':
|
|
423
|
-
return 'Repositories';
|
|
424
|
-
case 'data2':
|
|
425
|
-
return 'Branches';
|
|
426
|
-
case 'data3':
|
|
427
|
-
return 'Pull requests';
|
|
428
|
-
case 'data4':
|
|
429
|
-
return 'Workspaces';
|
|
430
|
-
case 'data5':
|
|
431
|
-
return 'Last commit';
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
this.filterData = (checked, name) => {
|
|
435
|
-
const { rows, columns, filters } = this.state;
|
|
436
|
-
if (checked) {
|
|
437
|
-
const updatedFilters = filters.filter((item) => item !== name);
|
|
438
|
-
const filteredColumns = this.defaultColumns.filter((column) => !updatedFilters.includes(column));
|
|
439
|
-
this.setState({
|
|
440
|
-
filters: updatedFilters,
|
|
441
|
-
filteredColumns: filteredColumns
|
|
442
|
-
});
|
|
443
|
-
} else {
|
|
444
|
-
let updatedFilters = filters;
|
|
445
|
-
updatedFilters.push(name);
|
|
446
|
-
const filteredColumns = columns.filter((column) => !filters.includes(column));
|
|
447
|
-
this.setState({
|
|
448
|
-
filters: updatedFilters,
|
|
449
|
-
filteredColumns: filteredColumns
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
this.unfilterAllData = () => {
|
|
454
|
-
this.setState({
|
|
455
|
-
filters: [],
|
|
456
|
-
filteredColumns: this.defaultColumns
|
|
457
|
-
});
|
|
458
|
-
};
|
|
459
|
-
this.handleChange = (event, checked) => {
|
|
460
|
-
const target = event.target;
|
|
461
|
-
const value = target.type === 'checkbox' ? target.checked : target.value;
|
|
462
|
-
this.filterData(checked, this.matchCheckboxNameToColumn(target.name));
|
|
463
|
-
this.setState({
|
|
464
|
-
[target.name]: value
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
this.handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {
|
|
468
|
-
this.setState(({ isModalOpen }) => ({
|
|
469
|
-
isModalOpen: !isModalOpen
|
|
470
|
-
}));
|
|
471
|
-
};
|
|
472
|
-
this.onSave = () => {
|
|
473
|
-
const orderedColumns = this.state.itemOrder.map((item) => this.matchDataListNameToColumn(item));
|
|
474
|
-
// concat empty string at the end for actions column
|
|
475
|
-
const filteredOrderedColumns = orderedColumns
|
|
476
|
-
.filter((col) => this.state.filteredColumns.length === 0 || this.state.filteredColumns.indexOf(col) > -1)
|
|
477
|
-
.concat(['']);
|
|
478
|
-
const orderedRows = [];
|
|
479
|
-
this.defaultRows.forEach((row) => {
|
|
480
|
-
const updatedCells = row.cells
|
|
481
|
-
.filter((cell) => filteredOrderedColumns.indexOf(cell.props.column) > -1)
|
|
482
|
-
.sort((cellA, cellB) => {
|
|
483
|
-
const indexA = filteredOrderedColumns.indexOf(cellA.props.column);
|
|
484
|
-
const indexB = filteredOrderedColumns.indexOf(cellB.props.column);
|
|
485
|
-
if (indexA < indexB) {
|
|
486
|
-
return -1;
|
|
487
|
-
}
|
|
488
|
-
if (indexA > indexB) {
|
|
489
|
-
return 1;
|
|
490
|
-
}
|
|
491
|
-
// a must be equal to b
|
|
492
|
-
return 0;
|
|
493
|
-
});
|
|
494
|
-
orderedRows.push({
|
|
495
|
-
cells: updatedCells
|
|
496
|
-
});
|
|
497
|
-
});
|
|
498
|
-
this.setState(({ isModalOpen }) => ({
|
|
499
|
-
columns: filteredOrderedColumns,
|
|
500
|
-
rows: orderedRows,
|
|
501
|
-
isModalOpen: !isModalOpen
|
|
502
|
-
}));
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
this.selectAllColumns = () => {
|
|
506
|
-
this.unfilterAllData();
|
|
507
|
-
this.setState({
|
|
508
|
-
check1: true,
|
|
509
|
-
check2: true,
|
|
510
|
-
check3: true,
|
|
511
|
-
check4: true,
|
|
512
|
-
check5: true
|
|
513
|
-
});
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
this.onDragStart = (id) => {
|
|
517
|
-
this.setState({
|
|
518
|
-
id: id,
|
|
519
|
-
liveText: `Dragging started for item id: ${id}.`
|
|
520
|
-
});
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
this.onDragMove = (oldIndex, newIndex) => {
|
|
524
|
-
const { id } = this.state;
|
|
525
|
-
this.setState({
|
|
526
|
-
liveText: `Dragging item ${id}.`
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
this.onDragCancel = () => {
|
|
531
|
-
this.setState({
|
|
532
|
-
liveText: `Dragging cancelled. List is unchanged.`
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
this.onDragFinish = (itemOrder) => {
|
|
537
|
-
this.setState({
|
|
538
|
-
liveText: `Dragging finished`,
|
|
539
|
-
itemOrder
|
|
540
|
-
});
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
onSelect(event, isSelected, rowId) {
|
|
545
|
-
let rows;
|
|
546
|
-
if (rowId === -1) {
|
|
547
|
-
rows = this.state.rows.map((oneRow) => {
|
|
548
|
-
oneRow.selected = isSelected;
|
|
549
|
-
return oneRow;
|
|
550
|
-
});
|
|
551
|
-
} else {
|
|
552
|
-
rows = [...this.state.rows];
|
|
553
|
-
rows[rowId] = { ...rows[rowId], selected: isSelected };
|
|
554
|
-
}
|
|
555
|
-
this.setState({
|
|
556
|
-
rows
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
toggleSelect(checked) {
|
|
561
|
-
this.setState({
|
|
562
|
-
canSelectAll: checked
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
renderModal() {
|
|
567
|
-
const { isModalOpen } = this.state;
|
|
568
|
-
return (
|
|
569
|
-
<Modal
|
|
570
|
-
title="Manage columns"
|
|
571
|
-
isOpen={isModalOpen}
|
|
572
|
-
variant="small"
|
|
573
|
-
description={
|
|
574
|
-
<TextContent>
|
|
575
|
-
<Text component={TextVariants.p}>Selected categories will be displayed in the table.</Text>
|
|
576
|
-
<Button isInline onClick={this.selectAllColumns} variant="link">
|
|
577
|
-
Select all
|
|
578
|
-
</Button>
|
|
579
|
-
</TextContent>
|
|
580
|
-
}
|
|
581
|
-
onClose={this.handleModalToggle}
|
|
582
|
-
actions={[
|
|
583
|
-
<Button key="save" variant="primary" onClick={this.onSave}>
|
|
584
|
-
Save
|
|
585
|
-
</Button>,
|
|
586
|
-
<Button key="cancel" variant="secondary" onClick={this.handleModalToggle}>
|
|
587
|
-
Cancel
|
|
588
|
-
</Button>
|
|
589
|
-
]}
|
|
590
|
-
>
|
|
591
|
-
<DataList
|
|
592
|
-
aria-label="Table column management"
|
|
593
|
-
id="table-column-management"
|
|
594
|
-
isCompact
|
|
595
|
-
onDragFinish={this.onDragFinish}
|
|
596
|
-
onDragStart={this.onDragStart}
|
|
597
|
-
onDragMove={this.onDragMove}
|
|
598
|
-
onDragCancel={this.onDragCancel}
|
|
599
|
-
itemOrder={this.state.itemOrder}
|
|
600
|
-
>
|
|
601
|
-
<DataListItem aria-labelledby="table-column-management-item1" id="data1">
|
|
602
|
-
<DataListItemRow>
|
|
603
|
-
<DataListControl>
|
|
604
|
-
<DataListDragButton
|
|
605
|
-
aria-label="Reorder"
|
|
606
|
-
aria-labelledby="table-column-management-item1"
|
|
607
|
-
aria-describedby="Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm the drag, or any other key to cancel the drag operation."
|
|
608
|
-
aria-pressed="false"
|
|
609
|
-
/>
|
|
610
|
-
<DataListCheck
|
|
611
|
-
aria-labelledby="table-column-management-item1"
|
|
612
|
-
checked={this.state.check1}
|
|
613
|
-
name="check1"
|
|
614
|
-
id="check1"
|
|
615
|
-
onChange={this.handleChange}
|
|
616
|
-
otherControls
|
|
617
|
-
/>
|
|
618
|
-
</DataListControl>
|
|
619
|
-
<DataListItemCells
|
|
620
|
-
dataListCells={[
|
|
621
|
-
<DataListCell id="table-column-management-item1" key="table-column-management-item1">
|
|
622
|
-
<label htmlFor="check1">Repositories</label>
|
|
623
|
-
</DataListCell>
|
|
624
|
-
]}
|
|
625
|
-
/>
|
|
626
|
-
</DataListItemRow>
|
|
627
|
-
</DataListItem>
|
|
628
|
-
<DataListItem aria-labelledby="table-column-management-item2" id="data2">
|
|
629
|
-
<DataListItemRow>
|
|
630
|
-
<DataListControl>
|
|
631
|
-
<DataListDragButton
|
|
632
|
-
aria-label="Reorder"
|
|
633
|
-
aria-labelledby="table-column-management-item2"
|
|
634
|
-
aria-describedby="Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm the drag, or any other key to cancel the drag operation."
|
|
635
|
-
aria-pressed="false"
|
|
636
|
-
/>
|
|
637
|
-
<DataListCheck
|
|
638
|
-
aria-labelledby="table-column-management-item2"
|
|
639
|
-
checked={this.state.check2}
|
|
640
|
-
name="check2"
|
|
641
|
-
id="check2"
|
|
642
|
-
onChange={this.handleChange}
|
|
643
|
-
otherControls
|
|
644
|
-
/>
|
|
645
|
-
</DataListControl>
|
|
646
|
-
<DataListItemCells
|
|
647
|
-
dataListCells={[
|
|
648
|
-
<DataListCell id="table-column-management-item2" key="table-column-management-item2">
|
|
649
|
-
<label htmlFor="check2">Branches</label>
|
|
650
|
-
</DataListCell>
|
|
651
|
-
]}
|
|
652
|
-
/>
|
|
653
|
-
</DataListItemRow>
|
|
654
|
-
</DataListItem>
|
|
655
|
-
<DataListItem aria-labelledby="table-column-management-item3" id="data3">
|
|
656
|
-
<DataListItemRow>
|
|
657
|
-
<DataListControl>
|
|
658
|
-
<DataListDragButton
|
|
659
|
-
aria-label="Reorder"
|
|
660
|
-
aria-labelledby="table-column-management-item3"
|
|
661
|
-
aria-describedby="Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm the drag, or any other key to cancel the drag operation."
|
|
662
|
-
aria-pressed="false"
|
|
663
|
-
/>
|
|
664
|
-
<DataListCheck
|
|
665
|
-
aria-labelledby="table-column-management-item3"
|
|
666
|
-
checked={this.state.check3}
|
|
667
|
-
name="check3"
|
|
668
|
-
id="check3"
|
|
669
|
-
onChange={this.handleChange}
|
|
670
|
-
otherControls
|
|
671
|
-
/>
|
|
672
|
-
</DataListControl>
|
|
673
|
-
<DataListItemCells
|
|
674
|
-
dataListCells={[
|
|
675
|
-
<DataListCell id="table-column-management-item3" key="table-column-management-item3">
|
|
676
|
-
<label htmlFor="check3">Pull requests</label>
|
|
677
|
-
</DataListCell>
|
|
678
|
-
]}
|
|
679
|
-
/>
|
|
680
|
-
</DataListItemRow>
|
|
681
|
-
</DataListItem>
|
|
682
|
-
<DataListItem aria-labelledby="table-column-management-item4" id="data4">
|
|
683
|
-
<DataListItemRow>
|
|
684
|
-
<DataListControl>
|
|
685
|
-
<DataListDragButton
|
|
686
|
-
aria-label="Reorder"
|
|
687
|
-
aria-labelledby="table-column-management-item4"
|
|
688
|
-
aria-describedby="Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm the drag, or any other key to cancel the drag operation."
|
|
689
|
-
aria-pressed="false"
|
|
690
|
-
/>
|
|
691
|
-
<DataListCheck
|
|
692
|
-
aria-labelledby="table-column-management-item4"
|
|
693
|
-
checked={this.state.check4}
|
|
694
|
-
name="check4"
|
|
695
|
-
id="check4"
|
|
696
|
-
onChange={this.handleChange}
|
|
697
|
-
otherControls
|
|
698
|
-
/>
|
|
699
|
-
</DataListControl>
|
|
700
|
-
<DataListItemCells
|
|
701
|
-
dataListCells={[
|
|
702
|
-
<DataListCell id="table-column-management-item4" key="table-column-management-item4">
|
|
703
|
-
<label htmlFor="check4">Workspaces</label>
|
|
704
|
-
</DataListCell>
|
|
705
|
-
]}
|
|
706
|
-
/>
|
|
707
|
-
</DataListItemRow>
|
|
708
|
-
</DataListItem>
|
|
709
|
-
<DataListItem aria-labelledby="table-column-management-item5" id="data5">
|
|
710
|
-
<DataListItemRow>
|
|
711
|
-
<DataListControl>
|
|
712
|
-
<DataListDragButton
|
|
713
|
-
aria-label="Reorder"
|
|
714
|
-
aria-labelledby="table-column-management-item5"
|
|
715
|
-
aria-describedby="Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm the drag, or any other key to cancel the drag operation."
|
|
716
|
-
aria-pressed="false"
|
|
717
|
-
/>
|
|
718
|
-
<DataListCheck
|
|
719
|
-
aria-labelledby="table-column-management-item5"
|
|
720
|
-
checked={this.state.check5}
|
|
721
|
-
name="check5"
|
|
722
|
-
id="check5"
|
|
723
|
-
onChange={this.handleChange}
|
|
724
|
-
otherControls
|
|
725
|
-
/>
|
|
726
|
-
</DataListControl>
|
|
727
|
-
<DataListItemCells
|
|
728
|
-
dataListCells={[
|
|
729
|
-
<DataListCell id="table-column-management-item5" key="table-column-management-item5">
|
|
730
|
-
<label htmlFor="check5">Last commit</label>
|
|
731
|
-
</DataListCell>
|
|
732
|
-
]}
|
|
733
|
-
/>
|
|
734
|
-
</DataListItemRow>
|
|
735
|
-
</DataListItem>
|
|
736
|
-
</DataList>
|
|
737
|
-
</Modal>
|
|
738
|
-
);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
render() {
|
|
742
|
-
const { canSelectAll, columns, rows } = this.state;
|
|
743
|
-
|
|
744
|
-
const toolbarItems = (
|
|
745
|
-
<React.Fragment>
|
|
746
|
-
<span id="page-layout-table-draggable-column-management-action-toolbar-top-select-checkbox-label" hidden>
|
|
747
|
-
Choose one
|
|
748
|
-
</span>
|
|
749
|
-
<ToolbarContent>
|
|
750
|
-
<ToolbarItem variant="overflow-menu">
|
|
751
|
-
<OverflowMenu breakpoint="md">
|
|
752
|
-
<OverflowMenuItem isPersistent>
|
|
753
|
-
<MenuToggle>
|
|
754
|
-
<FilterIcon /> Name
|
|
755
|
-
</MenuToggle>
|
|
756
|
-
</OverflowMenuItem>
|
|
757
|
-
<OverflowMenuItem>
|
|
758
|
-
<MenuToggle variant="plain" aria-label="Sort columns">
|
|
759
|
-
<SortAmountDownIcon aria-hidden="true" />
|
|
760
|
-
</MenuToggle>
|
|
761
|
-
</OverflowMenuItem>
|
|
762
|
-
<OverflowMenuGroup groupType="button" isPersistent>
|
|
763
|
-
<OverflowMenuItem>
|
|
764
|
-
<Button variant="primary">Action</Button>
|
|
765
|
-
</OverflowMenuItem>
|
|
766
|
-
<OverflowMenuItem>
|
|
767
|
-
<Button variant="link" onClick={this.handleModalToggle}>
|
|
768
|
-
Manage columns
|
|
769
|
-
</Button>
|
|
770
|
-
</OverflowMenuItem>
|
|
771
|
-
</OverflowMenuGroup>
|
|
772
|
-
</OverflowMenu>
|
|
773
|
-
</ToolbarItem>
|
|
774
|
-
<ToolbarItem variant="pagination">
|
|
775
|
-
<Pagination
|
|
776
|
-
itemCount={37}
|
|
777
|
-
widgetId="pagination-options-menu"
|
|
778
|
-
page={1}
|
|
779
|
-
variant={PaginationVariant.top}
|
|
780
|
-
isCompact
|
|
781
|
-
titles={{
|
|
782
|
-
paginationAriaLabel: `Draggable column management top pagination`
|
|
783
|
-
}}
|
|
784
|
-
/>
|
|
785
|
-
</ToolbarItem>
|
|
786
|
-
</ToolbarContent>
|
|
787
|
-
</React.Fragment>
|
|
788
|
-
);
|
|
789
|
-
|
|
790
|
-
return (
|
|
791
|
-
<React.Fragment>
|
|
792
|
-
<TableDeprecated
|
|
793
|
-
gridBreakPoint="grid-xl"
|
|
794
|
-
header={
|
|
795
|
-
<React.Fragment>
|
|
796
|
-
<Toolbar id="page-layout-table-draggable-column-management-action-toolbar-top">{toolbarItems}</Toolbar>
|
|
797
|
-
</React.Fragment>
|
|
798
|
-
}
|
|
799
|
-
aria-label="This is a table with checkboxes"
|
|
800
|
-
id="page-layout-table-draggable-column-management-action-table"
|
|
801
|
-
onSelect={this.onSelect}
|
|
802
|
-
cells={columns}
|
|
803
|
-
rows={rows}
|
|
804
|
-
actions={this.actions}
|
|
805
|
-
canSelectAll={canSelectAll}
|
|
806
|
-
>
|
|
807
|
-
<TableHeader />
|
|
808
|
-
<TableBody />
|
|
809
|
-
</TableDeprecated>
|
|
810
|
-
<Pagination
|
|
811
|
-
isCompact
|
|
812
|
-
id="page-layout-table-draggable-column-management-action-toolbar-bottom"
|
|
813
|
-
itemCount={37}
|
|
814
|
-
widgetId="pagination-options-menu-bottom"
|
|
815
|
-
page={1}
|
|
816
|
-
variant={PaginationVariant.bottom}
|
|
817
|
-
titles={{
|
|
818
|
-
paginationAriaLabel: `Draggable column management bottom pagination`
|
|
819
|
-
}}
|
|
820
|
-
/>
|
|
821
|
-
{this.renderModal()}
|
|
822
|
-
</React.Fragment>
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
### Filterable
|
|
829
|
-
|
|
830
|
-
```js isFullscreen
|
|
831
|
-
import React from 'react';
|
|
832
|
-
import {
|
|
833
|
-
Badge,
|
|
834
|
-
Button,
|
|
835
|
-
Bullseye,
|
|
836
|
-
EmptyState,
|
|
837
|
-
EmptyStateActions,
|
|
838
|
-
EmptyStateBody,
|
|
839
|
-
EmptyStateIcon,
|
|
840
|
-
EmptyStateHeader,
|
|
841
|
-
EmptyStateFooter,
|
|
842
|
-
Label,
|
|
843
|
-
MenuToggle,
|
|
844
|
-
MenuToggleElement,
|
|
845
|
-
Toolbar,
|
|
846
|
-
ToolbarItem,
|
|
847
|
-
ToolbarContent,
|
|
848
|
-
ToolbarFilter,
|
|
849
|
-
ToolbarToggleGroup,
|
|
850
|
-
ToolbarGroup,
|
|
851
|
-
Title,
|
|
852
|
-
Select,
|
|
853
|
-
SelectOption,
|
|
854
|
-
SearchInput
|
|
855
|
-
} from '@patternfly/react-core';
|
|
856
|
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
857
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
858
|
-
import { Table, TableText, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
859
|
-
import { rows, columns } from '@patternfly/react-table/src/docs/demos/table-demos/sampleData';
|
|
860
|
-
|
|
861
|
-
class FilterTableDemo extends React.Component {
|
|
862
|
-
constructor(props) {
|
|
863
|
-
super(props);
|
|
864
|
-
this.state = {
|
|
865
|
-
filters: {
|
|
866
|
-
location: [],
|
|
867
|
-
name: [],
|
|
868
|
-
status: []
|
|
869
|
-
},
|
|
870
|
-
currentCategory: 'Status',
|
|
871
|
-
isFilterDropdownOpen: false,
|
|
872
|
-
isCategoryDropdownOpen: false,
|
|
873
|
-
nameInput: '',
|
|
874
|
-
inputValue: '',
|
|
875
|
-
rows: rows.slice(0, 10)
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
this.onDelete = (type = '', id = '') => {
|
|
879
|
-
if (type) {
|
|
880
|
-
this.setState((prevState) => {
|
|
881
|
-
prevState.filters[type.toLowerCase()] = prevState.filters[type.toLowerCase()].filter((s) => s !== id);
|
|
882
|
-
return {
|
|
883
|
-
filters: prevState.filters
|
|
884
|
-
};
|
|
885
|
-
});
|
|
886
|
-
} else {
|
|
887
|
-
this.setState({
|
|
888
|
-
filters: {
|
|
889
|
-
location: [],
|
|
890
|
-
name: [],
|
|
891
|
-
status: []
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
|
|
897
|
-
this.onCategoryToggle = () => {
|
|
898
|
-
this.setState({
|
|
899
|
-
isCategoryDropdownOpen: !this.state.isCategoryDropdownOpen
|
|
900
|
-
});
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
this.onCategorySelect = (event) => {
|
|
904
|
-
this.setState({
|
|
905
|
-
currentCategory: event.target.innerText,
|
|
906
|
-
isCategoryDropdownOpen: false
|
|
907
|
-
});
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
this.onFilterToggle = () => {
|
|
911
|
-
this.setState({
|
|
912
|
-
isFilterDropdownOpen: !this.state.isFilterDropdownOpen
|
|
913
|
-
});
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
this.onFilterSelect = (event) => {
|
|
917
|
-
this.setState({
|
|
918
|
-
isFilterDropdownOpen: !this.state.isFilterDropdownOpen
|
|
919
|
-
});
|
|
920
|
-
};
|
|
921
|
-
|
|
922
|
-
this.onInputChange = (newValue) => {
|
|
923
|
-
this.setState({ inputValue: newValue });
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
this.onStatusSelect = (event, selection) => {
|
|
927
|
-
const checked = event.target.checked;
|
|
928
|
-
this.setState((prevState) => {
|
|
929
|
-
const prevSelections = prevState.filters['status'];
|
|
930
|
-
return {
|
|
931
|
-
filters: {
|
|
932
|
-
...prevState.filters,
|
|
933
|
-
status: checked ? [...prevSelections, selection] : prevSelections.filter((value) => value !== selection)
|
|
934
|
-
},
|
|
935
|
-
isFilterDropdownOpen: false
|
|
936
|
-
};
|
|
937
|
-
});
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
this.onNameInput = (event) => {
|
|
941
|
-
if (event.key && event.key !== 'Enter') {
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
const { inputValue } = this.state;
|
|
946
|
-
this.setState((prevState) => {
|
|
947
|
-
const prevFilters = prevState.filters['name'];
|
|
948
|
-
return {
|
|
949
|
-
filters: {
|
|
950
|
-
...prevState.filters,
|
|
951
|
-
['name']: prevFilters.includes(inputValue) ? prevFilters : [...prevFilters, inputValue]
|
|
952
|
-
},
|
|
953
|
-
inputValue: ''
|
|
954
|
-
};
|
|
955
|
-
});
|
|
956
|
-
};
|
|
957
|
-
|
|
958
|
-
this.onLocationSelect = (event, selection) => {
|
|
959
|
-
this.setState((prevState) => {
|
|
960
|
-
return {
|
|
961
|
-
filters: {
|
|
962
|
-
...prevState.filters,
|
|
963
|
-
['location']: [selection]
|
|
964
|
-
},
|
|
965
|
-
isFilterDropdownOpen: false
|
|
966
|
-
};
|
|
967
|
-
});
|
|
968
|
-
this.onFilterSelect();
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
buildCategoryDropdown() {
|
|
973
|
-
const { isCategoryDropdownOpen, currentCategory } = this.state;
|
|
974
|
-
|
|
975
|
-
const categoryMenuItems = [
|
|
976
|
-
<SelectOption key="cat1" value="Location">Location</SelectOption>,
|
|
977
|
-
<SelectOption key="cat2" value="Name">Name</SelectOption>,
|
|
978
|
-
<SelectOption key="cat3" value="Status">Status</SelectOption>
|
|
979
|
-
];
|
|
980
|
-
|
|
981
|
-
return (
|
|
982
|
-
<ToolbarItem>
|
|
983
|
-
<Select
|
|
984
|
-
onSelect={this.onCategorySelect}
|
|
985
|
-
selected={currentCategory}
|
|
986
|
-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
987
|
-
<MenuToggle
|
|
988
|
-
ref={toggleRef}
|
|
989
|
-
onClick={this.onCategoryToggle}
|
|
990
|
-
isExpanded={isCategoryDropdownOpen}
|
|
991
|
-
icon={<FilterIcon />}
|
|
992
|
-
style={
|
|
993
|
-
{
|
|
994
|
-
width: '100%',
|
|
995
|
-
verticalAlign: 'text-bottom'
|
|
996
|
-
} as React.CSSProperties
|
|
997
|
-
}
|
|
998
|
-
>
|
|
999
|
-
{currentCategory}
|
|
1000
|
-
</MenuToggle>
|
|
1001
|
-
)}
|
|
1002
|
-
isOpen={isCategoryDropdownOpen}
|
|
1003
|
-
>
|
|
1004
|
-
{categoryMenuItems}
|
|
1005
|
-
</Select>
|
|
1006
|
-
</ToolbarItem>
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
buildFilterDropdown() {
|
|
1011
|
-
const { currentCategory, isFilterDropdownOpen, inputValue, filters } = this.state;
|
|
1012
|
-
|
|
1013
|
-
const locationMenuItems = [
|
|
1014
|
-
<SelectOption key="raleigh" value="Raleigh">Raleigh</SelectOption>,
|
|
1015
|
-
<SelectOption key="san francisco" value="San Francisco">San Francisco</SelectOption>,
|
|
1016
|
-
<SelectOption key="boston" value="Boston">Boston</SelectOption>,
|
|
1017
|
-
<SelectOption key="atlanta" value="Atlanta">Atlanta</SelectOption>,
|
|
1018
|
-
];
|
|
1019
|
-
|
|
1020
|
-
const statusMenuItems = [
|
|
1021
|
-
<SelectOption
|
|
1022
|
-
hasCheckbox
|
|
1023
|
-
key="statusRunning"
|
|
1024
|
-
value="Running"
|
|
1025
|
-
isSelected={filters.status.includes("Running")}
|
|
1026
|
-
>
|
|
1027
|
-
Running
|
|
1028
|
-
</SelectOption>,
|
|
1029
|
-
<SelectOption
|
|
1030
|
-
hasCheckbox
|
|
1031
|
-
key="statusStopped"
|
|
1032
|
-
value="Stopped"
|
|
1033
|
-
isSelected={filters.status.includes("Stopped")}
|
|
1034
|
-
>
|
|
1035
|
-
Stopped
|
|
1036
|
-
</SelectOption>,
|
|
1037
|
-
<SelectOption
|
|
1038
|
-
hasCheckbox
|
|
1039
|
-
key="statusDown"
|
|
1040
|
-
value="Down"
|
|
1041
|
-
isSelected={filters.status.includes("Down")}
|
|
1042
|
-
>
|
|
1043
|
-
Down
|
|
1044
|
-
</SelectOption>,
|
|
1045
|
-
<SelectOption
|
|
1046
|
-
hasCheckbox
|
|
1047
|
-
key="statusDegraded"
|
|
1048
|
-
value="Degraded"
|
|
1049
|
-
isSelected={filters.status.includes("Degraded")}
|
|
1050
|
-
>
|
|
1051
|
-
Degraded
|
|
1052
|
-
</SelectOption>,
|
|
1053
|
-
<SelectOption
|
|
1054
|
-
hasCheckbox
|
|
1055
|
-
key="statusMaint"
|
|
1056
|
-
value="Needs maintenance"
|
|
1057
|
-
isSelected={filters.status.includes("Needs maintenance")}
|
|
1058
|
-
>
|
|
1059
|
-
Needs maintenance
|
|
1060
|
-
</SelectOption>
|
|
1061
|
-
];
|
|
1062
|
-
|
|
1063
|
-
return (
|
|
1064
|
-
<React.Fragment>
|
|
1065
|
-
<ToolbarFilter
|
|
1066
|
-
chips={filters.location}
|
|
1067
|
-
deleteChip={this.onDelete}
|
|
1068
|
-
categoryName="Location"
|
|
1069
|
-
showToolbarItem={currentCategory === 'Location'}
|
|
1070
|
-
>
|
|
1071
|
-
<Select
|
|
1072
|
-
aria-label="Location"
|
|
1073
|
-
onSelect={this.onLocationSelect}
|
|
1074
|
-
selected={filters.location[0]}
|
|
1075
|
-
isOpen={isFilterDropdownOpen}
|
|
1076
|
-
minWidth="100px"
|
|
1077
|
-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
1078
|
-
<MenuToggle
|
|
1079
|
-
ref={toggleRef}
|
|
1080
|
-
onClick={this.onFilterToggle}
|
|
1081
|
-
isExpanded={isFilterDropdownOpen}
|
|
1082
|
-
style={
|
|
1083
|
-
{
|
|
1084
|
-
width: '100%',
|
|
1085
|
-
verticalAlign: 'text-bottom'
|
|
1086
|
-
} as React.CSSProperties
|
|
1087
|
-
}
|
|
1088
|
-
>
|
|
1089
|
-
{filters.location[0] || `Any`}
|
|
1090
|
-
</MenuToggle>
|
|
1091
|
-
)}
|
|
1092
|
-
>
|
|
1093
|
-
{locationMenuItems}
|
|
1094
|
-
</Select>
|
|
1095
|
-
</ToolbarFilter>
|
|
1096
|
-
<ToolbarFilter
|
|
1097
|
-
chips={filters.name}
|
|
1098
|
-
deleteChip={this.onDelete}
|
|
1099
|
-
categoryName="Name"
|
|
1100
|
-
showToolbarItem={currentCategory === 'Name'}
|
|
1101
|
-
>
|
|
1102
|
-
<SearchInput
|
|
1103
|
-
aria-label="name filter"
|
|
1104
|
-
placeholder="Filter by name..."
|
|
1105
|
-
onChange={(_event, value) => this.onInputChange(value)}
|
|
1106
|
-
value={inputValue}
|
|
1107
|
-
onClear={() => {
|
|
1108
|
-
this.onInputChange('');
|
|
1109
|
-
}}
|
|
1110
|
-
onSearch={this.onNameInput}
|
|
1111
|
-
/>
|
|
1112
|
-
</ToolbarFilter>
|
|
1113
|
-
<ToolbarFilter
|
|
1114
|
-
chips={filters.status}
|
|
1115
|
-
deleteChip={this.onDelete}
|
|
1116
|
-
categoryName="Status"
|
|
1117
|
-
showToolbarItem={currentCategory === 'Status'}
|
|
1118
|
-
>
|
|
1119
|
-
<Select
|
|
1120
|
-
aria-label="Status"
|
|
1121
|
-
isOpen={isFilterDropdownOpen}
|
|
1122
|
-
minWidth="100px"
|
|
1123
|
-
onSelect={this.onStatusSelect}
|
|
1124
|
-
selected={filters.status}
|
|
1125
|
-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
1126
|
-
<MenuToggle
|
|
1127
|
-
ref={toggleRef}
|
|
1128
|
-
onClick={this.onFilterToggle}
|
|
1129
|
-
isExpanded={isFilterDropdownOpen}
|
|
1130
|
-
style={
|
|
1131
|
-
{
|
|
1132
|
-
width: '100%',
|
|
1133
|
-
verticalAlign: 'text-bottom'
|
|
1134
|
-
} as React.CSSProperties
|
|
1135
|
-
}
|
|
1136
|
-
>
|
|
1137
|
-
Filter by status
|
|
1138
|
-
{filters.status.length > 0 && <Badge isRead>{filters.status.length}</Badge>}
|
|
1139
|
-
</MenuToggle>
|
|
1140
|
-
)}
|
|
1141
|
-
>
|
|
1142
|
-
{statusMenuItems}
|
|
1143
|
-
</Select>
|
|
1144
|
-
</ToolbarFilter>
|
|
1145
|
-
</React.Fragment>
|
|
1146
|
-
);
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
renderToolbar() {
|
|
1150
|
-
return (
|
|
1151
|
-
<Toolbar id="toolbar-with-chip-groups" clearAllFilters={this.onDelete} collapseListedFiltersBreakpoint="xl">
|
|
1152
|
-
<ToolbarContent>
|
|
1153
|
-
<ToolbarToggleGroup toggleIcon={<FilterIcon />} breakpoint="xl">
|
|
1154
|
-
<ToolbarGroup
|
|
1155
|
-
variant="filter-group"
|
|
1156
|
-
style={{
|
|
1157
|
-
lineHeight: '22px',
|
|
1158
|
-
alignItems: 'center'
|
|
1159
|
-
} as React.CSSProperties}
|
|
1160
|
-
>
|
|
1161
|
-
{this.buildCategoryDropdown()}
|
|
1162
|
-
{this.buildFilterDropdown()}
|
|
1163
|
-
</ToolbarGroup>
|
|
1164
|
-
</ToolbarToggleGroup>
|
|
1165
|
-
</ToolbarContent>
|
|
1166
|
-
</Toolbar>
|
|
1167
|
-
);
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
render() {
|
|
1171
|
-
const { loading, filters, rows } = this.state;
|
|
1172
|
-
|
|
1173
|
-
const filteredRows =
|
|
1174
|
-
filters.name.length > 0 || filters.location.length > 0 || filters.status.length > 0
|
|
1175
|
-
? rows.filter((row) => {
|
|
1176
|
-
return (
|
|
1177
|
-
(filters.name.length === 0 ||
|
|
1178
|
-
filters.name.some((name) => row.name.toLowerCase().includes(name.toLowerCase()))) &&
|
|
1179
|
-
(filters.location.length === 0 || filters.location.includes(row.location)) &&
|
|
1180
|
-
(filters.status.length === 0 || filters.status.includes(row.status))
|
|
1181
|
-
);
|
|
1182
|
-
})
|
|
1183
|
-
: rows;
|
|
1184
|
-
|
|
1185
|
-
let tableRows = filteredRows;
|
|
1186
|
-
if (!loading && filteredRows.length === 0) {
|
|
1187
|
-
tableRows = [
|
|
1188
|
-
{
|
|
1189
|
-
heightAuto: true,
|
|
1190
|
-
cells: [
|
|
1191
|
-
{
|
|
1192
|
-
props: { colSpan: 8 },
|
|
1193
|
-
title: (
|
|
1194
|
-
<Bullseye>
|
|
1195
|
-
<EmptyState>
|
|
1196
|
-
<EmptyStateHeader
|
|
1197
|
-
titleText="Clear all filters and try again."
|
|
1198
|
-
headingLevel="h5"
|
|
1199
|
-
icon={<EmptyStateIcon icon={SearchIcon} />}
|
|
1200
|
-
/>
|
|
1201
|
-
<EmptyStateBody>
|
|
1202
|
-
No results match this filter criteria. Remove all filters or clear all filters to show results.
|
|
1203
|
-
</EmptyStateBody>
|
|
1204
|
-
<EmptyStateFooter>
|
|
1205
|
-
<EmptyStateActions>
|
|
1206
|
-
<Button
|
|
1207
|
-
variant="link"
|
|
1208
|
-
onClick={() => {
|
|
1209
|
-
this.onDelete(null);
|
|
1210
|
-
}}
|
|
1211
|
-
>
|
|
1212
|
-
Clear all filters
|
|
1213
|
-
</Button>
|
|
1214
|
-
</EmptyStateActions>
|
|
1215
|
-
</EmptyStateFooter>
|
|
1216
|
-
</EmptyState>
|
|
1217
|
-
</Bullseye>
|
|
1218
|
-
)
|
|
1219
|
-
}
|
|
1220
|
-
]
|
|
1221
|
-
}
|
|
1222
|
-
];
|
|
1223
|
-
} else if (loading) {
|
|
1224
|
-
tableRows = [
|
|
1225
|
-
{
|
|
1226
|
-
heightAuto: true,
|
|
1227
|
-
cells: [
|
|
1228
|
-
{
|
|
1229
|
-
props: { colSpan: 8 },
|
|
1230
|
-
title: (
|
|
1231
|
-
<Title headingLevel="h2" size="3xl">
|
|
1232
|
-
Please wait while loading data
|
|
1233
|
-
</Title>
|
|
1234
|
-
)
|
|
1235
|
-
}
|
|
1236
|
-
]
|
|
1237
|
-
}
|
|
1238
|
-
];
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
const renderLabel = labelText => {
|
|
1242
|
-
switch (labelText) {
|
|
1243
|
-
case 'Running':
|
|
1244
|
-
return <Label color="green">{labelText}</Label>;
|
|
1245
|
-
case 'Stopped':
|
|
1246
|
-
return <Label color="orange">{labelText}</Label>;
|
|
1247
|
-
case 'Needs maintenance':
|
|
1248
|
-
return <Label color="blue">{labelText}</Label>;
|
|
1249
|
-
case 'Down':
|
|
1250
|
-
return <Label color="red">{labelText}</Label>;
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
|
-
return (
|
|
1255
|
-
<React.Fragment>
|
|
1256
|
-
{this.renderToolbar()}
|
|
1257
|
-
<Table aria-label="Filterable Table Demo">
|
|
1258
|
-
<Thead>
|
|
1259
|
-
<Tr>
|
|
1260
|
-
<Th key={0}>{columns[0]}</Th>
|
|
1261
|
-
<Th key={1}>{columns[1]}</Th>
|
|
1262
|
-
<Th key={2}>{columns[2]}</Th>
|
|
1263
|
-
<Th key={3}>{columns[3]}</Th>
|
|
1264
|
-
<Th key={4}>{columns[4]}</Th>
|
|
1265
|
-
<Th key={5}>{columns[5]}</Th>
|
|
1266
|
-
<Th key={6}>{columns[6]}</Th>
|
|
1267
|
-
<Th key={7} width={10}>
|
|
1268
|
-
{columns[7]}
|
|
1269
|
-
</Th>
|
|
1270
|
-
</Tr>
|
|
1271
|
-
</Thead>
|
|
1272
|
-
<Tbody>
|
|
1273
|
-
{filteredRows.slice(0, 10).map((row, rowIndex) => (
|
|
1274
|
-
<Tr key={rowIndex}>
|
|
1275
|
-
<>
|
|
1276
|
-
<Td dataLabel={columns[0]}>{row.name}</Td>
|
|
1277
|
-
<Td dataLabel={columns[1]}>{row.threads}</Td>
|
|
1278
|
-
<Td dataLabel={columns[2]}>{row.applications}</Td>
|
|
1279
|
-
<Td dataLabel={columns[3]}>{row.workspaces}</Td>
|
|
1280
|
-
<Td dataLabel={columns[4]}>{renderLabel(row.status)}</Td>
|
|
1281
|
-
<Td dataLabel={columns[5]}>{row.location}</Td>
|
|
1282
|
-
<Td dataLabel={columns[6]}>{row.lastModified}</Td>
|
|
1283
|
-
<Td dataLabel={columns[7]} modifier="truncate">
|
|
1284
|
-
<TableText>
|
|
1285
|
-
<a href="#">{row.url}</a>
|
|
1286
|
-
</TableText>
|
|
1287
|
-
</Td>
|
|
1288
|
-
</>
|
|
1289
|
-
</Tr>
|
|
1290
|
-
))}
|
|
1291
|
-
</Tbody>
|
|
1292
|
-
</Table>
|
|
1293
|
-
</React.Fragment>
|
|
1294
|
-
);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
```
|
|
1298
|
-
|
|
1299
|
-
### Sortable - responsive
|
|
1300
|
-
|
|
1301
|
-
```js isFullscreen file="./table-demos/SortableResponsive.jsx"
|
|
1302
|
-
|
|
1303
|
-
```
|
|
1304
|
-
|
|
1305
|
-
### Automatic pagination
|
|
1306
|
-
|
|
1307
|
-
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:
|
|
1308
|
-
|
|
1309
|
-
- The component automatically changes the page back to the last full page of results, rather than defaulting to the final page of results.
|
|
1310
|
-
|
|
1311
|
-
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.
|
|
1312
|
-
|
|
1313
|
-
- The default behavior would show the last page of results, which would only contain the last two rows (rows 11 - 12).
|
|
1314
|
-
- The `isLastFullPageShown` prop navigates you back to the previous page which does contain a full page of 5 rows (rows 6 - 10).
|
|
1315
|
-
|
|
1316
|
-
```js isFullscreen
|
|
1317
|
-
import React from 'react';
|
|
1318
|
-
import { Pagination } from '@patternfly/react-core';
|
|
1319
|
-
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
1320
|
-
|
|
1321
|
-
class ComplexPaginationTableDemo extends React.Component {
|
|
1322
|
-
constructor(props) {
|
|
1323
|
-
super(props);
|
|
1324
|
-
(this.columns = {
|
|
1325
|
-
firstColumn: 'First column',
|
|
1326
|
-
secondColumn: 'Second column',
|
|
1327
|
-
thirdColumn: 'Third column'
|
|
1328
|
-
}),
|
|
1329
|
-
(this.defaultRows = [
|
|
1330
|
-
{ firstColumn: 'Row 1 column 1', secondColumn: 'Row 1 column 2', thirdColumn: 'Row 1 column 3' },
|
|
1331
|
-
{ firstColumn: 'Row 2 column 1', secondColumn: 'Row 2 column 2', thirdColumn: 'Row 2 column 3' },
|
|
1332
|
-
{ firstColumn: 'Row 3 column 1', secondColumn: 'Row 3 column 2', thirdColumn: 'Row 3 column 3' },
|
|
1333
|
-
{ firstColumn: 'Row 4 column 1', secondColumn: 'Row 4 column 2', thirdColumn: 'Row 4 column 3' },
|
|
1334
|
-
{ firstColumn: 'Row 5 column 1', secondColumn: 'Row 5 column 2', thirdColumn: 'Row 5 column 3' },
|
|
1335
|
-
{ firstColumn: 'Row 6 column 1', secondColumn: 'Row 6 column 2', thirdColumn: 'Row 6 column 3' },
|
|
1336
|
-
{ firstColumn: 'Row 7 column 1', secondColumn: 'Row 7 column 2', thirdColumn: 'Row 7 column 3' },
|
|
1337
|
-
{ firstColumn: 'Row 8 column 1', secondColumn: 'Row 8 column 2', thirdColumn: 'Row 8 column 3' },
|
|
1338
|
-
{ firstColumn: 'Row 9 column 1', secondColumn: 'Row 9 column 2', thirdColumn: 'Row 9 column 3' },
|
|
1339
|
-
{ firstColumn: 'Row 10 column 1', secondColumn: 'Row 10 column 2', thirdColumn: 'Row 10 column 3' },
|
|
1340
|
-
{ firstColumn: 'Row 11 column 1', secondColumn: 'Row 11 column 2', thirdColumn: 'Row 11 column 3' },
|
|
1341
|
-
{ firstColumn: 'Row 12 column 1', secondColumn: 'Row 12 column 2', thirdColumn: 'Row 12 column 3' }
|
|
1342
|
-
]);
|
|
1343
|
-
this.defaultPerPage = 10;
|
|
1344
|
-
this.state = {
|
|
1345
|
-
perPage: this.defaultPerPage,
|
|
1346
|
-
page: 1,
|
|
1347
|
-
rows: this.defaultRows.slice(0, this.defaultPerPage)
|
|
1348
|
-
};
|
|
1349
|
-
this.handleSetPage = this.handleSetPage.bind(this);
|
|
1350
|
-
this.handlePerPageSelect = this.handlePerPageSelect.bind(this);
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
handleSetPage(_evt, newPage, perPage, startIdx, endIdx) {
|
|
1354
|
-
this.setState({
|
|
1355
|
-
page: newPage,
|
|
1356
|
-
rows: this.defaultRows.slice(startIdx, endIdx)
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
handlePerPageSelect(_evt, newPerPage, newPage, startIdx, endIdx) {
|
|
1361
|
-
this.setState({
|
|
1362
|
-
perPage: newPerPage,
|
|
1363
|
-
page: newPage,
|
|
1364
|
-
rows: this.defaultRows.slice(startIdx, endIdx)
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
renderPagination(variant = 'top') {
|
|
1369
|
-
const { page, perPage } = this.state;
|
|
1370
|
-
return (
|
|
1371
|
-
<Pagination
|
|
1372
|
-
isCompact
|
|
1373
|
-
itemCount={this.defaultRows.length}
|
|
1374
|
-
page={page}
|
|
1375
|
-
perPage={perPage}
|
|
1376
|
-
isLastFullPageShown
|
|
1377
|
-
onSetPage={this.handleSetPage}
|
|
1378
|
-
onPerPageSelect={this.handlePerPageSelect}
|
|
1379
|
-
perPageOptions={[
|
|
1380
|
-
{ title: '3', value: 3 },
|
|
1381
|
-
{ title: '5', value: 5 },
|
|
1382
|
-
{ title: '12', value: 12 },
|
|
1383
|
-
{ title: '20', value: 20 }
|
|
1384
|
-
]}
|
|
1385
|
-
titles={{
|
|
1386
|
-
paginationAriaLabel: `${variant} pagination`
|
|
1387
|
-
}}
|
|
1388
|
-
/>
|
|
1389
|
-
);
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
render() {
|
|
1393
|
-
return (
|
|
1394
|
-
<React.Fragment>
|
|
1395
|
-
{this.renderPagination()}
|
|
1396
|
-
<Table aria-label="Automated Pagination Table Demo">
|
|
1397
|
-
<Thead>
|
|
1398
|
-
<Tr>
|
|
1399
|
-
<Th>{this.columns.firstColumn}</Th>
|
|
1400
|
-
<Th>{this.columns.secondColumn}</Th>
|
|
1401
|
-
<Th>{this.columns.thirdColumn}</Th>
|
|
1402
|
-
</Tr>
|
|
1403
|
-
</Thead>
|
|
1404
|
-
<Tbody>
|
|
1405
|
-
{this.state.rows.map((row, rowIndex) => (
|
|
1406
|
-
<Tr key={rowIndex}>
|
|
1407
|
-
<>
|
|
1408
|
-
<Td dataLabel={this.columns.firstColumn}>{row.firstColumn}</Td>
|
|
1409
|
-
<Td dataLabel={this.columns.secondColumn}>{row.secondColumn}</Td>
|
|
1410
|
-
<Td dataLabel={this.columns.thirdColumn}>{row.thirdColumn}</Td>
|
|
1411
|
-
</>
|
|
1412
|
-
</Tr>
|
|
1413
|
-
))}
|
|
1414
|
-
</Tbody>
|
|
1415
|
-
</Table>
|
|
1416
|
-
</React.Fragment>
|
|
1417
|
-
);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
```
|
|
1421
|
-
|
|
1422
|
-
### Static bottom pagination on mobile
|
|
1423
|
-
|
|
1424
|
-
```js isFullscreen file="table-demos/StaticBottomPagination.jsx"
|
|
1425
|
-
|
|
1426
|
-
```
|
|
1427
|
-
|
|
1428
|
-
### Sticky header
|
|
1429
|
-
|
|
1430
|
-
```js isFullscreen file="./table-demos/StickyHeader.jsx"
|
|
1431
|
-
|
|
1432
|
-
```
|
|
1433
|
-
|
|
1434
|
-
### Sticky first column
|
|
1435
|
-
|
|
1436
|
-
```js isFullscreen file="./table-demos/StickyFirstColumn.jsx"
|
|
1437
|
-
|
|
1438
|
-
```
|
|
1439
|
-
|
|
1440
|
-
### Sticky columns and header with toolbar
|
|
1441
|
-
|
|
1442
|
-
A toolbar may be added above a sticky table either inside or outside the `OuterScrollContainer`.
|
|
1443
|
-
|
|
1444
|
-
```ts isFullscreen file="../../components/Table/examples/TableStickyColumnsAndHeader.tsx"
|
|
1445
|
-
|
|
1446
|
-
```
|
|
1447
|
-
|
|
1448
|
-
## Empty states
|
|
1449
|
-
|
|
1450
|
-
These examples demonstrate the use of an [Empty State component](/components/empty-state) inside of a [Table](/components/table). Empty states are useful in a table when a filter returns no results, while data is loading, or when any type of error or exception condition occurs.
|
|
1451
|
-
|
|
1452
|
-
### Empty
|
|
1453
|
-
|
|
1454
|
-
```js isFullscreen
|
|
1455
|
-
import React from 'react';
|
|
1456
|
-
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
1457
|
-
import {
|
|
1458
|
-
Bullseye,
|
|
1459
|
-
Button,
|
|
1460
|
-
Card,
|
|
1461
|
-
EmptyState,
|
|
1462
|
-
EmptyStateVariant,
|
|
1463
|
-
EmptyStateIcon,
|
|
1464
|
-
EmptyStateBody,
|
|
1465
|
-
EmptyStateHeader,
|
|
1466
|
-
EmptyStateFooter,
|
|
1467
|
-
EmptyStateActions,
|
|
1468
|
-
PageSection
|
|
1469
|
-
} from '@patternfly/react-core';
|
|
1470
|
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
1471
|
-
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
1472
|
-
|
|
1473
|
-
export const TableEmptyState: React.FunctionComponent = () => (
|
|
1474
|
-
<DashboardWrapper hasPageTemplateTitle>
|
|
1475
|
-
<PageSection padding={{ default: 'noPadding', xl: 'padding' }}>
|
|
1476
|
-
<Card component="div">
|
|
1477
|
-
<Table aria-label="Empty state table">
|
|
1478
|
-
<Thead>
|
|
1479
|
-
<Tr>
|
|
1480
|
-
<Th>Repositories</Th>
|
|
1481
|
-
<Th>Branches</Th>
|
|
1482
|
-
<Th>Pull requests</Th>
|
|
1483
|
-
<Th>Workspaces</Th>
|
|
1484
|
-
<Th>Last commit</Th>
|
|
1485
|
-
</Tr>
|
|
1486
|
-
</Thead>
|
|
1487
|
-
<Tbody>
|
|
1488
|
-
<Tr>
|
|
1489
|
-
<Td colSpan={8}>
|
|
1490
|
-
<Bullseye>
|
|
1491
|
-
<EmptyState variant={EmptyStateVariant.sm}>
|
|
1492
|
-
<EmptyStateHeader
|
|
1493
|
-
icon={<EmptyStateIcon icon={SearchIcon} />}
|
|
1494
|
-
titleText="No results found"
|
|
1495
|
-
headingLevel="h2"
|
|
1496
|
-
/>
|
|
1497
|
-
<EmptyStateBody>
|
|
1498
|
-
No results match this filter criteria. Clear all filters and try again.
|
|
1499
|
-
</EmptyStateBody>
|
|
1500
|
-
<EmptyStateFooter>
|
|
1501
|
-
<EmptyStateActions>
|
|
1502
|
-
<Button variant="link">Clear all filters</Button>
|
|
1503
|
-
</EmptyStateActions>
|
|
1504
|
-
</EmptyStateFooter>
|
|
1505
|
-
</EmptyState>
|
|
1506
|
-
</Bullseye>
|
|
1507
|
-
</Td>
|
|
1508
|
-
</Tr>
|
|
1509
|
-
</Tbody>
|
|
1510
|
-
</Table>
|
|
1511
|
-
</Card>
|
|
1512
|
-
</PageSection>
|
|
1513
|
-
</DashboardWrapper>
|
|
1514
|
-
);
|
|
1515
|
-
```
|
|
1516
|
-
|
|
1517
|
-
### Loading
|
|
1518
|
-
|
|
1519
|
-
```js isFullscreen
|
|
1520
|
-
import React from 'react';
|
|
1521
|
-
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
1522
|
-
import {
|
|
1523
|
-
Bullseye,
|
|
1524
|
-
Card,
|
|
1525
|
-
EmptyState,
|
|
1526
|
-
EmptyStateIcon,
|
|
1527
|
-
EmptyStateBody,
|
|
1528
|
-
EmptyStateHeader,
|
|
1529
|
-
PageSection,
|
|
1530
|
-
Spinner
|
|
1531
|
-
} from '@patternfly/react-core';
|
|
1532
|
-
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
1533
|
-
|
|
1534
|
-
export const LoadingStateDemo: React.FunctionComponent = () => (
|
|
1535
|
-
<DashboardWrapper hasPageTemplateTitle>
|
|
1536
|
-
<PageSection padding={{ default: 'noPadding', xl: 'padding' }}>
|
|
1537
|
-
<Card component="div">
|
|
1538
|
-
<Table aria-label="Loading table demo">
|
|
1539
|
-
<Thead>
|
|
1540
|
-
<Tr>
|
|
1541
|
-
<Th>Repositories</Th>
|
|
1542
|
-
<Th>Branches</Th>
|
|
1543
|
-
<Th>Pull requests</Th>
|
|
1544
|
-
<Th>Workspaces</Th>
|
|
1545
|
-
<Th>Last commit</Th>
|
|
1546
|
-
</Tr>
|
|
1547
|
-
</Thead>
|
|
1548
|
-
<Tbody>
|
|
1549
|
-
<Tr>
|
|
1550
|
-
<Td colSpan={8}>
|
|
1551
|
-
<Bullseye>
|
|
1552
|
-
<EmptyState>
|
|
1553
|
-
<EmptyStateHeader titleText="Loading" headingLevel="h2" icon={<EmptyStateIcon icon={Spinner} />} />
|
|
1554
|
-
</EmptyState>
|
|
1555
|
-
</Bullseye>
|
|
1556
|
-
</Td>
|
|
1557
|
-
</Tr>
|
|
1558
|
-
</Tbody>
|
|
1559
|
-
</Table>
|
|
1560
|
-
</Card>
|
|
1561
|
-
</PageSection>
|
|
1562
|
-
</DashboardWrapper>
|
|
1563
|
-
);
|
|
1564
|
-
```
|
|
1565
|
-
|
|
1566
|
-
### Error
|
|
1567
|
-
|
|
1568
|
-
```js isFullscreen
|
|
1569
|
-
import React from 'react';
|
|
1570
|
-
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
1571
|
-
import {
|
|
1572
|
-
Bullseye,
|
|
1573
|
-
Card,
|
|
1574
|
-
EmptyState,
|
|
1575
|
-
EmptyStateVariant,
|
|
1576
|
-
EmptyStateIcon,
|
|
1577
|
-
EmptyStateBody,
|
|
1578
|
-
EmptyStateHeader,
|
|
1579
|
-
PageSection
|
|
1580
|
-
} from '@patternfly/react-core';
|
|
1581
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
1582
|
-
import globalDangerColor200 from '@patternfly/react-tokens/dist/esm/global_danger_color_200';
|
|
1583
|
-
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
1584
|
-
|
|
1585
|
-
export const ErrorStateDemo: React.FunctionComponent = () => (
|
|
1586
|
-
<DashboardWrapper hasPageTemplateTitle>
|
|
1587
|
-
<PageSection padding={{ default: 'noPadding', xl: 'padding' }}>
|
|
1588
|
-
<Card component="div">
|
|
1589
|
-
<Table aria-label="Loading table demo">
|
|
1590
|
-
<Thead>
|
|
1591
|
-
<Tr>
|
|
1592
|
-
<Th>Repositories</Th>
|
|
1593
|
-
<Th>Branches</Th>
|
|
1594
|
-
<Th>Pull requests</Th>
|
|
1595
|
-
<Th>Workspaces</Th>
|
|
1596
|
-
<Th>Last commit</Th>
|
|
1597
|
-
</Tr>
|
|
1598
|
-
</Thead>
|
|
1599
|
-
<Tbody>
|
|
1600
|
-
<Tr>
|
|
1601
|
-
<Td colSpan={8}>
|
|
1602
|
-
<Bullseye>
|
|
1603
|
-
<EmptyState variant={EmptyStateVariant.sm}>
|
|
1604
|
-
<EmptyStateHeader
|
|
1605
|
-
titleText="Unable to connect"
|
|
1606
|
-
icon={<EmptyStateIcon icon={ExclamationCircleIcon} color={globalDangerColor200.value} />}
|
|
1607
|
-
headingLevel="h2"
|
|
1608
|
-
/>
|
|
1609
|
-
<EmptyStateBody>
|
|
1610
|
-
There was an error retrieving data. Check your connection and reload the page.
|
|
1611
|
-
</EmptyStateBody>
|
|
1612
|
-
</EmptyState>
|
|
1613
|
-
</Bullseye>
|
|
1614
|
-
</Td>
|
|
1615
|
-
</Tr>
|
|
1616
|
-
</Tbody>
|
|
1617
|
-
</Table>
|
|
1618
|
-
</Card>
|
|
1619
|
-
</PageSection>
|
|
1620
|
-
</DashboardWrapper>
|
|
1621
|
-
);
|
|
1622
|
-
```
|