@itwin/tree-widget-react 1.0.0 → 1.1.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +42 -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/esm/TreeWidget.d.ts +1 -0
  49. package/lib/esm/TreeWidget.js +10 -3
  50. package/lib/esm/TreeWidget.js.map +1 -1
  51. package/lib/esm/components/SelectableTree.scss +0 -1
  52. package/lib/esm/components/trees/VisibilityTreeBase.scss +55 -84
  53. package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +4 -3
  54. package/lib/esm/components/trees/VisibilityTreeRenderer.js +6 -5
  55. package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +1 -1
  56. package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +1 -1
  57. package/lib/esm/components/trees/category-tree/CategoriesTree.js +10 -1
  58. package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +1 -1
  59. package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +2 -2
  60. package/lib/esm/components/trees/common/ContextMenu.d.ts +39 -0
  61. package/lib/esm/components/trees/common/ContextMenu.js +39 -0
  62. package/lib/esm/components/trees/common/ContextMenu.js.map +1 -0
  63. package/lib/esm/components/trees/common/TreeNodeRenderer.d.ts +61 -0
  64. package/lib/esm/components/trees/common/TreeNodeRenderer.js +44 -0
  65. package/lib/esm/components/trees/common/TreeNodeRenderer.js.map +1 -0
  66. package/lib/esm/components/trees/common/TreeRenderer.d.ts +26 -0
  67. package/lib/esm/components/trees/common/TreeRenderer.js +34 -0
  68. package/lib/esm/components/trees/common/TreeRenderer.js.map +1 -0
  69. package/lib/esm/components/trees/common/TreeRenderer.scss +102 -0
  70. package/lib/esm/components/trees/{Common.d.ts → common/Types.d.ts} +3 -2
  71. package/lib/esm/components/trees/{Common.js → common/Types.js} +1 -1
  72. package/lib/esm/components/trees/common/Types.js.map +1 -0
  73. package/lib/esm/components/trees/common/Utils.d.ts +11 -0
  74. package/lib/esm/components/trees/common/Utils.js +42 -0
  75. package/lib/esm/components/trees/common/Utils.js.map +1 -0
  76. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  77. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +9 -4
  78. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  79. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +7 -1
  80. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -4
  81. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  82. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  83. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +8 -2
  84. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  85. package/lib/esm/components/trees/index.d.ts +4 -2
  86. package/lib/esm/components/trees/index.js +4 -2
  87. package/lib/esm/components/trees/index.js.map +1 -1
  88. package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +6 -4
  89. package/lib/esm/components/trees/models-tree/ModelsTree.js +19 -7
  90. package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
  91. package/lib/esm/components/trees/models-tree/Utils.d.ts +2 -2
  92. package/lib/esm/components/trees/models-tree/Utils.js +267 -333
  93. package/lib/esm/components/trees/models-tree/Utils.js.map +1 -1
  94. package/package.json +1 -2
  95. package/lib/cjs/components/trees/Common.js.map +0 -1
  96. package/lib/esm/components/trees/Common.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
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 Mon, 07 Aug 2023 13:36:23 GMT and should not be manually modified.
4
+
5
+ ## 1.1.0
6
+ Mon, 07 Aug 2023 13:36:23 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Trees: Added ability to increase node size in order to make tree more user friendly on touch devices.
11
+ - Trees: Added ability to customize tree node label
12
+ - `ModelsTree`: Added ability to show models without elements.
13
+ - Added context menu support.
14
+
15
+ ### Patches
16
+
17
+ - Removed `@itwin/itwinui-variables` from dependencies.
4
18
 
5
19
  ## 1.0.0
6
20
  Mon, 31 Jul 2023 14:10:09 GMT
@@ -47,33 +61,33 @@ Tue, 02 May 2023 16:12:17 GMT
47
61
 
48
62
  ### Minor changes
49
63
 
