@itwin/tree-widget-react 1.0.0 → 1.1.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +49 -181
  2. package/lib/cjs/TreeWidget.d.ts +1 -0
  3. package/lib/cjs/TreeWidget.js +10 -3
  4. package/lib/cjs/TreeWidget.js.map +1 -1
  5. package/lib/cjs/components/SelectableTree.scss +0 -1
  6. package/lib/cjs/components/trees/VisibilityTreeBase.scss +55 -84
  7. package/lib/cjs/components/trees/VisibilityTreeRenderer.d.ts +4 -3
  8. package/lib/cjs/components/trees/VisibilityTreeRenderer.js +5 -4
  9. package/lib/cjs/components/trees/VisibilityTreeRenderer.js.map +1 -1
  10. package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +1 -1
  11. package/lib/cjs/components/trees/category-tree/CategoriesTree.js +13 -1
  12. package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +1 -1
  13. package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +2 -2
  14. package/lib/cjs/components/trees/common/ContextMenu.d.ts +39 -0
  15. package/lib/cjs/components/trees/common/ContextMenu.js +44 -0
  16. package/lib/cjs/components/trees/common/ContextMenu.js.map +1 -0
  17. package/lib/cjs/components/trees/common/TreeNodeRenderer.d.ts +61 -0
  18. package/lib/cjs/components/trees/common/TreeNodeRenderer.js +50 -0
  19. package/lib/cjs/components/trees/common/TreeNodeRenderer.js.map +1 -0
  20. package/lib/cjs/components/trees/common/TreeRenderer.d.ts +26 -0
  21. package/lib/cjs/components/trees/common/TreeRenderer.js +41 -0
  22. package/lib/cjs/components/trees/common/TreeRenderer.js.map +1 -0
  23. package/lib/cjs/components/trees/common/TreeRenderer.scss +102 -0
  24. package/lib/cjs/components/trees/{Common.d.ts → common/Types.d.ts} +3 -2
  25. package/lib/cjs/components/trees/{Common.js → common/Types.js} +1 -1
  26. package/lib/cjs/components/trees/common/Types.js.map +1 -0
  27. package/lib/cjs/components/trees/common/Utils.d.ts +11 -0
  28. package/lib/cjs/components/trees/common/Utils.js +49 -0
  29. package/lib/cjs/components/trees/common/Utils.js.map +1 -0
  30. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  31. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +9 -4
  32. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  33. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +7 -1
  34. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -4
  35. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  36. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  37. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +8 -2
  38. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  39. package/lib/cjs/components/trees/index.d.ts +4 -2
  40. package/lib/cjs/components/trees/index.js +4 -2
  41. package/lib/cjs/components/trees/index.js.map +1 -1
  42. package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +6 -4
  43. package/lib/cjs/components/trees/models-tree/ModelsTree.js +25 -10
  44. package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
  45. package/lib/cjs/components/trees/models-tree/Utils.d.ts +2 -2
  46. package/lib/cjs/components/trees/models-tree/Utils.js +269 -335
  47. package/lib/cjs/components/trees/models-tree/Utils.js.map +1 -1
  48. package/lib/cjs/e2e-tests/TreeWidget.test.d.ts +2 -0
  49. package/lib/cjs/e2e-tests/TreeWidget.test.js +46 -0
  50. package/lib/cjs/e2e-tests/TreeWidget.test.js.map +1 -0
  51. package/lib/cjs/e2e-tests/utils.d.ts +8 -0
  52. package/lib/cjs/e2e-tests/utils.js +40 -0
  53. package/lib/cjs/e2e-tests/utils.js.map +1 -0
  54. package/lib/esm/TreeWidget.d.ts +1 -0
  55. package/lib/esm/TreeWidget.js +10 -3
  56. package/lib/esm/TreeWidget.js.map +1 -1
  57. package/lib/esm/components/SelectableTree.scss +0 -1
  58. package/lib/esm/components/trees/VisibilityTreeBase.scss +55 -84
  59. package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +4 -3
  60. package/lib/esm/components/trees/VisibilityTreeRenderer.js +6 -5
  61. package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +1 -1
  62. package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +1 -1
  63. package/lib/esm/components/trees/category-tree/CategoriesTree.js +10 -1
  64. package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +1 -1
  65. package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +2 -2
  66. package/lib/esm/components/trees/common/ContextMenu.d.ts +39 -0
  67. package/lib/esm/components/trees/common/ContextMenu.js +39 -0
  68. package/lib/esm/components/trees/common/ContextMenu.js.map +1 -0
  69. package/lib/esm/components/trees/common/TreeNodeRenderer.d.ts +61 -0
  70. package/lib/esm/components/trees/common/TreeNodeRenderer.js +44 -0
  71. package/lib/esm/components/trees/common/TreeNodeRenderer.js.map +1 -0
  72. package/lib/esm/components/trees/common/TreeRenderer.d.ts +26 -0
  73. package/lib/esm/components/trees/common/TreeRenderer.js +34 -0
  74. package/lib/esm/components/trees/common/TreeRenderer.js.map +1 -0
  75. package/lib/esm/components/trees/common/TreeRenderer.scss +102 -0
  76. package/lib/esm/components/trees/{Common.d.ts → common/Types.d.ts} +3 -2
  77. package/lib/esm/components/trees/{Common.js → common/Types.js} +1 -1
  78. package/lib/esm/components/trees/common/Types.js.map +1 -0
  79. package/lib/esm/components/trees/common/Utils.d.ts +11 -0
  80. package/lib/esm/components/trees/common/Utils.js +42 -0
  81. package/lib/esm/components/trees/common/Utils.js.map +1 -0
  82. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  83. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +9 -4
  84. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  85. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +7 -1
  86. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -4
  87. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  88. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  89. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +8 -2
  90. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  91. package/lib/esm/components/trees/index.d.ts +4 -2
  92. package/lib/esm/components/trees/index.js +4 -2
  93. package/lib/esm/components/trees/index.js.map +1 -1
  94. package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +6 -4
  95. package/lib/esm/components/trees/models-tree/ModelsTree.js +19 -7
  96. package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
  97. package/lib/esm/components/trees/models-tree/Utils.d.ts +2 -2
  98. package/lib/esm/components/trees/models-tree/Utils.js +267 -333
  99. package/lib/esm/components/trees/models-tree/Utils.js.map +1 -1
  100. package/lib/esm/e2e-tests/TreeWidget.test.d.ts +2 -0
  101. package/lib/esm/e2e-tests/TreeWidget.test.js +41 -0
  102. package/lib/esm/e2e-tests/TreeWidget.test.js.map +1 -0
  103. package/lib/esm/e2e-tests/utils.d.ts +8 -0
  104. package/lib/esm/e2e-tests/utils.js +30 -0
  105. package/lib/esm/e2e-tests/utils.js.map +1 -0
  106. package/package.json +6 -2
  107. package/lib/cjs/components/trees/Common.js.map +0 -1
  108. package/lib/esm/components/trees/Common.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Change Log - @itwin/tree-widget-react
