Skip to content

Commit 6bd9087

Browse files
committed
draft: tree filter
1 parent 15f2619 commit 6bd9087

File tree

7 files changed

+366
-27
lines changed

7 files changed

+366
-27
lines changed

package-lock.json

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/module/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
},
3333
"dependencies": {
3434
"@patternfly/react-component-groups": "^6.1.0",
35-
"@patternfly/react-core": "^6.0.0",
36-
"@patternfly/react-icons": "^6.0.0",
37-
"@patternfly/react-table": "^6.0.0",
35+
"@patternfly/react-core": "^6.1.0",
36+
"@patternfly/react-icons": "^6.1.0",
37+
"@patternfly/react-table": "^6.1.0",
3838
"clsx": "^2.1.1",
3939
"react-jss": "^10.10.0"
4040
},
@@ -43,7 +43,7 @@
4343
"react-dom": "^17 || ^18"
4444
},
4545
"devDependencies": {
46-
"@patternfly/documentation-framework": "^6.5.4",
46+
"@patternfly/documentation-framework": "^6.5.8",
4747
"@patternfly/patternfly": "^6.0.0",
4848
"@patternfly/react-code-editor": "^6.0.0",
4949
"@patternfly/patternfly-a11y": "^5.0.0",

packages/module/patternfly-docs/content/extensions/data-view/examples/Toolbar/FiltersExample.tsx

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useMemo } from 'react';
2-
import { Pagination } from '@patternfly/react-core';
2+
import { Pagination, TreeViewDataItem } from '@patternfly/react-core';
33
import { BrowserRouter, useSearchParams } from 'react-router-dom';
44
import { useDataViewFilters, useDataViewPagination } from '@patternfly/react-data-view/dist/dynamic/Hooks';
55
import { DataView } from '@patternfly/react-data-view/dist/dynamic/DataView';
@@ -8,6 +8,7 @@ import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataVi
88
import { DataViewFilterOption, DataViewFilters } from '@patternfly/react-data-view/dist/dynamic/DataViewFilters';
99
import { DataViewTextFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTextFilter';
1010
import { DataViewCheckboxFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewCheckboxFilter';
11+
import { DataViewTreeFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTreeFilter';
1112

1213
const perPageOptions = [
1314
{ title: '5', value: 5 },
@@ -43,6 +44,61 @@ const filterOptions: DataViewFilterOption[] = [
4344
{ label: 'Workspace three', value: 'workspace-three' }
4445
];
4546

47+
const statusOptions: TreeViewDataItem[] = [
48+
{
49+
name: 'Ready',
50+
id: 'ready',
51+
checkProps: { checked: false },
52+
customBadgeContent: 1,
53+
children: [
54+
{
55+
name: 'Updated',
56+
id: 'updated',
57+
checkProps: { checked: false },
58+
customBadgeContent: 0
59+
},
60+
{
61+
name: 'Waiting to update',
62+
id: 'waiting',
63+
checkProps: { checked: false },
64+
customBadgeContent: 0
65+
},
66+
{
67+
name: 'Conditions degraded',
68+
id: 'degraded',
69+
checkProps: { checked: false },
70+
customBadgeContent: 1
71+
},
72+
{
73+
name: 'Approval required',
74+
id: 'approval',
75+
checkProps: { checked: false },
76+
customBadgeContent: 0
77+
}
78+
]
79+
},
80+
{
81+
name: 'Not ready',
82+
id: 'nr',
83+
checkProps: { checked: false },
84+
customBadgeContent: 1,
85+
children: [
86+
{
87+
name: 'Conditions degraded',
88+
id: 'nr-degraded',
89+
checkProps: { checked: false },
90+
customBadgeContent: 1
91+
}
92+
]
93+
},
94+
{
95+
name: 'Updating',
96+
id: 'updating',
97+
checkProps: { checked: false },
98+
customBadgeContent: 0
99+
}
100+
];
101+
46102
const columns = [ 'Name', 'Branch', 'Pull requests', 'Workspace', 'Last commit' ];
47103

48104
const ouiaId = 'LayoutExample';
@@ -81,6 +137,7 @@ const MyTable: React.FunctionComponent = () => {
81137
<DataViewTextFilter filterId="name" title='Name' placeholder='Filter by name' />
82138
<DataViewTextFilter filterId="branch" title='Branch' placeholder='Filter by branch' />
83139
<DataViewCheckboxFilter filterId="workspace" title='Workspace' placeholder='Filter by workspace' options={filterOptions} />
140+
<DataViewTreeFilter filterId="status" title='Status' placeholder='Filter by status' options={statusOptions} />
84141
</DataViewFilters>
85142
}
86143
/>

packages/module/patternfly-docs/content/extensions/data-view/examples/Toolbar/Toolbar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { DataViewTable } from '@patternfly/react-data-view/dist/dynamic/DataView
2525
import { DataViewFilters } from '@patternfly/react-data-view/dist/dynamic/DataViewFilters';
2626
import { DataViewTextFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTextFilter';
2727
import { DataViewCheckboxFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewCheckboxFilter';
28+
import { DataViewTreeFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTreeFilter';
2829

2930
The **data view toolbar** component renders a default opinionated data view toolbar above or below the data section.
3031

0 commit comments

Comments
 (0)