@itwin/presentation-hierarchies-react 2.0.0-alpha.4 → 2.0.0-alpha.41

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +693 -7
  2. package/README.md +25 -27
  3. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +85 -0
  4. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  5. package/lib/esm/presentation-hierarchies-react/Renderers.js +6 -0
  6. package/lib/esm/presentation-hierarchies-react/Renderers.js.map +1 -0
  7. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +27 -28
  8. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
  9. package/lib/esm/presentation-hierarchies-react/TreeNode.js +1 -7
  10. package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +1 -1
  11. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +2 -0
  12. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
  13. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +1 -1
  14. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
  15. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts +24 -0
  16. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  17. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +52 -0
  18. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  19. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +3 -3
  20. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
  21. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +1 -8
  22. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
  23. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +32 -70
  24. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
  25. package/lib/esm/presentation-hierarchies-react/UseTree.js +48 -49
  26. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
  27. package/lib/esm/presentation-hierarchies-react/Utils.d.ts +5 -0
  28. package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +1 -0
  29. package/lib/esm/presentation-hierarchies-react/Utils.js +23 -0
  30. package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -0
  31. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +2 -2
  32. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
  33. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +31 -16
  34. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
  35. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +24 -6
  36. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
  37. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +29 -33
  38. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
  39. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +6 -29
  40. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +1 -1
  41. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +31 -27
  42. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
  43. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +23 -9
  44. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
  45. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +16 -29
  46. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
  47. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +1 -1
  48. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
  49. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +26 -0
  50. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  51. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +75 -0
  52. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  53. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts +19 -0
  54. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts.map +1 -0
  55. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js +23 -0
  56. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js.map +1 -0
  57. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +58 -0
  58. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
  59. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +77 -0
  60. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
  61. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +123 -0
  62. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
  63. package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.js +15 -5
  64. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
  65. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts +21 -0
  66. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts.map +1 -0
  67. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js +36 -0
  68. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js.map +1 -0
  69. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -0
  70. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  71. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +42 -0
  72. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  73. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts +45 -0
  74. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
  75. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js +36 -0
  76. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
  77. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +47 -0
  78. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  79. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +28 -0
  80. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  81. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +56 -0
  82. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  83. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +147 -0
  84. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  85. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +70 -0
  86. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  87. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +116 -0
  88. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  89. package/lib/esm/presentation-hierarchies-react.d.ts +15 -9
  90. package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
  91. package/lib/esm/presentation-hierarchies-react.js +12 -8
  92. package/lib/esm/presentation-hierarchies-react.js.map +1 -1
  93. package/package.json +55 -47
  94. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
  95. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
  96. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
  97. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
  98. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -20
  99. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
  100. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
  101. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
  102. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
  103. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
  104. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
  105. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -25
  106. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
  107. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
  108. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
  109. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -13
  110. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
  111. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
  112. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
  113. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -46
  114. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
  115. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
  116. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
  117. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
  118. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
  119. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -30
  120. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,17 +1,544 @@
1
1
  # @itwin/presentation-hierarchies-react
2
2
 