2
2
 
3
- This log was last generated on Mon, 31 Jul 2023 14:10:09 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Aug 2023 14:42:37 GMT and should not be manually modified.
4
+
5
+ ## 1.1.1
6
+ Thu, 17 Aug 2023 14:42:37 GMT
7
+
8
+ ### Patches
9
+
10
+ - Trees: Fix eye checkbox background when node is selected and hovered.
11
+
12
+ ## 1.1.0
13
+ Mon, 07 Aug 2023 13:36:23 GMT
14
+
15
+ ### Minor changes
16
+
17
+ - Trees: Added ability to increase node size in order to make tree more user friendly on touch devices.
18
+ - Trees: Added ability to customize tree node label
19
+ - `ModelsTree`: Added ability to show models without elements.
20
+ - Added context menu support.
21
+
22
+ ### Patches
23
+
24
+ - Removed `@itwin/itwinui-variables` from dependencies.
4
25
 
5
26
  ## 1.0.0
6
27
  Mon, 31 Jul 2023 14:10:09 GMT
@@ -47,33 +68,33 @@ Tue, 02 May 2023 16:12:17 GMT
47
68
 
48
69
  ### Minor changes
49
70
 
50
- - Updated to AppUI 4.0 and Presentation 4.0
71
+ - Updated to AppUI 4.0 and Presentation 4.0.
51
72
 
52
73
  ## 0.8.0
53
74
  Mon, 03 Apr 2023 15:34:07 GMT
54
75
 
55
76
  ### Minor changes
56
77
 