50
- - Updated to AppUI 4.0 and Presentation 4.0
64
+ - Updated to AppUI 4.0 and Presentation 4.0.
51
65
 
52
66
  ## 0.8.0
53
67
  Mon, 03 Apr 2023 15:34:07 GMT
54
68
 
55
69
  ### Minor changes
56
70
 
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`)
71
+ - Removed `SpatialTree` and related components in favor of the ones in `@itwin/breakdown-trees-react`.
72
+ - Updated dependencies (`itwinui@2`, `appui@4`, `presentation-components@4`, `itwinjs-core@3.7`).
59
73
 
60
74
  ### Patches
61
75
 
62
- - Use iTwin UI components instead of custom ones and CSS variables from `@itwin/itwinui-variables` instead of `@itwin/core-react`
76
+ - Use iTwin UI components instead of custom ones and CSS variables from `@itwin/itwinui-variables` instead of `@itwin/core-react`.
63
77
 
64
78
  ## 0.7.2
65
79
  Fri, 24 Mar 2023 10:46:34 GMT
66
80
 
67
81
  ### Patches
68
82
 
69
- - Fixed tree filtering not being removed when search box is closed
83
+ - Fixed tree filtering not being removed when search box is closed.
70
84
 
71
85
  ## 0.7.1
72
86
  Thu, 23 Mar 2023 15:12:36 GMT
73
87
 
74
88
  ### Patches
75
89
 
76
- - 'ModelsTree': Restored 'HideAll' button behavior to hide only models
90
+ - 'ModelsTree': Restored 'HideAll' button behavior to hide only models.
77
91
 
78
92
  ## 0.7.0
79
93
  Mon, 20 Mar 2023 14:48:35 GMT
@@ -81,12 +95,12 @@ Mon, 20 Mar 2023 14:48:35 GMT
81
95
  ### Minor changes
82
96
 
83
97
  - 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`
98
+ - Upgrade `itwinjs-core` dependencies to `^3.6.0`.
99
+ - Upgrade `typescript` to `~4.4.0`.
86
100
 
87
101
  ### Patches
88
102
 
89
- - ModelsTree: ensure that the "Show all" button is going to show all elements when there are elements with an "exclusive" flag
103
+ - ModelsTree: ensure that the "Show all" button is going to show all elements when there are elements with an "exclusive" flag.
90
104
  - '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
105
 
92
106
  ## 0.6.2
@@ -94,30 +108,30 @@ Thu, 09 Mar 2023 20:08:53 GMT
94
108
 
95
109
  ### Patches
96
110
 
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
111
+ - `ModelsTreeComponent`: ensure that the "show all" and "hide all" buttons affect all iModel content.
112
+ - `ModelsTree`: Remove unused feature of filtering the tree by element ids.
99
113
 
100
114
  ## 0.6.1
101
115
  Thu, 19 Jan 2023 10:29:18 GMT
102
116
 
103
117
  ### Patches
104
118
 
105
- - CategoriesTree: Updated ruleset to not show private SubCategories
106
- - Bug fix for changing visibility of multiple nodes at once
119
+ - `CategoryTree`: Updated ruleset to not show private SubCategories.
120
+ - Bug fix for changing visibility of multiple nodes at once.
107
121
 
108
122
  ## 0.6.0
109
123
  Tue, 20 Dec 2022 15:12:29 GMT
110
124
 
111
125
  ### Minor changes
112
126
 
113
- - Moved core trees implementation from @itwin/appui-react package to @itwin/tree-widget-react
127
+ - Moved core trees implementation from `@itwin/appui-react` package to `@itwin/tree-widget-react`.
114
128
 
115
129
  ## 0.5.0
116
130
  Mon, 12 Sep 2022 19:50:36 GMT
117
131
 
118
132
  ### Minor changes
119
133
 
120
- - Add new `defaultTreeId` prop to specify default tree for TreeWidgetUiItemsProvider
134
+ - Add new `defaultTreeId` prop to specify default tree for `TreeWidgetUiItemsProvider`.
121
135
 
