@fluentui/react-tree 9.2.1 → 9.4.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/CHANGELOG.json +258 -1
- package/CHANGELOG.md +67 -2
- package/dist/index.d.ts +49 -20
- package/lib/components/FlatTree/FlatTree.types.js.map +1 -1
- package/lib/components/FlatTree/renderFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatTree.js +71 -2
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatTreeContextValues.js +20 -2
- package/lib/components/FlatTree/useFlatTreeContextValues.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/renderTree.js +1 -1
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useTree.js +11 -14
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +29 -15
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +52 -26
- 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/components/TreeProvider.js +21 -0
- package/lib/components/TreeProvider.js.map +1 -0
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/subtreeContext.js +14 -0
- package/lib/contexts/subtreeContext.js.map +1 -0
- package/lib/contexts/treeContext.js +9 -5
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/hooks/useRootTree.js +25 -78
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useSubtree.js +2 -14
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.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 +71 -2
- package/lib-commonjs/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.js +20 -2
- package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.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/renderTree.js +2 -2
- package/lib-commonjs/components/Tree/renderTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTree.js +11 -14
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +30 -15
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +55 -29
- 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/components/TreeProvider.js +32 -0
- package/lib-commonjs/components/TreeProvider.js.map +1 -0
- package/lib-commonjs/contexts/index.js +1 -0
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/subtreeContext.js +31 -0
- package/lib-commonjs/contexts/subtreeContext.js.map +1 -0
- package/lib-commonjs/contexts/treeContext.js +6 -7
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/hooks/useRootTree.js +25 -78
- package/lib-commonjs/hooks/useRootTree.js.map +1 -1
- package/lib-commonjs/hooks/useSubtree.js +2 -14
- package/lib-commonjs/hooks/useSubtree.js.map +1 -1
- package/lib-commonjs/index.js +7 -3
- package/lib-commonjs/index.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,264 @@
|
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 02 Oct 2023 08:53:05 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tree_v9.4.0",
|
|
7
|
+
"version": "9.4.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-tree",
|
|
13
|
+
"commit": "b7c4075ba6978c8435ce9942f6f04179a2f3be33",
|
|
14
|
+
"comment": "feat: creates SubtreeContext"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-tree",
|
|
19
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.35",
|
|
20
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-tree",
|
|
25
|
+
"comment": "Bump @fluentui/react-button to v9.3.44",
|
|
26
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-tree",
|
|
31
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.45",
|
|
32
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-tree",
|
|
37
|
+
"comment": "Bump @fluentui/react-portal to v9.3.19",
|
|
38
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-tree",
|
|
43
|
+
"comment": "Bump @fluentui/react-radio to v9.1.45",
|
|
44
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-tree",
|
|
49
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.2",
|
|
50
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-tree",
|
|
55
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.2",
|
|
56
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Tue, 26 Sep 2023 17:49:14 GMT",
|
|
63
|
+
"tag": "@fluentui/react-tree_v9.3.1",
|
|
64
|
+
"version": "9.3.1",
|
|
65
|
+
"comments": {
|
|
66
|
+
"patch": [
|
|
67
|
+
{
|
|
68
|
+
"author": "yuanboxue@microsoft.com",
|
|
69
|
+
"package": "@fluentui/react-tree",
|
|
70
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
|
|
71
|
+
"comment": "chore: trigger manual version bump after broken release"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "beachball",
|
|
75
|
+
"package": "@fluentui/react-tree",
|
|
76
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.6",
|
|
77
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"author": "beachball",
|
|
81
|
+
"package": "@fluentui/react-tree",
|
|
82
|
+
"comment": "Bump @fluentui/react-aria to v9.3.38",
|
|
83
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"author": "beachball",
|
|
87
|
+
"package": "@fluentui/react-tree",
|
|
88
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.34",
|
|
89
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"author": "beachball",
|
|
93
|
+
"package": "@fluentui/react-tree",
|
|
94
|
+
"comment": "Bump @fluentui/react-button to v9.3.43",
|
|
95
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"author": "beachball",
|
|
99
|
+
"package": "@fluentui/react-tree",
|
|
100
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.44",
|
|
101
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"author": "beachball",
|
|
105
|
+
"package": "@fluentui/react-tree",
|
|
106
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.36",
|
|
107
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"author": "beachball",
|
|
111
|
+
"package": "@fluentui/react-tree",
|
|
112
|
+
"comment": "Bump @fluentui/react-portal to v9.3.18",
|
|
113
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"author": "beachball",
|
|
117
|
+
"package": "@fluentui/react-tree",
|
|
118
|
+
"comment": "Bump @fluentui/react-radio to v9.1.44",
|
|
119
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"author": "beachball",
|
|
123
|
+
"package": "@fluentui/react-tree",
|
|
124
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
|
|
125
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"author": "beachball",
|
|
129
|
+
"package": "@fluentui/react-tree",
|
|
130
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.1",
|
|
131
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"author": "beachball",
|
|
135
|
+
"package": "@fluentui/react-tree",
|
|
136
|
+
"comment": "Bump @fluentui/react-theme to v9.1.14",
|
|
137
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"author": "beachball",
|
|
141
|
+
"package": "@fluentui/react-tree",
|
|
142
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.5",
|
|
143
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"author": "beachball",
|
|
147
|
+
"package": "@fluentui/react-tree",
|
|
148
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
|
|
149
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"date": "Tue, 26 Sep 2023 15:31:41 GMT",
|
|
156
|
+
"tag": "@fluentui/react-tree_v9.3.0",
|
|
157
|
+
"version": "9.3.0",
|
|
158
|
+
"comments": {
|
|
159
|
+
"minor": [
|
|
160
|
+
{
|
|
161
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
162
|
+
"package": "@fluentui/react-tree",
|
|
163
|
+
"commit": "aef09fc324e71a15a10a6a3c1c7ed556e2775725",
|
|
164
|
+
"comment": "feat: FlatTree supports navigation without useHeadlessFlatTree"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"author": "beachball",
|
|
168
|
+
"package": "@fluentui/react-tree",
|
|
169
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.5",
|
|
170
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"author": "beachball",
|
|
174
|
+
"package": "@fluentui/react-tree",
|
|
175
|
+
"comment": "Bump @fluentui/react-aria to v9.3.37",
|
|
176
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"author": "beachball",
|
|
180
|
+
"package": "@fluentui/react-tree",
|
|
181
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.33",
|
|
182
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"author": "beachball",
|
|
186
|
+
"package": "@fluentui/react-tree",
|
|
187
|
+
"comment": "Bump @fluentui/react-button to v9.3.42",
|
|
188
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"author": "beachball",
|
|
192
|
+
"package": "@fluentui/react-tree",
|
|
193
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.43",
|
|
194
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"author": "beachball",
|
|
198
|
+
"package": "@fluentui/react-tree",
|
|
199
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.35",
|
|
200
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"author": "beachball",
|
|
204
|
+
"package": "@fluentui/react-tree",
|
|
205
|
+
"comment": "Bump @fluentui/react-portal to v9.3.17",
|
|
206
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"author": "beachball",
|
|
210
|
+
"package": "@fluentui/react-tree",
|
|
211
|
+
"comment": "Bump @fluentui/react-radio to v9.1.43",
|
|
212
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"author": "beachball",
|
|
216
|
+
"package": "@fluentui/react-tree",
|
|
217
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
|
|
218
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"author": "beachball",
|
|
222
|
+
"package": "@fluentui/react-tree",
|
|
223
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.0",
|
|
224
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"author": "beachball",
|
|
228
|
+
"package": "@fluentui/react-tree",
|
|
229
|
+
"comment": "Bump @fluentui/react-theme to v9.1.13",
|
|
230
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"author": "beachball",
|
|
234
|
+
"package": "@fluentui/react-tree",
|
|
235
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.4",
|
|
236
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"author": "beachball",
|
|
240
|
+
"package": "@fluentui/react-tree",
|
|
241
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
|
|
242
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
"patch": [
|
|
246
|
+
{
|
|
247
|
+
"author": "martinhochel@microsoft.com",
|
|
248
|
+
"package": "@fluentui/react-tree",
|
|
249
|
+
"commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
|
|
250
|
+
"comment": "fix: bump swc core to mitigate transpilation memory leaks"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"author": "ololubek@microsoft.com",
|
|
254
|
+
"package": "@fluentui/react-tree",
|
|
255
|
+
"commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
|
|
256
|
+
"comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"date": "Wed, 20 Sep 2023 17:47:45 GMT",
|
|
6
263
|
"tag": "@fluentui/react-tree_v9.2.1",
|
|
7
264
|
"version": "9.2.1",
|
|
8
265
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,77 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 02 Oct 2023 08:53:05 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.4.0)
|
|
8
|
+
|
|
9
|
+
Mon, 02 Oct 2023 08:53:05 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.3.1..@fluentui/react-tree_v9.4.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: creates SubtreeContext ([PR #29194](https://github.com/microsoft/fluentui/pull/29194) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- Bump @fluentui/react-avatar to v9.5.35 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
16
|
+
- Bump @fluentui/react-button to v9.3.44 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
17
|
+
- Bump @fluentui/react-checkbox to v9.1.45 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
18
|
+
- Bump @fluentui/react-portal to v9.3.19 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
19
|
+
- Bump @fluentui/react-radio to v9.1.45 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
20
|
+
- Bump @fluentui/react-shared-contexts to v9.9.2 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tabster to v9.13.2 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.1)
|
|
24
|
+
|
|
25
|
+
Tue, 26 Sep 2023 17:49:14 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.3.0..@fluentui/react-tree_v9.3.1)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
|
|
31
|
+
- Bump @fluentui/keyboard-keys to v9.0.6 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
32
|
+
- Bump @fluentui/react-aria to v9.3.38 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
33
|
+
- Bump @fluentui/react-avatar to v9.5.34 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
34
|
+
- Bump @fluentui/react-button to v9.3.43 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
35
|
+
- Bump @fluentui/react-checkbox to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
36
|
+
- Bump @fluentui/react-context-selector to v9.1.36 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
37
|
+
- Bump @fluentui/react-portal to v9.3.18 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
38
|
+
- Bump @fluentui/react-radio to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
39
|
+
- Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
40
|
+
- Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
41
|
+
- Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
42
|
+
- Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
43
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
44
|
+
|
|
45
|
+
## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.0)
|
|
46
|
+
|
|
47
|
+
Tue, 26 Sep 2023 15:31:41 GMT
|
|
48
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.1..@fluentui/react-tree_v9.3.0)
|
|
49
|
+
|
|
50
|
+
### Minor changes
|
|
51
|
+
|
|
52
|
+
- feat: FlatTree supports navigation without useHeadlessFlatTree ([PR #29091](https://github.com/microsoft/fluentui/pull/29091) by bernardo.sunderhus@gmail.com)
|
|
53
|
+
- Bump @fluentui/keyboard-keys to v9.0.5 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
54
|
+
- Bump @fluentui/react-aria to v9.3.37 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
55
|
+
- Bump @fluentui/react-avatar to v9.5.33 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
56
|
+
- Bump @fluentui/react-button to v9.3.42 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
57
|
+
- Bump @fluentui/react-checkbox to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
58
|
+
- Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
59
|
+
- Bump @fluentui/react-portal to v9.3.17 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
60
|
+
- Bump @fluentui/react-radio to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
61
|
+
- Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
62
|
+
- Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
63
|
+
- Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
64
|
+
- Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
65
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
66
|
+
|
|
67
|
+
### Patches
|
|
68
|
+
|
|
69
|
+
- fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
|
|
70
|
+
- chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
|
|
71
|
+
|
|
7
72
|
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.2.1)
|
|
8
73
|
|
|
9
|
-
Wed, 20 Sep 2023 17:
|
|
74
|
+
Wed, 20 Sep 2023 17:47:45 GMT
|
|
10
75
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.0..@fluentui/react-tree_v9.2.1)
|
|
11
76
|
|
|
12
77
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -15,11 +15,8 @@ import { ContextSelector } from '@fluentui/react-context-selector';
|
|
|
15
15
|
import type { End } from '@fluentui/keyboard-keys';
|
|
16
16
|
import type { Enter } from '@fluentui/keyboard-keys';
|
|
17
17
|
import type { ExtractSlotProps } from '@fluentui/react-utilities';
|
|
18
|
-
import { FC } from 'react';
|
|
19
18
|
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
20
19
|
import type { Home } from '@fluentui/keyboard-keys';
|
|
21
|
-
import { Provider } from 'react';
|
|
22
|
-
import { ProviderProps } from 'react';
|
|
23
20
|
import { Radio } from '@fluentui/react-radio';
|
|
24
21
|
import { RadioProps } from '@fluentui/react-radio';
|
|
25
22
|
import * as React_2 from 'react';
|
|
@@ -106,7 +103,11 @@ export declare type FlattenTreeItem<Props extends TreeItemProps> = Omit<Props, '
|
|
|
106
103
|
*/
|
|
107
104
|
export declare const FlatTree: ForwardRefComponent<FlatTreeProps>;
|
|
108
105
|
|
|
109
|
-
export declare const flatTreeClassNames: SlotClassNames<
|
|
106
|
+
export declare const flatTreeClassNames: SlotClassNames<FlatTreeSlots>;
|
|
107
|
+
|
|
108
|
+
declare type FlatTreeContextValues = {
|
|
109
|
+
tree: TreeContextValue;
|
|
110
|
+
};
|
|
110
111
|
|
|
111
112
|
/**
|
|
112
113
|
* The `FlatTreeItem` component represents a single item in a flat tree.
|
|
@@ -188,6 +189,12 @@ export declare type FlatTreeProps = ComponentProps<TreeSlots> & {
|
|
|
188
189
|
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
189
190
|
};
|
|
190
191
|
|
|
192
|
+
export declare type FlatTreeSlots = TreeSlots;
|
|
193
|
+
|
|
194
|
+
export declare type FlatTreeState = ComponentState<FlatTreeSlots> & TreeContextValue & {
|
|
195
|
+
open: boolean;
|
|
196
|
+
};
|
|
197
|
+
|
|
191
198
|
/**
|
|
192
199
|
* FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
193
200
|
* in multiple scenarios including virtualization.
|
|
@@ -270,7 +277,7 @@ declare type HeadlessTreeItem<Props extends HeadlessTreeItemProps> = {
|
|
|
270
277
|
value: TreeItemValue;
|
|
271
278
|
parentValue: TreeItemValue | undefined;
|
|
272
279
|
itemType: TreeItemType;
|
|
273
|
-
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> &
|
|
280
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Props;
|
|
274
281
|
};
|
|
275
282
|
|
|
276
283
|
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
@@ -361,9 +368,13 @@ declare function isImmutableSet<Value>(value: unknown): value is ImmutableSet<Va
|
|
|
361
368
|
|
|
362
369
|
declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
363
370
|
|
|
371
|
+
/**
|
|
372
|
+
* helper type that avoids the expansion of unions while inferring it,
|
|
373
|
+
* should work exactly the same as Omit
|
|
374
|
+
*/
|
|
364
375
|
declare type OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;
|
|
365
376
|
|
|
366
|
-
export declare const renderFlatTree_unstable: (state:
|
|
377
|
+
export declare const renderFlatTree_unstable: (state: FlatTreeState, contextValues: FlatTreeContextValues) => JSX.Element;
|
|
367
378
|
|
|
368
379
|
export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
369
380
|
|
|
@@ -384,6 +395,11 @@ export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPerso
|
|
|
384
395
|
|
|
385
396
|
declare type SingleSelectValue = NonNullable<RadioProps['checked']>;
|
|
386
397
|
|
|
398
|
+
export declare type SubtreeContextValue = {
|
|
399
|
+
contextType: 'subtree';
|
|
400
|
+
level: number;
|
|
401
|
+
};
|
|
402
|
+
|
|
387
403
|
/**
|
|
388
404
|
* The `Tree` component renders nested items in a hierarchical structure.
|
|
389
405
|
* Use it with `TreeItem` component and layouts components `TreeItemLayout` or `TreeItemPersonaLayout`.
|
|
@@ -409,8 +425,9 @@ export declare type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];
|
|
|
409
425
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
410
426
|
|
|
411
427
|
export declare type TreeContextValue = {
|
|
412
|
-
|
|
428
|
+
contextType?: 'root';
|
|
413
429
|
level: number;
|
|
430
|
+
treeType: 'nested' | 'flat';
|
|
414
431
|
selectionMode: 'none' | SelectionMode_2;
|
|
415
432
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
416
433
|
size: 'small' | 'medium';
|
|
@@ -423,7 +440,7 @@ export declare type TreeContextValue = {
|
|
|
423
440
|
};
|
|
424
441
|
|
|
425
442
|
export declare type TreeContextValues = {
|
|
426
|
-
tree: TreeContextValue;
|
|
443
|
+
tree: TreeContextValue | SubtreeContextValue;
|
|
427
444
|
};
|
|
428
445
|
|
|
429
446
|
/**
|
|
@@ -618,13 +635,23 @@ export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
|
618
635
|
*/
|
|
619
636
|
open?: boolean;
|
|
620
637
|
onOpenChange?: (e: TreeItemOpenChangeEvent, data: TreeItemOpenChangeData) => void;
|
|
638
|
+
/**
|
|
639
|
+
* This property is inferred through context on a nested tree, and required for a flat tree.
|
|
640
|
+
*/
|
|
641
|
+
parentValue?: TreeItemValue;
|
|
621
642
|
};
|
|
622
643
|
|
|
623
644
|
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
624
645
|
|
|
625
646
|
declare type TreeItemRequest = {
|
|
626
647
|
itemType: TreeItemType;
|
|
627
|
-
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'>
|
|
648
|
+
} & ((OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> & {
|
|
649
|
+
requestType: 'open';
|
|
650
|
+
}) | (TreeNavigationData_unstable & {
|
|
651
|
+
requestType: 'navigate';
|
|
652
|
+
}) | (OmitWithoutExpanding<TreeCheckedChangeData, 'selectionMode' | 'checkedItems'> & {
|
|
653
|
+
requestType: 'selection';
|
|
654
|
+
}));
|
|
628
655
|
|
|
629
656
|
export declare type TreeItemSlots = {
|
|
630
657
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
@@ -647,6 +674,7 @@ export declare type TreeItemValue = string | number;
|
|
|
647
674
|
export declare type TreeNavigationData_unstable = {
|
|
648
675
|
target: HTMLElement;
|
|
649
676
|
value: TreeItemValue;
|
|
677
|
+
parentValue: TreeItemValue | undefined;
|
|
650
678
|
} & ({
|
|
651
679
|
event: React_2.MouseEvent<HTMLElement>;
|
|
652
680
|
type: 'Click';
|
|
@@ -769,30 +797,29 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
769
797
|
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
770
798
|
};
|
|
771
799
|
|
|
772
|
-
export declare const TreeProvider:
|
|
800
|
+
export declare const TreeProvider: {
|
|
801
|
+
(props: React_2.ProviderProps<TreeContextValue | SubtreeContextValue>): JSX.Element;
|
|
802
|
+
displayName: string;
|
|
803
|
+
};
|
|
773
804
|
|
|
774
805
|
export declare type TreeSelectionValue = MultiSelectValue | SingleSelectValue;
|
|
775
806
|
|
|
776
|
-
declare type TreeSlots = {
|
|
807
|
+
export declare type TreeSlots = {
|
|
777
808
|
root: Slot<'div'>;
|
|
778
809
|
};
|
|
779
|
-
export { TreeSlots as FlatTreeSlots }
|
|
780
|
-
export { TreeSlots }
|
|
781
810
|
|
|
782
811
|
/**
|
|
783
812
|
* State used in rendering Tree
|
|
784
813
|
*/
|
|
785
|
-
declare type TreeState = ComponentState<TreeSlots> &
|
|
814
|
+
export declare type TreeState = ComponentState<TreeSlots> & {
|
|
786
815
|
open: boolean;
|
|
787
|
-
};
|
|
788
|
-
export { TreeState as FlatTreeState }
|
|
789
|
-
export { TreeState }
|
|
816
|
+
} & (TreeContextValue | SubtreeContextValue);
|
|
790
817
|
|
|
791
|
-
export declare const useFlatTree_unstable: (props: FlatTreeProps, ref: React_2.Ref<HTMLElement>) =>
|
|
818
|
+
export declare const useFlatTree_unstable: (props: FlatTreeProps, ref: React_2.Ref<HTMLElement>) => FlatTreeState;
|
|
792
819
|
|
|
793
|
-
export declare const useFlatTreeContextValues_unstable: (state:
|
|
820
|
+
export declare const useFlatTreeContextValues_unstable: (state: FlatTreeState) => FlatTreeContextValues;
|
|
794
821
|
|
|
795
|
-
export declare const useFlatTreeStyles_unstable: (state:
|
|
822
|
+
export declare const useFlatTreeStyles_unstable: (state: FlatTreeState) => FlatTreeState;
|
|
796
823
|
|
|
797
824
|
/**
|
|
798
825
|
* this hook provides FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -808,6 +835,8 @@ export declare const useFlatTreeStyles_unstable: (state: TreeState) => TreeState
|
|
|
808
835
|
*/
|
|
809
836
|
export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeItemProps>(props: Props[], options?: HeadlessFlatTreeOptions): HeadlessFlatTree<Props>;
|
|
810
837
|
|
|
838
|
+
export declare const useSubtreeContext_unstable: () => SubtreeContextValue;
|
|
839
|
+
|
|
811
840
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
812
841
|
|
|
813
842
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FlatTree.types.ts"],"sourcesContent":["import type { ComponentProps, SelectionMode } from '@fluentui/react-utilities';\nimport type {\n TreeSlots,\n
|
|
1
|
+
{"version":3,"sources":["FlatTree.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, SelectionMode } from '@fluentui/react-utilities';\nimport type {\n TreeSlots,\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeSelectionValue,\n} from '../Tree/index';\nimport type { TreeItemValue } from '../TreeItem/index';\nimport type { TreeContextValue } from '../../contexts';\n\nexport type FlatTreeSlots = TreeSlots;\n\nexport type FlatTreeContextValues = {\n tree: TreeContextValue;\n};\n\nexport type FlatTreeProps = ComponentProps<TreeSlots> & {\n /**\n * A tree item can have various appearances:\n * - 'subtle' (default): The default tree item styles.\n * - 'subtle-alpha': Minimizes emphasis on hovered or focused states.\n * - 'transparent': Removes background color.\n * @default 'subtle'\n */\n appearance?: 'subtle' | 'subtle-alpha' | 'transparent';\n /**\n * Size of the tree item.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * This refers to a list of ids of opened tree items.\n * Controls the state of the open tree items.\n * These property is ignored for subtrees.\n */\n openItems?: Iterable<TreeItemValue>;\n /**\n * Callback fired when the component changes value from open state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event.\n */\n onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;\n\n /**\n * Callback fired when navigation happens inside the component.\n * These property is ignored for subtrees.\n *\n * FIXME: This method is not ideal, as navigation should be handled internally by tabster.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n */\n onNavigation?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;\n\n /**\n * This refers to the selection mode of the tree.\n * - undefined: No selection can be done.\n * - 'single': Only one tree item can be selected, radio buttons are rendered.\n * - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.\n *\n * @default undefined\n */\n selectionMode?: SelectionMode;\n /**\n * This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.\n * Controls the state of the checked tree items.\n * These property is ignored for subtrees.\n */\n checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;\n /**\n * Callback fired when the component changes value from checked state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as checked value and type of interaction that created the event.\n */\n onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;\n};\n\nexport type FlatTreeState = ComponentState<FlatTreeSlots> &\n TreeContextValue & {\n open: boolean;\n };\n"],"names":[],"mappings":"AAAA,WA0FI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderFlatTree.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["renderFlatTree.ts"],"sourcesContent":["import { renderTree_unstable } from '../../Tree';\nimport type { FlatTreeContextValues, FlatTreeState } from './FlatTree.types';\n\nexport const renderFlatTree_unstable: (state: FlatTreeState, contextValues: FlatTreeContextValues) => JSX.Element =\n renderTree_unstable;\n"],"names":["renderTree_unstable","renderFlatTree_unstable"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,aAAa;AAGjD,OAAO,MAAMC,0BACXD,oBAAoB"}
|
|
@@ -1,8 +1,77 @@
|
|
|
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';
|
|
10
|
+
import { ImmutableSet } from '../../utils/ImmutableSet';
|
|
11
|
+
import { ImmutableMap } from '../../utils/ImmutableMap';
|
|
3
12
|
export const useFlatTree_unstable = (props, ref)=>{
|
|
13
|
+
const level = useTreeContext_unstable((ctx)=>ctx.level);
|
|
14
|
+
// as level is static, this doesn't break rule of hooks
|
|
15
|
+
// and if this becomes an issue later on, this can be easily converted
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+
return level > 1 ? useSubFlatTree(props, ref) : useRootFlatTree(props, ref);
|
|
18
|
+
};
|
|
19
|
+
function useRootFlatTree(props, ref) {
|
|
20
|
+
const { navigate, initialize } = useFlatTreeNavigation();
|
|
21
|
+
const walkerRef = React.useRef();
|
|
22
|
+
const { targetDocument } = useFluent_unstable();
|
|
23
|
+
const initializeWalker = React.useCallback((root)=>{
|
|
24
|
+
if (root && targetDocument) {
|
|
25
|
+
walkerRef.current = createHTMLElementWalker(root, targetDocument, treeItemFilter);
|
|
26
|
+
initialize(walkerRef.current);
|
|
27
|
+
}
|
|
28
|
+
}, [
|
|
29
|
+
initialize,
|
|
30
|
+
targetDocument
|
|
31
|
+
]);
|
|
32
|
+
const handleNavigation = useEventCallback((event, data)=>{
|
|
33
|
+
var _props_onNavigation;
|
|
34
|
+
(_props_onNavigation = props.onNavigation) === null || _props_onNavigation === void 0 ? void 0 : _props_onNavigation.call(props, event, data);
|
|
35
|
+
if (walkerRef.current && !event.isDefaultPrevented()) {
|
|
36
|
+
navigate(data, walkerRef.current);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
4
39
|
return {
|
|
5
40
|
treeType: 'flat',
|
|
6
|
-
...useRootTree(
|
|
41
|
+
...useRootTree({
|
|
42
|
+
...props,
|
|
43
|
+
onNavigation: handleNavigation
|
|
44
|
+
}, useMergedRefs(ref, initializeWalker))
|
|
7
45
|
};
|
|
8
|
-
}
|
|
46
|
+
}
|
|
47
|
+
function useSubFlatTree(props, ref) {
|
|
48
|
+
if (process.env.NODE_ENV === 'development') {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.error(`@fluentui/react-tree [useFlatTree]:
|
|
51
|
+
Subtrees are not allowed in a FlatTree!
|
|
52
|
+
You cannot use a <FlatTree> component inside of another <FlatTree> component.`);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...useSubtree(props, ref),
|
|
56
|
+
// ------ defaultTreeContextValue
|
|
57
|
+
level: 0,
|
|
58
|
+
contextType: 'root',
|
|
59
|
+
treeType: 'nested',
|
|
60
|
+
selectionMode: 'none',
|
|
61
|
+
openItems: ImmutableSet.empty,
|
|
62
|
+
checkedItems: ImmutableMap.empty,
|
|
63
|
+
requestTreeResponse: noop,
|
|
64
|
+
appearance: 'subtle',
|
|
65
|
+
size: 'medium',
|
|
66
|
+
// ------ defaultTreeContextValue
|
|
67
|
+
open: false,
|
|
68
|
+
components: {
|
|
69
|
+
root: React.Fragment
|
|
70
|
+
},
|
|
71
|
+
root: slot.always(props, {
|
|
72
|
+
elementType: React.Fragment
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function noop() {
|
|
77
|
+
/* do nothing */ }
|
|
@@ -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, 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 { 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';\nimport { ImmutableSet } from '../../utils/ImmutableSet';\nimport { ImmutableMap } from '../../utils/ImmutableMap';\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 // ------ defaultTreeContextValue\n level: 0,\n contextType: 'root',\n treeType: 'nested',\n selectionMode: 'none',\n openItems: ImmutableSet.empty,\n checkedItems: ImmutableMap.empty,\n requestTreeResponse: noop,\n appearance: 'subtle',\n size: 'medium',\n // ------ defaultTreeContextValue\n open: false,\n components: { root: React.Fragment },\n root: slot.always(props, { elementType: React.Fragment }),\n };\n}\n\nfunction noop() {\n /* do nothing */\n}\n"],"names":["React","useRootTree","useFlatTreeNavigation","createHTMLElementWalker","useFluent_unstable","treeItemFilter","slot","useEventCallback","useMergedRefs","useTreeContext_unstable","useSubtree","ImmutableSet","ImmutableMap","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","contextType","selectionMode","openItems","empty","checkedItems","requestTreeResponse","noop","appearance","size","open","components","Fragment","always","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,SAASC,IAAI,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAElF,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,YAAY,QAAQ,2BAA2B;AAExD,OAAO,MAAMC,uBAA6F,CACxGC,OACAC;IAEA,MAAMC,QAAQP,wBAAwBQ,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,GAAGnB;IACjC,MAAMoB,YAAYtB,MAAMuB,MAAM;IAC9B,MAAM,EAAEC,cAAc,EAAE,GAAGpB;IAE3B,MAAMqB,mBAAmBzB,MAAM0B,WAAW,CACxC,CAACC;QACC,IAAIA,QAAQH,gBAAgB;YAC1BF,UAAUM,OAAO,GAAGzB,wBAAwBwB,MAAMH,gBAAgBnB;YAClEgB,WAAWC,UAAUM,OAAO;QAC9B;IACF,GACA;QAACP;QAAYG;KAAe;IAG9B,MAAMK,mBAAmBtB,iBACvB,CAACuB,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,GAAGjC,YAAY;YAAE,GAAGa,KAAK;YAAEkB,cAAcH;QAAiB,GAAGrB,cAAcO,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,GAAG7B,WAAWI,OAAOC,IAAI;QACzB,iCAAiC;QACjCC,OAAO;QACPwB,aAAa;QACbN,UAAU;QACVO,eAAe;QACfC,WAAW/B,aAAagC,KAAK;QAC7BC,cAAchC,aAAa+B,KAAK;QAChCE,qBAAqBC;QACrBC,YAAY;QACZC,MAAM;QACN,iCAAiC;QACjCC,MAAM;QACNC,YAAY;YAAEvB,MAAM3B,MAAMmD,QAAQ;QAAC;QACnCxB,MAAMrB,KAAK8C,MAAM,CAACtC,OAAO;YAAEuC,aAAarD,MAAMmD,QAAQ;QAAC;IACzD;AACF;AAEA,SAASL;AACP,cAAc,GAChB"}
|