57
- - Removed `SpatialTree` and related components in favor of the ones in `@itwin/breakdown-trees-react`
58
- - Updated dependencies (`itwinui@2`, `appui@4`, `presentation-components@4`, `itwinjs-core@3.7`)
78
+ - Removed `SpatialTree` and related components in favor of the ones in `@itwin/breakdown-trees-react`.
79
+ - Updated dependencies (`itwinui@2`, `appui@4`, `presentation-components@4`, `itwinjs-core@3.7`).
59
80
 
60
81
  ### Patches
61
82
 
62
- - Use iTwin UI components instead of custom ones and CSS variables from `@itwin/itwinui-variables` instead of `@itwin/core-react`
83
+ - Use iTwin UI components instead of custom ones and CSS variables from `@itwin/itwinui-variables` instead of `@itwin/core-react`.
63
84
 
64
85
  ## 0.7.2
65
86
  Fri, 24 Mar 2023 10:46:34 GMT
66
87
 
67
88
  ### Patches
68
89
 
69
- - Fixed tree filtering not being removed when search box is closed
90
+ - Fixed tree filtering not being removed when search box is closed.
70
91
 
71
92
  ## 0.7.1
72
93
  Thu, 23 Mar 2023 15:12:36 GMT
73
94
 
74
95
  ### Patches
75
96
 
76
- - 'ModelsTree': Restored 'HideAll' button behavior to hide only models
97
+ - 'ModelsTree': Restored 'HideAll' button behavior to hide only models.
77
98
 
78
99
  ## 0.7.0
79
100
  Mon, 20 Mar 2023 14:48:35 GMT
@@ -81,12 +102,12 @@ Mon, 20 Mar 2023 14:48:35 GMT
81
102
  ### Minor changes
82
103
 
83
104
  - Add an option to control what buttons are available in tree toolbars.
84
- - Upgrade `itwinjs-core` dependencies to `^3.6.0`
85
- - Upgrade `typescript` to `~4.4.0`
105
+ - Upgrade `itwinjs-core` dependencies to `^3.6.0`.
106
+ - Upgrade `typescript` to `~4.4.0`.
86
107
 
87
108
  ### Patches
88
109
 
89
- - ModelsTree: ensure that the "Show all" button is going to show all elements when there are elements with an "exclusive" flag
110
+ - ModelsTree: ensure that the "Show all" button is going to show all elements when there are elements with an "exclusive" flag.
90
111
  - '2d' and '3d' buttons react to visibility changes in the viewport. The '2d' button will be disabled if no models with the PlanProjection flag are present in the model.
91
112
 
92
113
  ## 0.6.2
@@ -94,30 +115,30 @@ Thu, 09 Mar 2023 20:08:53 GMT
94
115
 
95
116
  ### Patches
96
117
 
97
- - `ModelsTreeComponent`: ensure that the "show all" and "hide all" buttons affect all iModel content
98
- - Models Tree: Remove unused feature of filtering the tree by element ids
118
+ - `ModelsTreeComponent`: ensure that the "show all" and "hide all" buttons affect all iModel content.
119
+ - `ModelsTree`: Remove unused feature of filtering the tree by element ids.
99
120
 
100
121
  ## 0.6.1
101
122
  Thu, 19 Jan 2023 10:29:18 GMT
102
123
 
103
124
  ### Patches
104
125
 
105
- - CategoriesTree: Updated ruleset to not show private SubCategories
106
- - Bug fix for changing visibility of multiple nodes at once
126
+ - `CategoryTree`: Updated ruleset to not show private SubCategories.
127
+ - Bug fix for changing visibility of multiple nodes at once.
107
128
 
108
129
  ## 0.6.0
109
130
  Tue, 20 Dec 2022 15:12:29 GMT
110
131
 
111
132
  ### Minor changes
112
133
 
113
- - Moved core trees implementation from @itwin/appui-react package to @itwin/tree-widget-react
134
+ - Moved core trees implementation from `@itwin/appui-react` package to `@itwin/tree-widget-react`.
114
135
 
115
136
  ## 0.5.0
116
137
  Mon, 12 Sep 2022 19:50:36 GMT
117
138
 
118
139
  ### Minor changes
119
140
 
120
- - Add new `defaultTreeId` prop to specify default tree for TreeWidgetUiItemsProvider
141
+ - Add new `defaultTreeId` prop to specify default tree for `TreeWidgetUiItemsProvider`.
121
142
 
122
143
  ## 0.4.7
123
144
  Mon, 30 May 2022 12:44:10 GMT
