@fluentui/react-tree 9.2.1 → 9.3.1
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.json +201 -1
- package/CHANGELOG.md +51 -2
- package/dist/index.d.ts +13 -2
- package/lib/components/FlatTree/useFlatTree.js +57 -2
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatTreeNavigation.js +28 -14
- package/lib/components/FlatTree/useFlatTreeNavigation.js.map +1 -1
- package/lib/components/FlatTree/useHeadlessFlatTree.js +16 -16
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/useTree.js +7 -7
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +51 -25
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +2 -3
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/hooks/useRootTree.js +24 -78
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/utils/createHTMLElementWalker.js +2 -3
- package/lib/utils/createHTMLElementWalker.js.map +1 -1
- package/lib/utils/createHeadlessTree.js +5 -3
- package/lib/utils/createHeadlessTree.js.map +1 -1
- package/lib/utils/flattenTree.js +1 -2
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/normalizeOpenItems.js +1 -2
- package/lib/utils/normalizeOpenItems.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTree.js +57 -2
- package/lib-commonjs/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js +27 -13
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js +16 -16
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTree.js +7 -7
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +50 -24
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +2 -3
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/hooks/useRootTree.js +24 -78
- package/lib-commonjs/hooks/useRootTree.js.map +1 -1
- package/lib-commonjs/utils/createHTMLElementWalker.js +2 -3
- package/lib-commonjs/utils/createHTMLElementWalker.js.map +1 -1
- package/lib-commonjs/utils/createHeadlessTree.js +5 -3
- package/lib-commonjs/utils/createHeadlessTree.js.map +1 -1
- package/lib-commonjs/utils/flattenTree.js +1 -2
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.js +1 -2
- package/lib-commonjs/utils/normalizeOpenItems.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,207 @@
|
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 26 Sep 2023 17:44:20 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tree_v9.3.1",
|
|
7
|
+
"version": "9.3.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "yuanboxue@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-tree",
|
|
13
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
|
|
14
|
+
"comment": "chore: trigger manual version bump after broken release"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-tree",
|
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.6",
|
|
20
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-tree",
|
|
25
|
+
"comment": "Bump @fluentui/react-aria to v9.3.38",
|
|
26
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-tree",
|
|
31
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.34",
|
|
32
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-tree",
|
|
37
|
+
"comment": "Bump @fluentui/react-button to v9.3.43",
|
|
38
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-tree",
|
|
43
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.44",
|
|
44
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-tree",
|
|
49
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.36",
|
|
50
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-tree",
|
|
55
|
+
"comment": "Bump @fluentui/react-portal to v9.3.18",
|
|
56
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "beachball",
|
|
60
|
+
"package": "@fluentui/react-tree",
|
|
61
|
+
"comment": "Bump @fluentui/react-radio to v9.1.44",
|
|
62
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"author": "beachball",
|
|
66
|
+
"package": "@fluentui/react-tree",
|
|
67
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
|
|
68
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"author": "beachball",
|
|
72
|
+
"package": "@fluentui/react-tree",
|
|
73
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.1",
|
|
74
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"author": "beachball",
|
|
78
|
+
"package": "@fluentui/react-tree",
|
|
79
|
+
"comment": "Bump @fluentui/react-theme to v9.1.14",
|
|
80
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"author": "beachball",
|
|
84
|
+
"package": "@fluentui/react-tree",
|
|
85
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.5",
|
|
86
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"author": "beachball",
|
|
90
|
+
"package": "@fluentui/react-tree",
|
|
91
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
|
|
92
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"date": "Tue, 26 Sep 2023 15:31:41 GMT",
|
|
99
|
+
"tag": "@fluentui/react-tree_v9.3.0",
|
|
100
|
+
"version": "9.3.0",
|
|
101
|
+
"comments": {
|
|
102
|
+
"minor": [
|
|
103
|
+
{
|
|
104
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
105
|
+
"package": "@fluentui/react-tree",
|
|
106
|
+
"commit": "aef09fc324e71a15a10a6a3c1c7ed556e2775725",
|
|
107
|
+
"comment": "feat: FlatTree supports navigation without useHeadlessFlatTree"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"author": "beachball",
|
|
111
|
+
"package": "@fluentui/react-tree",
|
|
112
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.5",
|
|
113
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"author": "beachball",
|
|
117
|
+
"package": "@fluentui/react-tree",
|
|
118
|
+
"comment": "Bump @fluentui/react-aria to v9.3.37",
|
|
119
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"author": "beachball",
|
|
123
|
+
"package": "@fluentui/react-tree",
|
|
124
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.33",
|
|
125
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"author": "beachball",
|
|
129
|
+
"package": "@fluentui/react-tree",
|
|
130
|
+
"comment": "Bump @fluentui/react-button to v9.3.42",
|
|
131
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"author": "beachball",
|
|
135
|
+
"package": "@fluentui/react-tree",
|
|
136
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.43",
|
|
137
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"author": "beachball",
|
|
141
|
+
"package": "@fluentui/react-tree",
|
|
142
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.35",
|
|
143
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"author": "beachball",
|
|
147
|
+
"package": "@fluentui/react-tree",
|
|
148
|
+
"comment": "Bump @fluentui/react-portal to v9.3.17",
|
|
149
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"author": "beachball",
|
|
153
|
+
"package": "@fluentui/react-tree",
|
|
154
|
+
"comment": "Bump @fluentui/react-radio to v9.1.43",
|
|
155
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"author": "beachball",
|
|
159
|
+
"package": "@fluentui/react-tree",
|
|
160
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
|
|
161
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"author": "beachball",
|
|
165
|
+
"package": "@fluentui/react-tree",
|
|
166
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.0",
|
|
167
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"author": "beachball",
|
|
171
|
+
"package": "@fluentui/react-tree",
|
|
172
|
+
"comment": "Bump @fluentui/react-theme to v9.1.13",
|
|
173
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"author": "beachball",
|
|
177
|
+
"package": "@fluentui/react-tree",
|
|
178
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.4",
|
|
179
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"author": "beachball",
|
|
183
|
+
"package": "@fluentui/react-tree",
|
|
184
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
|
|
185
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"patch": [
|
|
189
|
+
{
|
|
190
|
+
"author": "martinhochel@microsoft.com",
|
|
191
|
+
"package": "@fluentui/react-tree",
|
|
192
|
+
"commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
|
|
193
|
+
"comment": "fix: bump swc core to mitigate transpilation memory leaks"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"author": "ololubek@microsoft.com",
|
|
197
|
+
"package": "@fluentui/react-tree",
|
|
198
|
+
"commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
|
|
199
|
+
"comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"date": "Wed, 20 Sep 2023 17:47:45 GMT",
|
|
6
206
|
"tag": "@fluentui/react-tree_v9.2.1",
|
|
7
207
|
"version": "9.2.1",
|
|
8
208
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 26 Sep 2023 17:44:20 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.1)
|
|
8
|
+
|
|
9
|
+
Tue, 26 Sep 2023 17:44:20 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.3.0..@fluentui/react-tree_v9.3.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v9.0.6 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.3.38 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
17
|
+
- Bump @fluentui/react-avatar to v9.5.34 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
18
|
+
- Bump @fluentui/react-button to v9.3.43 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
19
|
+
- Bump @fluentui/react-checkbox to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
20
|
+
- Bump @fluentui/react-context-selector to v9.1.36 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
21
|
+
- Bump @fluentui/react-portal to v9.3.18 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
22
|
+
- Bump @fluentui/react-radio to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
23
|
+
- Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
25
|
+
- Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
27
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
28
|
+
|
|
29
|
+
## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.0)
|
|
30
|
+
|
|
31
|
+
Tue, 26 Sep 2023 15:31:41 GMT
|
|
32
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.1..@fluentui/react-tree_v9.3.0)
|
|
33
|
+
|
|
34
|
+
### Minor changes
|
|
35
|
+
|
|
36
|
+
- feat: FlatTree supports navigation without useHeadlessFlatTree ([PR #29091](https://github.com/microsoft/fluentui/pull/29091) by bernardo.sunderhus@gmail.com)
|
|
37
|
+
- Bump @fluentui/keyboard-keys to v9.0.5 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
38
|
+
- Bump @fluentui/react-aria to v9.3.37 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
39
|
+
- Bump @fluentui/react-avatar to v9.5.33 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
40
|
+
- Bump @fluentui/react-button to v9.3.42 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
41
|
+
- Bump @fluentui/react-checkbox to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
42
|
+
- Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
43
|
+
- Bump @fluentui/react-portal to v9.3.17 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
44
|
+
- Bump @fluentui/react-radio to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
45
|
+
- Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
46
|
+
- Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
47
|
+
- Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
48
|
+
- Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
49
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
50
|
+
|
|
51
|
+
### Patches
|
|
52
|
+
|
|
53
|
+
- fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
|
|
54
|
+
- chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
|
|
55
|
+
|
|
7
56
|
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.2.1)
|
|
8
57
|
|
|
9
|
-
Wed, 20 Sep 2023 17:
|
|
58
|
+
Wed, 20 Sep 2023 17:47:45 GMT
|
|
10
59
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.0..@fluentui/react-tree_v9.2.1)
|
|
11
60
|
|
|
12
61
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -270,7 +270,7 @@ declare type HeadlessTreeItem<Props extends HeadlessTreeItemProps> = {
|
|
|
270
270
|
value: TreeItemValue;
|
|
271
271
|
parentValue: TreeItemValue | undefined;
|
|
272
272
|
itemType: TreeItemType;
|
|
273
|
-
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> &
|
|
273
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Props;
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
@@ -618,13 +618,23 @@ export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
|
618
618
|
*/
|
|
619
619
|
open?: boolean;
|
|
620
620
|
onOpenChange?: (e: TreeItemOpenChangeEvent, data: TreeItemOpenChangeData) => void;
|
|
621
|
+
/**
|
|
622
|
+
* This property is inferred through context on a nested tree, and required for a flat tree.
|
|
623
|
+
*/
|
|
624
|
+
parentValue?: TreeItemValue;
|
|
621
625
|
};
|
|
622
626
|
|
|
623
627
|
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
624
628
|
|
|
625
629
|
declare type TreeItemRequest = {
|
|
626
630
|
itemType: TreeItemType;
|
|
627
|
-
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'>
|
|
631
|
+
} & ((OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> & {
|
|
632
|
+
requestType: 'open';
|
|
633
|
+
}) | (TreeNavigationData_unstable & {
|
|
634
|
+
requestType: 'navigate';
|
|
635
|
+
}) | (OmitWithoutExpanding<TreeCheckedChangeData, 'selectionMode' | 'checkedItems'> & {
|
|
636
|
+
requestType: 'selection';
|
|
637
|
+
}));
|
|
628
638
|
|
|
629
639
|
export declare type TreeItemSlots = {
|
|
630
640
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
@@ -647,6 +657,7 @@ export declare type TreeItemValue = string | number;
|
|
|
647
657
|
export declare type TreeNavigationData_unstable = {
|
|
648
658
|
target: HTMLElement;
|
|
649
659
|
value: TreeItemValue;
|
|
660
|
+
parentValue: TreeItemValue | undefined;
|
|
650
661
|
} & ({
|
|
651
662
|
event: React_2.MouseEvent<HTMLElement>;
|
|
652
663
|
type: 'Click';
|
|
@@ -1,8 +1,63 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRootTree } from '../../hooks/useRootTree';
|
|
3
|
+
import { useFlatTreeNavigation } from './useFlatTreeNavigation';
|
|
4
|
+
import { createHTMLElementWalker } from '../../utils/createHTMLElementWalker';
|
|
5
|
+
import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
6
|
+
import { treeItemFilter } from '../../utils/treeItemFilter';
|
|
7
|
+
import { slot, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
|
8
|
+
import { useTreeContext_unstable } from '../../contexts/treeContext';
|
|
9
|
+
import { useSubtree } from '../../hooks/useSubtree';
|
|
3
10
|
export const useFlatTree_unstable = (props, ref)=>{
|
|
11
|
+
const level = useTreeContext_unstable((ctx)=>ctx.level);
|
|
12
|
+
// as level is static, this doesn't break rule of hooks
|
|
13
|
+
// and if this becomes an issue later on, this can be easily converted
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
return level > 1 ? useSubFlatTree(props, ref) : useRootFlatTree(props, ref);
|
|
16
|
+
};
|
|
17
|
+
function useRootFlatTree(props, ref) {
|
|
18
|
+
const { navigate, initialize } = useFlatTreeNavigation();
|
|
19
|
+
const walkerRef = React.useRef();
|
|
20
|
+
const { targetDocument } = useFluent_unstable();
|
|
21
|
+
const initializeWalker = React.useCallback((root)=>{
|
|
22
|
+
if (root && targetDocument) {
|
|
23
|
+
walkerRef.current = createHTMLElementWalker(root, targetDocument, treeItemFilter);
|
|
24
|
+
initialize(walkerRef.current);
|
|
25
|
+
}
|
|
26
|
+
}, [
|
|
27
|
+
initialize,
|
|
28
|
+
targetDocument
|
|
29
|
+
]);
|
|
30
|
+
const handleNavigation = useEventCallback((event, data)=>{
|
|
31
|
+
var _props_onNavigation;
|
|
32
|
+
(_props_onNavigation = props.onNavigation) === null || _props_onNavigation === void 0 ? void 0 : _props_onNavigation.call(props, event, data);
|
|
33
|
+
if (walkerRef.current && !event.isDefaultPrevented()) {
|
|
34
|
+
navigate(data, walkerRef.current);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
4
37
|
return {
|
|
5
38
|
treeType: 'flat',
|
|
6
|
-
...useRootTree(
|
|
39
|
+
...useRootTree({
|
|
40
|
+
...props,
|
|
41
|
+
onNavigation: handleNavigation
|
|
42
|
+
}, useMergedRefs(ref, initializeWalker))
|
|
7
43
|
};
|
|
8
|
-
}
|
|
44
|
+
}
|
|
45
|
+
function useSubFlatTree(props, ref) {
|
|
46
|
+
if (process.env.NODE_ENV === 'development') {
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.error(`@fluentui/react-tree [useFlatTree]:
|
|
49
|
+
Subtrees are not allowed in a FlatTree!
|
|
50
|
+
You cannot use a <FlatTree> component inside of another <FlatTree> component.`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
...useSubtree(props, ref),
|
|
54
|
+
open: false,
|
|
55
|
+
treeType: 'flat',
|
|
56
|
+
components: {
|
|
57
|
+
root: React.Fragment
|
|
58
|
+
},
|
|
59
|
+
root: slot.always(undefined, {
|
|
60
|
+
elementType: React.Fragment
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useFlatTree.ts"],"sourcesContent":["import * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport { FlatTreeProps, FlatTreeState } from './FlatTree.types';\n\nexport const useFlatTree_unstable = (props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState => {\n return {\n treeType: 'flat',\n ...useRootTree(props, ref),\n };\n};\n"],"names":["React","useRootTree","useFlatTree_unstable","props","ref","treeType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"sources":["useFlatTree.ts"],"sourcesContent":["import * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport { FlatTreeProps, FlatTreeSlots, FlatTreeState } from './FlatTree.types';\nimport { useFlatTreeNavigation } from './useFlatTreeNavigation';\nimport { HTMLElementWalker, createHTMLElementWalker } from '../../utils/createHTMLElementWalker';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { treeItemFilter } from '../../utils/treeItemFilter';\nimport { ExtractSlotProps, slot, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TreeNavigationData_unstable, TreeNavigationEvent_unstable } from '../Tree/Tree.types';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { useSubtree } from '../../hooks/useSubtree';\n\nexport const useFlatTree_unstable: (props: FlatTreeProps, ref: React.Ref<HTMLElement>) => FlatTreeState = (\n props,\n ref,\n) => {\n const level = useTreeContext_unstable(ctx => ctx.level);\n // as level is static, this doesn't break rule of hooks\n // and if this becomes an issue later on, this can be easily converted\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return level > 1 ? useSubFlatTree(props, ref) : useRootFlatTree(props, ref);\n};\n\nfunction useRootFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n const { navigate, initialize } = useFlatTreeNavigation();\n const walkerRef = React.useRef<HTMLElementWalker>();\n const { targetDocument } = useFluent_unstable();\n\n const initializeWalker = React.useCallback(\n (root: HTMLElement | null) => {\n if (root && targetDocument) {\n walkerRef.current = createHTMLElementWalker(root, targetDocument, treeItemFilter);\n initialize(walkerRef.current);\n }\n },\n [initialize, targetDocument],\n );\n\n const handleNavigation = useEventCallback(\n (event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable) => {\n props.onNavigation?.(event, data);\n if (walkerRef.current && !event.isDefaultPrevented()) {\n navigate(data, walkerRef.current);\n }\n },\n );\n\n return {\n treeType: 'flat',\n ...useRootTree({ ...props, onNavigation: handleNavigation }, useMergedRefs(ref, initializeWalker)),\n };\n}\n\nfunction useSubFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(/* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTree]:\n Subtrees are not allowed in a FlatTree!\n You cannot use a <FlatTree> component inside of another <FlatTree> component.\n `);\n }\n return {\n ...useSubtree(props, ref),\n open: false,\n treeType: 'flat',\n components: { root: React.Fragment },\n root: slot.always<ExtractSlotProps<FlatTreeSlots['root']>>(undefined, { elementType: React.Fragment }),\n };\n}\n"],"names":["React","useRootTree","useFlatTreeNavigation","createHTMLElementWalker","useFluent_unstable","treeItemFilter","slot","useEventCallback","useMergedRefs","useTreeContext_unstable","useSubtree","useFlatTree_unstable","props","ref","level","ctx","useSubFlatTree","useRootFlatTree","navigate","initialize","walkerRef","useRef","targetDocument","initializeWalker","useCallback","root","current","handleNavigation","event","data","onNavigation","isDefaultPrevented","treeType","process","env","NODE_ENV","console","error","open","components","Fragment","always","undefined","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAQ,0BAA0B;AAEtD,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAA4BC,uBAAuB,QAAQ,sCAAsC;AACjG,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAA2BC,IAAI,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAEpG,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,OAAO,MAAMC,uBAA6F,CACxGC,OACAC;IAEA,MAAMC,QAAQL,wBAAwBM,CAAAA,MAAOA,IAAID,KAAK;IACtD,uDAAuD;IACvD,sEAAsE;IACtE,sDAAsD;IACtD,OAAOA,QAAQ,IAAIE,eAAeJ,OAAOC,OAAOI,gBAAgBL,OAAOC;AACzE,EAAE;AAEF,SAASI,gBAAgBL,KAAoB,EAAEC,GAA2B;IACxE,MAAM,EAAEK,QAAQ,EAAEC,UAAU,EAAE,GAAGjB;IACjC,MAAMkB,YAAYpB,MAAMqB,MAAM;IAC9B,MAAM,EAAEC,cAAc,EAAE,GAAGlB;IAE3B,MAAMmB,mBAAmBvB,MAAMwB,WAAW,CACxC,CAACC;QACC,IAAIA,QAAQH,gBAAgB;YAC1BF,UAAUM,OAAO,GAAGvB,wBAAwBsB,MAAMH,gBAAgBjB;YAClEc,WAAWC,UAAUM,OAAO;QAC9B;IACF,GACA;QAACP;QAAYG;KAAe;IAG9B,MAAMK,mBAAmBpB,iBACvB,CAACqB,OAAqCC;YACpCjB;SAAAA,sBAAAA,MAAMkB,YAAY,cAAlBlB,0CAAAA,yBAAAA,OAAqBgB,OAAOC;QAC5B,IAAIT,UAAUM,OAAO,IAAI,CAACE,MAAMG,kBAAkB,IAAI;YACpDb,SAASW,MAAMT,UAAUM,OAAO;QAClC;IACF;IAGF,OAAO;QACLM,UAAU;QACV,GAAG/B,YAAY;YAAE,GAAGW,KAAK;YAAEkB,cAAcH;QAAiB,GAAGnB,cAAcK,KAAKU,kBAAkB;IACpG;AACF;AAEA,SAASP,eAAeJ,KAAoB,EAAEC,GAA2B;IACvE,IAAIoB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,sCAAsC;QACtCC,QAAQC,KAAK,CAAsB,CAAC;;6EAIpC,CAAC;IACH;IACA,OAAO;QACL,GAAG3B,WAAWE,OAAOC,IAAI;QACzByB,MAAM;QACNN,UAAU;QACVO,YAAY;YAAEd,MAAMzB,MAAMwC,QAAQ;QAAC;QACnCf,MAAMnB,KAAKmC,MAAM,CAA0CC,WAAW;YAAEC,aAAa3C,MAAMwC,QAAQ;QAAC;IACtG;AACF"}
|
|
@@ -4,8 +4,8 @@ import { nextTypeAheadElement } from '../../utils/nextTypeAheadElement';
|
|
|
4
4
|
import { treeDataTypes } from '../../utils/tokens';
|
|
5
5
|
import { treeItemFilter } from '../../utils/treeItemFilter';
|
|
6
6
|
import { useRovingTabIndex } from '../../hooks/useRovingTabIndexes';
|
|
7
|
-
import { dataTreeItemValueAttrName
|
|
8
|
-
export function useFlatTreeNavigation(
|
|
7
|
+
import { dataTreeItemValueAttrName } from '../../utils/getTreeItemValueFromElement';
|
|
8
|
+
export function useFlatTreeNavigation() {
|
|
9
9
|
const { targetDocument } = useFluent_unstable();
|
|
10
10
|
const { rove, initialize } = useRovingTabIndex(treeItemFilter);
|
|
11
11
|
function getNextElement(data, walker) {
|
|
@@ -19,10 +19,30 @@ export function useFlatTreeNavigation(virtualTree) {
|
|
|
19
19
|
walker.currentElement = data.target;
|
|
20
20
|
return nextTypeAheadElement(walker, data.event.key);
|
|
21
21
|
case treeDataTypes.ArrowLeft:
|
|
22
|
-
|
|
22
|
+
{
|
|
23
|
+
const nextElement = parentElement(data.parentValue, walker);
|
|
24
|
+
if (!nextElement && process.env.NODE_ENV !== 'production') {
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.warn(`@fluentui/react-tree [useFlatTreeNavigation]:
|
|
27
|
+
\'ArrowLeft\' navigation was not possible.
|
|
28
|
+
No parent element found for the current element:`, data.target);
|
|
29
|
+
}
|
|
30
|
+
return nextElement;
|
|
31
|
+
}
|
|
23
32
|
case treeDataTypes.ArrowRight:
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
{
|
|
34
|
+
walker.currentElement = data.target;
|
|
35
|
+
const nextElement = firstChild(data.target, walker);
|
|
36
|
+
if (!nextElement && process.env.NODE_ENV !== 'production') {
|
|
37
|
+
const ariaLevel = Number(data.target.getAttribute('aria-level'));
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.warn(`@fluentui/react-tree [useFlatTreeNavigation]:
|
|
40
|
+
\'ArrowRight\' navigation was not possible.
|
|
41
|
+
No element with "aria-posinset=1" and "aria-level=${ariaLevel + 1}"
|
|
42
|
+
was found after the current element!`, data.target);
|
|
43
|
+
}
|
|
44
|
+
return nextElement;
|
|
45
|
+
}
|
|
26
46
|
case treeDataTypes.End:
|
|
27
47
|
walker.currentElement = walker.root;
|
|
28
48
|
return walker.lastChild();
|
|
@@ -61,15 +81,9 @@ function firstChild(target, treeWalker) {
|
|
|
61
81
|
}
|
|
62
82
|
return null;
|
|
63
83
|
}
|
|
64
|
-
function parentElement(
|
|
65
|
-
|
|
66
|
-
const value = getTreeItemValueFromElement(target);
|
|
67
|
-
if (value === null) {
|
|
84
|
+
function parentElement(parentValue, treeWalker) {
|
|
85
|
+
if (parentValue === undefined) {
|
|
68
86
|
return null;
|
|
69
87
|
}
|
|
70
|
-
|
|
71
|
-
if ((_virtualTreeItem = virtualTreeItem) === null || _virtualTreeItem === void 0 ? void 0 : _virtualTreeItem.parentValue) {
|
|
72
|
-
return treeWalker.root.querySelector(`[${dataTreeItemValueAttrName}="${virtualTreeItem.parentValue}"]`);
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
88
|
+
return treeWalker.root.querySelector(`[${dataTreeItemValueAttrName}="${parentValue}"]`);
|
|
75
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useFlatTreeNavigation.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { TreeNavigationData_unstable } from '../../Tree';\nimport {
|
|
1
|
+
{"version":3,"sources":["useFlatTreeNavigation.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { TreeNavigationData_unstable } from '../../Tree';\nimport { nextTypeAheadElement } from '../../utils/nextTypeAheadElement';\nimport { treeDataTypes } from '../../utils/tokens';\nimport { treeItemFilter } from '../../utils/treeItemFilter';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndexes';\nimport { HTMLElementWalker } from '../../utils/createHTMLElementWalker';\nimport { TreeItemValue } from '../../TreeItem';\nimport { dataTreeItemValueAttrName } from '../../utils/getTreeItemValueFromElement';\n\nexport function useFlatTreeNavigation() {\n const { targetDocument } = useFluent_unstable();\n const { rove, initialize } = useRovingTabIndex(treeItemFilter);\n\n function getNextElement(data: TreeNavigationData_unstable, walker: HTMLElementWalker) {\n if (!targetDocument) {\n return null;\n }\n switch (data.type) {\n case treeDataTypes.Click:\n return data.target;\n case treeDataTypes.TypeAhead:\n walker.currentElement = data.target;\n return nextTypeAheadElement(walker, data.event.key);\n case treeDataTypes.ArrowLeft: {\n const nextElement = parentElement(data.parentValue, walker);\n if (!nextElement && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n /* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTreeNavigation]:\n \\'ArrowLeft\\' navigation was not possible.\n No parent element found for the current element:\n `,\n data.target,\n );\n }\n return nextElement;\n }\n case treeDataTypes.ArrowRight: {\n walker.currentElement = data.target;\n const nextElement = firstChild(data.target, walker);\n if (!nextElement && process.env.NODE_ENV !== 'production') {\n const ariaLevel = Number(data.target.getAttribute('aria-level'));\n // eslint-disable-next-line no-console\n console.warn(\n /* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTreeNavigation]:\n \\'ArrowRight\\' navigation was not possible.\n No element with \"aria-posinset=1\" and \"aria-level=${ariaLevel + 1}\"\n was found after the current element!\n `,\n data.target,\n );\n }\n return nextElement;\n }\n case treeDataTypes.End:\n walker.currentElement = walker.root;\n return walker.lastChild();\n case treeDataTypes.Home:\n walker.currentElement = walker.root;\n return walker.firstChild();\n case treeDataTypes.ArrowDown:\n walker.currentElement = data.target;\n return walker.nextElement();\n case treeDataTypes.ArrowUp:\n walker.currentElement = data.target;\n return walker.previousElement();\n }\n }\n const navigate = useEventCallback((data: TreeNavigationData_unstable, walker: HTMLElementWalker) => {\n const nextElement = getNextElement(data, walker);\n if (nextElement) {\n rove(nextElement);\n }\n });\n return { navigate, initialize } as const;\n}\n\nfunction firstChild(target: HTMLElement, treeWalker: HTMLElementWalker): HTMLElement | null {\n const nextElement = treeWalker.nextElement();\n if (!nextElement) {\n return null;\n }\n const nextElementAriaPosInSet = nextElement.getAttribute('aria-posinset');\n const nextElementAriaLevel = nextElement.getAttribute('aria-level');\n const targetAriaLevel = target.getAttribute('aria-level');\n if (nextElementAriaPosInSet === '1' && Number(nextElementAriaLevel) === Number(targetAriaLevel) + 1) {\n return nextElement;\n }\n return null;\n}\n\nfunction parentElement(parentValue: TreeItemValue | undefined, treeWalker: HTMLElementWalker) {\n if (parentValue === undefined) {\n return null;\n }\n return treeWalker.root.querySelector<HTMLElement>(`[${dataTreeItemValueAttrName}=\"${parentValue}\"]`);\n}\n"],"names":["useFluent_unstable","useEventCallback","nextTypeAheadElement","treeDataTypes","treeItemFilter","useRovingTabIndex","dataTreeItemValueAttrName","useFlatTreeNavigation","targetDocument","rove","initialize","getNextElement","data","walker","type","Click","target","TypeAhead","currentElement","event","key","ArrowLeft","nextElement","parentElement","parentValue","process","env","NODE_ENV","console","warn","ArrowRight","firstChild","ariaLevel","Number","getAttribute","End","root","lastChild","Home","ArrowDown","ArrowUp","previousElement","navigate","treeWalker","nextElementAriaPosInSet","nextElementAriaLevel","targetAriaLevel","undefined","querySelector"],"mappings":"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"}
|
|
@@ -26,7 +26,7 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
26
26
|
]);
|
|
27
27
|
const [openItems, setOpenItems] = useControllableOpenItems(options);
|
|
28
28
|
const [checkedItems, setCheckedItems] = useFlatControllableCheckedItems(options, headlessTree);
|
|
29
|
-
const { initialize, navigate } = useFlatTreeNavigation(
|
|
29
|
+
const { initialize, navigate } = useFlatTreeNavigation();
|
|
30
30
|
const { targetDocument } = useFluent_unstable();
|
|
31
31
|
const walkerRef = React.useRef();
|
|
32
32
|
const initializeWalker = React.useCallback((root)=>{
|
|
@@ -40,30 +40,23 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
40
40
|
]);
|
|
41
41
|
const treeRef = React.useRef(null);
|
|
42
42
|
const handleOpenChange = useEventCallback((event, data)=>{
|
|
43
|
-
var _options_onOpenChange
|
|
43
|
+
var _options_onOpenChange;
|
|
44
44
|
const nextOpenItems = createNextOpenItems(data, openItems);
|
|
45
|
-
(_options_onOpenChange =
|
|
45
|
+
(_options_onOpenChange = options.onOpenChange) === null || _options_onOpenChange === void 0 ? void 0 : _options_onOpenChange.call(options, event, {
|
|
46
46
|
...data,
|
|
47
47
|
openItems: nextOpenItems.dangerouslyGetInternalSet_unstable()
|
|
48
48
|
});
|
|
49
49
|
setOpenItems(nextOpenItems);
|
|
50
50
|
});
|
|
51
51
|
const handleCheckedChange = useEventCallback((event, data)=>{
|
|
52
|
-
var _options_onCheckedChange
|
|
52
|
+
var _options_onCheckedChange;
|
|
53
53
|
const nextCheckedItems = createNextFlatCheckedItems(data, checkedItems, headlessTree);
|
|
54
|
-
(_options_onCheckedChange =
|
|
54
|
+
(_options_onCheckedChange = options.onCheckedChange) === null || _options_onCheckedChange === void 0 ? void 0 : _options_onCheckedChange.call(options, event, {
|
|
55
55
|
...data,
|
|
56
56
|
checkedItems: nextCheckedItems.dangerouslyGetInternalMap_unstable()
|
|
57
57
|
});
|
|
58
58
|
setCheckedItems(nextCheckedItems);
|
|
59
59
|
});
|
|
60
|
-
const handleNavigation = useEventCallback((event, data)=>{
|
|
61
|
-
var _options_onNavigation, _options;
|
|
62
|
-
(_options_onNavigation = (_options = options).onNavigation) === null || _options_onNavigation === void 0 ? void 0 : _options_onNavigation.call(_options, event, data);
|
|
63
|
-
if (walkerRef.current) {
|
|
64
|
-
navigate(data, walkerRef.current);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
60
|
const getNextNavigableItem = useEventCallback((visibleItems, data)=>{
|
|
68
61
|
const item = headlessTree.get(data.value);
|
|
69
62
|
if (item) {
|
|
@@ -90,18 +83,23 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
90
83
|
return (_treeRef_current = treeRef.current) === null || _treeRef_current === void 0 ? void 0 : _treeRef_current.querySelector(`[${dataTreeItemValueAttrName}="${item.value}"]`);
|
|
91
84
|
}, []);
|
|
92
85
|
const ref = useMergedRefs(treeRef, initializeWalker);
|
|
93
|
-
const getTreeProps = React.useCallback(()=>
|
|
86
|
+
const getTreeProps = React.useCallback(()=>{
|
|
87
|
+
var _options_onNavigation;
|
|
88
|
+
return {
|
|
94
89
|
ref,
|
|
95
90
|
openItems,
|
|
96
91
|
selectionMode: options.selectionMode,
|
|
97
92
|
checkedItems,
|
|
98
93
|
onOpenChange: handleOpenChange,
|
|
99
94
|
onCheckedChange: handleCheckedChange,
|
|
100
|
-
onNavigation:
|
|
101
|
-
}
|
|
95
|
+
onNavigation: (_options_onNavigation = options.onNavigation) !== null && _options_onNavigation !== void 0 ? _options_onNavigation : noop
|
|
96
|
+
};
|
|
97
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
102
98
|
[
|
|
103
99
|
openItems,
|
|
104
|
-
checkedItems
|
|
100
|
+
checkedItems,
|
|
101
|
+
options.selectionMode,
|
|
102
|
+
options.onNavigation
|
|
105
103
|
]);
|
|
106
104
|
const items = React.useCallback(()=>headlessTree.visibleItems(openItems), [
|
|
107
105
|
openItems,
|
|
@@ -125,3 +123,5 @@ import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
|
125
123
|
items
|
|
126
124
|
]);
|
|
127
125
|
}
|
|
126
|
+
function noop() {
|
|
127
|
+
/* noop */ }
|