@patternfly/react-data-view 6.1.0-prerelease.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DataView/DataView.d.ts +15 -1
- package/dist/cjs/DataView/DataView.js +14 -3
- package/dist/cjs/DataViewCheckboxFilter/DataViewCheckboxFilter.d.ts +29 -0
- package/dist/cjs/DataViewCheckboxFilter/DataViewCheckboxFilter.js +70 -0
- package/dist/cjs/DataViewCheckboxFilter/DataViewCheckboxFilter.test.d.ts +1 -0
- package/dist/cjs/DataViewCheckboxFilter/DataViewCheckboxFilter.test.js +25 -0
- package/dist/cjs/DataViewCheckboxFilter/index.d.ts +2 -0
- package/dist/cjs/DataViewCheckboxFilter/index.js +23 -0
- package/dist/cjs/DataViewEventsContext/DataViewEventsContext.d.ts +16 -0
- package/dist/cjs/DataViewEventsContext/DataViewEventsContext.js +62 -0
- package/dist/cjs/DataViewEventsContext/DataViewEventsContext.test.d.ts +1 -0
- package/dist/cjs/DataViewEventsContext/DataViewEventsContext.test.js +72 -0
- package/dist/cjs/DataViewEventsContext/index.d.ts +2 -0
- package/dist/cjs/DataViewEventsContext/index.js +23 -0
- package/dist/cjs/DataViewFilters/DataViewFilters.d.ts +25 -0
- package/dist/cjs/DataViewFilters/DataViewFilters.js +85 -0
- package/dist/cjs/DataViewFilters/DataViewFilters.test.d.ts +1 -0
- package/dist/cjs/DataViewFilters/DataViewFilters.test.js +19 -0
- package/dist/cjs/DataViewFilters/index.d.ts +2 -0
- package/dist/cjs/DataViewFilters/index.js +23 -0
- package/dist/cjs/DataViewTable/DataViewTable.d.ts +49 -0
- package/dist/cjs/DataViewTable/DataViewTable.js +18 -0
- package/dist/cjs/DataViewTable/DataViewTable.test.d.ts +1 -0
- package/dist/cjs/DataViewTable/DataViewTable.test.js +57 -0
- package/dist/cjs/DataViewTable/index.d.ts +2 -0
- package/dist/cjs/DataViewTable/index.js +23 -0
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.d.ts +19 -0
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.js +71 -0
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.test.d.ts +1 -0
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.test.js +43 -0
- package/dist/cjs/DataViewTableBasic/index.d.ts +2 -0
- package/dist/cjs/DataViewTableBasic/index.js +23 -0
- package/dist/cjs/DataViewTableHead/DataViewTableHead.d.ts +14 -0
- package/dist/cjs/DataViewTableHead/DataViewTableHead.js +57 -0
- package/dist/cjs/DataViewTableHead/DataViewTableHead.test.d.ts +1 -0
- package/dist/cjs/DataViewTableHead/DataViewTableHead.test.js +36 -0
- package/dist/cjs/DataViewTableHead/index.d.ts +2 -0
- package/dist/cjs/DataViewTableHead/index.js +23 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.d.ts +25 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.js +144 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.test.d.ts +1 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.test.js +90 -0
- package/dist/cjs/DataViewTableTree/index.d.ts +2 -0
- package/dist/cjs/DataViewTableTree/index.js +23 -0
- package/dist/cjs/DataViewTextFilter/DataViewTextFilter.d.ts +21 -0
- package/dist/cjs/DataViewTextFilter/DataViewTextFilter.js +26 -0
- package/dist/cjs/DataViewTextFilter/DataViewTextFilter.test.d.ts +1 -0
- package/dist/cjs/DataViewTextFilter/DataViewTextFilter.test.js +22 -0
- package/dist/cjs/DataViewTextFilter/index.d.ts +2 -0
- package/dist/cjs/DataViewTextFilter/index.js +23 -0
- package/dist/cjs/DataViewToolbar/DataViewToolbar.d.ts +13 -3
- package/dist/cjs/DataViewToolbar/DataViewToolbar.js +31 -6
- package/dist/cjs/Hooks/filters.d.ts +14 -0
- package/dist/cjs/Hooks/filters.js +69 -0
- package/dist/cjs/Hooks/filters.test.d.ts +1 -0
- package/dist/cjs/Hooks/filters.test.js +75 -0
- package/dist/cjs/Hooks/index.d.ts +2 -0
- package/dist/cjs/Hooks/index.js +2 -0
- package/dist/cjs/Hooks/pagination.d.ts +14 -1
- package/dist/cjs/Hooks/pagination.js +36 -4
- package/dist/cjs/Hooks/pagination.test.js +1 -1
- package/dist/cjs/Hooks/selection.d.ts +3 -3
- package/dist/cjs/Hooks/selection.js +4 -4
- package/dist/cjs/Hooks/selection.test.js +4 -4
- package/dist/cjs/Hooks/sort.d.ts +32 -0
- package/dist/cjs/Hooks/sort.js +47 -0
- package/dist/cjs/Hooks/sort.test.d.ts +1 -0
- package/dist/cjs/Hooks/sort.test.js +68 -0
- package/dist/cjs/InternalContext/InternalContext.d.ts +26 -0
- package/dist/cjs/InternalContext/InternalContext.js +40 -0
- package/dist/cjs/InternalContext/InternalContext.test.d.ts +1 -0
- package/dist/cjs/InternalContext/InternalContext.test.js +56 -0
- package/dist/cjs/InternalContext/index.d.ts +2 -0
- package/dist/cjs/InternalContext/index.js +23 -0
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.js +26 -2
- package/dist/dynamic/DataViewCheckboxFilter/package.json +1 -0
- package/dist/dynamic/DataViewEventsContext/package.json +1 -0
- package/dist/dynamic/DataViewFilters/package.json +1 -0
- package/dist/dynamic/DataViewTable/package.json +1 -0
- package/dist/dynamic/DataViewTableBasic/package.json +1 -0
- package/dist/dynamic/DataViewTableHead/package.json +1 -0
- package/dist/dynamic/DataViewTableTree/package.json +1 -0
- package/dist/dynamic/DataViewTextFilter/package.json +1 -0
- package/dist/dynamic/InternalContext/package.json +1 -0
- package/dist/esm/DataView/DataView.d.ts +15 -1
- package/dist/esm/DataView/DataView.js +13 -2
- package/dist/esm/DataViewCheckboxFilter/DataViewCheckboxFilter.d.ts +29 -0
- package/dist/esm/DataViewCheckboxFilter/DataViewCheckboxFilter.js +62 -0
- package/dist/esm/DataViewCheckboxFilter/DataViewCheckboxFilter.test.d.ts +1 -0
- package/dist/esm/DataViewCheckboxFilter/DataViewCheckboxFilter.test.js +20 -0
- package/dist/esm/DataViewCheckboxFilter/index.d.ts +2 -0
- package/dist/esm/DataViewCheckboxFilter/index.js +2 -0
- package/dist/esm/DataViewEventsContext/DataViewEventsContext.d.ts +16 -0
- package/dist/esm/DataViewEventsContext/DataViewEventsContext.js +34 -0
- package/dist/esm/DataViewEventsContext/DataViewEventsContext.test.d.ts +1 -0
- package/dist/esm/DataViewEventsContext/DataViewEventsContext.test.js +67 -0
- package/dist/esm/DataViewEventsContext/index.d.ts +2 -0
- package/dist/esm/DataViewEventsContext/index.js +2 -0
- package/dist/esm/DataViewFilters/DataViewFilters.d.ts +25 -0
- package/dist/esm/DataViewFilters/DataViewFilters.js +58 -0
- package/dist/esm/DataViewFilters/DataViewFilters.test.d.ts +1 -0
- package/dist/esm/DataViewFilters/DataViewFilters.test.js +14 -0
- package/dist/esm/DataViewFilters/index.d.ts +2 -0
- package/dist/esm/DataViewFilters/index.js +2 -0
- package/dist/esm/DataViewTable/DataViewTable.d.ts +49 -0
- package/dist/esm/DataViewTable/DataViewTable.js +8 -0
- package/dist/esm/DataViewTable/DataViewTable.test.d.ts +1 -0
- package/dist/esm/DataViewTable/DataViewTable.test.js +52 -0
- package/dist/esm/DataViewTable/index.d.ts +2 -0
- package/dist/esm/DataViewTable/index.js +2 -0
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.d.ts +19 -0
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.js +44 -0
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.test.d.ts +1 -0
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.test.js +38 -0
- package/dist/esm/DataViewTableBasic/index.d.ts +2 -0
- package/dist/esm/DataViewTableBasic/index.js +2 -0
- package/dist/esm/DataViewTableHead/DataViewTableHead.d.ts +14 -0
- package/dist/esm/DataViewTableHead/DataViewTableHead.js +30 -0
- package/dist/esm/DataViewTableHead/DataViewTableHead.test.d.ts +1 -0
- package/dist/esm/DataViewTableHead/DataViewTableHead.test.js +31 -0
- package/dist/esm/DataViewTableHead/index.d.ts +2 -0
- package/dist/esm/DataViewTableHead/index.js +2 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.d.ts +25 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.js +117 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.test.d.ts +1 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.test.js +85 -0
- package/dist/esm/DataViewTableTree/index.d.ts +2 -0
- package/dist/esm/DataViewTableTree/index.js +2 -0
- package/dist/esm/DataViewTextFilter/DataViewTextFilter.d.ts +21 -0
- package/dist/esm/DataViewTextFilter/DataViewTextFilter.js +19 -0
- package/dist/esm/DataViewTextFilter/DataViewTextFilter.test.d.ts +1 -0
- package/dist/esm/DataViewTextFilter/DataViewTextFilter.test.js +17 -0
- package/dist/esm/DataViewTextFilter/index.d.ts +2 -0
- package/dist/esm/DataViewTextFilter/index.js +2 -0
- package/dist/esm/DataViewToolbar/DataViewToolbar.d.ts +13 -3
- package/dist/esm/DataViewToolbar/DataViewToolbar.js +9 -4
- package/dist/esm/Hooks/filters.d.ts +14 -0
- package/dist/esm/Hooks/filters.js +65 -0
- package/dist/esm/Hooks/filters.test.d.ts +1 -0
- package/dist/esm/Hooks/filters.test.js +73 -0
- package/dist/esm/Hooks/index.d.ts +2 -0
- package/dist/esm/Hooks/index.js +2 -0
- package/dist/esm/Hooks/pagination.d.ts +14 -1
- package/dist/esm/Hooks/pagination.js +36 -4
- package/dist/esm/Hooks/pagination.test.js +1 -1
- package/dist/esm/Hooks/selection.d.ts +3 -3
- package/dist/esm/Hooks/selection.js +4 -4
- package/dist/esm/Hooks/selection.test.js +4 -4
- package/dist/esm/Hooks/sort.d.ts +32 -0
- package/dist/esm/Hooks/sort.js +43 -0
- package/dist/esm/Hooks/sort.test.d.ts +1 -0
- package/dist/esm/Hooks/sort.test.js +66 -0
- package/dist/esm/InternalContext/InternalContext.d.ts +26 -0
- package/dist/esm/InternalContext/InternalContext.js +12 -0
- package/dist/esm/InternalContext/InternalContext.test.d.ts +1 -0
- package/dist/esm/InternalContext/InternalContext.test.js +51 -0
- package/dist/esm/InternalContext/index.d.ts +2 -0
- package/dist/esm/InternalContext/index.js +2 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.js +16 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +16 -15
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md +63 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/EventsExample.tsx +130 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/PredefinedLayoutFullExample.tsx +275 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/DataViewTableEmptyExample.tsx +57 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/DataViewTableErrorExample.tsx +45 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/DataViewTableExample.tsx +67 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/DataViewTableLoadingExample.tsx +27 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/DataViewTableTreeExample.tsx +71 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/SortingExample.tsx +87 -0
- package/patternfly-docs/content/extensions/data-view/examples/Table/Table.md +130 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/AllSelectedExample.tsx +116 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/DataViewToolbarActionsExample.tsx +27 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/DataViewToolbarExample.tsx +36 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/FiltersExample.tsx +107 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/PaginationExample.tsx +56 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/SelectionExample.tsx +57 -0
- package/patternfly-docs/content/extensions/data-view/examples/Toolbar/Toolbar.md +154 -0
- package/patternfly-docs/pages/index.js +1 -1
- package/release.config.js +1 -1
- package/src/DataView/DataView.tsx +28 -5
- package/src/DataView/__snapshots__/DataView.test.tsx.snap +2 -2
- package/src/DataViewCheckboxFilter/DataViewCheckboxFilter.test.tsx +24 -0
- package/src/DataViewCheckboxFilter/DataViewCheckboxFilter.tsx +175 -0
- package/src/DataViewCheckboxFilter/__snapshots__/DataViewCheckboxFilter.test.tsx.snap +197 -0
- package/src/DataViewCheckboxFilter/index.ts +2 -0
- package/src/DataViewEventsContext/DataViewEventsContext.test.tsx +105 -0
- package/src/DataViewEventsContext/DataViewEventsContext.tsx +70 -0
- package/src/DataViewEventsContext/index.ts +2 -0
- package/src/DataViewFilters/DataViewFilters.test.tsx +21 -0
- package/src/DataViewFilters/DataViewFilters.tsx +144 -0
- package/src/DataViewFilters/__snapshots__/DataViewFilters.test.tsx.snap +194 -0
- package/src/DataViewFilters/index.tsx +2 -0
- package/src/DataViewTable/DataViewTable.test.tsx +80 -0
- package/src/DataViewTable/DataViewTable.tsx +57 -0
- package/src/DataViewTable/__snapshots__/DataViewTable.test.tsx.snap +1042 -0
- package/src/DataViewTable/index.ts +2 -0
- package/src/DataViewTableBasic/DataViewTableBasic.test.tsx +65 -0
- package/src/DataViewTableBasic/DataViewTableBasic.tsx +83 -0
- package/src/DataViewTableBasic/__snapshots__/DataViewTableBasic.test.tsx.snap +555 -0
- package/src/DataViewTableBasic/index.ts +2 -0
- package/src/DataViewTableHead/DataViewTableHead.test.tsx +50 -0
- package/src/DataViewTableHead/DataViewTableHead.tsx +54 -0
- package/src/DataViewTableHead/__snapshots__/DataViewTableHead.test.tsx.snap +227 -0
- package/src/DataViewTableHead/index.ts +2 -0
- package/src/DataViewTableTree/DataViewTableTree.test.tsx +113 -0
- package/src/DataViewTableTree/DataViewTableTree.tsx +186 -0
- package/src/DataViewTableTree/__snapshots__/DataViewTableTree.test.tsx.snap +1200 -0
- package/src/DataViewTableTree/index.ts +2 -0
- package/src/DataViewTextFilter/DataViewTextFilter.test.tsx +24 -0
- package/src/DataViewTextFilter/DataViewTextFilter.tsx +54 -0
- package/src/DataViewTextFilter/__snapshots__/DataViewTextFilter.test.tsx.snap +203 -0
- package/src/DataViewTextFilter/index.ts +2 -0
- package/src/DataViewToolbar/DataViewToolbar.tsx +55 -22
- package/src/DataViewToolbar/__snapshots__/DataViewToolbar.test.tsx.snap +52 -8
- package/src/Hooks/filters.test.tsx +89 -0
- package/src/Hooks/filters.ts +97 -0
- package/src/Hooks/index.ts +2 -0
- package/src/Hooks/pagination.test.tsx +1 -1
- package/src/Hooks/pagination.ts +69 -12
- package/src/Hooks/selection.test.tsx +5 -5
- package/src/Hooks/selection.ts +7 -7
- package/src/Hooks/sort.test.tsx +84 -0
- package/src/Hooks/sort.ts +87 -0
- package/src/InternalContext/InternalContext.test.tsx +89 -0
- package/src/InternalContext/InternalContext.tsx +52 -0
- package/src/InternalContext/index.ts +2 -0
- package/src/index.ts +24 -0
- package/patternfly-docs/content/extensions/data-view/about-data-view.md +0 -14
- package/patternfly-docs/content/extensions/data-view/examples/Components/Components.md +0 -31
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewToolbarExample.tsx +0 -20
- package/patternfly-docs/content/extensions/data-view/examples/Functionality/Functionality.md +0 -77
- package/patternfly-docs/content/extensions/data-view/examples/Functionality/PaginationExample.tsx +0 -65
- package/patternfly-docs/content/extensions/data-view/examples/Functionality/SelectionExample.tsx +0 -88
- package/patternfly-docs/content/extensions/data-view/examples/Layout/Layout.md +0 -39
- package/patternfly-docs/content/extensions/data-view/examples/Layout/PredefinedLayoutExample.tsx +0 -120
- /package/patternfly-docs/content/extensions/data-view/examples/{Layout → DataView}/AbstractLayoutExample.tsx +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Sidenav top-level section
|
|
3
|
-
# should be the same for all markdown files
|
|
4
|
-
section: extensions
|
|
5
|
-
subsection: Data view
|
|
6
|
-
# Sidenav secondary level section
|
|
7
|
-
# should be the same for all markdown files
|
|
8
|
-
id: Components
|
|
9
|
-
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
10
|
-
source: react
|
|
11
|
-
# If you use typescript, the name of the interface to display props for
|
|
12
|
-
# These are found through the sourceProps function provided in patternfly-docs.source.js
|
|
13
|
-
sortValue: 4
|
|
14
|
-
propComponents: ['DataViewToolbar']
|
|
15
|
-
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/Components/Components.md
|
|
16
|
-
---
|
|
17
|
-
import { BulkSelect } from '@patternfly/react-component-groups';
|
|
18
|
-
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
19
|
-
|
|
20
|
-
## Data view toolbar
|
|
21
|
-
|
|
22
|
-
The **data view toolbar** component renders a default opinionated data view toolbar above or below the data section.
|
|
23
|
-
|
|
24
|
-
Data view toolbar can contain a `pagination`, `bulkSelect` or any other children content passed. The preffered way of passing children toolbar items is using the [toolbar item](/components/toolbar#toolbar-items) component.
|
|
25
|
-
|
|
26
|
-
### Basic example
|
|
27
|
-
|
|
28
|
-
```js file="./DataViewToolbarExample.tsx"
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewToolbarExample.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pagination } from '@patternfly/react-core';
|
|
3
|
-
import { BulkSelect } from '@patternfly/react-component-groups';
|
|
4
|
-
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const BasicExample: React.FunctionComponent = () => (
|
|
8
|
-
<DataViewToolbar
|
|
9
|
-
pagination={
|
|
10
|
-
<Pagination page={1} perPage={10} />
|
|
11
|
-
}
|
|
12
|
-
bulkSelect={
|
|
13
|
-
<BulkSelect
|
|
14
|
-
selectedCount={0}
|
|
15
|
-
pageCount={5}
|
|
16
|
-
onSelect={() => null}
|
|
17
|
-
/>
|
|
18
|
-
}
|
|
19
|
-
/>
|
|
20
|
-
)
|
package/patternfly-docs/content/extensions/data-view/examples/Functionality/Functionality.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Sidenav top-level section
|
|
3
|
-
# should be the same for all markdown files
|
|
4
|
-
section: extensions
|
|
5
|
-
subsection: Data view
|
|
6
|
-
# Sidenav secondary level section
|
|
7
|
-
# should be the same for all markdown files
|
|
8
|
-
id: Functionality
|
|
9
|
-
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
10
|
-
source: react
|
|
11
|
-
# If you use typescript, the name of the interface to display props for
|
|
12
|
-
# These are found through the sourceProps function provided in patternfly-docs.source.js
|
|
13
|
-
sortValue: 3
|
|
14
|
-
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/Functionality/Functionality.md
|
|
15
|
-
---
|
|
16
|
-
import { useMemo } from 'react';
|
|
17
|
-
import { useDataViewPagination, useDataViewSelection } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
18
|
-
import { DataView } from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
19
|
-
import { BulkSelect, BulkSelectValue } from '@patternfly/react-component-groups/dist/dynamic/BulkSelect';
|
|
20
|
-
import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
21
|
-
|
|
22
|
-
This is a list of functionality you can use to manage data displayed in the **data view**.
|
|
23
|
-
|
|
24
|
-
# Pagination
|
|
25
|
-
Allows to display data records on multiple pages and display the pagination state.
|
|
26
|
-
|
|
27
|
-
### Toolbar usage
|
|
28
|
-
Data view toolbar can display a pagination using the `pagination` property accepting a React node. You can also pass a custom `ouiaId` for testing purposes.
|
|
29
|
-
|
|
30
|
-
### Pagination state
|
|
31
|
-
|
|
32
|
-
The `useDataViewPagination` hook manages the pagination state of the data view.
|
|
33
|
-
|
|
34
|
-
**Initial values:**
|
|
35
|
-
- `perPage` initial value
|
|
36
|
-
- (optional) `page` initial value
|
|
37
|
-
|
|
38
|
-
The retrieved values are named to match the PatternFly [pagination](/components/pagination) component props, so you can easily spread them.
|
|
39
|
-
|
|
40
|
-
**Return values:**
|
|
41
|
-
- current `page` number
|
|
42
|
-
- `onSetPage` to modify current page
|
|
43
|
-
- items `perPage` value
|
|
44
|
-
- `onPerPageSelect` to modify per page value
|
|
45
|
-
|
|
46
|
-
### Pagination example
|
|
47
|
-
```js file="./PaginationExample.tsx"
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
# Selection
|
|
52
|
-
Allows to select data records inside the data view and show the selection state.
|
|
53
|
-
|
|
54
|
-
### Toolbar usage
|
|
55
|
-
Data view toolbar can display a bulk selection component using the `bulkSelect` property accepting a React node. You can make use of a predefined [bulk select](/extensions/component-groups/bulk-select) from the [component groups](/extensions/component-groups/about-component-groups) extension.
|
|
56
|
-
|
|
57
|
-
### Selection state
|
|
58
|
-
|
|
59
|
-
The `useDataViewSelection` hook manages the selection state of the data view.
|
|
60
|
-
|
|
61
|
-
**Initial values:**
|
|
62
|
-
- (optional) `initialSelected` array of record's identifiers selected by default
|
|
63
|
-
- (optional) `matchOption` function to check if given record is selected
|
|
64
|
-
|
|
65
|
-
*When no `matchOption` is passed, the `Array.prototype.includes()` operation is performed on the `selected` array.*
|
|
66
|
-
|
|
67
|
-
**Return values:**
|
|
68
|
-
- `selected` array of currently selected records
|
|
69
|
-
- `isSelected` function returning the selection state for given record
|
|
70
|
-
- `onSelect` callback to modify the selection state and accepting `isSelecting` flag indicating if records are changing to selected or deselected and `items` containing affected records
|
|
71
|
-
|
|
72
|
-
### Selection example
|
|
73
|
-
|
|
74
|
-
```js file="./SelectionExample.tsx"
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
package/patternfly-docs/content/extensions/data-view/examples/Functionality/PaginationExample.tsx
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { Pagination } from '@patternfly/react-core';
|
|
3
|
-
import { Table, Tbody, Th, Thead, Tr, Td } from '@patternfly/react-table';
|
|
4
|
-
import { useDataViewPagination } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
5
|
-
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
6
|
-
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
7
|
-
|
|
8
|
-
const perPageOptions = [
|
|
9
|
-
{ title: '5', value: 5 },
|
|
10
|
-
{ title: '10', value: 10 }
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
interface Repository {
|
|
14
|
-
name: string;
|
|
15
|
-
branches: string | null;
|
|
16
|
-
prs: string | null;
|
|
17
|
-
workspaces: string;
|
|
18
|
-
lastCommit: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const repositories: Repository[] = [
|
|
22
|
-
{ name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
|
|
23
|
-
{ name: 'one - 2', branches: null, prs: null, workspaces: 'four - 2', lastCommit: 'five - 2' },
|
|
24
|
-
{ name: 'one - 3', branches: 'two - 3', prs: 'three - 3', workspaces: 'four - 3', lastCommit: 'five - 3' },
|
|
25
|
-
{ name: 'one - 4', branches: 'two - 4', prs: 'null', workspaces: 'four - 4', lastCommit: 'five - 4' },
|
|
26
|
-
{ name: 'one - 5', branches: 'two - 5', prs: 'three - 5', workspaces: 'four - 5', lastCommit: 'five - 5' },
|
|
27
|
-
{ name: 'one - 6', branches: 'two - 6', prs: 'three - 6', workspaces: 'four - 6', lastCommit: 'five - 6' }
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const cols = {
|
|
31
|
-
name: 'Repositories',
|
|
32
|
-
branches: 'Branches',
|
|
33
|
-
prs: 'Pull requests',
|
|
34
|
-
workspaces: 'Workspaces',
|
|
35
|
-
lastCommit: 'Last commit'
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const ouiaId = 'LayoutExample';
|
|
39
|
-
|
|
40
|
-
export const BasicExample: React.FunctionComponent = () => {
|
|
41
|
-
const pagination = useDataViewPagination({ perPage: 5 });
|
|
42
|
-
const { page, perPage } = pagination;
|
|
43
|
-
|
|
44
|
-
const data = useMemo(() => repositories.slice((page - 1) * perPage, ((page - 1) * perPage) + perPage), [ page, perPage ]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<DataView>
|
|
48
|
-
<DataViewToolbar ouiaId='DataViewHeader' pagination={<Pagination perPageOptions={perPageOptions} itemCount={repositories.length} {...pagination} />} />
|
|
49
|
-
<Table aria-label="Repositories table" ouiaId={ouiaId}>
|
|
50
|
-
<Thead data-ouia-component-id={`${ouiaId}-thead`}>
|
|
51
|
-
<Tr ouiaId={`${ouiaId}-tr-head`}>
|
|
52
|
-
{Object.values(cols).map((column, index) => <Th key={index} data-ouia-component-id={`${ouiaId}-th-${index}`}>{column}</Th>)}
|
|
53
|
-
</Tr>
|
|
54
|
-
</Thead>
|
|
55
|
-
<Tbody>
|
|
56
|
-
{data.map((repo, rowIndex) => (
|
|
57
|
-
<Tr key={repo.name} ouiaId={`${ouiaId}-tr-${rowIndex}`}>
|
|
58
|
-
{Object.keys(cols).map((column, colIndex) => <Td key={colIndex} data-ouia-component-id={`${ouiaId}-td-${rowIndex}-${colIndex}`}>{repo[column]}</Td>)}
|
|
59
|
-
</Tr>
|
|
60
|
-
))}
|
|
61
|
-
</Tbody>
|
|
62
|
-
</Table>
|
|
63
|
-
<DataViewToolbar ouiaId='DataViewFooter' pagination={<Pagination isCompact perPageOptions={perPageOptions} itemCount={repositories.length} {...pagination} />} />
|
|
64
|
-
</DataView>
|
|
65
|
-
)}
|
package/patternfly-docs/content/extensions/data-view/examples/Functionality/SelectionExample.tsx
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Table, Tbody, Th, Thead, Tr, Td } from '@patternfly/react-table';
|
|
3
|
-
import { useDataViewSelection } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
4
|
-
import { BulkSelect, BulkSelectValue } from '@patternfly/react-component-groups/dist/dynamic/BulkSelect';
|
|
5
|
-
import { DataView } from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
6
|
-
import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
7
|
-
|
|
8
|
-
interface Repository {
|
|
9
|
-
name: string;
|
|
10
|
-
branches: string | null;
|
|
11
|
-
prs: string | null;
|
|
12
|
-
workspaces: string;
|
|
13
|
-
lastCommit: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const repositories: Repository[] = [
|
|
17
|
-
{ name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
|
|
18
|
-
{ name: 'one - 2', branches: null, prs: null, workspaces: 'four - 2', lastCommit: 'five - 2' },
|
|
19
|
-
{ name: 'one - 3', branches: 'two - 3', prs: 'three - 3', workspaces: 'four - 3', lastCommit: 'five - 3' },
|
|
20
|
-
{ name: 'one - 4', branches: 'two - 4', prs: 'null', workspaces: 'four - 4', lastCommit: 'five - 4' },
|
|
21
|
-
{ name: 'one - 5', branches: 'two - 5', prs: 'three - 5', workspaces: 'four - 5', lastCommit: 'five - 5' },
|
|
22
|
-
{ name: 'one - 6', branches: 'two - 6', prs: 'three - 6', workspaces: 'four - 6', lastCommit: 'five - 6' }
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
const cols = {
|
|
26
|
-
name: 'Repositories',
|
|
27
|
-
branches: 'Branches',
|
|
28
|
-
prs: 'Pull requests',
|
|
29
|
-
workspaces: 'Workspaces',
|
|
30
|
-
lastCommit: 'Last commit'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const ouiaId = 'LayoutExample';
|
|
34
|
-
|
|
35
|
-
export const BasicExample: React.FunctionComponent = () => {
|
|
36
|
-
const selection = useDataViewSelection({});
|
|
37
|
-
const { selected, onSelect, isSelected } = selection;
|
|
38
|
-
|
|
39
|
-
const handleBulkSelect = (value: BulkSelectValue) => {
|
|
40
|
-
value === BulkSelectValue.none && onSelect(false);
|
|
41
|
-
value === BulkSelectValue.all && onSelect(true, repositories);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<DataView>
|
|
46
|
-
<DataViewToolbar
|
|
47
|
-
ouiaId='DataViewHeader'
|
|
48
|
-
bulkSelect={
|
|
49
|
-
<BulkSelect
|
|
50
|
-
canSelectAll
|
|
51
|
-
isDataPaginated={false}
|
|
52
|
-
totalCount={repositories.length}
|
|
53
|
-
selectedCount={selected.length}
|
|
54
|
-
onSelect={handleBulkSelect}
|
|
55
|
-
/>
|
|
56
|
-
}
|
|
57
|
-
/>
|
|
58
|
-
<Table aria-label="Repositories table" ouiaId={ouiaId}>
|
|
59
|
-
<Thead data-ouia-component-id={`${ouiaId}-thead`}>
|
|
60
|
-
<Tr ouiaId={`${ouiaId}-tr-head`}>
|
|
61
|
-
<Th key="row-select"/>
|
|
62
|
-
{Object.values(cols).map((column, index) => (
|
|
63
|
-
<Th key={index} data-ouia-component-id={`${ouiaId}-th-${index}`}>{column}</Th>
|
|
64
|
-
))}
|
|
65
|
-
</Tr>
|
|
66
|
-
</Thead>
|
|
67
|
-
<Tbody>
|
|
68
|
-
{repositories.map((repo, rowIndex) => (
|
|
69
|
-
<Tr key={repo.name} ouiaId={`${ouiaId}-tr-${rowIndex}`}>
|
|
70
|
-
<Td
|
|
71
|
-
key={`select-${rowIndex}`}
|
|
72
|
-
select={{
|
|
73
|
-
rowIndex,
|
|
74
|
-
onSelect: (_event, isSelecting) => onSelect(isSelecting, repo),
|
|
75
|
-
isSelected: isSelected(repo),
|
|
76
|
-
isDisabled: false
|
|
77
|
-
}}
|
|
78
|
-
/>
|
|
79
|
-
{Object.keys(cols).map((column, colIndex) => (
|
|
80
|
-
<Td key={colIndex} data-ouia-component-id={`${ouiaId}-td-${rowIndex}-${colIndex}`}>{repo[column]}</Td>
|
|
81
|
-
))}
|
|
82
|
-
</Tr>
|
|
83
|
-
))}
|
|
84
|
-
</Tbody>
|
|
85
|
-
</Table>
|
|
86
|
-
</DataView>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Sidenav top-level section
|
|
3
|
-
# should be the same for all markdown files
|
|
4
|
-
section: extensions
|
|
5
|
-
subsection: Data view
|
|
6
|
-
# Sidenav secondary level section
|
|
7
|
-
# should be the same for all markdown files
|
|
8
|
-
id: Layout
|
|
9
|
-
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
10
|
-
source: react
|
|
11
|
-
# If you use typescript, the name of the interface to display props for
|
|
12
|
-
# These are found through the sourceProps function provided in patternfly-docs.source.js
|
|
13
|
-
sortValue: 2
|
|
14
|
-
propComponents: ['DataView']
|
|
15
|
-
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/Layout/Layout.md
|
|
16
|
-
---
|
|
17
|
-
import { useMemo } from 'react';
|
|
18
|
-
import { useDataViewPagination, useDataViewSelection } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
19
|
-
import { BulkSelect, BulkSelectValue } from '@patternfly/react-component-groups/dist/dynamic/BulkSelect';
|
|
20
|
-
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
21
|
-
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
22
|
-
|
|
23
|
-
The **data view** component renders record data in a configured layout.
|
|
24
|
-
|
|
25
|
-
### Layout example
|
|
26
|
-
|
|
27
|
-
Data view is expected to consist of header, data part and footer stacked below each other and passed as `children`.
|
|
28
|
-
|
|
29
|
-
```js file="./AbstractLayoutExample.tsx"
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Predefined layout components
|
|
34
|
-
|
|
35
|
-
You can make use of the predefined layout components to display a default header and footer. See [data view toolbar](/extensions/data-view/components#dataviewtoolbar) for more information
|
|
36
|
-
|
|
37
|
-
```js file="./PredefinedLayoutExample.tsx"
|
|
38
|
-
|
|
39
|
-
```
|
package/patternfly-docs/content/extensions/data-view/examples/Layout/PredefinedLayoutExample.tsx
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { Pagination } from '@patternfly/react-core';
|
|
3
|
-
import { Table, Tbody, Th, Thead, Tr, Td } from '@patternfly/react-table';
|
|
4
|
-
import { useDataViewPagination, useDataViewSelection } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
5
|
-
import { BulkSelect, BulkSelectValue } from '@patternfly/react-component-groups/dist/dynamic/BulkSelect';
|
|
6
|
-
import { DataView } from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
7
|
-
import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
8
|
-
|
|
9
|
-
const perPageOptions = [
|
|
10
|
-
{ title: '5', value: 5 },
|
|
11
|
-
{ title: '10', value: 10 }
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
interface Repository {
|
|
15
|
-
name: string;
|
|
16
|
-
branches: string | null;
|
|
17
|
-
prs: string | null;
|
|
18
|
-
workspaces: string;
|
|
19
|
-
lastCommit: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const repositories: Repository[] = [
|
|
23
|
-
{ name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
|
|
24
|
-
{ name: 'one - 2', branches: null, prs: null, workspaces: 'four - 2', lastCommit: 'five - 2' },
|
|
25
|
-
{ name: 'one - 3', branches: 'two - 3', prs: 'three - 3', workspaces: 'four - 3', lastCommit: 'five - 3' },
|
|
26
|
-
{ name: 'one - 4', branches: 'two - 4', prs: 'null', workspaces: 'four - 4', lastCommit: 'five - 4' },
|
|
27
|
-
{ name: 'one - 5', branches: 'two - 5', prs: 'three - 5', workspaces: 'four - 5', lastCommit: 'five - 5' },
|
|
28
|
-
{ name: 'one - 6', branches: 'two - 6', prs: 'three - 6', workspaces: 'four - 6', lastCommit: 'five - 6' }
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const cols = {
|
|
32
|
-
name: 'Repositories',
|
|
33
|
-
branches: 'Branches',
|
|
34
|
-
prs: 'Pull requests',
|
|
35
|
-
workspaces: 'Workspaces',
|
|
36
|
-
lastCommit: 'Last commit'
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const ouiaId = 'LayoutExample';
|
|
40
|
-
|
|
41
|
-
export const BasicExample: React.FunctionComponent = () => {
|
|
42
|
-
const pagination = useDataViewPagination({ perPage: 5 });
|
|
43
|
-
const { page, perPage } = pagination;
|
|
44
|
-
const selection = useDataViewSelection({});
|
|
45
|
-
const { selected, onSelect, isSelected } = selection;
|
|
46
|
-
|
|
47
|
-
const pageData = useMemo(() => repositories.slice((page - 1) * perPage, ((page - 1) * perPage) + perPage), [ page, perPage ]);
|
|
48
|
-
|
|
49
|
-
const handleBulkSelect = (value: BulkSelectValue) => {
|
|
50
|
-
value === BulkSelectValue.none && onSelect(false);
|
|
51
|
-
value === BulkSelectValue.all && onSelect(true, repositories);
|
|
52
|
-
value === BulkSelectValue.nonePage && onSelect(false, pageData);
|
|
53
|
-
value === BulkSelectValue.page && onSelect(true, pageData);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<DataView>
|
|
58
|
-
<DataViewToolbar
|
|
59
|
-
ouiaId='LayoutExampleHeader'
|
|
60
|
-
bulkSelect={
|
|
61
|
-
<BulkSelect
|
|
62
|
-
canSelectAll
|
|
63
|
-
pageCount={pageData.length}
|
|
64
|
-
totalCount={repositories.length}
|
|
65
|
-
selectedCount={selected.length}
|
|
66
|
-
pageSelected={pageData.every(item => isSelected(item))}
|
|
67
|
-
pagePartiallySelected={pageData.some(item => isSelected(item)) && !pageData.every(item => isSelected(item))}
|
|
68
|
-
onSelect={handleBulkSelect}
|
|
69
|
-
/>
|
|
70
|
-
}
|
|
71
|
-
pagination={
|
|
72
|
-
<Pagination
|
|
73
|
-
perPageOptions={perPageOptions}
|
|
74
|
-
itemCount={repositories.length}
|
|
75
|
-
{...pagination}
|
|
76
|
-
/>
|
|
77
|
-
}
|
|
78
|
-
/>
|
|
79
|
-
<Table aria-label="Repositories table" ouiaId={ouiaId}>
|
|
80
|
-
<Thead data-ouia-component-id={`${ouiaId}-thead`}>
|
|
81
|
-
<Tr ouiaId={`${ouiaId}-tr-head`}>
|
|
82
|
-
<Th key="row-select"/>
|
|
83
|
-
{Object.values(cols).map((column, index) => (
|
|
84
|
-
<Th key={index} data-ouia-component-id={`${ouiaId}-th-${index}`}>{column}</Th>
|
|
85
|
-
))}
|
|
86
|
-
</Tr>
|
|
87
|
-
</Thead>
|
|
88
|
-
<Tbody>
|
|
89
|
-
{pageData.map((repo, rowIndex) => (
|
|
90
|
-
<Tr key={repo.name} ouiaId={`${ouiaId}-tr-${rowIndex}`}>
|
|
91
|
-
<Td
|
|
92
|
-
key={`select-${rowIndex}`}
|
|
93
|
-
select={{
|
|
94
|
-
rowIndex,
|
|
95
|
-
onSelect: (_event, isSelecting) => onSelect(isSelecting, repo),
|
|
96
|
-
isSelected: isSelected(repo),
|
|
97
|
-
isDisabled: false
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
{Object.keys(cols).map((column, colIndex) => (
|
|
101
|
-
<Td key={colIndex} data-ouia-component-id={`${ouiaId}-td-${rowIndex}-${colIndex}`}>{repo[column]}</Td>
|
|
102
|
-
))}
|
|
103
|
-
</Tr>
|
|
104
|
-
))}
|
|
105
|
-
</Tbody>
|
|
106
|
-
</Table>
|
|
107
|
-
<DataViewToolbar
|
|
108
|
-
ouiaId='LayoutExampleFooter'
|
|
109
|
-
pagination={
|
|
110
|
-
<Pagination
|
|
111
|
-
isCompact
|
|
112
|
-
perPageOptions={perPageOptions}
|
|
113
|
-
itemCount={repositories.length}
|
|
114
|
-
{...pagination}
|
|
115
|
-
/>
|
|
116
|
-
}
|
|
117
|
-
/>
|
|
118
|
-
</DataView>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
File without changes
|