@@ -131,28 +152,28 @@ Thu, 26 May 2022 15:54:07 GMT
131
152
 
132
153
  ### Patches
133
154
 
134
- - Allow a caller to specify a default priority for Tree Widget item provider.
155
+ - Allow a caller to specify a default priority for `TreeWidgetUiItemsProvider`.
135
156
 
136
157
  ## 0.4.5
137
158
  Mon, 09 May 2022 18:04:58 GMT
138
159
 
139
160
  ### Patches
140
161
 
141
- - set restore transient state in tree widget ui items provider to restore state when remounted
162
+ - Set restore transient state in `TreeWidgetUiItemsProvider` to restore state when remounted.
142
163
 
143
164
  ## 0.4.4
144
165
  Thu, 05 May 2022 12:21:21 GMT
145
166
 
146
167
  ### Patches
147
168
 
148
- - set tree-widget-search-bar-button-container z-index to 1
169
+ - Set tree-widget-search-bar-button-container z-index to 1.
149
170
 
150
171
  ## 0.4.3
151
172
  Thu, 21 Apr 2022 18:47:53 GMT
152
173
 
153
174
  ### Patches
154
175
 
155
- - Do not unmount children in AutoSizer when height or width is 0 to avoid losing children state
176
+ - Do not unmount children in `AutoSizer` when height or width is 0 to avoid losing children state.
156
177
 
157
178
  ## 0.4.2
158
179
  Tue, 19 Apr 2022 14:15:57 GMT
@@ -166,201 +187,48 @@ Wed, 06 Apr 2022 13:48:44 GMT
166
187
 
167
188
  ### Patches
168
189
 
169
- - Updates to allow specification of default panel location.
170
- - Add transitive peers as dev deps
171
- - added tree icon to tree widget tab
190
+ - Allow specifying default panel location.
191
+ - Added tree icon to tree widget tab.
172
192
 
173
193
  ## 0.4.0
174
194
  Fri, 18 Mar 2022 13:31:19 GMT
175
195
 
176
196
  ### Minor changes
177
197
 
178
- - Remove deprecated WidgetControl, update UiItemsProvider init
198
+ - Remove deprecated `WidgetControl`, update `UiItemsProvider` initialization.
179
199
 
180
200
  ## 0.3.0
181
201
  Wed, 02 Mar 2022 21:38:51 GMT
182
202
 
183
203
  ### Minor changes
184
204
 
185
- - Add `IModelContentTree`
205
+ - Add `IModelContentTree`.
186
206
 
187
207
  ## 0.2.1
188
208
  Fri, 04 Feb 2022 00:43:35 GMT
189
209
 
190
210
  ### Patches
191
211
 
192
- - Update scss to be pulled from cjs dir
212
+ - Update scss to be pulled from cjs dir.
193
213
 
194
214
  ## 0.2.0
195
215
  Mon, 24 Jan 2022 19:14:37 GMT
196
216
 
197
217
  ### Minor changes
198
218
 
199
- - Bump to official iTwin.js 3.0 release
219
+ - Bump to official iTwin.js 3.0 release.
200
220
 
201
221
  ## 0.1.2
202
222
  Wed, 19 Jan 2022 17:39:40 GMT
203
223
 
204
224
  ### Patches
205
225
 
206
- - updated to latest rc, dev-185, and updated deps
226
+ - Updated to latest rc, dev-185, and updated deps.
207
227
 
208
228
  ## 0.1.1
209
229
  Wed, 12 Jan 2022 13:59:35 GMT
210
230
 
211
231
  ### Patches
212
232
 