3
+ ## 2.0.0-alpha.41
4
+
5
+ ### Major Changes
6
+
7
+ - [#1113](https://github.com/iTwin/presentation/pull/1113): Pass selected nodes to tree node action getters to support actions that should be applied on all selected nodes.
8
+
9
+ **Breaking changes**
10
+ - `StrataKitTreeRenderer.getInlineActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.
11
+ - `StrataKitTreeRenderer.getMenuActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.
12
+
13
+ Before
14
+
15
+ ```tsx
16
+ return <StrataKitTreeRenderer getInlineActions={(node) => [<InlineAction node={node} />]} getMenuActions={(node) => [<MenuAction node={node} />]} />;
17
+ ```
18
+
19
+ After
20
+
21
+ ```tsx
22
+ return (
23
+ <StrataKitTreeRenderer
24
+ getInlineActions={({ targetNode }) => [<InlineAction node={targetNode} />]}
25
+ getMenuActions={({ targetNode }) => [<MenuAction node={targetNode} />]}
26
+ />
27
+ );
28
+ ```
29
+
30
+ - [#1115](https://github.com/iTwin/presentation/pull/1115): Unified tree actions handling to make it easier defining actions that could be reused in different contexts: inline, context menu and actions dropdown.
31
+
32
+ **Breaking changes**
33
+ - Removed `reserveSpace` property from `<RenameAction />` and `<FilterAction />`. These actions now automatically infer the context they're used in.
34
+ - Added requirement to render newly introduced `<TreeActionBase />` component instead of `<Tree.ItemAction />` when rendering custom tree actions.
35
+
36
+ ### Minor Changes
37
+
38
+ - [#1115](https://github.com/iTwin/presentation/pull/1115): Added `getContextMenuActions` callback for rendering tree actions in context menu.
39
+
40
+ ## 2.0.0-alpha.40
41
+
42
+ ### Patch Changes
43
+
44
+ - [#1110](https://github.com/iTwin/presentation/pull/1110): Bump dependencies.
45
+ - Updated dependencies:
46
+ - @itwin/presentation-hierarchies@2.0.0-alpha.5
47
+ - @itwin/presentation-shared@2.0.0-alpha.3
48
+ - @itwin/unified-selection@1.6.2-alpha.0
49
+
50
+ ## 2.0.0-alpha.39
51
+
52
+ ### Minor Changes
53
+
54
+ - [#1106](https://github.com/iTwin/presentation/pull/1106): Added an `id` property to `StrataKitTreeRenderer` that is passed to it's scroll wrapper.
55
+ - [#1107](https://github.com/iTwin/presentation/pull/1107): Introduced new `getClassName` callback to `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer` for providing class to tree node HTML element.
56
+
57
+ ### Patch Changes
58
+
59
+ - [#1109](https://github.com/iTwin/presentation/pull/1109): Fixed error item Anchor font size.
60
+
61
+ ## 2.0.0-alpha.38
62
+
63
+ ### Patch Changes
64
+
65
+ - [#1102](https://github.com/iTwin/presentation/pull/1102): Updated tree error item renderer to render error actions as buttons based on StrataKit docs JSDoc suggestion.
66
+
67
+ ## 2.0.0-alpha.37
68
+
69
+ ### Major Changes
70
+
71
+ - [#1100](https://github.com/iTwin/presentation/pull/1100): Bumped StrataKit peer dependencies to:
72
+ - `@stratakit/structures`: ^0.5.0
73
+ - `@stratakit/icons`: ^0.2.0
74
+ - `@stratakit/foundations`: ^0.4.0
75
+ - `@stratakit/bricks`: ^0.5.0
76
+
77
+ ## 2.0.0-alpha.36
78
+
79
+ ### Major Changes
80
+
81
+ - [#1094](https://github.com/iTwin/presentation/pull/1094): Improve custom errors rendering API:
82
+ - Separated `ChildrenLoad` error from the `Unknown` error. All expected tree errors have dedicated type and `Unknown` error can be used to handle custom errors encountered outside of tree.
83
+ - Exposed `ErrorItemRenderer` that renders all error types supported by the tree.
84
+ - Updated `TreeErrorRenderer` to pass all props necessary to render `ErrorItemRenderer` into `renderError` callback.
85
+
86
+ These changes makes it easier to customize only some types of errors and leave default handling for others.
87
+
88
+ Example:
89
+
90
+ ```tsx
91
+ <StrataKitTreeRenderer
92
+ {...treeProps}
93
+ errorRenderer={(errorProps) => {
94
+ return (
95
+ <TreeErrorRenderer
96
+ {...errorProps}
97
+ renderError={(errorItemProps) => {
98
+ if (errorItemProps.errorItem.errorNode.error.type === "Unknown") {
99
+ return <ErrorRegion.Item message="Custom error" messageId={errorItemProps.errorItem.errorNode.id} />;
100
+ }
101
+ return <ErrorItemRenderer {...errorItemProps} />;
102
+ }}
103
+ />
104
+ );
105
+ }}
106
+ />
107
+ ```
108
+
109
+ ## 2.0.0-alpha.35
110
+
111
+ ### Patch Changes
112
+
113
+ - [#1075](https://github.com/iTwin/presentation/pull/1075): Fix accessibility issues in `<TreeErrorRenderer />`.
114
+
115
+ This involves a few localized string changes:
116
+ - Added `issuesForTree`, defaulting to "Issues for {{tree_label}}.", used as a region landmark label for the error message container.
117
+ - Added `noIssuesFound`, defaulting to "No issues found.", used as a label for errors' list when there are no issues.
118
+ - Changed `issuesFound` to default to "{{number_of_issues}} issue(s) found.", and updated its usage to inject the number of issues found into the string instead of prefixing it before the string, which allows to place the number at any place in the string (may be a requirement for some languages). This is **a breaking change** for anyone, supplying their own localized strings.
119
+
120
+ Also, **a new required prop** `treeLabel` was added to `<TreeErrorRenderer />` and `<StrataKitTreeRenderer />` components. The label is used to uniquely identify a tree in the application, which is required for accessibility purposes.
121
+
122
+ ## 2.0.0-alpha.34
123
+
124
+ ### Patch Changes
125
+
126
+ - [#1068](https://github.com/iTwin/presentation/pull/1068): Extend `@stratakit` peer dependency range to support the latest versions
127
+
128
+ ## 2.0.0-alpha.33
129
+
130
+ ### Patch Changes
131
+
132
+ - [#1057](https://github.com/iTwin/presentation/pull/1057): Change `useNodeHighlighting` hook to only highlight nodes that are filter targets.
133
+
134
+ ## 2.0.0-alpha.32
135
+
136
+ ### Patch Changes
137
+
138
+ - [#1045](https://github.com/iTwin/presentation/pull/1045): Fix highlight matching in `useNodeHighlighting` hook. Highlighting now works when the `highlightText` contains special characters (`[`, `+`, `*`, etc.).
139
+
140
+ ## 2.0.0-alpha.31
141
+
142
+ ### Patch Changes
143
+
144
+ - [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
145
+ - [#1040](https://github.com/iTwin/presentation/pull/1040): Added a react hook `useNodeHighlighting` that helps create highlighted node labels based on provided text that should be highlighted.
146
+
147
+ Example usage:
148
+
149
+ ```ts
150
+ import { StrataKitTreeRenderer, useNodeHighlighting } from "@itwin/presentation-hierarchies-react";
151
+
152
+ type BaseTreeRendererProps = React.ComponentPropsWithoutRef<typeof StrataKitTreeRenderer>;
153
+
154
+ function MyComponent(props: BaseTreeRendererProps & { searchText: string }) {
155
+ // Create highlight based on searchText
156
+ const highlightText = props.searchText !== "" ? props.searchText : undefined;
157
+ const { getLabel } = useNodeHighlighting({ highlightText });
158
+
159
+ // Provide getLabel function to tree renderer
160
+ return <StrataKitTreeRenderer {...props} getLabel={getLabel} />;
161
+ }
162
+ ```
163
+
164
+ - Updated dependencies:
165
+ - @itwin/presentation-hierarchies@2.0.0-alpha.4
166
+ - @itwin/presentation-shared@2.0.0-alpha.2
167
+ - @itwin/unified-selection@1.5.1-alpha.1
168
+
169
+ ## 2.0.0-alpha.30
170
+
171
+ ### Patch Changes
172
+
173
+ - [#1037](https://github.com/iTwin/presentation/pull/1037): Added additional documentation for `RenameAction`
174
+
175
+ ## 2.0.0-alpha.29
176
+
177
+ ### Patch Changes
178
+
179
+ - [#1035](https://github.com/iTwin/presentation/pull/1035): Version bump after merge from `master`.
180
+
181
+ ## 2.0.0-alpha.28
182
+
183
+ ### Patch Changes
184
+
185
+ - [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
186
+ - Updated dependencies:
187
+ - @itwin/presentation-hierarchies@2.0.0-alpha.3
188
+ - @itwin/unified-selection@1.5.1-alpha.0
189
+
190
+ ## 2.0.0-alpha.27
191
+
192
+ ### Patch Changes
193
+
194
+ - [#1026](https://github.com/iTwin/presentation/pull/1026): Fix `reserveSpace` property being required instead of optional for `FilterAction` and `RenameAction`.
195
+
196
+ ## 2.0.0-alpha.26
197
+
198
+ ### Major Changes
199
+
200
+ - [#1023](https://github.com/iTwin/presentation/pull/1023): Split `getActions` into `getMenuActions` & `getInlineActions` for `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer`.
201
+
202
+ Updated peer dependencies:
203
+ - @stratakit/bricks@0.3.3
204
+ - @stratakit/foundations@0.2.2
205
+ - @stratakit/structures@0.3.1
206
+
207
+ Added `reserveSpace` property to `FilterAction` and `RenameAction`, which reserves space for the action when it is not available
208
+
209
+ ### Minor Changes
210
+
211
+ - [#1007](https://github.com/iTwin/presentation/pull/1007): Renames:
212
+ `FlatNode` => `FlatTreeNodeItem`
213
+ `FlatTreeNode` => `FlatTreeItem`
214
+ `PlaceholderNode` => `PlaceholderItem`
215
+ `useFlatTreeNodeList` => `useFlatTreeItems`
216
+
217
+ Changed `FlatTreeNodeItem` (previously `FlatNode`) to have property `node: PresentationHierarchyNode` instead of extending `PresentationHierarchyNode`.
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies:
222
+ - @itwin/presentation-hierarchies@2.0.0-alpha.2
223
+
224
+ ## 2.0.0-alpha.25
225
+
226
+ ### Patch Changes
227
+
228
+ - Updated dependencies:
229
+ - @itwin/presentation-hierarchies@2.0.0-alpha.1
230
+ - @itwin/presentation-shared@2.0.0-alpha.1
231
+ - @itwin/unified-selection@1.4.3-alpha.0
232
+
233
+ ## 2.0.0-alpha.24
234
+
235
+ ### Patch Changes
236
+
237
+ - [#975](https://github.com/iTwin/presentation/pull/975): Associate tree nodes rendered by `<StrataKitTreeNodeRenderer />` component with error messages rendered in `<TreeErrorRenderer />`. This improves accessibility by linking error information to the node.
238
+ - [#979](https://github.com/iTwin/presentation/pull/979): Adjust how `useTree` and other variants of it determines `isReloading` value. `isReloading` is now set to `true` if root nodes are being loaded.
239
+
240
+ ## 2.0.0-alpha.23
241
+
242
+ ### Minor Changes
243
+
244
+ - [#972](https://github.com/iTwin/presentation/pull/972): Added `getEditingProps` prop to `<StrataKitTreeRenderer />` component that allows to make node labels editable. In order to enter label editing mode `<RenameAction />` component was added.
245
+
246
+ ## 2.0.0-alpha.22
247
+
248
+ ### Minor Changes
249
+
250
+ - [#970](https://github.com/iTwin/presentation/pull/970): Exposed the type of tree state hooks' result `treeRendererProps` attribute - `TreeRendererProps`. The type can be useful when creating custom tree renderers.
251
+
252
+ ## 2.0.0-alpha.21
253
+
254
+ ### Major Changes
255
+
256
+ - [#961](https://github.com/iTwin/presentation/pull/961): **Breaking changes** to tree state hooks `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`:
257
+ - All tree rendering props have been moved under `treeRendererProps`. The value can be passed to `<StrataKitTreeRenderer />` component.
258
+ - In case an error occurs while loading the root hierarchy level, instead of `treeRendererProps`, the `rootErrorRendererProps` are set, which can be passed to `<StrataKitRootErrorRenderer />` component to render the error state.
259
+ - The `isLoading` attribute has been renamed to `isReloading`.
260
+ - Errors are no longer defined as children of `PresentationHierarchyNode` and instead are now included as `error` attribute for more fluent API.
261
+
262
+ When rendering tree state, the recommended order of checks is:
263
+ 1. If `rootErrorRendererProps` is defined, there was an error - render error state.
264
+ 2. If `treeRendererProps` is not defined, the component is doing the initial load - render loading state.
265
+ 3. If `treeRendererProps` is defined, the hierarchy is loaded - render the tree component.
266
+
267
+ The `isReloading` attribute may also be set at the same time, indicating that the hierarchy is being reloaded in the background. Consumers may want to render an overlay in this case, or not render the tree at all.
268
+
269
+ Example:
270
+
271
+ ```ts
272
+ function MyComponent () {
273
+ const useTreeResult = useIModelUnifiedSelectionTree({...});
274
+
275
+ // handle possible root errors with our provided component or your own custom implementation
276
+ if (treeProps.rootErrorRendererProps) {
277
+ return <StrataKitRootErrorRenderer {...useTreeResult.rootErrorRendererProps} />;
278
+ }
279
+
280
+ // handle loading state
281
+ if (!treeProps.treeRendererProps) {
282
+ return <MyLoadingComponent />;
283
+ }
284
+
285
+ // handle loaded hierarchy
286
+ return <StrataKitTreeRenderer {...useTreeResult.treeProps} />;
287
+ }
288
+ ```
289
+
290
+ ## 2.0.0-alpha.20
291
+
292
+ ### Major Changes
293
+
294
+ - [#965](https://github.com/iTwin/presentation/pull/965): Added `@stratakit/structures` as a peer dependency.
295
+
296
+ ## 2.0.0-alpha.19
297
+
298
+ ### Major Changes
299
+
300
+ - [#954](https://github.com/iTwin/presentation/pull/954): Add additional requirements for types in `EC` metadata namespace, whose objects are returned by `ECSchemaProvider`.
301
+ - `EC.Schema`, `EC.Class` and `EC.Property` now all have an async `getCustomAttributes()` method that returns an `EC.CustomAttributeSet`, allowing consumers to access custom attributes of these schema items.
302
+ - `EC.Class` now additionally has these members:
303
+ - `baseClass: Promise<Class | undefined>`
304
+ - `getDerivedClasses(): Promise<Class[]>`
305
+
306
+ While this is an addition, it's considered a breaking change, because objects of the updated types are expected to be supplied to us by consumers.
307
+
308
+ In reality, consumers will likely use `@itwin/presentation-core-interop` package for creating them, and the package has been updated to handle the change, so reacting to the breaking change is as simple as bumping the version of `@itwin/presentation-core-interop` package in the consumer's `package.json`.
309
+
310
+ ### Patch Changes
311
+
312
+ - [#957](https://github.com/iTwin/presentation/pull/957): Avoid leaking custom props to the `PlaceholderNode` that are causing console errors.
313
+ - Updated dependencies:
314
+ - @itwin/presentation-hierarchies@2.0.0-alpha.0
315
+ - @itwin/presentation-shared@2.0.0-alpha.0
316
+ - @itwin/unified-selection@1.4.2-alpha.0
317
+
318
+ ## 2.0.0-alpha.18
319
+
320
+ ### Major Changes
321
+
322
+ - [#951](https://github.com/iTwin/presentation/pull/951): Move from `@itwin/itwinui-react@5.0.0-alpha` to `@stratakit/*` packages.
323
+
324
+ ## 2.0.0-alpha.17
325
+
326
+ ### Patch Changes
327
+
328
+ - [#949](https://github.com/iTwin/presentation/pull/949): Use default imports instead of `URL` constructor for icons.
329
+
330
+ ## 2.0.0-alpha.16
331
+
332
+ ### Minor Changes
333
+
334
+ - [#945](https://github.com/iTwin/presentation/pull/945): Re-export `getLogger` and `setLogger` functions from `@itwin/presentation-hierarchies` to allow setting a logger.
335
+
336
+ ## 2.0.0-alpha.15
337
+
338
+ ### Major Changes
339
+
340
+ - [#942](https://github.com/iTwin/presentation/pull/942): Unified selection API cleanup.
341
+ - Remove deprecated `UnifiedSelectionProvider`.
342
+ - Make `selectionStorage` prop required for unified selection - enabled tree state hooks (`useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree`).
343
+
344
+ Previously, the `selectionStorage` prop was optional, and if not provided, the hooks used unified selection React context (provided by `UnifiedSelectionProvider`) as fallback. Finally, if the context was not provided either, the hooks acted as regular non-unified selection hooks.
345
+
346
+ This didn't make much sense, as the hooks were designed to work with unified selection, as their name suggests. So it makes sense to require the selection storage to be provided to them, and at that point the context becomes redundant.
347
+
348
+ - [#936](https://github.com/iTwin/presentation/pull/936): Replaced `actions` property on `TreeNodeRenderer` with `getActions` to match how decorations are handled. Removed `useFilterAction` hook and replaced it with `FilterAction` component.
349
+
350
+ Before:
351
+
352
+ ```tsx
353
+ import { TreeNodeRenderer, useFilterAction } from "@itwin/presentation-hierarchies-react";
354
+
355
+ const filterAction = useFilterAction({ onFilter, getHierarchyLevelDetails });
356
+ return (
357
+ <TreeNodeRenderer
358
+ actions={useMemo(
359
+ () => [
360
+ filterAction,
361
+ (node) => ({
362
+ label: "Custom Action",
363
+ actions: () => log(node.label),
364
+ icon: customIconHref,
365
+ }),
366
+ ],
367
+ [filterAction],
368
+ )}
369
+ />
370
+ );
371
+ ```
372
+
373
+ After:
374
+
375
+ ```tsx
376
+ import { Icon, Tree } from "@itwin/itwinui-react";
377
+ import { FilterAction, TreeNodeRenderer } from "@itwin/presentation-hierarchies-react";
378
+
379
+ return (
380
+ <TreeNodeRenderer
381
+ getActions={useCallback(
382
+ (node) => [
383
+ <FilterAction key="filter" node={node} onFilter={onFilter} getHierarchyLevelDetails={getHierarchyLevelDetails} />,
384
+ <Tree.ItemAction key="customAction" label="Custom action" onClick={() => log(node.label)} icon={<Icon href={customIconHref} />} />,
385
+ ],
386
+ [onFilter, getHierarchyLevelDetails],
387
+ )}
388
+ />
389
+ );
390
+ ```
391
+
392
+ ### Minor Changes
393
+
394
+ - [#930](https://github.com/iTwin/presentation/pull/930): Exposed `TreeErrorRenderer`, which takes `renderError` property to render custom error messages.
395
+ `TreeRenderer` now takes `errorRenderer` to render a custom error display component.
396
+
397
+ Custom error display component example:
398
+
399
+ ```ts
400
+ <TreeRenderer
401
+ {...treeProps}
402
+ errorRenderer={(errorsRendererProps) => (
403
+ <MyErrorRenderer {...errorsRendererProps} />
404
+ )}
405
+ />
406
+ ```
407
+
408
+ Custom error message example:
409
+
410
+ ```ts
411
+ <TreeRenderer
412
+ {...treeProps}
413
+ errorRenderer={(errorsRendererProps) => (
414
+ <TreeErrorRenderer
415
+ {...errorsRendererProps}
416
+ renderError={(errorProps) => {
417
+ return <unstable_ErrorRegion.Item message={...} />;
418
+ }}
419
+ />
420
+ )}
421
+ />
422
+ ```
423
+
424
+ - [#937](https://github.com/iTwin/presentation/pull/937): `TreeRenderer` now takes `rootErrorRenderer` to render a custom root error display component.
425
+
426
+ Custom error display component example:
427
+
428
+ ```ts
429
+ <TreeRenderer
430
+ {...treeProps}
431
+ rootErrorRenderer={(rootErrorRendererProps) => (
432
+ <MyRootErrorRenderer {...rootErrorRendererProps} />
433
+ )}
434
+ />
435
+ ```
436
+
437
+ - [#930](https://github.com/iTwin/presentation/pull/930): Changed flat tree building functions to hooks:
438
+ - `flattenNodes` => `useFlatTreeNodeList`.
439
+ - `getErrors` => `useErrorList`.
440
+
441
+ ### Patch Changes
442
+
443
+ - [#930](https://github.com/iTwin/presentation/pull/930): Fix `ResultSetTooLarge` error suggesting filtering when parent node is not filterable.
444
+
445
+ ## 2.0.0-alpha.14
446
+
447
+ ### Patch Changes
448
+
449
+ - [#928](https://github.com/iTwin/presentation/pull/928): Memoize tree components to reduce the amount of renders.
450
+
451
+ ## 2.0.0-alpha.13
452
+
453
+ ### Patch Changes
454
+
455
+ - [#924](https://github.com/iTwin/presentation/pull/924): Fix tree error dropdown not applying actions.
456
+
457
+ ## 2.0.0-alpha.12
458
+
459
+ ### Patch Changes
460
+
461
+ - [#922](https://github.com/iTwin/presentation/pull/922): Fix tree displaying aditional scrollbars, when scrolling to the last element with low tree width.
462
+
463
+ ## 2.0.0-alpha.11
464
+
465
+ ### Patch Changes
466
+
467
+ - [#916](https://github.com/iTwin/presentation/pull/916): Fix tree nodes overlapping when nodes with and without sublabel are rendered alongside.
468
+ - [#920](https://github.com/iTwin/presentation/pull/920): Changed error display for node errors to match new design system.
469
+
470
+ ## 2.0.0-alpha.10
471
+
472
+ ### Patch Changes
473
+
474
+ - [#913](https://github.com/iTwin/presentation/pull/913): Removed outline showed after node expander is clicked.
475
+
476
+ ## 2.0.0-alpha.9
477
+
478
+ ### Patch Changes
479
+
480
+ - [#906](https://github.com/iTwin/presentation/pull/906): Replaced `TreeNodeRenderer.getIcon` prop with `getDecorations` prop.
481
+
482
+ The `getIcon` prop took either an icon URI, or a `ReactElement`. The new `getDecorations` prop allows passing multiple React elements, allowing consumers to render not just the icon, but also addition components like a tag or a color swatch. Migration:
483
+
484
+ ```ts
485
+ // previously, when `getIcon` returned a `ReactElement`:
486
+ function myGetIcon(node: PresentationHierarchyNode): React.ReactElement {
487
+ // implementation...
488
+ }
489
+ <TreeNodeRenderer getIcon={myGetIcon} />
490
+
491
+ // now:
492
+ <TreeNodeRenderer getDecorations={myGetIcon} />
493
+
494
+ // previously, when `getIcon` returned an icon URI:
495
+ function myGetIconUri(node: PresentationHierarchyNode): string {
496
+ // implementation...
497
+ }
498
+ <TreeNodeRenderer getIcon={myGetIconUri} />
499
+
500
+ // now:
501
+ <TreeNodeRenderer getDecorations={(node) => <Icon href={myGetIconUri(node)} />} />
502
+ ```
503
+
504
+ - [#911](https://github.com/iTwin/presentation/pull/911): Fix incorrect left padding on tree items
505
+
506
+ ## 2.0.0-alpha.8
507
+
508
+ ### Patch Changes
509
+
510
+ - [#903](https://github.com/iTwin/presentation/pull/903): Added `activeDescription` optional property to TreeItemAction interface, which when provided a value will display a dot above the button indicating an active state. The provided value is used to set accesible description and should explain why the action item is active.
511
+ - [#903](https://github.com/iTwin/presentation/pull/903): Changed `createFilterAction` function to a React hook and renamed it to `useFilterAction`.
512
+
513
+ ## 2.0.0-alpha.7
514
+
515
+ ### Patch Changes
516
+
517
+ - [#892](https://github.com/iTwin/presentation/pull/892): Fix focus outline for tree items not being visible on action items click.
518
+ - [#894](https://github.com/iTwin/presentation/pull/894): Fix `treeRenderer` property `getSublabel` not being used.
519
+
520
+ ## 2.0.0-alpha.6
521
+
522
+ ### Patch Changes
523
+
524
+ - [#890](https://github.com/iTwin/presentation/pull/890): Fix alpha peer dependencies to no longer have caret.
525
+
526
+ ## 2.0.0-alpha.5
527
+
528
+ ### Minor Changes
529
+
530
+ - [#883](https://github.com/iTwin/presentation/pull/883): Trees rendered with `TreeRenderer` will now be virtualized.
531
+
3
532
  ## 2.0.0-alpha.4
4
533
 
5
534
  ### Minor Changes
6
535
 
7
536
  - [#878](https://github.com/iTwin/presentation/pull/878): Tree node renderer now uses `Tree.ItemAction`. `Show` property now takes in undefined values, values behave like this:
8
-
9
537
  - `undefined` - visible on hover/focus,
10
538
  - `true` - visible at all times,
11
539
  - `false` - hidden at all times.
12
540
 
13
541
  Updated peer dependencies:
14
-
15
542
  - itwinui-icons to 5.0.0-alpha.3,
16
543
  - itwinui-react to 5.0.0-alpha.6,
17
544
 
@@ -20,7 +547,6 @@
20
547
  ### Patch Changes
21
548
 
22
549
  - [#870](https://github.com/iTwin/presentation/pull/870): `TreeRenderer` and `TreeNodeRenderer` now take actions as specification function array.
23
-
24
550
  - `label`: Action item's label.
25
551
  - `action`: The action performed when the button is clicked.
26
552
  - `show` A boolean determining whether the button should be displayed.
@@ -42,7 +568,6 @@
42
568
  - [#862](https://github.com/iTwin/presentation/pull/862): Update `@itwin/itwinui-react` dependency to `5.0.0-alpha.3`.
43
569
 
44
570
  This fixes the following issues:
45
-
46
571
  - nodes being selected on expand,
47
572
  - node action buttons being rendered incorrectly.
48
573
 
@@ -52,12 +577,175 @@
52
577
 
53
578
  - [#847](https://github.com/iTwin/presentation/pull/847): Moving tree rendering components to a new design systems.
54
579
 
580
+ ## 1.9.5
581
+
582
+ ### Patch Changes
583
+
584
+ - [#1079](https://github.com/iTwin/presentation/pull/1079): Fixed tree node actions background color when node is selected and hovered.
585
+
586
+ ## 1.9.4
587
+
588
+ ### Patch Changes
589
+
590
+ - [#1063](https://github.com/iTwin/presentation/pull/1063): Make sure tree node actions are properly sticking to the right side when scrolling tree horizontally.
591
+
592
+ ## 1.9.3
593
+
594
+ ### Patch Changes
595
+
596
+ - [#1054](https://github.com/iTwin/presentation/pull/1054): Show tooltip with full label on tree nodes.
597
+
598
+ ## 1.9.2
599
+
600
+ ### Patch Changes
601
+
602
+ - [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
603
+ - Updated dependencies:
604
+ - @itwin/presentation-hierarchies@1.7.2
605
+ - @itwin/presentation-shared@1.2.3
606
+ - @itwin/unified-selection@1.5.1
607
+
608
+ ## 1.9.1
609
+
610
+ ### Patch Changes
611
+
612
+ - [#1033](https://github.com/iTwin/presentation/pull/1033): Fix unified selection tree state hooks `useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree` not handling the recently added `createSelectableForGenericNode` prop.
613
+
614
+ ## 1.9.0
615
+
616
+ ### Minor Changes
617
+
618
+ - [#1027](https://github.com/iTwin/presentation/pull/1027): Added `getActions` property to `TreeRenderer` and `TreeNodeRenderer` to allow providing custom actions for tree nodes.
619
+
620
+ ## 1.8.1
621
+
622
+ ### Patch Changes
623
+
624
+ - Updated dependencies:
625
+ - @itwin/presentation-hierarchies@1.7.1
626
+
627
+ ## 1.8.0
628
+
629
+ ### Minor Changes
630
+
631
+ - [#1019](https://github.com/iTwin/presentation/pull/1019): Add ability to customize `Selectable` objects that are added to unified selection, when a generic node in a unified selection-driven tree component is selected.
632
+
633
+ By default, when a generic node is selected in a unified selection-driven tree component, the `Selectable` that is created for it gets a per-tree unique identifier. This means that a similar generic node somewhere else in the tree or a different tree will not be considered the same. However, in some cases we do want generic nodes to be treated as the same, and for that matter unified selection-enabling tree state hooks now have a new `createSelectableForGenericNode` option:
634
+
635
+ ```tsx
636
+ import { useUnifiedSelectionTree } from "@itwin/presentation-hierarchies-react";
637
+
638
+ const treeState = useUnifiedSelectionTree({
639
+ selectionStorage,
640
+ createSelectableForGenericNode: useCallback<NonNullable<Props<typeof useUnifiedSelectionTree>["createSelectableForGenericNode"]>>(
641
+ (node, uniqueId) => ({ identifier: node.key.id, data: node, async *loadInstanceKeys() {} }),
642
+ [],
643
+ ),
644
+ // ...other options
645
+ });
646
+ ```
647
+
648
+ ### Patch Changes
649
+
650
+ - Updated dependencies:
651
+ - @itwin/unified-selection@1.5.0
652
+
653
+ ## 1.7.2
654
+
655
+ ### Patch Changes
656
+
657
+ - Updated dependencies:
658
+ - @itwin/presentation-hierarchies@1.7.0
659
+
660
+ ## 1.7.1
661
+
662
+ ### Patch Changes
663
+
664
+ - Updated dependencies:
665
+ - @itwin/presentation-hierarchies@1.6.1
666
+
667
+ ## 1.7.0
668
+
669
+ ### Minor Changes
670
+
671
+ - 64e80beaeb87e5797d8238c14fa9cd8dbfcee7c3: Added `abortSignal` to `getFilteredPaths` callback used by `UseTree` hook. This allows to cancel ongoing requests when component is unmounted or new request is started.
672
+
673
+ ### Patch Changes
674
+
675
+ - Updated dependencies:
676
+ - @itwin/presentation-hierarchies@1.6.0
677
+
678
+ ## 1.6.9
679
+
680
+ ### Patch Changes
681
+
682
+ - [#1000](https://github.com/iTwin/presentation/pull/1000): Made sure `Apply filter` button becomes focused after hierarchy level filter is applied.
683
+
684
+ ## 1.6.8
685
+
686
+ ### Patch Changes
687
+
688
+ - [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
689
+ - Updated dependencies:
690
+ - @itwin/presentation-hierarchies@1.5.1
691
+ - @itwin/presentation-shared@1.2.2
692
+ - @itwin/unified-selection@1.4.2
693
+
694
+ ## 1.6.7
695
+
696
+ ### Patch Changes
697
+
698
+ - [#974](https://github.com/iTwin/presentation/pull/974): Removed tree node outline on mobile devices.
699
+ - Updated dependencies:
700
+ - @itwin/presentation-hierarchies@1.5.0
701
+
702
+ ## 1.6.6
703
+
704
+ ### Patch Changes
705
+
706
+ - [#944](https://github.com/iTwin/presentation/pull/944): Fixed `extended` selection mode not replacing existing selection when selected node is clicked.
707
+
708
+ ## 1.6.5
709
+
710
+ ### Patch Changes
711
+
712
+ - [#938](https://github.com/iTwin/presentation/pull/938): Fixed hierarchy level size exceeded message that suggest applying filtering on hierarchy levels that do not support filtering.
713
+
714
+ ## 1.6.4
715
+
716
+ ### Patch Changes
717
+
718
+ - [#909](https://github.com/iTwin/presentation/pull/909): Do not use `dev` versions of `@itwin/*` packages.
719
+ - Updated dependencies:
720
+ - @itwin/unified-selection@1.4.1
721
+ - @itwin/presentation-hierarchies@1.4.2
722
+ - @itwin/presentation-shared@1.2.1
723
+
724
+ ## 1.6.3
725
+
726
+ ### Patch Changes
727
+
728
+ - Updated dependencies:
729
+ - @itwin/unified-selection@1.4.0
730
+
731
+ ## 1.6.2
732
+
733
+ ### Patch Changes
734
+
735
+ - [#873](https://github.com/iTwin/presentation/pull/873): Fix hierarchy level size exceeds limit info message wrapping in narrow Tree on Safari browser.
736
+ - [#873](https://github.com/iTwin/presentation/pull/873): Do not require two clicks to expand node with filter buttons on touch devices.
737
+
738
+ ## 1.6.1
739
+
740
+ ### Patch Changes
741
+
742
+ - [#866](https://github.com/iTwin/presentation/pull/866): Updated hierarchy level size exceeded info message styling in narrow tree component to avoid cutting out text.
743
+
55
744
  ## 1.6.0
56
745
 
57
746
  ### Minor Changes
58
747
 
59
748
  - [#841](https://github.com/iTwin/presentation/pull/841): Changed how tree state hooks access unified selection storage.
60
-
61
749
  - The tree state hooks that hook into unified selection system now accept a `selectionStorage` prop. At the moment the prop is optional, but will be made required in the next major release of the package.
62
750
  - The `UnifiedSelectionProvider` React context provider is now deprecated. The context is still used by tree state hooks if the selection storage is not provided through prop.
63
751
 
@@ -103,7 +791,6 @@
103
791
  ### Minor Changes
104
792
 
105
793
  - [#840](https://github.com/iTwin/presentation/pull/840): Added `filterButtonsVisibility` to `treeNodeRenderer`. Which allows configuring filter buttons visibility for the whole tree.
106
-
107
794
  - `show-on-hover` - default value, shows filter buttons on node hover or focus.
108
795
  - `hide` - hides filter buttons on focus and hover, but will continue to show buttons on nodes in which filter is applied. Reaching hierarchy limit will continue to provide a way to filter nodes.
109
796
 
@@ -314,7 +1001,6 @@
314
1001
  See "Basic example" section in README learning page for the full example.
315
1002
 
316
1003
  - [#717](https://github.com/iTwin/presentation/pull/717): **BREAKING:** Add support for non-iModel-driven trees.
317
-
318
1004
  - `useTree` and `useUnifiedSelectionTree` hooks have been changed to support non-iModel-driven trees. The hooks take a `getHierarchyProvider` prop, which returns a `HierarchyProvider`. The provider can return data from any data source.
319
1005
  - New `useIModelTree` and `useIModelUnifiedSelectionTree` hooks have been added to cover the most common case, where a tree is created from a iModel's data. The API of these hooks is exactly the same as of the old `useTree` and `useUnifiedSelectionTree` hooks.
320
1006