@patternfly/react-data-view 5.1.4 → 5.3.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 +8 -0
- package/dist/cjs/DataView/DataView.js +9 -4
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.d.ts +3 -2
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.js +6 -7
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.test.js +8 -1
- package/dist/cjs/DataViewTableTree/DataViewTableTree.d.ts +3 -2
- package/dist/cjs/DataViewTableTree/DataViewTableTree.js +16 -5
- package/dist/cjs/DataViewTableTree/DataViewTableTree.test.js +7 -1
- package/dist/cjs/DataViewToolbar/DataViewToolbar.js +2 -2
- package/dist/cjs/InternalContext/InternalContext.d.ts +2 -0
- package/dist/cjs/InternalContext/InternalContext.js +3 -2
- package/dist/esm/DataView/DataView.d.ts +8 -0
- package/dist/esm/DataView/DataView.js +8 -3
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.d.ts +3 -2
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.js +6 -7
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.test.js +8 -1
- package/dist/esm/DataViewTableTree/DataViewTableTree.d.ts +3 -2
- package/dist/esm/DataViewTableTree/DataViewTableTree.js +16 -5
- package/dist/esm/DataViewTableTree/DataViewTableTree.test.js +7 -1
- package/dist/esm/DataViewToolbar/DataViewToolbar.js +2 -2
- package/dist/esm/InternalContext/InternalContext.d.ts +2 -0
- package/dist/esm/InternalContext/InternalContext.js +3 -2
- package/package.json +5 -5
- package/patternfly-docs/content/extensions/data-view/examples/Components/Components.md +22 -4
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewTableEmptyExample.tsx +11 -8
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewTableErrorExample.tsx +38 -0
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewToolbarActionsExample.tsx +27 -0
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewToolbarExample.tsx +4 -4
- package/patternfly-docs/content/extensions/data-view/examples/Functionality/Functionality.md +1 -2
- package/patternfly-docs/content/extensions/data-view/examples/Layout/Layout.md +1 -1
- package/src/DataView/DataView.tsx +14 -4
- package/src/DataView/__snapshots__/DataView.test.tsx.snap +2 -2
- package/src/DataViewTableBasic/DataViewTableBasic.test.tsx +13 -1
- package/src/DataViewTableBasic/DataViewTableBasic.tsx +42 -39
- package/src/DataViewTableBasic/__snapshots__/DataViewTableBasic.test.tsx.snap +178 -73
- package/src/DataViewTableHeader/__snapshots__/DataViewTableHeader.test.tsx.snap +2 -2
- package/src/DataViewTableTree/DataViewTableTree.test.tsx +13 -1
- package/src/DataViewTableTree/DataViewTableTree.tsx +24 -11
- package/src/DataViewTableTree/__snapshots__/DataViewTableTree.test.tsx.snap +176 -71
- package/src/DataViewToolbar/DataViewToolbar.tsx +7 -3
- package/src/DataViewToolbar/__snapshots__/DataViewToolbar.test.tsx.snap +86 -84
- package/src/InternalContext/InternalContext.tsx +7 -3
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { useInternalContext } from '../InternalContext';
|
|
12
12
|
import { DataViewTableHeader } from '../DataViewTableHeader';
|
|
13
13
|
import { DataViewTh, DataViewTrTree, isDataViewTdObject } from '../DataViewTable';
|
|
14
|
+
import { DataViewState } from '../DataView/DataView';
|
|
14
15
|
|
|
15
16
|
const getDescendants = (node: DataViewTrTree): DataViewTrTree[] => (!node.children || !node.children.length) ? [ node ] : node.children.flatMap(getDescendants);
|
|
16
17
|
|
|
@@ -35,8 +36,8 @@ export interface DataViewTableTreeProps extends Omit<TableProps, 'onSelect' | 'r
|
|
|
35
36
|
columns: DataViewTh[];
|
|
36
37
|
/** Current page rows */
|
|
37
38
|
rows: DataViewTrTree[];
|
|
38
|
-
/**
|
|
39
|
-
|
|
39
|
+
/** States to be displayed when active */
|
|
40
|
+
states?: Partial<Record<DataViewState, React.ReactNode>>
|
|
40
41
|
/** Optional icon for the leaf rows */
|
|
41
42
|
leafIcon?: React.ReactNode;
|
|
42
43
|
/** Optional icon for the expanded parent rows */
|
|
@@ -50,20 +51,20 @@ export interface DataViewTableTreeProps extends Omit<TableProps, 'onSelect' | 'r
|
|
|
50
51
|
export const DataViewTableTree: React.FC<DataViewTableTreeProps> = ({
|
|
51
52
|
columns,
|
|
52
53
|
rows,
|
|
53
|
-
|
|
54
|
+
states = {},
|
|
54
55
|
leafIcon = null,
|
|
55
56
|
expandedIcon = null,
|
|
56
57
|
collapsedIcon = null,
|
|
57
58
|
ouiaId = 'DataViewTableTree',
|
|
58
59
|
...props
|
|
59
60
|
}: DataViewTableTreeProps) => {
|
|
60
|
-
const { selection } = useInternalContext();
|
|
61
|
+
const { selection, activeState } = useInternalContext();
|
|
61
62
|
const { onSelect, isSelected, isSelectDisabled } = selection ?? {};
|
|
62
63
|
const [ expandedNodeIds, setExpandedNodeIds ] = React.useState<string[]>([]);
|
|
63
64
|
const [ expandedDetailsNodeNames, setExpandedDetailsNodeIds ] = React.useState<string[]>([]);
|
|
64
65
|
|
|
65
66
|
const nodes = useMemo(() => {
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
const renderRows = (
|
|
68
69
|
[ node, ...remainingNodes ]: DataViewTrTree[],
|
|
69
70
|
level = 1,
|
|
@@ -134,19 +135,31 @@ export const DataViewTableTree: React.FC<DataViewTableTreeProps> = ({
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
return renderRows(rows);
|
|
137
|
-
}, [
|
|
138
|
+
}, [
|
|
139
|
+
rows,
|
|
140
|
+
expandedNodeIds,
|
|
141
|
+
expandedDetailsNodeNames,
|
|
142
|
+
leafIcon,
|
|
143
|
+
expandedIcon,
|
|
144
|
+
collapsedIcon,
|
|
145
|
+
isSelected,
|
|
146
|
+
onSelect,
|
|
147
|
+
isSelectDisabled,
|
|
148
|
+
ouiaId
|
|
149
|
+
]);
|
|
138
150
|
|
|
139
151
|
return (
|
|
140
152
|
<Table isTreeTable aria-label="Data table" ouiaId={ouiaId} {...props}>
|
|
141
153
|
<DataViewTableHeader isTreeTable columns={columns} ouiaId={ouiaId} />
|
|
142
|
-
<Tbody>
|
|
143
|
-
|
|
144
|
-
<Tr key=
|
|
154
|
+
<Tbody>{
|
|
155
|
+
activeState && Object.keys(states).includes(activeState) ? (
|
|
156
|
+
<Tr key={activeState} ouiaId={`${ouiaId}-tr-${activeState}`}>
|
|
145
157
|
<Td colSpan={columns.length}>
|
|
146
|
-
{
|
|
158
|
+
{states[activeState]}
|
|
147
159
|
</Td>
|
|
148
160
|
</Tr>
|
|
149
|
-
)
|
|
161
|
+
) : nodes
|
|
162
|
+
}
|
|
150
163
|
</Tbody>
|
|
151
164
|
</Table>
|
|
152
165
|
);
|
|
@@ -4,7 +4,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
6
|
class="pf-v5-l-stack"
|
|
7
|
-
data-ouia-component-id="DataView-stack
|
|
7
|
+
data-ouia-component-id="DataView-stack"
|
|
8
8
|
>
|
|
9
9
|
<div
|
|
10
10
|
class="pf-v5-l-stack__item"
|
|
@@ -938,85 +938,190 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
938
938
|
|
|
939
939
|
exports[`DataViewTableTree component should render tree table with an empty state 1`] = `
|
|
940
940
|
<div>
|
|
941
|
-
<
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
data-ouia-component-id="TreeTableExample"
|
|
945
|
-
data-ouia-component-type="PF5/Table"
|
|
946
|
-
data-ouia-safe="true"
|
|
947
|
-
role="treegrid"
|
|
941
|
+
<div
|
|
942
|
+
class="pf-v5-l-stack"
|
|
943
|
+
data-ouia-component-id="DataView-stack"
|
|
948
944
|
>
|
|
949
|
-
<
|
|
950
|
-
class="pf-v5-
|
|
951
|
-
data-ouia-component-id="
|
|
945
|
+
<div
|
|
946
|
+
class="pf-v5-l-stack__item"
|
|
947
|
+
data-ouia-component-id="DataView-stack-item-0"
|
|
952
948
|
>
|
|
953
|
-
<
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
data-ouia-component-
|
|
949
|
+
<table
|
|
950
|
+
aria-label="Repositories table"
|
|
951
|
+
class="pf-v5-c-table pf-m-tree-view-grid-md pf-m-tree-view"
|
|
952
|
+
data-ouia-component-id="TreeTableExample"
|
|
953
|
+
data-ouia-component-type="PF5/Table"
|
|
957
954
|
data-ouia-safe="true"
|
|
955
|
+
role="treegrid"
|
|
958
956
|
>
|
|
959
|
-
<
|
|
960
|
-
class="pf-v5-c-
|
|
961
|
-
data-ouia-component-id="TreeTableExample-
|
|
962
|
-
scope="col"
|
|
963
|
-
tabindex="-1"
|
|
964
|
-
>
|
|
965
|
-
Repositories
|
|
966
|
-
</th>
|
|
967
|
-
<th
|
|
968
|
-
class="pf-v5-c-table__th"
|
|
969
|
-
data-ouia-component-id="TreeTableExample-th-1"
|
|
970
|
-
scope="col"
|
|
971
|
-
tabindex="-1"
|
|
972
|
-
>
|
|
973
|
-
Branches
|
|
974
|
-
</th>
|
|
975
|
-
<th
|
|
976
|
-
class="pf-v5-c-table__th"
|
|
977
|
-
data-ouia-component-id="TreeTableExample-th-2"
|
|
978
|
-
scope="col"
|
|
979
|
-
tabindex="-1"
|
|
980
|
-
>
|
|
981
|
-
Pull requests
|
|
982
|
-
</th>
|
|
983
|
-
<th
|
|
984
|
-
class="pf-v5-c-table__th"
|
|
985
|
-
data-ouia-component-id="TreeTableExample-th-3"
|
|
986
|
-
scope="col"
|
|
987
|
-
tabindex="-1"
|
|
957
|
+
<thead
|
|
958
|
+
class="pf-v5-c-table__thead"
|
|
959
|
+
data-ouia-component-id="TreeTableExample-thead"
|
|
988
960
|
>
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
961
|
+
<tr
|
|
962
|
+
class="pf-v5-c-table__tr"
|
|
963
|
+
data-ouia-component-id="TreeTableExample-tr-head"
|
|
964
|
+
data-ouia-component-type="PF5/TableRow"
|
|
965
|
+
data-ouia-safe="true"
|
|
966
|
+
>
|
|
967
|
+
<th
|
|
968
|
+
class="pf-v5-c-table__th"
|
|
969
|
+
data-ouia-component-id="TreeTableExample-th-0"
|
|
970
|
+
scope="col"
|
|
971
|
+
tabindex="-1"
|
|
972
|
+
>
|
|
973
|
+
Repositories
|
|
974
|
+
</th>
|
|
975
|
+
<th
|
|
976
|
+
class="pf-v5-c-table__th"
|
|
977
|
+
data-ouia-component-id="TreeTableExample-th-1"
|
|
978
|
+
scope="col"
|
|
979
|
+
tabindex="-1"
|
|
980
|
+
>
|
|
981
|
+
Branches
|
|
982
|
+
</th>
|
|
983
|
+
<th
|
|
984
|
+
class="pf-v5-c-table__th"
|
|
985
|
+
data-ouia-component-id="TreeTableExample-th-2"
|
|
986
|
+
scope="col"
|
|
987
|
+
tabindex="-1"
|
|
988
|
+
>
|
|
989
|
+
Pull requests
|
|
990
|
+
</th>
|
|
991
|
+
<th
|
|
992
|
+
class="pf-v5-c-table__th"
|
|
993
|
+
data-ouia-component-id="TreeTableExample-th-3"
|
|
994
|
+
scope="col"
|
|
995
|
+
tabindex="-1"
|
|
996
|
+
>
|
|
997
|
+
Workspaces
|
|
998
|
+
</th>
|
|
999
|
+
<th
|
|
1000
|
+
class="pf-v5-c-table__th"
|
|
1001
|
+
data-ouia-component-id="TreeTableExample-th-4"
|
|
1002
|
+
scope="col"
|
|
1003
|
+
tabindex="-1"
|
|
1004
|
+
>
|
|
1005
|
+
Last commit
|
|
1006
|
+
</th>
|
|
1007
|
+
</tr>
|
|
1008
|
+
</thead>
|
|
1009
|
+
<tbody
|
|
1010
|
+
class="pf-v5-c-table__tbody"
|
|
1011
|
+
role="rowgroup"
|
|
996
1012
|
>
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1013
|
+
<tr
|
|
1014
|
+
class="pf-v5-c-table__tr"
|
|
1015
|
+
data-ouia-component-id="TreeTableExample-tr-empty"
|
|
1016
|
+
data-ouia-component-type="PF5/TableRow"
|
|
1017
|
+
data-ouia-safe="true"
|
|
1018
|
+
>
|
|
1019
|
+
<td
|
|
1020
|
+
class="pf-v5-c-table__td"
|
|
1021
|
+
colspan="5"
|
|
1022
|
+
tabindex="-1"
|
|
1023
|
+
>
|
|
1024
|
+
No data found
|
|
1025
|
+
</td>
|
|
1026
|
+
</tr>
|
|
1027
|
+
</tbody>
|
|
1028
|
+
</table>
|
|
1029
|
+
</div>
|
|
1030
|
+
</div>
|
|
1031
|
+
</div>
|
|
1032
|
+
`;
|
|
1033
|
+
|
|
1034
|
+
exports[`DataViewTableTree component should render tree table with an error state 1`] = `
|
|
1035
|
+
<div>
|
|
1036
|
+
<div
|
|
1037
|
+
class="pf-v5-l-stack"
|
|
1038
|
+
data-ouia-component-id="DataView-stack"
|
|
1039
|
+
>
|
|
1040
|
+
<div
|
|
1041
|
+
class="pf-v5-l-stack__item"
|
|
1042
|
+
data-ouia-component-id="DataView-stack-item-0"
|
|
1004
1043
|
>
|
|
1005
|
-
<
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
data-ouia-component-
|
|
1044
|
+
<table
|
|
1045
|
+
aria-label="Repositories table"
|
|
1046
|
+
class="pf-v5-c-table pf-m-tree-view-grid-md pf-m-tree-view"
|
|
1047
|
+
data-ouia-component-id="TreeTableExample"
|
|
1048
|
+
data-ouia-component-type="PF5/Table"
|
|
1009
1049
|
data-ouia-safe="true"
|
|
1050
|
+
role="treegrid"
|
|
1010
1051
|
>
|
|
1011
|
-
<
|
|
1012
|
-
class="pf-v5-c-
|
|
1013
|
-
|
|
1014
|
-
|
|
1052
|
+
<thead
|
|
1053
|
+
class="pf-v5-c-table__thead"
|
|
1054
|
+
data-ouia-component-id="TreeTableExample-thead"
|
|
1055
|
+
>
|
|
1056
|
+
<tr
|
|
1057
|
+
class="pf-v5-c-table__tr"
|
|
1058
|
+
data-ouia-component-id="TreeTableExample-tr-head"
|
|
1059
|
+
data-ouia-component-type="PF5/TableRow"
|
|
1060
|
+
data-ouia-safe="true"
|
|
1061
|
+
>
|
|
1062
|
+
<th
|
|
1063
|
+
class="pf-v5-c-table__th"
|
|
1064
|
+
data-ouia-component-id="TreeTableExample-th-0"
|
|
1065
|
+
scope="col"
|
|
1066
|
+
tabindex="-1"
|
|
1067
|
+
>
|
|
1068
|
+
Repositories
|
|
1069
|
+
</th>
|
|
1070
|
+
<th
|
|
1071
|
+
class="pf-v5-c-table__th"
|
|
1072
|
+
data-ouia-component-id="TreeTableExample-th-1"
|
|
1073
|
+
scope="col"
|
|
1074
|
+
tabindex="-1"
|
|
1075
|
+
>
|
|
1076
|
+
Branches
|
|
1077
|
+
</th>
|
|
1078
|
+
<th
|
|
1079
|
+
class="pf-v5-c-table__th"
|
|
1080
|
+
data-ouia-component-id="TreeTableExample-th-2"
|
|
1081
|
+
scope="col"
|
|
1082
|
+
tabindex="-1"
|
|
1083
|
+
>
|
|
1084
|
+
Pull requests
|
|
1085
|
+
</th>
|
|
1086
|
+
<th
|
|
1087
|
+
class="pf-v5-c-table__th"
|
|
1088
|
+
data-ouia-component-id="TreeTableExample-th-3"
|
|
1089
|
+
scope="col"
|
|
1090
|
+
tabindex="-1"
|
|
1091
|
+
>
|
|
1092
|
+
Workspaces
|
|
1093
|
+
</th>
|
|
1094
|
+
<th
|
|
1095
|
+
class="pf-v5-c-table__th"
|
|
1096
|
+
data-ouia-component-id="TreeTableExample-th-4"
|
|
1097
|
+
scope="col"
|
|
1098
|
+
tabindex="-1"
|
|
1099
|
+
>
|
|
1100
|
+
Last commit
|
|
1101
|
+
</th>
|
|
1102
|
+
</tr>
|
|
1103
|
+
</thead>
|
|
1104
|
+
<tbody
|
|
1105
|
+
class="pf-v5-c-table__tbody"
|
|
1106
|
+
role="rowgroup"
|
|
1015
1107
|
>
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1108
|
+
<tr
|
|
1109
|
+
class="pf-v5-c-table__tr"
|
|
1110
|
+
data-ouia-component-id="TreeTableExample-tr-error"
|
|
1111
|
+
data-ouia-component-type="PF5/TableRow"
|
|
1112
|
+
data-ouia-safe="true"
|
|
1113
|
+
>
|
|
1114
|
+
<td
|
|
1115
|
+
class="pf-v5-c-table__td"
|
|
1116
|
+
colspan="5"
|
|
1117
|
+
tabindex="-1"
|
|
1118
|
+
>
|
|
1119
|
+
Some error
|
|
1120
|
+
</td>
|
|
1121
|
+
</tr>
|
|
1122
|
+
</tbody>
|
|
1123
|
+
</table>
|
|
1124
|
+
</div>
|
|
1125
|
+
</div>
|
|
1021
1126
|
</div>
|
|
1022
1127
|
`;
|
|
@@ -14,7 +14,7 @@ export interface DataViewToolbarProps extends PropsWithChildren {
|
|
|
14
14
|
actions?: React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export const DataViewToolbar: React.FC<DataViewToolbarProps> = ({ className, ouiaId = 'DataViewToolbar', bulkSelect, actions
|
|
17
|
+
export const DataViewToolbar: React.FC<DataViewToolbarProps> = ({ className, ouiaId = 'DataViewToolbar', bulkSelect, actions, pagination, children, ...props }: DataViewToolbarProps) => (
|
|
18
18
|
<Toolbar ouiaId={ouiaId} className={className} {...props}>
|
|
19
19
|
<ToolbarContent>
|
|
20
20
|
{bulkSelect && (
|
|
@@ -22,7 +22,11 @@ export const DataViewToolbar: React.FC<DataViewToolbarProps> = ({ className, oui
|
|
|
22
22
|
{bulkSelect}
|
|
23
23
|
</ToolbarItem>
|
|
24
24
|
)}
|
|
25
|
-
{actions
|
|
25
|
+
{actions && (
|
|
26
|
+
<ToolbarItem variant={ToolbarItemVariant['overflow-menu']}>
|
|
27
|
+
{actions}
|
|
28
|
+
</ToolbarItem>
|
|
29
|
+
)}
|
|
26
30
|
{pagination && (
|
|
27
31
|
<ToolbarItem variant={ToolbarItemVariant.pagination} data-ouia-component-id={`${ouiaId}-pagination`}>
|
|
28
32
|
{pagination}
|
|
@@ -31,7 +35,7 @@ export const DataViewToolbar: React.FC<DataViewToolbarProps> = ({ className, oui
|
|
|
31
35
|
{children}
|
|
32
36
|
</ToolbarContent>
|
|
33
37
|
</Toolbar>
|
|
34
|
-
)
|
|
38
|
+
)
|
|
35
39
|
|
|
36
40
|
export default DataViewToolbar;
|
|
37
41
|
|
|
@@ -46,53 +46,54 @@ exports[`DataViewToolbar component should render correctly 1`] = `
|
|
|
46
46
|
</b>
|
|
47
47
|
|
|
48
48
|
</div>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
<button
|
|
50
|
+
aria-expanded="false"
|
|
51
|
+
aria-haspopup="listbox"
|
|
52
|
+
class="pf-v5-c-menu-toggle pf-m-plain pf-m-text"
|
|
53
|
+
data-ouia-component-id="OUIA-Generated-MenuToggle-plainText-1"
|
|
54
|
+
data-ouia-component-type="PF5/MenuToggle"
|
|
55
|
+
data-ouia-safe="true"
|
|
56
|
+
id="options-menu-top-toggle"
|
|
57
|
+
type="button"
|
|
58
|
+
>
|
|
59
|
+
<span
|
|
60
|
+
class="pf-v5-c-menu-toggle__text"
|
|
61
|
+
>
|
|
62
|
+
<b>
|
|
63
|
+
1
|
|
64
|
+
-
|
|
65
|
+
10
|
|
66
|
+
</b>
|
|
67
|
+
|
|
68
|
+
of
|
|
69
|
+
|
|
70
|
+
<b>
|
|
71
|
+
0
|
|
72
|
+
</b>
|
|
73
|
+
|
|
74
|
+
</span>
|
|
75
|
+
<span
|
|
76
|
+
class="pf-v5-c-menu-toggle__controls"
|
|
56
77
|
>
|
|
57
78
|
<span
|
|
58
|
-
class="pf-v5-c-menu-
|
|
59
|
-
>
|
|
60
|
-
<b>
|
|
61
|
-
1
|
|
62
|
-
-
|
|
63
|
-
10
|
|
64
|
-
</b>
|
|
65
|
-
|
|
66
|
-
of
|
|
67
|
-
|
|
68
|
-
<b>
|
|
69
|
-
0
|
|
70
|
-
</b>
|
|
71
|
-
|
|
72
|
-
</span>
|
|
73
|
-
<span
|
|
74
|
-
class="pf-v5-c-menu-toggle__controls"
|
|
79
|
+
class="pf-v5-c-menu-toggle__toggle-icon"
|
|
75
80
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
81
|
+
<svg
|
|
82
|
+
aria-hidden="true"
|
|
83
|
+
class="pf-v5-svg"
|
|
84
|
+
fill="currentColor"
|
|
85
|
+
height="1em"
|
|
86
|
+
role="img"
|
|
87
|
+
viewBox="0 0 320 512"
|
|
88
|
+
width="1em"
|
|
78
89
|
>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
height="1em"
|
|
84
|
-
role="img"
|
|
85
|
-
viewBox="0 0 320 512"
|
|
86
|
-
width="1em"
|
|
87
|
-
>
|
|
88
|
-
<path
|
|
89
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
90
|
-
/>
|
|
91
|
-
</svg>
|
|
92
|
-
</span>
|
|
90
|
+
<path
|
|
91
|
+
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
93
94
|
</span>
|
|
94
|
-
</
|
|
95
|
-
</
|
|
95
|
+
</span>
|
|
96
|
+
</button>
|
|
96
97
|
<nav
|
|
97
98
|
aria-label="Pagination"
|
|
98
99
|
class="pf-v5-c-pagination__nav"
|
|
@@ -288,53 +289,54 @@ exports[`DataViewToolbar component should render correctly 1`] = `
|
|
|
288
289
|
</b>
|
|
289
290
|
|
|
290
291
|
</div>
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
<button
|
|
293
|
+
aria-expanded="false"
|
|
294
|
+
aria-haspopup="listbox"
|
|
295
|
+
class="pf-v5-c-menu-toggle pf-m-plain pf-m-text"
|
|
296
|
+
data-ouia-component-id="OUIA-Generated-MenuToggle-plainText-1"
|
|
297
|
+
data-ouia-component-type="PF5/MenuToggle"
|
|
298
|
+
data-ouia-safe="true"
|
|
299
|
+
id="options-menu-top-toggle"
|
|
300
|
+
type="button"
|
|
301
|
+
>
|
|
302
|
+
<span
|
|
303
|
+
class="pf-v5-c-menu-toggle__text"
|
|
304
|
+
>
|
|
305
|
+
<b>
|
|
306
|
+
1
|
|
307
|
+
-
|
|
308
|
+
10
|
|
309
|
+
</b>
|
|
310
|
+
|
|
311
|
+
of
|
|
312
|
+
|
|
313
|
+
<b>
|
|
314
|
+
0
|
|
315
|
+
</b>
|
|
316
|
+
|
|
317
|
+
</span>
|
|
318
|
+
<span
|
|
319
|
+
class="pf-v5-c-menu-toggle__controls"
|
|
298
320
|
>
|
|
299
321
|
<span
|
|
300
|
-
class="pf-v5-c-menu-
|
|
301
|
-
>
|
|
302
|
-
<b>
|
|
303
|
-
1
|
|
304
|
-
-
|
|
305
|
-
10
|
|
306
|
-
</b>
|
|
307
|
-
|
|
308
|
-
of
|
|
309
|
-
|
|
310
|
-
<b>
|
|
311
|
-
0
|
|
312
|
-
</b>
|
|
313
|
-
|
|
314
|
-
</span>
|
|
315
|
-
<span
|
|
316
|
-
class="pf-v5-c-menu-toggle__controls"
|
|
322
|
+
class="pf-v5-c-menu-toggle__toggle-icon"
|
|
317
323
|
>
|
|
318
|
-
<
|
|
319
|
-
|
|
324
|
+
<svg
|
|
325
|
+
aria-hidden="true"
|
|
326
|
+
class="pf-v5-svg"
|
|
327
|
+
fill="currentColor"
|
|
328
|
+
height="1em"
|
|
329
|
+
role="img"
|
|
330
|
+
viewBox="0 0 320 512"
|
|
331
|
+
width="1em"
|
|
320
332
|
>
|
|
321
|
-
<
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
height="1em"
|
|
326
|
-
role="img"
|
|
327
|
-
viewBox="0 0 320 512"
|
|
328
|
-
width="1em"
|
|
329
|
-
>
|
|
330
|
-
<path
|
|
331
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
332
|
-
/>
|
|
333
|
-
</svg>
|
|
334
|
-
</span>
|
|
333
|
+
<path
|
|
334
|
+
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
335
|
+
/>
|
|
336
|
+
</svg>
|
|
335
337
|
</span>
|
|
336
|
-
</
|
|
337
|
-
</
|
|
338
|
+
</span>
|
|
339
|
+
</button>
|
|
338
340
|
<nav
|
|
339
341
|
aria-label="Pagination"
|
|
340
342
|
class="pf-v5-c-pagination__nav"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { createContext, PropsWithChildren, useContext } from 'react';
|
|
2
|
+
import { DataViewState } from '../DataView';
|
|
2
3
|
|
|
3
4
|
export interface DataViewSelection {
|
|
4
5
|
/** Called when the selection of items changes */
|
|
@@ -11,20 +12,23 @@ export interface DataViewSelection {
|
|
|
11
12
|
|
|
12
13
|
export interface InternalContextValue {
|
|
13
14
|
selection?: DataViewSelection;
|
|
15
|
+
activeState?: DataViewState;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const InternalContext = createContext<InternalContextValue>({
|
|
17
|
-
selection: undefined
|
|
19
|
+
selection: undefined,
|
|
20
|
+
activeState: undefined
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
export type InternalProviderProps = PropsWithChildren<InternalContextValue>
|
|
21
24
|
|
|
22
25
|
export const InternalContextProvider: React.FC<InternalProviderProps> = ({
|
|
23
26
|
children,
|
|
24
|
-
selection
|
|
27
|
+
selection,
|
|
28
|
+
activeState
|
|
25
29
|
}) => (
|
|
26
30
|
<InternalContext.Provider
|
|
27
|
-
value={{ selection }}
|
|
31
|
+
value={{ selection, activeState }}
|
|
28
32
|
>
|
|
29
33
|
{children}
|
|
30
34
|
</InternalContext.Provider>
|