213
- - iTwin.js 3.0 first rc
214
-
215
- ## 1.4.6
216
- Tue, 11 Jan 2022 16:25:27 GMT
217
-
218
- ### Patches
219
-
220
- - Fix hide all button blocked by search bar
221
-
222
- ## 1.4.5
223
- Tue, 23 Nov 2021 21:19:42 GMT
224
-
225
- ### Patches
226
-
227
- - Fix an issue where ModelsTree Component could lose its state
228
-
229
- ## 1.4.4
230
- Thu, 16 Sep 2021 17:55:54 GMT
231
-
232
- ### Patches
233
-
234
- - Stop delivering psuedo-localized strings
235
-
236
- ## 1.4.3
237
- Thu, 26 Aug 2021 14:00:14 GMT
238
-
239
- ### Patches
240
-
241
- - Search bar was not sized correctly, and alignment was not centered.
242
-
243
- ## 1.4.2
244
- Mon, 09 Aug 2021 20:24:55 GMT
245
-
246
- ### Patches
247
-
248
- - Updated tree widget barrel file to include UiProvider
249
-
250
- ## 1.4.1
251
- Mon, 19 Jul 2021 18:07:24 GMT
252
-
253
- ### Patches
254
-
255
- - Model/Category tree was not resizing properly, missing flex=1.
256
-
257
- ## 1.4.0
258
- Tue, 13 Jul 2021 17:43:28 GMT
259
-
260
- ### Minor changes
261
-
262
- - Added a UiProvider that implements the existing tree widget
263
-
264
- ## 1.3.1
265
- Tue, 08 Jun 2021 21:23:59 GMT
266
-
267
- ### Patches
268
-
269
- - bump classnames dep
270
-
271
- ## 1.3.0
272
- Thu, 13 May 2021 21:15:14 GMT
273
-
274
- ### Minor changes
275
-
276
- - update imjs to 2.15.2 to resolve breaking change in usePResentationTreeNodeLoader
277
-
278
- ## 1.2.8
279
- Wed, 24 Mar 2021 21:09:25 GMT
280
-
281
- ### Patches
282
-
283
- - Avoid Nested ScrollBars in Tree View widget
284
-
285
- ## 1.2.7
286
- Tue, 23 Mar 2021 16:17:57 GMT
287
-
288
- ### Patches
289
-
290
- - Change .component-selectable-content to block to display to fix resize flicker.
291
-
292
- ## 1.2.6
293
- Fri, 26 Feb 2021 18:43:33 GMT
294
-
295
- ### Patches
296
-
297
- - Fixes for models tree not loading models when using show all, invert and other toggles
298
-
299
- ## 1.2.5
300
- Tue, 15 Dec 2020 13:51:37 GMT
301
-
302
- ### Patches
303
-
304
- - Fix styling issues in search bar
305
-
306
- ## 1.2.4
307
- Wed, 09 Dec 2020 19:09:13 GMT
308
-
309
- ### Patches
310
-
311
- - Fixing resizing issues with the SearchBox in Model tree
312
-
313
- ## 1.2.3
314
- Tue, 25 Aug 2020 16:57:36 GMT
315
-
316
- ### Patches
317
-
318
- - rm unecessary dep on react-scripts
319
-
320
- ## 1.2.2
321
- Mon, 24 Aug 2020 17:39:24 GMT
322
-
323
- ### Patches
324
-
325
- - alphabetize package.json
326
-
327
- ## 1.2.1
328
- Fri, 21 Aug 2020 21:17:48 GMT
329
-
330
- ### Patches
331
-
332
- - readme update
333
- - support replacing model/category/spatial trees in TreeWidgetControl
334
-
335
- ## 1.2.0
336
- Tue, 11 Aug 2020 14:24:07 GMT
337
-
338
- ### Minor changes
339
-
340
- - Added 2D / 3D toggle to tree view header
341
-
342
- ### Patches
343
-
344
- - Decouple tree header for using in other widgets
345
-
346
- ## 1.1.1
347
- Tue, 28 Jul 2020 22:10:32 GMT
348
-
349
- ### Patches
350
-
351
- - Fixes for tree widgets consistency: Category tree invert functionality, tooltips on buttons and fix for iFrame height of tree not defined properly
352
-
353
- ## 1.1.0
354
- Tue, 14 Jul 2020 22:54:18 GMT
355
-
356
- ### Minor changes
357
-
358
- - "Add classifications tree."
359
- - Added in tree-widget package
360
- - Replacing ThemedSelect component with SelectableContent component
361
-
362
- ### Patches
363
-
364
- - Functional component.
365
- - Model tree search box will now properly clear itself in addition to closing when its "X" icon is hit
233
+ - iTwin.js 3.0 first rc.
366
234
 
