@patternfly/react-data-view 5.1.3 → 5.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 +8 -0
- package/dist/cjs/DataView/DataView.js +9 -4
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.d.ts +3 -0
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.js +32 -11
- package/dist/cjs/DataViewTableBasic/DataViewTableBasic.test.js +11 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.d.ts +3 -0
- package/dist/cjs/DataViewTableTree/DataViewTableTree.js +17 -6
- package/dist/cjs/DataViewTableTree/DataViewTableTree.test.js +10 -0
- 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 -0
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.js +9 -8
- package/dist/esm/DataViewTableBasic/DataViewTableBasic.test.js +11 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.d.ts +3 -0
- package/dist/esm/DataViewTableTree/DataViewTableTree.js +18 -7
- package/dist/esm/DataViewTableTree/DataViewTableTree.test.js +10 -0
- package/dist/esm/InternalContext/InternalContext.d.ts +2 -0
- package/dist/esm/InternalContext/InternalContext.js +3 -2
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/data-view/examples/Components/Components.md +18 -3
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewTableEmptyExample.tsx +51 -0
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewTableErrorExample.tsx +38 -0
- package/patternfly-docs/content/extensions/data-view/examples/Components/DataViewTableTreeExample.tsx +11 -9
- 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/DataViewTable/__snapshots__/DataViewTable.test.tsx.snap +6 -6
- package/src/DataViewTableBasic/DataViewTableBasic.test.tsx +19 -0
- package/src/DataViewTableBasic/DataViewTableBasic.tsx +45 -32
- package/src/DataViewTableBasic/__snapshots__/DataViewTableBasic.test.tsx.snap +190 -0
- package/src/DataViewTableHeader/__snapshots__/DataViewTableHeader.test.tsx.snap +2 -2
- package/src/DataViewTableTree/DataViewTableTree.test.tsx +19 -0
- package/src/DataViewTableTree/DataViewTableTree.tsx +30 -6
- package/src/DataViewTableTree/__snapshots__/DataViewTableTree.test.tsx.snap +197 -7
- package/src/InternalContext/InternalContext.tsx +7 -3
|
@@ -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"
|
|
@@ -80,7 +80,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
80
80
|
aria-posinset="1"
|
|
81
81
|
aria-setsize="2"
|
|
82
82
|
class="pf-v5-c-table__tr"
|
|
83
|
-
data-ouia-component-id="
|
|
83
|
+
data-ouia-component-id="TreeTableExample-tr-0"
|
|
84
84
|
data-ouia-component-type="PF5/TableRow"
|
|
85
85
|
data-ouia-safe="true"
|
|
86
86
|
>
|
|
@@ -244,7 +244,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
244
244
|
aria-posinset="1"
|
|
245
245
|
aria-setsize="0"
|
|
246
246
|
class="pf-v5-c-table__tr"
|
|
247
|
-
data-ouia-component-id="
|
|
247
|
+
data-ouia-component-id="TreeTableExample-tr-1"
|
|
248
248
|
data-ouia-component-type="PF5/TableRow"
|
|
249
249
|
data-ouia-safe="true"
|
|
250
250
|
hidden=""
|
|
@@ -376,7 +376,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
376
376
|
aria-posinset="2"
|
|
377
377
|
aria-setsize="0"
|
|
378
378
|
class="pf-v5-c-table__tr"
|
|
379
|
-
data-ouia-component-id="
|
|
379
|
+
data-ouia-component-id="TreeTableExample-tr-2"
|
|
380
380
|
data-ouia-component-type="PF5/TableRow"
|
|
381
381
|
data-ouia-safe="true"
|
|
382
382
|
hidden=""
|
|
@@ -508,7 +508,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
508
508
|
aria-posinset="2"
|
|
509
509
|
aria-setsize="1"
|
|
510
510
|
class="pf-v5-c-table__tr"
|
|
511
|
-
data-ouia-component-id="
|
|
511
|
+
data-ouia-component-id="TreeTableExample-tr-3"
|
|
512
512
|
data-ouia-component-type="PF5/TableRow"
|
|
513
513
|
data-ouia-safe="true"
|
|
514
514
|
>
|
|
@@ -672,7 +672,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
672
672
|
aria-posinset="1"
|
|
673
673
|
aria-setsize="0"
|
|
674
674
|
class="pf-v5-c-table__tr"
|
|
675
|
-
data-ouia-component-id="
|
|
675
|
+
data-ouia-component-id="TreeTableExample-tr-4"
|
|
676
676
|
data-ouia-component-type="PF5/TableRow"
|
|
677
677
|
data-ouia-safe="true"
|
|
678
678
|
hidden=""
|
|
@@ -804,7 +804,7 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
804
804
|
aria-posinset="3"
|
|
805
805
|
aria-setsize="0"
|
|
806
806
|
class="pf-v5-c-table__tr"
|
|
807
|
-
data-ouia-component-id="
|
|
807
|
+
data-ouia-component-id="TreeTableExample-tr-5"
|
|
808
808
|
data-ouia-component-type="PF5/TableRow"
|
|
809
809
|
data-ouia-safe="true"
|
|
810
810
|
>
|
|
@@ -935,3 +935,193 @@ exports[`DataViewTableTree component should render the tree table correctly 1`]
|
|
|
935
935
|
</div>
|
|
936
936
|
</div>
|
|
937
937
|
`;
|
|
938
|
+
|
|
939
|
+
exports[`DataViewTableTree component should render tree table with an empty state 1`] = `
|
|
940
|
+
<div>
|
|
941
|
+
<div
|
|
942
|
+
class="pf-v5-l-stack"
|
|
943
|
+
data-ouia-component-id="DataView-stack"
|
|
944
|
+
>
|
|
945
|
+
<div
|
|
946
|
+
class="pf-v5-l-stack__item"
|
|
947
|
+
data-ouia-component-id="DataView-stack-item-0"
|
|
948
|
+
>
|
|
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"
|
|
954
|
+
data-ouia-safe="true"
|
|
955
|
+
role="treegrid"
|
|
956
|
+
>
|
|
957
|
+
<thead
|
|
958
|
+
class="pf-v5-c-table__thead"
|
|
959
|
+
data-ouia-component-id="TreeTableExample-thead"
|
|
960
|
+
>
|
|
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"
|
|
1012
|
+
>
|
|
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"
|
|
1043
|
+
>
|
|
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"
|
|
1049
|
+
data-ouia-safe="true"
|
|
1050
|
+
role="treegrid"
|
|
1051
|
+
>
|
|
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"
|
|
1107
|
+
>
|
|
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>
|
|
1126
|
+
</div>
|
|
1127
|
+
`;
|
|
@@ -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>
|