122
136
  ## 0.4.7
123
137
  Mon, 30 May 2022 12:44:10 GMT
@@ -131,28 +145,28 @@ Thu, 26 May 2022 15:54:07 GMT
131
145
 
132
146
  ### Patches
133
147
 
134
- - Allow a caller to specify a default priority for Tree Widget item provider.
148
+ - Allow a caller to specify a default priority for `TreeWidgetUiItemsProvider`.
135
149
 
136
150
  ## 0.4.5
137
151
  Mon, 09 May 2022 18:04:58 GMT
138
152
 
139
153
  ### Patches
140
154
 
141
- - set restore transient state in tree widget ui items provider to restore state when remounted
155
+ - Set restore transient state in `TreeWidgetUiItemsProvider` to restore state when remounted.
142
156
 
143
157
  ## 0.4.4
144
158
  Thu, 05 May 2022 12:21:21 GMT
145
159
 
146
160
  ### Patches
147
161
 
148
- - set tree-widget-search-bar-button-container z-index to 1
162
+ - Set tree-widget-search-bar-button-container z-index to 1.
149
163
 
150
164
  ## 0.4.3
151
165
  Thu, 21 Apr 2022 18:47:53 GMT
152
166
 
153
167
  ### Patches
154
168
 
155
- - Do not unmount children in AutoSizer when height or width is 0 to avoid losing children state
169
+ - Do not unmount children in `AutoSizer` when height or width is 0 to avoid losing children state.
156
170
 
157
171
  ## 0.4.2
158
172
  Tue, 19 Apr 2022 14:15:57 GMT
@@ -166,201 +180,48 @@ Wed, 06 Apr 2022 13:48:44 GMT
166
180
 
167
181
  ### Patches
168
182
 
169
- - Updates to allow specification of default panel location.
170
- - Add transitive peers as dev deps
171
- - added tree icon to tree widget tab
183
+ - Allow specifying default panel location.
184
+ - Added tree icon to tree widget tab.
172
185
 
173
186
  ## 0.4.0
174
187
  Fri, 18 Mar 2022 13:31:19 GMT
175
188
 
176
189
  ### Minor changes
177
190
 
178
- - Remove deprecated WidgetControl, update UiItemsProvider init
191
+ - Remove deprecated `WidgetControl`, update `UiItemsProvider` initialization.
179
192
 
180
193
  ## 0.3.0
181
194
  Wed, 02 Mar 2022 21:38:51 GMT
182
195
 
183
196
  ### Minor changes
184
197
 
185
- - Add `IModelContentTree`
198
+ - Add `IModelContentTree`.
186
199
 
187
200
  ## 0.2.1
188
201
  Fri, 04 Feb 2022 00:43:35 GMT
189
202
 
190
203
  ### Patches
191
204
 
192
- - Update scss to be pulled from cjs dir
205
+ - Update scss to be pulled from cjs dir.
193
206
 
194
207
  ## 0.2.0
195
208
  Mon, 24 Jan 2022 19:14:37 GMT
196
209
 
197
210
  ### Minor changes
198
211
 
199
- - Bump to official iTwin.js 3.0 release
212
+ - Bump to official iTwin.js 3.0 release.
200
213
 
201
214
  ## 0.1.2
202
215
  Wed, 19 Jan 2022 17:39:40 GMT
203
216
 
204
217
  ### Patches
205
218
 
206
- - updated to latest rc, dev-185, and updated deps
219
+ - Updated to latest rc, dev-185, and updated deps.
207
220
 
208
221
  ## 0.1.1
209
222
  Wed, 12 Jan 2022 13:59:35 GMT
210
223
 
211
224
  ### Patches
212
225
 
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
226
+ - iTwin.js 3.0 first rc.
366
227
 
@@ -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
+ .contents {
32
+ &: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;