@@ -7,6 +7,7 @@ import type { LocalizationOptions } from "@itwin/core-i18n";
7
7
  export declare class TreeWidget {
8
8
  private static _i18n?;
9
9
  private static _initialized?;
10
+ private static _dispose?;
10
11
  /**
11
12
  * Called by IModelApp to initialize the Tree Widget
12
13
  * @param i18n - The internationalization service created by the IModelApp.
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TreeWidget = void 0;
8
8
  const appui_abstract_1 = require("@itwin/appui-abstract");
9
9
  const core_frontend_1 = require("@itwin/core-frontend");
10
+ const Utils_1 = require("./components/trees/common/Utils");
10
11
  /**
11
12
  * Entry point for static initialization required by various components used in the package.
12
13
  * @public
@@ -21,13 +22,19 @@ class TreeWidget {
21
22
  return;
22
23
  TreeWidget._initialized = true;
23
24
  TreeWidget._i18n = i18n ?? core_frontend_1.IModelApp.localization;
25
+ TreeWidget._dispose = (0, Utils_1.registerRenderers)();
24
26
  return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);
25
27
  }
26
28
  /** Unregisters the TreeWidget internationalization service namespace */
27
29
  static terminate() {
28
- if (TreeWidget._i18n)
29
- TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace); // eslint-disable-line @itwin/no-internal
30
- TreeWidget._i18n = undefined;
30
+ if (TreeWidget._i18n) {
31
+ TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace);
32
+ TreeWidget._i18n = undefined;
33
+ }
34
+ if (TreeWidget._dispose) {
35
+ TreeWidget._dispose();
36
+ TreeWidget._dispose = undefined;
37
+ }
31
38
  TreeWidget._initialized = false;
32
39
  }
33
40
  /** The internationalization service created by the IModelApp. */
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../src/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,0DAAgD;AAChD,wDAAiD;AAKjD;;;GAGG;AACH,MAAa,UAAU;IAIrB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAE9B,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAElD,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK;YAClB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,yCAAyC;QAC3G,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;QAC7B,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK;YACnB,MAAM,IAAI,wBAAO,CACf,UAAU,CAAC,WAAW,EACtB,4BAA4B,CAC7B,CAAC;QACJ,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,MAAM,KAAK,WAAW;QAC3B,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CACrB,GAAsB,EACtB,OAA6B;QAE7B,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CACvC,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAxDD,gCAwDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\nimport type { Localization } from \"@itwin/core-common\";\nimport type { LocalizationOptions } from \"@itwin/core-i18n\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n private static _i18n?: Localization;\n private static _initialized?: boolean;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this._initialized) return;\n\n TreeWidget._initialized = true;\n TreeWidget._i18n = i18n ?? IModelApp.localization;\n\n return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget._i18n)\n TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace); // eslint-disable-line @itwin/no-internal\n TreeWidget._i18n = undefined;\n TreeWidget._initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget._i18n)\n throw new UiError(\n TreeWidget.packageName,\n \"TreeWidget not initialized\"\n );\n return TreeWidget._i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n public static get packageName(): string {\n return \"tree-widget-react\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(\n key: string | string[],\n options?: LocalizationOptions\n ): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(\n stringKey,\n options\n );\n }\n}\n"]}
1
+ {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../src/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,0DAAgD;AAChD,wDAAiD;AACjD,2DAAoE;AAKpE;;;GAGG;AACH,MAAa,UAAU;IAKrB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAE9B,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAClD,UAAU,CAAC,QAAQ,GAAG,IAAA,yBAAiB,GAAE,CAAC;QAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK,EAAE;YACpB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/D,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;SAC9B;QAED,IAAI,UAAU,CAAC,QAAQ,EAAE;YACvB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;SACjC;QAED,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK;YACnB,MAAM,IAAI,wBAAO,CACf,UAAU,CAAC,WAAW,EACtB,4BAA4B,CAC7B,CAAC;QACJ,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,MAAM,KAAK,WAAW;QAC3B,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CACrB,GAAsB,EACtB,OAA6B;QAE7B,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CACvC,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAhED,gCAgEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { registerRenderers } from \"./components/trees/common/Utils\";\n\nimport type { Localization } from \"@itwin/core-common\";\nimport type { LocalizationOptions } from \"@itwin/core-i18n\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n private static _i18n?: Localization;\n private static _initialized?: boolean;\n private static _dispose?: () => void;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this._initialized) return;\n\n TreeWidget._initialized = true;\n TreeWidget._i18n = i18n ?? IModelApp.localization;\n TreeWidget._dispose = registerRenderers();\n return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget._i18n) {\n TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace);\n TreeWidget._i18n = undefined;\n }\n\n if (TreeWidget._dispose) {\n TreeWidget._dispose();\n TreeWidget._dispose = undefined;\n }\n\n TreeWidget._initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget._i18n)\n throw new UiError(\n TreeWidget.packageName,\n \"TreeWidget not initialized\"\n );\n return TreeWidget._i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n public static get packageName(): string {\n return \"tree-widget-react\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(\n key: string | string[],\n options?: LocalizationOptions\n ): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(\n stringKey,\n options\n );\n }\n}\n"]}
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/itwinui-variables";
6
5
 
