@itwin/tree-widget-react 3.7.0 → 3.8.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.
- package/CHANGELOG.md +14 -2
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +6 -5
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +10 -4
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +2 -3
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +1 -5
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +2 -2
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +95 -68
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/cjs/tree-widget-react-internal.d.ts +9 -0
- package/lib/cjs/tree-widget-react-internal.js +28 -0
- package/lib/cjs/tree-widget-react-internal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +6 -5
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +10 -4
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +2 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +2 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +95 -68
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react-internal.d.ts +9 -0
- package/lib/esm/tree-widget-react-internal.js +15 -0
- package/lib/esm/tree-widget-react-internal.js.map +1 -0
- package/package.json +32 -28
|
@@ -74,7 +74,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
74
74
|
}
|
|
75
75
|
[Symbol.dispose]() {
|
|
76
76
|
this._eventListener.dispose();
|
|
77
|
-
this._alwaysAndNeverDrawnElements.dispose();
|
|
77
|
+
this._alwaysAndNeverDrawnElements[Symbol.dispose]();
|
|
78
78
|
this._subscriptions.forEach((x) => x.unsubscribe());
|
|
79
79
|
}
|
|
80
80
|
getVisibilityStatusObs(node) {
|
|
@@ -92,7 +92,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
92
92
|
return this.getSubjectNodeVisibilityStatus({ subjectIds: node.key.instanceKeys.map((key) => key.id) });
|
|
93
93
|
}
|
|
94
94
|
if (ModelsTreeNode_js_1.ModelsTreeNode.isModelNode(node)) {
|
|
95
|
-
return this.getModelVisibilityStatus({
|
|
95
|
+
return this.getModelVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id) });
|
|
96
96
|
}
|
|
97
97
|
const modelId = ModelsTreeNode_js_1.ModelsTreeNode.getModelId(node);
|
|
98
98
|
if (!modelId) {
|
|
@@ -100,7 +100,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
100
100
|
}
|
|
101
101
|
if (ModelsTreeNode_js_1.ModelsTreeNode.isCategoryNode(node)) {
|
|
102
102
|
return this.getCategoryDisplayStatus({
|
|
103
|
-
|
|
103
|
+
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
104
104
|
modelId,
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -121,12 +121,12 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
121
121
|
observables.push(this.getSubjectNodeVisibilityStatus({ subjectIds: [...subjects], ignoreTooltip: true }));
|
|
122
122
|
}
|
|
123
123
|
if (models?.size) {
|
|
124
|
-
observables.push(
|
|
124
|
+
observables.push(this.getModelVisibilityStatus({ modelIds: models, ignoreTooltip: true }));
|
|
125
125
|
}
|
|
126
126
|
if (categories?.size) {
|
|
127
127
|
observables.push((0, rxjs_1.from)(categories).pipe((0, rxjs_1.mergeMap)((key) => {
|
|
128
128
|
const { modelId, categoryId } = (0, FilteredTree_js_1.parseCategoryKey)(key);
|
|
129
|
-
return this.getCategoryDisplayStatus({ modelId, categoryId, ignoreTooltip: true });
|
|
129
|
+
return this.getCategoryDisplayStatus({ modelId, categoryIds: categoryId, ignoreTooltip: true });
|
|
130
130
|
})));
|
|
131
131
|
}
|
|
132
132
|
if (elements?.size) {
|
|
@@ -136,17 +136,14 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
136
136
|
})));
|
|
137
137
|
}
|
|
138
138
|
return (0, rxjs_1.merge)(...observables);
|
|
139
|
-
}), (
|
|
140
|
-
(0, core_bentley_1.assert)(x !== "empty");
|
|
141
|
-
return (0, Tooltip_js_1.createVisibilityStatus)(x);
|
|
142
|
-
}));
|
|
139
|
+
}), mergeVisibilityStatuses());
|
|
143
140
|
}
|
|
144
141
|
getSubjectNodeVisibilityStatus({ subjectIds, ignoreTooltip }) {
|
|
145
142
|
const result = (0, rxjs_1.defer)(() => {
|
|
146
143
|
if (!this._props.viewport.view.isSpatialView()) {
|
|
147
144
|
return (0, rxjs_1.of)((0, Tooltip_js_1.createVisibilityStatus)("disabled", getTooltipOptions("modelsTree.subject.nonSpatialView", ignoreTooltip)));
|
|
148
145
|
}
|
|
149
|
-
return (0, rxjs_1.from)(this._idsCache.getSubjectModelIds(subjectIds)).pipe((0, rxjs_1.
|
|
146
|
+
return (0, rxjs_1.from)(this._idsCache.getSubjectModelIds(subjectIds)).pipe((0, rxjs_1.mergeMap)((modelIds) => this.getModelVisibilityStatus({ modelIds, ignoreTooltip: true })), mergeVisibilityStatuses({
|
|
150
147
|
visible: "modelsTree.subject.allModelsVisible",
|
|
151
148
|
hidden: "modelsTree.subject.allModelsHidden",
|
|
152
149
|
partial: "modelsTree.subject.someModelsHidden",
|
|
@@ -154,47 +151,68 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
154
151
|
});
|
|
155
152
|
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, { ids: subjectIds }, result, this._props.overrides?.getSubjectNodeVisibility);
|
|
156
153
|
}
|
|
157
|
-
getModelVisibilityStatus({
|
|
154
|
+
getModelVisibilityStatus({ modelIds, ignoreTooltip }) {
|
|
158
155
|
const result = (0, rxjs_1.defer)(() => {
|
|
159
156
|
const viewport = this._props.viewport;
|
|
160
157
|
if (!viewport.view.isSpatialView()) {
|
|
161
158
|
return (0, rxjs_1.of)((0, Tooltip_js_1.createVisibilityStatus)("disabled", getTooltipOptions("modelsTree.model.nonSpatialView", ignoreTooltip)));
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
return (0, rxjs_1.from)(modelIds).pipe((0, rxjs_1.distinct)(), (0, rxjs_1.mergeMap)((modelId) => {
|
|
161
|
+
if (!viewport.view.viewsModel(modelId)) {
|
|
162
|
+
return (0, rxjs_1.from)(this._idsCache.getModelCategories(modelId)).pipe((0, rxjs_1.mergeMap)((categoryIds) => (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(modelId, categoryIds))), this.getSubModeledElementsVisibilityStatus({
|
|
163
|
+
ignoreTooltips: ignoreTooltip,
|
|
164
|
+
haveSubModel: "yes",
|
|
165
|
+
tooltips: { visible: undefined, hidden: "modelsTree.model.hiddenThroughModelSelector", partial: "modelsTree.model.someSubModelsVisible" },
|
|
166
|
+
parentNodeVisibilityStatus: (0, Tooltip_js_1.createVisibilityStatus)("hidden"),
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
return (0, rxjs_1.from)(this._idsCache.getModelCategories(modelId)).pipe((0, rxjs_1.mergeMap)((categoryIds) => categoryIds.length === 0 ? (0, rxjs_1.of)((0, Tooltip_js_1.createVisibilityStatus)("visible")) : this.getCategoryDisplayStatus({ modelId, categoryIds, ignoreTooltip: true })), mergeVisibilityStatuses({
|
|
170
|
+
visible: "modelsTree.model.allCategoriesVisible",
|
|
171
|
+
partial: "modelsTree.model.someCategoriesHidden",
|
|
172
|
+
hidden: "modelsTree.model.allCategoriesHidden",
|
|
169
173
|
}));
|
|
170
|
-
}
|
|
171
|
-
return (0, rxjs_1.from)(this._idsCache.getModelCategories(modelId)).pipe((0, rxjs_1.concatAll)(), (0, rxjs_1.mergeMap)((categoryId) => this.getCategoryDisplayStatus({ modelId, categoryId, ignoreTooltip: true })), (0, rxjs_1.map)((x) => x.state), getVisibilityFromTreeNodeChildren, (0, rxjs_1.map)((visibilityByCategories) => {
|
|
172
|
-
const state = visibilityByCategories === "empty" ? "visible" : visibilityByCategories;
|
|
173
|
-
return (0, Tooltip_js_1.createVisibilityStatus)(state, getTooltipOptions(state === "partial" ? "modelsTree.model.someCategoriesHidden" : `modelsTree.model.allCategories${state ? "Visible" : "Hidden"}`, ignoreTooltip));
|
|
174
|
-
}));
|
|
174
|
+
}), mergeVisibilityStatuses());
|
|
175
175
|
});
|
|
176
|
-
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, {
|
|
176
|
+
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, { ids: modelIds }, result, this._props.overrides?.getModelDisplayStatus);
|
|
177
177
|
}
|
|
178
|
-
getDefaultCategoryVisibilityStatus({ modelId,
|
|
178
|
+
getDefaultCategoryVisibilityStatus({ modelId, categoryIds, ignoreTooltip, }) {
|
|
179
179
|
const viewport = this._props.viewport;
|
|
180
|
-
if (!viewport.view.viewsModel(modelId)) {
|
|
180
|
+
if (!viewport.view.viewsModel(modelId) || core_bentley_1.Id64.sizeOf(categoryIds) === 0) {
|
|
181
181
|
return (0, Tooltip_js_1.createVisibilityStatus)("hidden", getTooltipOptions("modelsTree.category.hiddenThroughModel", ignoreTooltip));
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
let visibility = "unknown";
|
|
184
|
+
for (const categoryId of core_bentley_1.Id64.iterable(categoryIds)) {
|
|
185
|
+
const override = this._props.viewport.perModelCategoryVisibility.getOverride(modelId, categoryId);
|
|
186
|
+
if (override === core_frontend_1.PerModelCategoryVisibility.Override.Show) {
|
|
187
|
+
if (visibility === "hidden") {
|
|
188
|
+
return (0, Tooltip_js_1.createVisibilityStatus)("partial");
|
|
189
|
+
}
|
|
190
|
+
visibility = "visible";
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (override === core_frontend_1.PerModelCategoryVisibility.Override.Hide) {
|
|
194
|
+
if (visibility === "visible") {
|
|
195
|
+
return (0, Tooltip_js_1.createVisibilityStatus)("partial");
|
|
196
|
+
}
|
|
197
|
+
visibility = "hidden";
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const isVisible = viewport.view.viewsCategory(categoryId);
|
|
201
|
+
if (isVisible && visibility === "hidden") {
|
|
202
|
+
return (0, Tooltip_js_1.createVisibilityStatus)("partial");
|
|
203
|
+
}
|
|
204
|
+
if (!isVisible && visibility === "visible") {
|
|
205
|
+
return (0, Tooltip_js_1.createVisibilityStatus)("partial");
|
|
206
|
+
}
|
|
207
|
+
visibility = isVisible ? "visible" : "hidden";
|
|
188
208
|
}
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
? (0, Tooltip_js_1.createVisibilityStatus)("visible", getTooltipOptions("modelsTree.category.displayedThroughCategorySelector", ignoreTooltip))
|
|
192
|
-
: (0, Tooltip_js_1.createVisibilityStatus)("hidden", getTooltipOptions("modelsTree.category.hiddenThroughCategorySelector", ignoreTooltip));
|
|
209
|
+
(0, core_bentley_1.assert)(visibility !== "unknown");
|
|
210
|
+
return (0, Tooltip_js_1.createVisibilityStatus)(visibility);
|
|
193
211
|
}
|
|
194
212
|
getCategoryDisplayStatus({ ignoreTooltip, ...props }) {
|
|
195
213
|
const result = (0, rxjs_1.defer)(() => {
|
|
196
214
|
if (!this._props.viewport.view.viewsModel(props.modelId)) {
|
|
197
|
-
return (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(props.modelId,
|
|
215
|
+
return (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(props.modelId, props.categoryIds)).pipe(this.getSubModeledElementsVisibilityStatus({
|
|
198
216
|
ignoreTooltips: ignoreTooltip,
|
|
199
217
|
parentNodeVisibilityStatus: (0, Tooltip_js_1.createVisibilityStatus)("hidden"),
|
|
200
218
|
tooltips: {
|
|
@@ -206,17 +224,19 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
206
224
|
}));
|
|
207
225
|
}
|
|
208
226
|
return this.getVisibilityFromAlwaysAndNeverDrawnElements({
|
|
209
|
-
|
|
227
|
+
categoryProps: { categoryIds: props.categoryIds, modelId: props.modelId },
|
|
210
228
|
tooltips: {
|
|
211
229
|
allElementsInAlwaysDrawnList: "modelsTree.category.allElementsVisible",
|
|
212
230
|
allElementsInNeverDrawnList: "modelsTree.category.allElementsHidden",
|
|
213
231
|
elementsInBothAlwaysAndNeverDrawn: "modelsTree.category.someElementsAreHidden",
|
|
214
232
|
noElementsInExclusiveAlwaysDrawnList: "modelsTree.category.allElementsHidden",
|
|
215
233
|
},
|
|
216
|
-
defaultStatus: () =>
|
|
234
|
+
defaultStatus: (categoryId) => categoryId
|
|
235
|
+
? this.getDefaultCategoryVisibilityStatus({ modelId: props.modelId, categoryIds: categoryId })
|
|
236
|
+
: this.getDefaultCategoryVisibilityStatus({ modelId: props.modelId, categoryIds: props.categoryIds }),
|
|
217
237
|
ignoreTooltip,
|
|
218
238
|
}).pipe((0, rxjs_1.mergeMap)((visibilityStatusAlwaysAndNeverDraw) => {
|
|
219
|
-
return (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(props.modelId,
|
|
239
|
+
return (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(props.modelId, props.categoryIds)).pipe(this.getSubModeledElementsVisibilityStatus({
|
|
220
240
|
tooltips: {
|
|
221
241
|
visible: undefined,
|
|
222
242
|
hidden: "modelsTree.category.allElementsAndSubModelsHidden",
|
|
@@ -248,7 +268,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
248
268
|
return this.getVisibilityFromAlwaysAndNeverDrawnElements({
|
|
249
269
|
elements: elementIds,
|
|
250
270
|
defaultStatus: () => {
|
|
251
|
-
const status = this.getDefaultCategoryVisibilityStatus({ categoryId, modelId, ignoreTooltip: true });
|
|
271
|
+
const status = this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true });
|
|
252
272
|
return (0, Tooltip_js_1.createVisibilityStatus)(status.state, getTooltipOptions(`modelsTree.groupingNode.${status.state}ThroughCategory`));
|
|
253
273
|
},
|
|
254
274
|
tooltips: {
|
|
@@ -325,7 +345,9 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
325
345
|
const { elementId, modelId, categoryId } = props;
|
|
326
346
|
const viewsModel = viewport.view.viewsModel(modelId);
|
|
327
347
|
const elementStatus = this.getElementOverriddenVisibility(elementId, ignoreTooltip);
|
|
328
|
-
return (0, rxjs_1.from)(this._idsCache.hasSubModel(elementId)).pipe((0, rxjs_1.mergeMap)((hasSubModel) => (hasSubModel ? this.getModelVisibilityStatus({
|
|
348
|
+
return (0, rxjs_1.from)(this._idsCache.hasSubModel(elementId)).pipe((0, rxjs_1.mergeMap)((hasSubModel) => (hasSubModel ? this.getModelVisibilityStatus({ modelIds: [elementId] }) : (0, rxjs_1.of)(undefined))), (0, rxjs_1.map)((subModelVisibilityStatus) => this.getElementVisibility(ignoreTooltip, viewsModel, elementStatus,
|
|
349
|
+
// Single category will always return "visible" or "hidden"
|
|
350
|
+
this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true }), subModelVisibilityStatus)));
|
|
329
351
|
});
|
|
330
352
|
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, props, result, this._props.overrides?.getElementDisplayStatus);
|
|
331
353
|
}
|
|
@@ -344,7 +366,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
344
366
|
return this.changeSubjectNodeState(node.key.instanceKeys.map((key) => key.id), on);
|
|
345
367
|
}
|
|
346
368
|
if (ModelsTreeNode_js_1.ModelsTreeNode.isModelNode(node)) {
|
|
347
|
-
return this.changeModelState({ ids: node.key.instanceKeys
|
|
369
|
+
return this.changeModelState({ ids: node.key.instanceKeys.map(({ id }) => id), on });
|
|
348
370
|
}
|
|
349
371
|
const modelId = ModelsTreeNode_js_1.ModelsTreeNode.getModelId(node);
|
|
350
372
|
if (!modelId) {
|
|
@@ -352,7 +374,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
352
374
|
}
|
|
353
375
|
if (ModelsTreeNode_js_1.ModelsTreeNode.isCategoryNode(node)) {
|
|
354
376
|
return this.changeCategoryState({
|
|
355
|
-
|
|
377
|
+
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
356
378
|
modelId,
|
|
357
379
|
on,
|
|
358
380
|
});
|
|
@@ -384,7 +406,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
384
406
|
if (categories?.size) {
|
|
385
407
|
observables.push((0, rxjs_1.from)(categories).pipe((0, rxjs_1.mergeMap)((key) => {
|
|
386
408
|
const { modelId, categoryId } = (0, FilteredTree_js_1.parseCategoryKey)(key);
|
|
387
|
-
return this.changeCategoryState({ modelId, categoryId, on });
|
|
409
|
+
return this.changeCategoryState({ modelId, categoryIds: categoryId, on });
|
|
388
410
|
})));
|
|
389
411
|
}
|
|
390
412
|
if (elements?.size) {
|
|
@@ -424,7 +446,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
424
446
|
viewport.perModelCategoryVisibility.clearOverrides(ids);
|
|
425
447
|
return (0, rxjs_1.from)(viewport.addViewedModels(ids));
|
|
426
448
|
}), idsObs.pipe((0, rxjs_1.mergeMap)((modelId) => {
|
|
427
|
-
return (0, rxjs_1.from)(this._idsCache.getModelCategories(modelId)).pipe((0, rxjs_1.
|
|
449
|
+
return (0, rxjs_1.from)(this._idsCache.getModelCategories(modelId)).pipe((0, rxjs_1.mergeMap)((categoryIds) => this.changeCategoryState({ categoryIds, modelId, on: true })));
|
|
428
450
|
})));
|
|
429
451
|
});
|
|
430
452
|
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, props, result, this._props.overrides?.changeModelState);
|
|
@@ -463,11 +485,13 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
463
485
|
changeCategoryState(props) {
|
|
464
486
|
const result = (0, rxjs_1.defer)(() => {
|
|
465
487
|
const viewport = this._props.viewport;
|
|
466
|
-
const { modelId,
|
|
488
|
+
const { modelId, categoryIds, on } = props;
|
|
467
489
|
return (0, rxjs_1.concat)(props.on && !viewport.view.viewsModel(modelId) ? this.showModelWithoutAnyCategoriesOrElements(modelId) : rxjs_1.EMPTY, (0, rxjs_1.defer)(() => {
|
|
468
|
-
|
|
490
|
+
for (const categoryId of core_bentley_1.Id64.iterable(categoryIds)) {
|
|
491
|
+
this.changeCategoryStateInViewportAccordingToModelVisibility(modelId, categoryId, on);
|
|
492
|
+
}
|
|
469
493
|
return this.clearAlwaysAndNeverDrawnElements(props);
|
|
470
|
-
}), (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(modelId,
|
|
494
|
+
}), (0, rxjs_1.from)(this._idsCache.getCategoriesModeledElements(modelId, categoryIds)).pipe((0, rxjs_1.mergeMap)((modeledElementIds) => this.changeModelState({ ids: modeledElementIds, on }))));
|
|
471
495
|
});
|
|
472
496
|
return (0, UseHierarchyVisibility_js_1.createVisibilityHandlerResult)(this, props, result, this._props.overrides?.changeCategoryState);
|
|
473
497
|
}
|
|
@@ -476,7 +500,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
476
500
|
const { modelId, categoryId, elementIds, on } = props;
|
|
477
501
|
const viewport = this._props.viewport;
|
|
478
502
|
return (0, rxjs_1.concat)(on && !viewport.view.viewsModel(modelId) ? this.showModelWithoutAnyCategoriesOrElements(modelId) : rxjs_1.EMPTY, (0, rxjs_1.defer)(() => {
|
|
479
|
-
const categoryVisibility = this.getDefaultCategoryVisibilityStatus({ categoryId, modelId, ignoreTooltip: true });
|
|
503
|
+
const categoryVisibility = this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true });
|
|
480
504
|
const isDisplayedByDefault = categoryVisibility.state === "visible";
|
|
481
505
|
return this.queueElementsVisibilityChange(elementIds, on, isDisplayedByDefault);
|
|
482
506
|
}), (0, rxjs_1.from)(elementIds).pipe((0, rxjs_1.mergeMap)(async (elementId) => ({ elementId, isSubModel: await this._idsCache.hasSubModel(elementId) })), (0, rxjs_1.filter)(({ isSubModel }) => isSubModel), (0, rxjs_1.map)(({ elementId }) => elementId), (0, rxjs_1.toArray)(), (0, rxjs_1.mergeMap)((subModelIds) => this.changeModelState({ ids: subModelIds, on }))));
|
|
@@ -598,25 +622,28 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
598
622
|
ignoreTooltip,
|
|
599
623
|
}));
|
|
600
624
|
}
|
|
601
|
-
const { modelId,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
625
|
+
const { modelId, categoryIds } = props.categoryProps;
|
|
626
|
+
return (0, rxjs_1.from)(core_bentley_1.Id64.iterable(categoryIds)).pipe((0, rxjs_1.mergeMap)((categoryId) => {
|
|
627
|
+
const totalCount = this._idsCache.getCategoryElementsCount(modelId, categoryId);
|
|
628
|
+
return (0, rxjs_1.forkJoin)({
|
|
629
|
+
totalCount,
|
|
630
|
+
alwaysDrawn: this.getAlwaysDrawnElements({ categoryIds: categoryId, modelId }),
|
|
631
|
+
neverDrawn: this.getNeverDrawnElements({ categoryIds: categoryId, modelId }),
|
|
632
|
+
}).pipe((0, rxjs_1.map)((state) => {
|
|
633
|
+
return this.getVisibilityFromAlwaysAndNeverDrawnElementsImpl({
|
|
634
|
+
...props,
|
|
635
|
+
...state,
|
|
636
|
+
defaultStatus: () => props.defaultStatus(categoryId),
|
|
637
|
+
ignoreTooltip,
|
|
638
|
+
});
|
|
639
|
+
}));
|
|
640
|
+
}), mergeVisibilityStatuses());
|
|
614
641
|
}
|
|
615
642
|
getAlwaysDrawnElements(props) {
|
|
616
|
-
return this._alwaysAndNeverDrawnElements.getElements({
|
|
643
|
+
return this._alwaysAndNeverDrawnElements.getElements({ modelId: props.modelId, categoryIds: props.categoryIds, setType: "always" });
|
|
617
644
|
}
|
|
618
645
|
getNeverDrawnElements(props) {
|
|
619
|
-
return this._alwaysAndNeverDrawnElements.getElements({
|
|
646
|
+
return this._alwaysAndNeverDrawnElements.getElements({ modelId: props.modelId, categoryIds: props.categoryIds, setType: "never" });
|
|
620
647
|
}
|
|
621
648
|
clearAlwaysAndNeverDrawnElements(props) {
|
|
622
649
|
return (0, rxjs_1.forkJoin)({
|
|
@@ -654,12 +681,12 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
654
681
|
if (modeledElementIds.length === 0) {
|
|
655
682
|
return (0, rxjs_1.of)(parentNodeVisibilityStatus);
|
|
656
683
|
}
|
|
657
|
-
return
|
|
684
|
+
return this.getModelVisibilityStatus({ modelIds: modeledElementIds }).pipe((0, rxjs_1.startWith)(parentNodeVisibilityStatus), mergeVisibilityStatuses(tooltips, ignoreTooltips));
|
|
658
685
|
}));
|
|
659
686
|
};
|
|
660
687
|
}
|
|
661
688
|
}
|
|
662
|
-
function
|
|
689
|
+
function mergeVisibilities(obs) {
|
|
663
690
|
return obs.pipe((0, Rxjs_js_1.reduceWhile)((x) => x.allVisible || x.allHidden, (acc, val) => {
|
|
664
691
|
acc.allVisible &&= val === "visible";
|
|
665
692
|
acc.allHidden &&= val === "hidden";
|
|
@@ -671,13 +698,13 @@ function getVisibilityFromTreeNodeChildren(obs) {
|
|
|
671
698
|
return x.allVisible ? "visible" : x.allHidden ? "hidden" : "partial";
|
|
672
699
|
}));
|
|
673
700
|
}
|
|
674
|
-
function
|
|
701
|
+
function mergeVisibilityStatuses(tooltipMap, ignoreTooltip) {
|
|
675
702
|
return (obs) => {
|
|
676
|
-
return
|
|
703
|
+
return obs.pipe((0, rxjs_1.map)((visibilityStatus) => visibilityStatus.state), mergeVisibilities, (0, rxjs_1.map)((visibility) => {
|
|
677
704
|
if (visibility === "empty") {
|
|
678
705
|
visibility = "visible";
|
|
679
706
|
}
|
|
680
|
-
return (0, Tooltip_js_1.createVisibilityStatus)(visibility, getTooltipOptions(tooltipMap[visibility], ignoreTooltip));
|
|
707
|
+
return (0, Tooltip_js_1.createVisibilityStatus)(visibility, getTooltipOptions(tooltipMap?.[visibility], ignoreTooltip));
|
|
681
708
|
}));
|
|
682
709
|
};
|
|
683
710
|
}
|