@itwin/tree-widget-react 0.2.1 → 0.4.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 (83) hide show
  1. package/README.md +30 -1
  2. package/lib/cjs/components/TreeWidgetComponent.d.ts +1 -0
  3. package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +9 -17
  4. package/lib/cjs/components/TreeWidgetUiItemsProvider.js +50 -47
  5. package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
  6. package/lib/cjs/components/header/TreeHeader.d.ts +1 -0
  7. package/lib/cjs/components/rulesets/IModelContent.json +435 -0
  8. package/lib/cjs/components/trees/CategoriesTree.d.ts +3 -7
  9. package/lib/cjs/components/trees/CategoriesTree.js +21 -23
  10. package/lib/cjs/components/trees/CategoriesTree.js.map +1 -1
  11. package/lib/cjs/components/trees/IModelContentTree.d.ts +4 -0
  12. package/lib/cjs/components/trees/{ClassificationsTree.js → IModelContentTree.js} +19 -12
  13. package/lib/cjs/components/trees/IModelContentTree.js.map +1 -0
  14. package/lib/cjs/components/trees/ModelsTree.d.ts +3 -8
  15. package/lib/cjs/components/trees/ModelsTree.js +8 -16
  16. package/lib/cjs/components/trees/ModelsTree.js.map +1 -1
  17. package/lib/cjs/components/trees/SpatialTree.d.ts +3 -2
  18. package/lib/cjs/components/trees/SpatialTree.js +11 -28
  19. package/lib/cjs/components/trees/SpatialTree.js.map +1 -1
  20. package/lib/cjs/components/trees/index.d.ts +1 -2
  21. package/lib/cjs/components/trees/index.js +5 -6
  22. package/lib/cjs/components/trees/index.js.map +1 -1
  23. package/lib/cjs/components/utils/AutoSizer.d.ts +10 -0
  24. package/lib/cjs/components/utils/AutoSizer.js +36 -0
  25. package/lib/cjs/components/utils/AutoSizer.js.map +1 -0
  26. package/lib/cjs/tree-widget-react.d.ts +1 -1
  27. package/lib/cjs/tree-widget-react.js +4 -4
  28. package/lib/cjs/tree-widget-react.js.map +1 -1
  29. package/lib/cjs/types.d.ts +26 -0
  30. package/lib/cjs/types.js +3 -0
  31. package/lib/cjs/types.js.map +1 -0
  32. package/lib/esm/components/TreeWidgetComponent.d.ts +1 -0
  33. package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +9 -17
  34. package/lib/esm/components/TreeWidgetUiItemsProvider.js +50 -47
  35. package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
  36. package/lib/esm/components/header/TreeHeader.d.ts +1 -0
  37. package/lib/esm/components/rulesets/IModelContent.json +435 -0
  38. package/lib/esm/components/trees/CategoriesTree.d.ts +3 -7
  39. package/lib/esm/components/trees/CategoriesTree.js +23 -25
  40. package/lib/esm/components/trees/CategoriesTree.js.map +1 -1
  41. package/lib/esm/components/trees/IModelContentTree.d.ts +4 -0
  42. package/lib/esm/components/trees/IModelContentTree.js +24 -0
  43. package/lib/esm/components/trees/IModelContentTree.js.map +1 -0
  44. package/lib/esm/components/trees/ModelsTree.d.ts +3 -8
  45. package/lib/esm/components/trees/ModelsTree.js +9 -17
  46. package/lib/esm/components/trees/ModelsTree.js.map +1 -1
  47. package/lib/esm/components/trees/SpatialTree.d.ts +3 -2
  48. package/lib/esm/components/trees/SpatialTree.js +10 -11
  49. package/lib/esm/components/trees/SpatialTree.js.map +1 -1
  50. package/lib/esm/components/trees/index.d.ts +1 -2
  51. package/lib/esm/components/trees/index.js +4 -5
  52. package/lib/esm/components/trees/index.js.map +1 -1
  53. package/lib/esm/components/utils/AutoSizer.d.ts +10 -0
  54. package/lib/esm/components/utils/AutoSizer.js +13 -0
  55. package/lib/esm/components/utils/AutoSizer.js.map +1 -0
  56. package/lib/esm/tree-widget-react.d.ts +1 -1
  57. package/lib/esm/tree-widget-react.js +4 -4
  58. package/lib/esm/tree-widget-react.js.map +1 -1
  59. package/lib/esm/types.d.ts +26 -0
  60. package/lib/esm/types.js +2 -0
  61. package/lib/esm/types.js.map +1 -0
  62. package/package.json +6 -3
  63. package/lib/cjs/components/TreeWidgetControl.d.ts +0 -26
  64. package/lib/cjs/components/TreeWidgetControl.js +0 -66
  65. package/lib/cjs/components/TreeWidgetControl.js.map +0 -1
  66. package/lib/cjs/components/rulesets/ClassificationSystems.json +0 -122
  67. package/lib/cjs/components/trees/ClassificationsTree.d.ts +0 -6
  68. package/lib/cjs/components/trees/ClassificationsTree.js.map +0 -1
  69. package/lib/cjs/components/trees/TreeWithRuleset.d.ts +0 -35
  70. package/lib/cjs/components/trees/TreeWithRuleset.js +0 -110
  71. package/lib/cjs/components/trees/TreeWithRuleset.js.map +0 -1
  72. package/lib/cjs/components/trees/TreeWithRulesetTree.scss +0 -17
  73. package/lib/esm/components/TreeWidgetControl.d.ts +0 -26
  74. package/lib/esm/components/TreeWidgetControl.js +0 -59
  75. package/lib/esm/components/TreeWidgetControl.js.map +0 -1
  76. package/lib/esm/components/rulesets/ClassificationSystems.json +0 -122
  77. package/lib/esm/components/trees/ClassificationsTree.d.ts +0 -6
  78. package/lib/esm/components/trees/ClassificationsTree.js +0 -17
  79. package/lib/esm/components/trees/ClassificationsTree.js.map +0 -1
  80. package/lib/esm/components/trees/TreeWithRuleset.d.ts +0 -35
  81. package/lib/esm/components/trees/TreeWithRuleset.js +0 -85
  82. package/lib/esm/components/trees/TreeWithRuleset.js.map +0 -1
  83. package/lib/esm/components/trees/TreeWithRulesetTree.scss +0 -17