7
6
  .tree-widget-selectable-tree {
8
7
  padding: var(--iui-size-xs);
@@ -3,109 +3,80 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
 
6
- .tree-widget-tree-with-header {
7
- width: 100%;
8
- height: 100%;
9
-
10
- .tree-widget-tree-header {
11
- height: var(--iui-size-xl);
12
- }
13
-
14
- .tree-widget-tree-content {
15
- height: calc(100% - var(--iui-size-xl));
16
- }
17
- }
18
-
19
6
  .tree-widget-visibility-tree-base {
20
- height: 100%;
21
- width: 100%;
22
- display: flex;
23
- flex-direction: column;
24
- position: relative;
25
-
26
- .ReactWindow__VariableSizeList {
27
- >div {
28
- min-width: max-content !important; // to override inline class
29
- }
30
- }
31
- .core-tree-node {
32
- &.with-checkbox {
33
- >.contents {
34
- padding-left: calc(var(--iui-size-3xs) / 2);
7
+ .tree-widget-tree-nodes-list {
8
+ .core-tree-node {
9
+ &.with-checkbox {
10
+ > .contents {
11
+ padding-left: calc(var(--iui-size-3xs) / 2);
12
+ }
35
13
  }
36
- }
37
14
 
38
- &.disable-expander {
39
- >.contents {
40
- >.core-tree-expansionToggle {
41
- display: none;
15
+ &.disable-expander {
16
+ > .contents {
17
+ > .core-tree-expansionToggle {
18
+ display: none;
19
+ }
42
20
  }
43
21
  }
44
- }
45
22
 
46
- &.is-selected {
47
- >.contents {
48
- >.visibility-tree-checkbox-container {
49
- background-color: var(--iui-color-background-accent-muted)
23
+ &.is-selected {
24
+ > .contents {
25
+ > .visibility-tree-checkbox-container {
26
+ background-color: var(--iui-color-background-accent-muted);
27
+ }
50
28
  }
51
29
  }
52
- }
53
- }
54
30
 
55
- .contents {
56
- &:hover {
57
- > .visibility-tree-checkbox-container {
58
- background-color: var(--iui-color-background-hover);
31
+ &:not(.is-selected) {
32
+ > .contents:hover {
33
+ > .visibility-tree-checkbox-container {
34
+ background-color: var(--iui-color-background-hover);
35
+ }
36
+ }
59
37
  }
60
- }
61
38
 
62
- > .visibility-tree-checkbox-container {
63
- height: var(--iui-size-l);
64
- width: var(--iui-size-l);
65
- position: sticky;
66
- order: -1;
67
- left: 0;
68
- background-color: var(--iui-color-background);
69
- z-index: 1;
70
- display: flex;
71
- align-items: center;
72
- justify-content: center;
39
+ .visibility-tree-checkbox-container {
40
+ height: var(--iui-size-l);
41
+ width: var(--iui-size-l);
42
+ position: sticky;
43
+ order: -1;
44
+ left: 0;
45
+ background-color: var(--iui-color-background);
46
+ z-index: 1;
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
73
50
 
74
- .visibility-tree-checkbox {
75
- &:disabled {
76
- background-color: transparent;
77
- }
51
+ .visibility-tree-checkbox {
52
+ &:disabled {
53
+ background-color: transparent;
54
+ }
78
55
 
79
- &:hover {
80
- background-color: transparent;
56
+ &:hover {
57
+ background-color: transparent;
58
+ }
81
59
  }
82
60
  }
83
61
  }
84
- }
85
62
 
86
- .filteredTreeOverlay {
87
- position: absolute;
88
- top: 0;
89
- left: 0;
90
- width: 100%;
91
- height: 100%;
92
- z-index: 9999;
93
- background-color: hsl(var(--iui-color-background) / var(--iui-opacity-2));
94
- }
63
+ &.enlarge {
64
+ .core-tree-node {
65
+ .visibility-tree-checkbox-container {
66
+ height: var(--enlarged-node-height);
67
+ width: var(--enlarged-node-height);
95
68
 
96
- .components-tree-errormessage {
97
- position: absolute;
98
- top: 40%;
99
- left: 50%;
100
- width: 75%;
101
- text-align: center;
102
- transform: translate(-50%, -50%);
103
- font-style: italic;
104
- color: var(--iui-color-text-muted);
69
+ .visibility-tree-checkbox {
70
+ --iui-checkbox-target-size: var(--enlarged-node-height);
71
+ }
72
+ }
73
+ }
105
74
 
106
- .errormessage-header {
107
- display: block;
108
- font-weight: bold;
75
+ .without-expander {
76
+ .visibility-tree-checkbox-container + * {
77
+ margin-left: var(--enlarged-node-expander-additional-padding);
78
+ }
79
+ }
109
80
  }
110
81
  }
111
82
  }
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import type { TreeRendererBaseProps } from "./common/TreeRenderer";
2
3
  import type { AbstractTreeNodeLoaderWithProvider, TreeNodeRendererProps, TreeRendererProps } from "@itwin/components-react";
3
4
  import type { NodeCheckboxRenderProps } from "@itwin/core-react";
4
5
  import type { IPresentationTreeDataProvider } from "@itwin/presentation-components";
5
- import type { VisibilityTreeFilterInfo } from "./Common";
6
+ import type { VisibilityTreeFilterInfo } from "./common/Types";
6
7
  /**
7
8
  * Props for visibility tree renderer.
8
9
  * @public
9
10
  */
10
- export interface VisibilityTreeRendererProps {
11
+ export interface VisibilityTreeRendererProps extends TreeRendererBaseProps {
11
12
  /** Props for single node renderer. */
12
13
  nodeRendererProps: VisibilityTreeNodeRendererProps;
13
14
  }
@@ -39,7 +40,7 @@ export interface VisibilityTreeNodeRendererProps {
39
40
  * Creates Visibility tree renderer which renders nodes with eye checkbox.
40
41
  * @public
41
42
  */
42
- export declare function createVisibilityTreeRenderer({ nodeRendererProps }: VisibilityTreeRendererProps): (props: TreeRendererProps) => JSX.Element;
43
+ export declare function createVisibilityTreeRenderer({ nodeRendererProps, ...restProps }: VisibilityTreeRendererProps): (treeProps: TreeRendererProps) => JSX.Element;
43
44
  /**
44
45
  * Creates node renderer which renders node with eye checkbox.
45
46
  * @public
@@ -9,11 +9,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
10
10
  * See LICENSE.md in the project root for license terms and full copyright notice.
11
11
  *--------------------------------------------------------------------------------------------*/
12
+ const classnames_1 = __importDefault(require("classnames"));
12
13
  const react_1 = require("react");
13
14
  const components_react_1 = require("@itwin/components-react");
14
15
  const itwinui_react_1 = require("@itwin/itwinui-react");
15
16
  const presentation_components_1 = require("@itwin/presentation-components");
16
- const classnames_1 = __importDefault(require("classnames"));
17
+ const TreeRenderer_1 = require("./common/TreeRenderer");
17
18
  /**
18
19
  * This constant is taken from `@itwin/core-react`.
19
20
  * Defines the size in pixels of the expansion toggle.
@@ -25,9 +26,9 @@ const EXPANSION_TOGGLE_WIDTH = 24;
25
26
  * Creates Visibility tree renderer which renders nodes with eye checkbox.
26
27
  * @public
27
28
  */
28
- function createVisibilityTreeRenderer({ nodeRendererProps }) {
29
- return function VisibilityTreeRenderer(props) {
30
- return ((0, jsx_runtime_1.jsx)(components_react_1.TreeRenderer, { ...props, nodeRenderer: createVisibilityTreeNodeRenderer(nodeRendererProps) }));
29
+ function createVisibilityTreeRenderer({ nodeRendererProps, ...restProps }) {
30
+ return function VisibilityTreeRenderer(treeProps) {
31
+ return (0, jsx_runtime_1.jsx)(TreeRenderer_1.TreeRenderer, { ...treeProps, ...restProps, nodeRenderer: createVisibilityTreeNodeRenderer(nodeRendererProps) });
31
32
  };
32
33
  }
33
34
  exports.createVisibilityTreeRenderer = createVisibilityTreeRenderer;