@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
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.customizeModelsTreeNodeItem = exports.createSearchRuleset = exports.createRuleset = exports.CachingElementIdsContainer = void 0;
7
+ exports.addModelsTreeNodeItemIcons = exports.createSearchRuleset = exports.createRuleset = exports.CachingElementIdsContainer = void 0;
8
8
  const presentation_common_1 = require("@itwin/presentation-common");
9
9
  /** @internal */
10
10
  class CachingElementIdsContainer {
@@ -27,7 +27,11 @@ class CachingElementIdsContainer {
27
27
  exports.CachingElementIdsContainer = CachingElementIdsContainer;
28
28
  /** @internal */
29
29
  function createRuleset(props) {
30
- const elementClassSpecification = props.elementClassSpecification ?? { schemaName: "BisCore", className: "GeometricElement3d" };
30
+ const context = {
31
+ elementClassSpecification: props.elementClassSpecification ?? { schemaName: "BisCore", className: "GeometricElement3d" },
32
+ groupElements: !!props.enableElementsClassGrouping,
33
+ showEmptyModels: !!props.showEmptyModels,
34
+ };
31
35
  return {
32
36
  id: "tree-widget-react/ModelsTree",
33
37
  requiredSchemas: [
@@ -40,20 +44,7 @@ function createRuleset(props) {
40
44
  ruleType: "RootNodes",
41
45
  autoExpand: true,
42
46
  specifications: [
43
- {
44
- specType: "InstanceNodesOfSpecificClasses",
45
- classes: [
46
- {
47
- schemaName: "BisCore",
48
- classNames: [
49
- "Subject",
50
- ],
51
- },
52
- ],
53
- instanceFilter: `this.Parent = NULL`,
54
- groupByClass: false,
55
- groupByLabel: false,
56
- },
47
+ createRootSubjectSpecification(),
57
48
  ],
58
49
  customizationRules: [
59
50
  {
@@ -69,46 +60,8 @@ function createRuleset(props) {
69
60
  ruleType: "ChildNodes",
70
61
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
71
62
  specifications: [
72
- {
73
- specType: "RelatedInstanceNodes",
74
- relationshipPaths: [
75
- {
76
- relationship: {
77
- schemaName: "BisCore",
78
- className: "SubjectOwnsSubjects",
79
- },
80
- direction: "Forward",
81
- targetClass: {
82
- schemaName: "BisCore",
83
- className: "Subject",
84
- },
85
- },
86
- ],
87
- instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") <> NULL OR ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") = "Hierarchy"`,
88
- hideNodesInHierarchy: true,
89
- groupByClass: false,
90
- groupByLabel: false,
91
- },
92
- {
93
- specType: "RelatedInstanceNodes",
94
- relationshipPaths: [
95
- {
96
- relationship: {
97
- schemaName: "BisCore",
98
- className: "SubjectOwnsSubjects",
99
- },
100
- direction: "Forward",
101
- targetClass: {
102
- schemaName: "BisCore",
103
- className: "Subject",
104
- },
105
- },
106
- ],
107
- instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") = NULL AND ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") <> "Hierarchy"`,
108
- hideIfNoChildren: true,
109
- groupByClass: false,
110
- groupByLabel: false,
111
- },
63
+ createRelatedHierarchySubjectSpecification(),
64
+ createRelatedNonHierarchySubjectSpecification(),
112
65
  ],
113
66
  customizationRules: [
114
67
  {
@@ -124,70 +77,8 @@ function createRuleset(props) {
124
77
  ruleType: "ChildNodes",
125
78
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
126
79
  specifications: [
127
- {
128
- specType: "InstanceNodesOfSpecificClasses",
129
- classes: {
130
- schemaName: "BisCore",
131
- classNames: [
132
- "GeometricModel3d",
133
- ],
134
- arePolymorphic: true,
135
- },
136
- relatedInstances: [
137
- {
138
- relationshipPath: {
139
- relationship: {
140
- schemaName: "BisCore",
141
- className: "ModelModelsElement",
142
- },
143
- direction: "Forward",
144
- targetClass: {
145
- schemaName: "BisCore",
146
- className: "InformationPartitionElement",
147
- },
148
- },
149
- alias: "partition",
150
- isRequired: true,
151
- },
152
- ],
153
- 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 AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
154
- hasChildren: "Always",
155
- hideIfNoChildren: true,
156
- groupByClass: false,
157
- groupByLabel: false,
158
- },
159
- {
160
- specType: "InstanceNodesOfSpecificClasses",
161
- classes: {
162
- schemaName: "BisCore",
163
- classNames: [
164
- "GeometricModel3d",
165
- ],
166
- arePolymorphic: true,
167
- },
168
- relatedInstances: [
169
- {
170
- relationshipPath: {
171
- relationship: {
172
- schemaName: "BisCore",
173
- className: "ModelModelsElement",
174
- },
175
- direction: "Forward",
176
- targetClass: {
177
- schemaName: "BisCore",
178
- className: "InformationPartitionElement",
179
- },
180
- },
181
- alias: "partition",
182
- isRequired: true,
183
- },
184
- ],
185
- 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) AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
186
- hasChildren: "Always",
187
- hideNodesInHierarchy: true,
188
- groupByClass: false,
189
- groupByLabel: false,
190
- },
80
+ createNonContentModelsSpecification(context),
81
+ createContentModelsSpecification(context),
191
82
  ],
192
83
  customizationRules: [
193
84
  {
@@ -203,22 +94,7 @@ function createRuleset(props) {
203
94
  ruleType: "ChildNodes",
204
95
  condition: `ParentNode.IsOfClass("ISubModeledElement", "BisCore")`,
205
96
  specifications: [
206
- {
207
- specType: "RelatedInstanceNodes",
208
- relationshipPaths: [
209
- {
210
- relationship: {
211
- schemaName: "BisCore",
212
- className: "ModelModelsElement",
213
- },
214
- direction: "Backward",
215
- },
216
- ],
217
- instanceFilter: `NOT this.IsPrivate AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
218
- hideNodesInHierarchy: true,
219
- groupByClass: false,
220
- groupByLabel: false,
221
- },
97
+ createElementModelSpecification(context),
222
98
  ],
223
99
  customizationRules: [
224
100
  {
@@ -234,33 +110,7 @@ function createRuleset(props) {
234
110
  ruleType: "ChildNodes",
235
111
  condition: `ParentNode.IsOfClass("GeometricModel3d", "BisCore")`,
236
112
  specifications: [
237
- {
238
- specType: "RelatedInstanceNodes",
239
- relationshipPaths: [
240
- [
241
- {
242
- relationship: {
243
- schemaName: "BisCore",
244
- className: "ModelContainsElements",
245
- },
246
- direction: "Forward",
247
- targetClass: elementClassSpecification,
248
- },
249
- {
250
- relationship: {
251
- schemaName: "BisCore",
252
- className: "GeometricElement3dIsInCategory",
253
- },
254
- direction: "Forward",
255
- },
256
- ],
257
- ],
258
- instanceFilter: `NOT this.IsPrivate`,
259
- suppressSimilarAncestorsCheck: true,
260
- hideIfNoChildren: true,
261
- groupByClass: false,
262
- groupByLabel: false,
263
- },
113
+ createModelCategoriesSpecification(context),
264
114
  ],
265
115
  customizationRules: [
266
116
  {
@@ -277,22 +127,7 @@ function createRuleset(props) {
277
127
  ruleType: "ChildNodes",
278
128
  condition: `ParentNode.IsOfClass("SpatialCategory", "BisCore")`,
279
129
  specifications: [
280
- {
281
- specType: "RelatedInstanceNodes",
282
- relationshipPaths: [
283
- {
284
- relationship: {
285
- schemaName: "BisCore",
286
- className: "GeometricElement3dIsInCategory",
287
- },
288
- direction: "Backward",
289
- targetClass: elementClassSpecification,
290
- },
291
- ],
292
- instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,
293
- groupByClass: !!props.enableElementsClassGrouping,
294
- groupByLabel: false,
295
- },
130
+ createCategoryElementsSpecification(context),
296
131
  ],
297
132
  customizationRules: [
298
133
  {
@@ -310,21 +145,7 @@ function createRuleset(props) {
310
145
  ruleType: "ChildNodes",
311
146
  condition: `ParentNode.IsOfClass("GeometricElement3d", "BisCore")`,
312
147
  specifications: [
313
- {
314
- specType: "RelatedInstanceNodes",
315
- relationshipPaths: [
316
- {
317
- relationship: {
318
- schemaName: "BisCore",
319
- className: "ElementOwnsChildElements",
320
- },
321
- direction: "Forward",
322
- targetClass: elementClassSpecification,
323
- },
324
- ],
325
- groupByClass: !!props.enableElementsClassGrouping,
326
- groupByLabel: false,
327
- },
148
+ createEementElementsSpecification(context),
328
149
  ],
329
150
  customizationRules: [
330
151
  {
@@ -392,28 +213,18 @@ function createRuleset(props) {
392
213
  exports.createRuleset = createRuleset;
393
214
  /** @internal */
394
215
  function createSearchRuleset(props) {
395
- const elementClassSpecification = props.elementClassSpecification ?? { schemaName: "BisCore", className: "GeometricElement3d" };
216
+ const context = {
217
+ elementClassSpecification: props.elementClassSpecification ?? { schemaName: "BisCore", className: "GeometricElement3d" },
218
+ groupElements: false,
219
+ showEmptyModels: !!props.showEmptyModels,
220
+ };
396
221
  return {
397
222
  id: "tree-widget-react/ModelsTreeSearch",
398
223
  rules: [
399
224
  {
400
225
  ruleType: "RootNodes",
401
226
  specifications: [
402
- {
403
- specType: "InstanceNodesOfSpecificClasses",
404
- classes: [
405
- {
406
- schemaName: "BisCore",
407
- classNames: [
408
- "Subject",
409
- ],
410
- },
411
- ],
412
- instanceFilter: "this.Parent = NULL",
413
- arePolymorphic: false,
414
- groupByClass: false,
415
- groupByLabel: false,
416
- },
227
+ createRootSubjectSpecification(),
417
228
  ],
418
229
  customizationRules: [
419
230
  {
@@ -429,45 +240,10 @@ function createSearchRuleset(props) {
429
240
  ruleType: "ChildNodes",
430
241
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
431
242
  specifications: [
243
+ createRelatedHierarchySubjectSpecification(),
432
244
  {
433
- specType: "RelatedInstanceNodes",
434
- relationshipPaths: [
435
- {
436
- relationship: {
437
- schemaName: "BisCore",
438
- className: "SubjectOwnsSubjects",
439
- },
440
- direction: "Forward",
441
- targetClass: {
442
- schemaName: "BisCore",
443
- className: "Subject",
444
- },
445
- },
446
- ],
447
- instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") <> NULL OR ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") = "Hierarchy"`,
448
- hideNodesInHierarchy: true,
449
- groupByClass: false,
450
- groupByLabel: false,
451
- },
452
- {
453
- specType: "RelatedInstanceNodes",
454
- relationshipPaths: [
455
- {
456
- relationship: {
457
- schemaName: "BisCore",
458
- className: "SubjectOwnsSubjects",
459
- },
460
- direction: "Forward",
461
- targetClass: {
462
- schemaName: "BisCore",
463
- className: "Subject",
464
- },
465
- },
466
- ],
467
- instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") = NULL AND ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") <> "Hierarchy"`,
245
+ ...createRelatedNonHierarchySubjectSpecification(),
468
246
  hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,
469
- groupByClass: false,
470
- groupByLabel: false,
471
247
  },
472
248
  ],
473
249
  customizationRules: [
@@ -497,36 +273,7 @@ function createSearchRuleset(props) {
497
273
  ruleType: "ChildNodes",
498
274
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
499
275
  specifications: [
500
- {
501
- specType: "InstanceNodesOfSpecificClasses",
502
- classes: {
503
- schemaName: "BisCore",
504
- classNames: [
505
- "GeometricModel3d",
506
- ],
507
- },
508
- arePolymorphic: true,
509
- relatedInstances: [
510
- {
511
- relationshipPath: {
512
- relationship: {
513
- schemaName: "BisCore",
514
- className: "ModelModelsElement",
515
- },
516
- direction: "Forward",
517
- targetClass: {
518
- schemaName: "BisCore",
519
- className: "InformationPartitionElement",
520
- },
521
- },
522
- alias: "partition",
523
- isRequired: true,
524
- },
525
- ],
526
- 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 AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
527
- groupByClass: false,
528
- groupByLabel: false,
529
- },
276
+ createNonContentModelsSpecification(context),
530
277
  ],
531
278
  customizationRules: [
532
279
  {
@@ -542,37 +289,7 @@ function createSearchRuleset(props) {
542
289
  ruleType: "ChildNodes",
543
290
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
544
291
  specifications: [
545
- {
546
- specType: "InstanceNodesOfSpecificClasses",
547
- classes: {
548
- schemaName: "BisCore",
549
- classNames: [
550
- "GeometricModel3d",
551
- ],
552
- },
553
- arePolymorphic: true,
554
- relatedInstances: [
555
- {
556
- relationshipPath: {
557
- relationship: {
558
- schemaName: "BisCore",
559
- className: "ModelModelsElement",
560
- },
561
- direction: "Forward",
562
- targetClass: {
563
- schemaName: "BisCore",
564
- className: "InformationPartitionElement",
565
- },
566
- },
567
- alias: "partition",
568
- isRequired: true,
569
- },
570
- ],
571
- 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) AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
572
- hideNodesInHierarchy: true,
573
- groupByClass: false,
574
- groupByLabel: false,
575
- },
292
+ createContentModelsSpecification(context),
576
293
  ],
577
294
  customizationRules: [
578
295
  {
@@ -594,25 +311,7 @@ function createSearchRuleset(props) {
594
311
  ruleType: "ChildNodes",
595
312
  condition: `ParentNode.IsOfClass("GeometricModel3d", "BisCore")`,
596
313
  specifications: [
597
- {
598
- specType: "RelatedInstanceNodes",
599
- relationshipPaths: [
600
- {
601
- relationship: {
602
- schemaName: "BisCore",
603
- className: "ModelOwnsSubModel",
604
- },
605
- direction: "Forward",
606
- targetClass: {
607
- schemaName: "BisCore",
608
- className: "GeometricModel3d",
609
- },
610
- },
611
- ],
612
- instanceFilter: `NOT this.IsPrivate AND this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`,
613
- groupByClass: false,
614
- groupByLabel: false,
615
- },
314
+ createModelSubModelsSpecification(context),
616
315
  ],
617
316
  customizationRules: [
618
317
  {
@@ -628,16 +327,251 @@ function createSearchRuleset(props) {
628
327
  };
629
328
  }
630
329
  exports.createSearchRuleset = createSearchRuleset;
631
- /** @internal */
632
- function customizeModelsTreeNodeItem(item, node) {
633
- item.isCheckboxVisible = true;
634
- item.isCheckboxDisabled = true;
635
- item.icon = getIcon(node);
330
+ function createRootSubjectSpecification() {
331
+ return {
332
+ specType: "InstanceNodesOfSpecificClasses",
333
+ classes: [
334
+ {
335
+ schemaName: "BisCore",
336
+ classNames: [
337
+ "Subject",
338
+ ],
339
+ },
340
+ ],
341
+ instanceFilter: `this.Parent = NULL`,
342
+ groupByClass: false,
343
+ groupByLabel: false,
344
+ };
345
+ }
346
+ function createRelatedHierarchySubjectSpecification() {
347
+ return {
348
+ specType: "RelatedInstanceNodes",
349
+ relationshipPaths: [
350
+ {
351
+ relationship: {
352
+ schemaName: "BisCore",
353
+ className: "SubjectOwnsSubjects",
354
+ },
355
+ direction: "Forward",
356
+ targetClass: {
357
+ schemaName: "BisCore",
358
+ className: "Subject",
359
+ },
360
+ },
361
+ ],
362
+ instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") <> NULL OR ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") = "Hierarchy"`,
363
+ hideNodesInHierarchy: true,
364
+ groupByClass: false,
365
+ groupByLabel: false,
366
+ };
367
+ }
368
+ function createRelatedNonHierarchySubjectSpecification() {
369
+ return {
370
+ specType: "RelatedInstanceNodes",
371
+ relationshipPaths: [
372
+ {
373
+ relationship: {
374
+ schemaName: "BisCore",
375
+ className: "SubjectOwnsSubjects",
376
+ },
377
+ direction: "Forward",
378
+ targetClass: {
379
+ schemaName: "BisCore",
380
+ className: "Subject",
381
+ },
382
+ },
383
+ ],
384
+ instanceFilter: `json_extract(this.JsonProperties, "$.Subject.Job.Bridge") = NULL AND ifnull(json_extract(this.JsonProperties, "$.Subject.Model.Type"), "") <> "Hierarchy"`,
385
+ hideIfNoChildren: true,
386
+ groupByClass: false,
387
+ groupByLabel: false,
388
+ };
636
389
  }
637
- exports.customizeModelsTreeNodeItem = customizeModelsTreeNodeItem;
638
- function getIcon(node) {
639
- return node.key && presentation_common_1.NodeKey.isClassGroupingNodeKey(node.key)
390
+ function createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }) {
391
+ const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, "$.Subject.Model.TargetPartition") = printf("0x%x", partition.ECInstanceId)`;
392
+ const modelHasElements = `this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`;
393
+ const hasNoContent = `json_extract(partition.JsonProperties, "$.PhysicalPartition.Model.Content") = NULL AND json_extract(partition.JsonProperties, "$.GraphicalPartition3d.Model.Content") = NULL`;
394
+ const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? "" : ` AND ${modelHasElements}`}`;
395
+ return {
396
+ specType: "InstanceNodesOfSpecificClasses",
397
+ classes: {
398
+ schemaName: "BisCore",
399
+ classNames: [
400
+ "GeometricModel3d",
401
+ ],
402
+ arePolymorphic: true,
403
+ },
404
+ relatedInstances: [
405
+ {
406
+ relationshipPath: {
407
+ relationship: {
408
+ schemaName: "BisCore",
409
+ className: "ModelModelsElement",
410
+ },
411
+ direction: "Forward",
412
+ targetClass: {
413
+ schemaName: "BisCore",
414
+ className: "InformationPartitionElement",
415
+ },
416
+ },
417
+ alias: "partition",
418
+ isRequired: true,
419
+ },
420
+ ],
421
+ instanceFilter,
422
+ hasChildren: showEmptyModels ? "Unknown" : "Always",
423
+ groupByClass: false,
424
+ groupByLabel: false,
425
+ };
426
+ }
427
+ function createContentModelsSpecification({ elementClassSpecification, showEmptyModels }) {
428
+ const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, "$.Subject.Model.TargetPartition") = printf("0x%x", partition.ECInstanceId)`;
429
+ const modelHasElements = `this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`;
430
+ const hasContent = `json_extract(partition.JsonProperties, "$.PhysicalPartition.Model.Content") <> NULL OR json_extract(partition.JsonProperties, "$.GraphicalPartition3d.Model.Content") <> NULL`;
431
+ const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? "" : ` AND ${modelHasElements}`}`;
432
+ return {
433
+ specType: "InstanceNodesOfSpecificClasses",
434
+ classes: {
435
+ schemaName: "BisCore",
436
+ classNames: ["GeometricModel3d"],
437
+ arePolymorphic: true,
438
+ },
439
+ relatedInstances: [
440
+ {
441
+ relationshipPath: {
442
+ relationship: {
443
+ schemaName: "BisCore",
444
+ className: "ModelModelsElement",
445
+ },
446
+ direction: "Forward",
447
+ targetClass: {
448
+ schemaName: "BisCore",
449
+ className: "InformationPartitionElement",
450
+ },
451
+ },
452
+ alias: "partition",
453
+ isRequired: true,
454
+ },
455
+ ],
456
+ instanceFilter,
457
+ hasChildren: showEmptyModels ? "Unknown" : "Always",
458
+ hideNodesInHierarchy: true,
459
+ groupByClass: false,
460
+ groupByLabel: false,
461
+ };
462
+ }
463
+ function createElementModelSpecification({ elementClassSpecification, showEmptyModels }) {
464
+ const hasElements = `this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`;
465
+ const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? "" : ` AND ${hasElements}`}`;
466
+ return {
467
+ specType: "RelatedInstanceNodes",
468
+ relationshipPaths: [
469
+ {
470
+ relationship: {
471
+ schemaName: "BisCore",
472
+ className: "ModelModelsElement",
473
+ },
474
+ direction: "Backward",
475
+ },
476
+ ],
477
+ instanceFilter,
478
+ hideNodesInHierarchy: true,
479
+ groupByClass: false,
480
+ groupByLabel: false,
481
+ };
482
+ }
483
+ function createModelCategoriesSpecification({ elementClassSpecification }) {
484
+ return {
485
+ specType: "RelatedInstanceNodes",
486
+ relationshipPaths: [
487
+ [
488
+ {
489
+ relationship: {
490
+ schemaName: "BisCore",
491
+ className: "ModelContainsElements",
492
+ },
493
+ direction: "Forward",
494
+ targetClass: elementClassSpecification,
495
+ },
496
+ {
497
+ relationship: {
498
+ schemaName: "BisCore",
499
+ className: "GeometricElement3dIsInCategory",
500
+ },
501
+ direction: "Forward",
502
+ },
503
+ ],
504
+ ],
505
+ instanceFilter: `NOT this.IsPrivate`,
506
+ suppressSimilarAncestorsCheck: true,
507
+ hideIfNoChildren: true,
508
+ groupByClass: false,
509
+ groupByLabel: false,
510
+ };
511
+ }
512
+ function createCategoryElementsSpecification({ elementClassSpecification, groupElements }) {
513
+ return {
514
+ specType: "RelatedInstanceNodes",
515
+ relationshipPaths: [
516
+ {
517
+ relationship: {
518
+ schemaName: "BisCore",
519
+ className: "GeometricElement3dIsInCategory",
520
+ },
521
+ direction: "Backward",
522
+ targetClass: elementClassSpecification,
523
+ },
524
+ ],
525
+ instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,
526
+ groupByClass: groupElements,
527
+ groupByLabel: false,
528
+ };
529
+ }
530
+ function createEementElementsSpecification({ elementClassSpecification, groupElements }) {
531
+ return {
532
+ specType: "RelatedInstanceNodes",
533
+ relationshipPaths: [
534
+ {
535
+ relationship: {
536
+ schemaName: "BisCore",
537
+ className: "ElementOwnsChildElements",
538
+ },
539
+ direction: "Forward",
540
+ targetClass: elementClassSpecification,
541
+ },
542
+ ],
543
+ groupByClass: groupElements,
544
+ groupByLabel: false,
545
+ };
546
+ }
547
+ function createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }) {
548
+ const hasElements = `this.HasRelatedInstance("BisCore:ModelContainsElements", "Forward", "${elementClassSpecification.schemaName}:${elementClassSpecification.className}")`;
549
+ const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? "" : ` AND ${hasElements}`}`;
550
+ return {
551
+ specType: "RelatedInstanceNodes",
552
+ relationshipPaths: [
553
+ {
554
+ relationship: {
555
+ schemaName: "BisCore",
556
+ className: "ModelOwnsSubModel",
557
+ },
558
+ direction: "Forward",
559
+ targetClass: {
560
+ schemaName: "BisCore",
561
+ className: "GeometricModel3d",
562
+ },
563
+ },
564
+ ],
565
+ instanceFilter,
566
+ groupByClass: false,
567
+ groupByLabel: false,
568
+ };
569
+ }
570
+ /** @internal */
571
+ function addModelsTreeNodeItemIcons(item, node) {
572
+ item.icon = node.key && presentation_common_1.NodeKey.isClassGroupingNodeKey(node.key)
640
573
  ? node.extendedData?.groupIcon
641
574
  : node.extendedData?.icon;
642
575
  }
576
+ exports.addModelsTreeNodeItemIcons = addModelsTreeNodeItemIcons;
643
577
  //# sourceMappingURL=Utils.js.map