@@ -0,0 +1,435 @@
1
+ {
2
+ "$schema": "../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
+ "id": "tree-widget-react/imodel-content",
4
+ "requiredSchemas": [
5
+ {
6
+ "name": "BisCore"
7
+ }
8
+ ],
9
+ "rules": [
10
+ {
11
+ "ruleType": "RootNodes",
12
+ "autoExpand": true,
13
+ "specifications": [
14
+ {
15
+ "specType": "InstanceNodesOfSpecificClasses",
16
+ "classes": [
17
+ {
18
+ "schemaName": "BisCore",
19
+ "classNames": ["Subject"],
20
+ "arePolymorphic": false
21
+ }
22
+ ],
23
+ "instanceFilter": "this.Parent = NULL",
24
+ "groupByClass": false,
25
+ "groupByLabel": false
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "ruleType": "ChildNodes",
31
+ "condition": "ParentNode.IsOfClass(\"Subject\", \"BisCore\")",
32
+ "specifications": [
33
+ {
34
+ "specType": "RelatedInstanceNodes",
35
+ "relationshipPaths": [
36
+ {
37
+ "relationship": {
38
+ "schemaName": "BisCore",
39
+ "className": "SubjectOwnsSubjects"
40
+ },
41
+ "direction": "Forward",
42
+ "targetClass": {
43
+ "schemaName": "BisCore",
44
+ "className": "Subject"
45
+ }
46
+ }
47
+ ],
48
+ "instanceFilter": "json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"",
49
+ "hideNodesInHierarchy": true,
50
+ "groupByClass": false,
51
+ "groupByLabel": false
52
+ },
53
+ {
54
+ "specType": "RelatedInstanceNodes",
55
+ "relationshipPaths": [
56
+ {
57
+ "relationship": {
58
+ "schemaName": "BisCore",
59
+ "className": "SubjectOwnsSubjects"
60
+ },
61
+ "direction": "Forward",
62
+ "targetClass": {
63
+ "schemaName": "BisCore",
64
+ "className": "Subject"
65
+ }
66
+ }
67
+ ],
68
+ "instanceFilter": "json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"",
69
+ "groupByClass": false,
70
+ "groupByLabel": false
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "ruleType": "ChildNodes",
76
+ "condition": "ParentNode.IsOfClass(\"Subject\", \"BisCore\")",
77
+ "specifications": [
78
+ {
79
+ "specType": "InstanceNodesOfSpecificClasses",
80
+ "classes": {
81
+ "schemaName": "BisCore",
82
+ "classNames": ["Model"],
83
+ "arePolymorphic": true
84
+ },
85
+ "relatedInstances": [
86
+ {
87
+ "relationshipPath": {
88
+ "relationship": {
89
+ "schemaName": "BisCore",
90
+ "className": "ModelModelsElement"
91
+ },
92
+ "direction": "Forward",
93
+ "targetClass": {
94
+ "schemaName": "BisCore",
95
+ "className": "InformationPartitionElement"
96
+ }
97
+ },
98
+ "alias": "partition",
99
+ "isRequired": true
100
+ }
101
+ ],
102
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL",
103
+ "groupByClass": false,
104
+ "groupByLabel": false
105
+ },
106
+ {
107
+ "specType": "InstanceNodesOfSpecificClasses",
108
+ "classes": {
109
+ "schemaName": "BisCore",
110
+ "classNames": ["Model"],
111
+ "arePolymorphic": true
112
+ },
113
+ "relatedInstances": [
114
+ {
115
+ "relationshipPath": {
116
+ "relationship": {
117
+ "schemaName": "BisCore",
118
+ "className": "ModelModelsElement"
119
+ },
120
+ "direction": "Forward",
121
+ "targetClass": {
122
+ "schemaName": "BisCore",
123
+ "className": "InformationPartitionElement"
124
+ }
125
+ },
126
+ "alias": "partition",
127
+ "isRequired": true
128
+ }
129
+ ],
130
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL)",
131
+ "hideNodesInHierarchy": true,
132
+ "groupByClass": false,
133
+ "groupByLabel": false
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "ruleType": "ChildNodes",
139
+ "condition": "ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")",
140
+ "specifications": [
141
+ {
142
+ "specType": "RelatedInstanceNodes",
143
+ "relationshipPaths": [
144
+ {
145
+ "relationship": {
146
+ "schemaName": "BisCore",
147
+ "className": "ModelModelsElement"
148
+ },
149
+ "direction": "Backward"
150
+ }
151
+ ],
152
+ "instanceFilter": "NOT this.IsPrivate",
153
+ "hideNodesInHierarchy": true,
154
+ "groupByClass": false,
155
+ "groupByLabel": false
156
+ }
157
+ ]
158
+ },
159
+ {
160
+ "ruleType": "ChildNodes",
161
+ "condition": "ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")",
162
+ "specifications": [
163
+ {
164
+ "specType": "RelatedInstanceNodes",
165
+ "relationshipPaths": [
166
+ [
167
+ {
168
+ "relationship": {
169
+ "schemaName": "BisCore",
170
+ "className": "ModelContainsElements"
171
+ },
172
+ "direction": "Forward"
173
+ },
174
+ {
175
+ "relationship": {
176
+ "schemaName": "BisCore",
177
+ "className": "GeometricElement3dIsInCategory"
178
+ },
179
+ "direction": "Forward"
180
+ }
181
+ ]
182
+ ],
183
+ "suppressSimilarAncestorsCheck": true,
184
+ "groupByClass": false,
185
+ "groupByLabel": false,
186
+ "nestedRules": [
187
+ {
188
+ "ruleType": "ChildNodes",
189
+ "condition": "ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")",
190
+ "specifications": [
191
+ {
192
+ "specType": "RelatedInstanceNodes",
193
+ "relationshipPaths": [
194
+ {
195
+ "relationship": {
196
+ "schemaName": "BisCore",
197
+ "className": "GeometricElement3dIsInCategory"
198
+ },
199
+ "direction": "Backward"
200
+ }
201
+ ],
202
+ "instanceFilter": "this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL",
203
+ "groupByClass": true,
204
+ "groupByLabel": false
205
+ }
206
+ ]
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "specType": "RelatedInstanceNodes",
212
+ "relationshipPaths": [
213
+ {
214
+ "relationship": {
215
+ "schemaName": "BisCore",
216
+ "className": "ModelContainsElements"
217
+ },
218
+ "direction": "Forward",
219
+ "targetClass": {
220
+ "schemaName": "BisCore",
221
+ "className": "InformationContentElement"
222
+ }
223
+ }
224
+ ],
225
+ "groupByClass": true,
226
+ "groupByLabel": false
227
+ }
228
+ ]
229
+ },
230
+ {
231
+ "ruleType": "ChildNodes",
232
+ "condition": "ParentNode.IsOfClass(\"GeometricModel2d\", \"BisCore\")",
233
+ "specifications": [
234
+ {
235
+ "specType": "RelatedInstanceNodes",
236
+ "relationshipPaths": [
237
+ [
238
+ {
239
+ "relationship": {
240
+ "schemaName": "BisCore",
241
+ "className": "ModelContainsElements"
242
+ },
243
+ "direction": "Forward"
244
+ },
245
+ {
246
+ "relationship": {
247
+ "schemaName": "BisCore",
248
+ "className": "GeometricElement2dIsInCategory"
249
+ },
250
+ "direction": "Forward"
251
+ }
252
+ ]
253
+ ],
254
+ "suppressSimilarAncestorsCheck": true,
255
+ "groupByClass": false,
256
+ "groupByLabel": false,
257
+ "nestedRules": [
258
+ {
259
+ "ruleType": "ChildNodes",
260
+ "condition": "ParentNode.IsOfClass(\"DrawingCategory\", \"BisCore\")",
261
+ "specifications": [
262
+ {
263
+ "specType": "RelatedInstanceNodes",
264
+ "relationshipPaths": [
265
+ {
266
+ "relationship": {
267
+ "schemaName": "BisCore",
268
+ "className": "GeometricElement2dIsInCategory"
269
+ },
270
+ "direction": "Backward"
271
+ }
272
+ ],
273
+ "instanceFilter": "this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL",
274
+ "groupByClass": true,
275
+ "groupByLabel": false
276
+ }
277
+ ]
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ "specType": "RelatedInstanceNodes",
283
+ "relationshipPaths": [
284
+ {
285
+ "relationship": {
286
+ "schemaName": "BisCore",
287
+ "className": "ModelContainsElements"
288
+ },
289
+ "direction": "Forward",
290
+ "targetClass": {
291
+ "schemaName": "BisCore",
292
+ "className": "InformationContentElement"
293
+ }
294
+ }
295
+ ],
296
+ "groupByClass": true,
297
+ "groupByLabel": false
298
+ }
299
+ ]
300
+ },
301
+ {
302
+ "ruleType": "ChildNodes",
303
+ "condition": "ParentNode.IsOfClass(\"Model\", \"BisCore\")",
304
+ "onlyIfNotHandled": true,
305
+ "specifications": [
306
+ {
307
+ "specType": "RelatedInstanceNodes",
308
+ "relationshipPaths": [
309
+ [
310
+ {
311
+ "relationship": {
312
+ "schemaName": "BisCore",
313
+ "className": "ModelContainsElements"
314
+ },
315
+ "direction": "Forward"
316
+ }
317
+ ]
318
+ ],
319
+ "instanceFilter": "this.Parent = NULL",
320
+ "groupByClass": true,
321
+ "groupByLabel": false
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "ruleType": "ChildNodes",
327
+ "condition": "ParentNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
328
+ "onlyIfNotHandled": true,
329
+ "specifications": [
330
+ {
331
+ "specType": "CustomNode",
332
+ "type": "T_CHILDREN",
333
+ "label": "Children",
334
+ "imageId": "icon-hierarchy-tree",
335
+ "hideIfNoChildren": true,
336
+ "nestedRules": [
337
+ {
338
+ "ruleType": "ChildNodes",
339
+ "specifications": [
340
+ {
341
+ "specType": "RelatedInstanceNodes",
342
+ "relationshipPaths": [
343
+ {
344
+ "relationship": {
345
+ "schemaName": "BisCore",
346
+ "className": "ElementOwnsChildElements"
347
+ },
348
+ "direction": "Forward"
349
+ }
350
+ ],
351
+ "groupByClass": true,
352
+ "groupByLabel": false
353
+ }
354
+ ]
355
+ }
356
+ ]
357
+ },
358
+ {
359
+ "specType": "CustomNode",
360
+ "type": "T_GROUPED_MEMBERS",
361
+ "label": "Members",
362
+ "imageId": "icon-group",
363
+ "hideIfNoChildren": true,
364
+ "nestedRules": [
365
+ {
366
+ "ruleType": "ChildNodes",
367
+ "specifications": [
368
+ {
369
+ "specType": "RelatedInstanceNodes",
370
+ "relationshipPaths": [
371
+ {
372
+ "relationship": {
373
+ "schemaName": "BisCore",
374
+ "className": "ElementGroupsMembers"
375
+ },
376
+ "direction": "Forward"
377
+ }
378
+ ],
379
+ "groupByClass": true,
380
+ "groupByLabel": false
381
+ }
382
+ ]
383
+ }
384
+ ]
385
+ }
386
+ ]
387
+ },
388
+ {
389
+ "ruleType": "ChildNodes",
390
+ "condition": "ParentNode.IsOfClass(\"Element\", \"BisCore\")",
391
+ "onlyIfNotHandled": true,
392
+ "specifications": [
393
+ {
394
+ "specType": "RelatedInstanceNodes",
395
+ "relationshipPaths": [
396
+ {
397
+ "relationship": {
398
+ "schemaName": "BisCore",
399
+ "className": "ElementOwnsChildElements"
400
+ },
401
+ "direction": "Forward"
402
+ }
403
+ ],
404
+ "groupByClass": true,
405
+ "groupByLabel": false
406
+ }
407
+ ]
408
+ },
409
+ {
410
+ "ruleType": "ImageIdOverride",
411
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Subject\", \"BisCore\")",
412
+ "imageIdExpression": "IIF(this.Parent.Id = NULL, \"icon-imodel-hollow-2\", \"icon-folder\")"
413
+ },
414
+ {
415
+ "ruleType": "ImageIdOverride",
416
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Model\", \"BisCore\")",
417
+ "imageIdExpression": "\"icon-model\""
418
+ },
419
+ {
420
+ "ruleType": "ImageIdOverride",
421
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Category\", \"BisCore\")",
422
+ "imageIdExpression": "\"icon-layers\""
423
+ },
424
+ {
425
+ "ruleType": "ImageIdOverride",
426
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Element\", \"BisCore\")",
427
+ "imageIdExpression": "\"icon-item\""
428
+ },
429
+ {
430
+ "ruleType": "ImageIdOverride",
431
+ "condition": "ThisNode.IsClassGroupingNode",
432
+ "imageIdExpression": "\"icon-ec-class\""
433
+ }
434
+ ]
435
+ }
@@ -1,9 +1,5 @@
1
- import type { IModelConnection, Viewport } from "@itwin/core-frontend";
1
+ /// <reference types="react" />
2
2
  import "./CategoriesTree.scss";
3
- export interface CategoriesTreeComponentProps {
4
- iModel: IModelConnection;
5
- allViewports?: boolean;
6
- activeView?: Viewport;
7
- }
8
- export declare function CategoriesTreeComponent(props: CategoriesTreeComponentProps): JSX.Element;
3
+ import type { CategoriesTreeProps } from "../../types";
4
+ export declare function CategoriesTreeComponent(props: CategoriesTreeProps): JSX.Element;
9
5
  //# sourceMappingURL=CategoriesTree.d.ts.map
@@ -31,32 +31,29 @@ const TreeFilteringState_1 = require("../TreeFilteringState");
31
31
  require("./CategoriesTree.scss");
32
32
  const TreeHeader_1 = require("../header/TreeHeader");
33
33
  const appui_react_2 = require("@itwin/appui-react");
34
- const core_react_1 = require("@itwin/core-react");
34
+ const AutoSizer_1 = require("../utils/AutoSizer");
35
35
  function CategoriesTreeComponent(props) {
36
+ const iModel = appui_react_1.useActiveIModelConnection();
37
+ const viewport = appui_react_1.useActiveViewport();
36
38
  const { searchOptions, filterString, activeMatchIndex, onFilterApplied, filteredProvider, } = TreeFilteringState_1.useTreeFilteringState();
37
- const [height, setHeight] = react_1.useState(0);
38
- const [width, setWidth] = react_1.useState(0);
39
- const handleResize = react_1.useCallback((w, h) => {
40
- setHeight(h);
41
- setWidth(w);
42
- }, []);
43
- const ref = core_react_1.useResizeObserver(handleResize);
44
39
  const showAll = react_1.useCallback(async () => {
45
- return appui_react_1.toggleAllCategories(core_frontend_1.IModelApp.viewManager, props.iModel, true, undefined, true, filteredProvider);
46
- }, [props.iModel, filteredProvider]);
40
+ if (!iModel)
41
+ return;
42
+ return appui_react_1.toggleAllCategories(core_frontend_1.IModelApp.viewManager, iModel, true, undefined, true, filteredProvider);
43
+ }, [iModel, filteredProvider]);
47
44
  const hideAll = react_1.useCallback(async () => {
48
- return appui_react_1.toggleAllCategories(core_frontend_1.IModelApp.viewManager, props.iModel, false, undefined, true, filteredProvider);
49
- }, [props.iModel, filteredProvider]);
45
+ if (!iModel)
46
+ return;
47
+ return appui_react_1.toggleAllCategories(core_frontend_1.IModelApp.viewManager, iModel, false, undefined, true, filteredProvider);
48
+ }, [iModel, filteredProvider]);
50
49
  const invert = react_1.useCallback(async () => {
51
- const activeView = core_frontend_1.IModelApp.viewManager.getFirstOpenView();
52
- if (!activeView) {
50
+ if (!iModel || !viewport)
53
51
  return;
54
- }
55
- const ids = await appui_react_1.getCategories(props.iModel, activeView, filteredProvider);
52
+ const ids = await appui_react_1.getCategories(iModel, viewport, filteredProvider);
56
53
  const enabled = [];
57
54
  const disabled = [];
58
55
  for (const id of ids) {
59
- if (activeView.view.viewsCategory(id)) {
56
+ if (viewport.view.viewsCategory(id)) {
60
57
  enabled.push(id);
61
58
  }
62
59
  else {
@@ -64,13 +61,14 @@ function CategoriesTreeComponent(props) {
64
61
  }
65
62
  }
66
63
  // Disable enabled
67
- appui_react_2.CategoryVisibilityHandler.enableCategory(core_frontend_1.IModelApp.viewManager, props.iModel, enabled, false, true);
64
+ appui_react_2.CategoryVisibilityHandler.enableCategory(core_frontend_1.IModelApp.viewManager, iModel, enabled, false, true);
68
65
  // Enable disabled
69
- appui_react_2.CategoryVisibilityHandler.enableCategory(core_frontend_1.IModelApp.viewManager, props.iModel, disabled, true, true);
70
- }, [props.iModel, filteredProvider]);
71
- return (react_1.default.createElement(react_1.default.Fragment, null,
72
- react_1.default.createElement(TreeHeader_1.TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert }),
73
- react_1.default.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (react_1.default.createElement(appui_react_1.CategoryTree, { ...props, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied, width: width, height: height })))));
66
+ appui_react_2.CategoryVisibilityHandler.enableCategory(core_frontend_1.IModelApp.viewManager, iModel, disabled, true, true);
67
+ }, [iModel, viewport, filteredProvider]);
68
+ return (react_1.default.createElement(react_1.default.Fragment, null, iModel && viewport &&
69
+ react_1.default.createElement(react_1.default.Fragment, null,
70
+ react_1.default.createElement(TreeHeader_1.TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert }),
71
+ react_1.default.createElement(AutoSizer_1.AutoSizer, null, ({ width, height }) => (react_1.default.createElement(appui_react_1.CategoryTree, { ...props, iModel: iModel, width: width, height: height, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied }))))));
74
72
  }
75
73
  exports.CategoriesTreeComponent = CategoriesTreeComponent;
76
74
  //# sourceMappingURL=CategoriesTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesTree.tsx"],"names":[],"mappings":"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","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*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback, useState } from \"react\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { CategoryTree, getCategories, toggleAllCategories } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./CategoriesTree.scss\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport { CategoryVisibilityHandler } from \"@itwin/appui-react\";\nimport { useResizeObserver } from \"@itwin/core-react\";\n\nexport interface CategoriesTreeComponentProps {\n iModel: IModelConnection;\n allViewports?: boolean;\n activeView?: Viewport;\n}\n\nexport function CategoriesTreeComponent(props: CategoriesTreeComponentProps) {\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\n const [height, setHeight] = useState(0);\n const [width, setWidth] = useState(0);\n const handleResize = useCallback((w: number, h: number) => {\n setHeight(h);\n setWidth(w);\n }, []);\n const ref = useResizeObserver<HTMLDivElement>(handleResize);\n\n const showAll = useCallback(async () => {\n return toggleAllCategories(\n IModelApp.viewManager,\n props.iModel,\n true,\n undefined,\n true,\n filteredProvider\n );\n }, [props.iModel, filteredProvider]);\n\n const hideAll = useCallback(async () => {\n return toggleAllCategories(\n IModelApp.viewManager,\n props.iModel,\n false,\n undefined,\n true,\n filteredProvider\n );\n }, [props.iModel, filteredProvider]);\n\n const invert = useCallback(async () => {\n const activeView = IModelApp.viewManager.getFirstOpenView();\n if (!activeView) {\n return;\n }\n\n const ids = await getCategories(props.iModel, activeView, filteredProvider);\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (activeView.view.viewsCategory(id)) {\n enabled.push(id);\n } else {\n disabled.push(id);\n }\n }\n // Disable enabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n props.iModel,\n enabled,\n false,\n true\n );\n // Enable disabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n props.iModel,\n disabled,\n true,\n true\n );\n }, [props.iModel, filteredProvider]);\n\n return (\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n />\n <div ref={ref} style={{ width: \"100%\", height: \"100%\" }}>\n {width && height && (\n <CategoryTree\n {...props}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n width={width}\n height={height}\n />\n )}\n </div>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesTree.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAA2C;AAC3C,wDAAiD;AACjD,oDAAoI;AACpI,8DAA8D;AAC9D,iCAA+B;AAC/B,qDAA2D;AAC3D,oDAA+D;AAE/D,kDAA+C;AAE/C,SAAgB,uBAAuB,CAAC,KAA0B;IAChE,MAAM,MAAM,GAAG,uCAAyB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,+BAAiB,EAAE,CAAC;IAErC,MAAM,EACJ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,GAAG,0CAAqB,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAG,mBAAW,CAAC,KAAK,IAAI,EAAE;QACrC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,OAAO,iCAAmB,CACxB,yBAAS,CAAC,WAAW,EACrB,MAAM,EACN,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,gBAAgB,CACjB,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,mBAAW,CAAC,KAAK,IAAI,EAAE;QACrC,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,OAAO,iCAAmB,CACxB,yBAAS,CAAC,WAAW,EACrB,MAAM,EACN,KAAK,EACL,SAAS,EACT,IAAI,EACJ,gBAAgB,CACjB,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE/B,MAAM,MAAM,GAAG,mBAAW,CAAC,KAAK,IAAI,EAAE;QACpC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEjC,MAAM,GAAG,GAAG,MAAM,2BAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACpE,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;YACpB,IAAI,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE;gBACnC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAClB;iBAAM;gBACL,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACnB;SACF;QACD,kBAAkB;QAClB,uCAAyB,CAAC,cAAc,CACtC,yBAAS,CAAC,WAAW,EACrB,MAAM,EACN,OAAO,EACP,KAAK,EACL,IAAI,CACL,CAAC;QACF,kBAAkB;QAClB,uCAAyB,CAAC,cAAc,CACtC,yBAAS,CAAC,WAAW,EACrB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,CACL,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL,8DACG,MAAM,IAAI,QAAQ;QACjB;YACE,8BAAC,gCAAmB,IAClB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd;YACF,8BAAC,qBAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,8BAAC,0BAAY,OACP,KAAK,EACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,EACtD,eAAe,EAAE,eAAe,GAChC,CACH,CACS,CACX,CAEJ,CACJ,CAAC;AACJ,CAAC;AA9FD,0DA8FC","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*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { CategoryTree, getCategories, toggleAllCategories, useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./CategoriesTree.scss\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport { CategoryVisibilityHandler } from \"@itwin/appui-react\";\nimport type { CategoriesTreeProps } from \"../../types\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\n\nexport function CategoriesTreeComponent(props: CategoriesTreeProps) {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\n const showAll = useCallback(async () => {\n if (!iModel) return;\n\n return toggleAllCategories(\n IModelApp.viewManager,\n iModel,\n true,\n undefined,\n true,\n filteredProvider\n );\n }, [iModel, filteredProvider]);\n\n const hideAll = useCallback(async () => {\n if (!iModel) return;\n return toggleAllCategories(\n IModelApp.viewManager,\n iModel,\n false,\n undefined,\n true,\n filteredProvider\n );\n }, [iModel, filteredProvider]);\n\n const invert = useCallback(async () => {\n if (!iModel || !viewport) return;\n\n const ids = await getCategories(iModel, viewport, filteredProvider);\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (viewport.view.viewsCategory(id)) {\n enabled.push(id);\n } else {\n disabled.push(id);\n }\n }\n // Disable enabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n iModel,\n enabled,\n false,\n true\n );\n // Enable disabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n iModel,\n disabled,\n true,\n true\n );\n }, [iModel, viewport, filteredProvider]);\n\n return (\n <>\n {iModel && viewport &&\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n />\n <AutoSizer>\n {({ width, height }) => (\n <CategoryTree\n {...props}\n iModel={iModel}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </>\n }\n </>\n );\n}\n"]}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { IModelContentTreeProps } from "../../types";
3
+ export declare const IModelContentTree: (props: IModelContentTreeProps) => JSX.Element;
4
+ //# sourceMappingURL=IModelContentTree.d.ts.map
@@ -22,22 +22,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.ClassificationsTreeComponent = void 0;
25
+ exports.IModelContentTree = void 0;
26
26
  /*---------------------------------------------------------------------------------------------
27
27
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
28
28
  * See LICENSE.md in the project root for license terms and full copyright notice.
29
29
  *--------------------------------------------------------------------------------------------*/
30
- const React = __importStar(require("react"));
31
- const TreeWithRuleset_1 = require("./TreeWithRuleset");
30
+ const react_1 = __importStar(require("react"));
32
31
  const presentation_components_1 = require("@itwin/presentation-components");
33
- const ClassificationSystems_json_1 = __importDefault(require("../rulesets/ClassificationSystems.json"));
34
- function ClassificationsTreeComponent(props) {
35
- const dataProvider = new presentation_components_1.PresentationTreeDataProvider({
36
- imodel: props.iModel,
37
- ruleset: ClassificationSystems_json_1.default.id,
32
+ const components_react_1 = require("@itwin/components-react");
33
+ const IModelContent_json_1 = __importDefault(require("../rulesets/IModelContent.json"));
34
+ const AutoSizer_1 = require("../utils/AutoSizer");
35
+ const classnames_1 = __importDefault(require("classnames"));
36
+ const IModelContentTree = (props) => {
37
+ const { iModel, className, ...divProps } = props;
38
+ const { nodeLoader } = presentation_components_1.usePresentationTreeNodeLoader({
39
+ imodel: iModel,
40
+ ruleset: IModelContent_json_1.default,
38
41
  pagingSize: 20,
42
+ appendChildrenCountForGroupingNodes: true,
39
43
  });
40
- return (React.createElement(TreeWithRuleset_1.SimpleTreeWithRuleset, { imodel: props.iModel, ruleSet: ClassificationSystems_json_1.default, dataProvider: dataProvider }));
41
- }
42
- exports.ClassificationsTreeComponent = ClassificationsTreeComponent;
43
- //# sourceMappingURL=ClassificationsTree.js.map
44
+ const eventHandler = components_react_1.useTreeEventsHandler(react_1.useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource, collapsedChildrenDisposalEnabled: true }), [nodeLoader]));
45
+ const treeModel = components_react_1.useTreeModel(nodeLoader.modelSource);
46
+ return (react_1.default.createElement(AutoSizer_1.AutoSizer, null, ({ width, height }) => (react_1.default.createElement("div", { ...divProps, className: classnames_1.default("imodel-content-tree", className) },
47
+ react_1.default.createElement(components_react_1.ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: components_react_1.SelectionMode.None, eventsHandler: eventHandler, model: treeModel, iconsEnabled: true })))));
48
+ };
49
+ exports.IModelContentTree = IModelContentTree;
50
+ //# sourceMappingURL=IModelContentTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../src/components/trees/IModelContentTree.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAAuC;AAEvC,4EAA+E;AAC/E,8DAA4G;AAC5G,wFAAoE;AACpE,kDAA+C;AAC/C,4DAAoC;AAG7B,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjD,MAAM,EAAE,UAAU,EAAE,GAAG,uDAA6B,CAAC;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,4BAAiC;QAC1C,UAAU,EAAE,EAAE;QACd,mCAAmC,EAAE,IAAI;KAC1C,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,uCAAoB,CAAC,eAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,gCAAgC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEtK,MAAM,SAAS,GAAG,+BAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEvD,OAAO,CACL,8BAAC,qBAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,0CAAS,QAAQ,EAAE,SAAS,EAAE,oBAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC;QACxE,8BAAC,iCAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,gCAAa,CAAC,IAAI,EACjC,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,IAAI,GAClB,CACE,CACP,CACS,CACb,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","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*--------------------------------------------------------------------------------------------*/\nimport React, { useMemo } from \"react\";\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport IMODEL_CONTENT_RULESET from \"../rulesets/IModelContent.json\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\nimport classNames from \"classnames\";\nimport type { IModelContentTreeProps } from \"../../types\";\n\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, className, ...divProps } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: IMODEL_CONTENT_RULESET as Ruleset,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource, collapsedChildrenDisposalEnabled: true }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <AutoSizer>\n {({ width, height }) => (\n <div {...divProps} className={classNames(\"imodel-content-tree\", className)}>\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n iconsEnabled={true}\n />\n </div>\n )}\n </AutoSizer>\n );\n};\n"]}
@@ -1,10 +1,5 @@
1
- import type { IModelConnection, Viewport } from "@itwin/core-frontend";
1
+ /// <reference types="react" />
2
2
  import "./ModelsTree.scss";
3
- export interface ModelTreeProps {
4
- iModel: IModelConnection;
5
- allViewports?: boolean;
6
- activeView?: Viewport;
7
- enableElementsClassGrouping?: boolean;
8
- }
9
- export declare const ModelsTreeComponent: (props: ModelTreeProps) => JSX.Element | null;
3
+ import type { ModelTreeProps } from "../../types";
4
+ export declare const ModelsTreeComponent: (props: ModelTreeProps) => JSX.Element;
10
5
  //# sourceMappingURL=ModelsTree.d.ts.map