@itwin/tree-widget-react 3.7.0 → 3.9.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 +22 -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 +35 -31
|
@@ -70,7 +70,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
70
70
|
}
|
|
71
71
|
[Symbol.dispose]() {
|
|
72
72
|
this._eventListener.dispose();
|
|
73
|
-
this._alwaysAndNeverDrawnElements.dispose();
|
|
73
|
+
this._alwaysAndNeverDrawnElements[Symbol.dispose]();
|
|
74
74
|
this._subscriptions.forEach((x) => x.unsubscribe());
|
|
75
75
|
}
|
|
76
76
|
getVisibilityStatusObs(node) {
|
|
@@ -88,7 +88,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
88
88
|
return this.getSubjectNodeVisibilityStatus({ subjectIds: node.key.instanceKeys.map((key) => key.id) });
|
|
89
89
|
}
|
|
90
90
|
if (ModelsTreeNode.isModelNode(node)) {
|
|
91
|
-
return this.getModelVisibilityStatus({
|
|
91
|
+
return this.getModelVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id) });
|
|
92
92
|
}
|
|
93
93
|
const modelId = ModelsTreeNode.getModelId(node);
|
|
94
94
|
if (!modelId) {
|
|
@@ -96,7 +96,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
96
96
|
}
|
|
97
97
|
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
98
98
|
return this.getCategoryDisplayStatus({
|
|
99
|
-
|
|
99
|
+
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
100
100
|
modelId,
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -117,12 +117,12 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
117
117
|
observables.push(this.getSubjectNodeVisibilityStatus({ subjectIds: [...subjects], ignoreTooltip: true }));
|
|
118
118
|
}
|
|
119
119
|
if (models?.size) {
|
|
120
|
-
observables.push(
|
|
120
|
+
observables.push(this.getModelVisibilityStatus({ modelIds: models, ignoreTooltip: true }));
|
|
121
121
|
}
|
|
122
122
|
if (categories?.size) {
|
|
123
123
|
observables.push(from(categories).pipe(mergeMap((key) => {
|
|
124
124
|
const { modelId, categoryId } = parseCategoryKey(key);
|
|
125
|
-
return this.getCategoryDisplayStatus({ modelId, categoryId, ignoreTooltip: true });
|
|
125
|
+
return this.getCategoryDisplayStatus({ modelId, categoryIds: categoryId, ignoreTooltip: true });
|
|
126
126
|
})));
|
|
127
127
|
}
|
|
128
128
|
if (elements?.size) {
|
|
@@ -132,17 +132,14 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
132
132
|
})));
|
|
133
133
|
}
|
|
134
134
|
return merge(...observables);
|
|
135
|
-
}),
|
|
136
|
-
assert(x !== "empty");
|
|
137
|
-
return createVisibilityStatus(x);
|
|
138
|
-
}));
|
|
135
|
+
}), mergeVisibilityStatuses());
|
|
139
136
|
}
|
|
140
137
|
getSubjectNodeVisibilityStatus({ subjectIds, ignoreTooltip }) {
|
|
141
138
|
const result = defer(() => {
|
|
142
139
|
if (!this._props.viewport.view.isSpatialView()) {
|
|
143
140
|
return of(createVisibilityStatus("disabled", getTooltipOptions("modelsTree.subject.nonSpatialView", ignoreTooltip)));
|
|
144
141
|
}
|
|
145
|
-
return from(this._idsCache.getSubjectModelIds(subjectIds)).pipe(
|
|
142
|
+
return from(this._idsCache.getSubjectModelIds(subjectIds)).pipe(mergeMap((modelIds) => this.getModelVisibilityStatus({ modelIds, ignoreTooltip: true })), mergeVisibilityStatuses({
|
|
146
143
|
visible: "modelsTree.subject.allModelsVisible",
|
|
147
144
|
hidden: "modelsTree.subject.allModelsHidden",
|
|
148
145
|
partial: "modelsTree.subject.someModelsHidden",
|
|
@@ -150,47 +147,68 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
150
147
|
});
|
|
151
148
|
return createVisibilityHandlerResult(this, { ids: subjectIds }, result, this._props.overrides?.getSubjectNodeVisibility);
|
|
152
149
|
}
|
|
153
|
-
getModelVisibilityStatus({
|
|
150
|
+
getModelVisibilityStatus({ modelIds, ignoreTooltip }) {
|
|
154
151
|
const result = defer(() => {
|
|
155
152
|
const viewport = this._props.viewport;
|
|
156
153
|
if (!viewport.view.isSpatialView()) {
|
|
157
154
|
return of(createVisibilityStatus("disabled", getTooltipOptions("modelsTree.model.nonSpatialView", ignoreTooltip)));
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
return from(modelIds).pipe(distinct(), mergeMap((modelId) => {
|
|
157
|
+
if (!viewport.view.viewsModel(modelId)) {
|
|
158
|
+
return from(this._idsCache.getModelCategories(modelId)).pipe(mergeMap((categoryIds) => from(this._idsCache.getCategoriesModeledElements(modelId, categoryIds))), this.getSubModeledElementsVisibilityStatus({
|
|
159
|
+
ignoreTooltips: ignoreTooltip,
|
|
160
|
+
haveSubModel: "yes",
|
|
161
|
+
tooltips: { visible: undefined, hidden: "modelsTree.model.hiddenThroughModelSelector", partial: "modelsTree.model.someSubModelsVisible" },
|
|
162
|
+
parentNodeVisibilityStatus: createVisibilityStatus("hidden"),
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
return from(this._idsCache.getModelCategories(modelId)).pipe(mergeMap((categoryIds) => categoryIds.length === 0 ? of(createVisibilityStatus("visible")) : this.getCategoryDisplayStatus({ modelId, categoryIds, ignoreTooltip: true })), mergeVisibilityStatuses({
|
|
166
|
+
visible: "modelsTree.model.allCategoriesVisible",
|
|
167
|
+
partial: "modelsTree.model.someCategoriesHidden",
|
|
168
|
+
hidden: "modelsTree.model.allCategoriesHidden",
|
|
165
169
|
}));
|
|
166
|
-
}
|
|
167
|
-
return from(this._idsCache.getModelCategories(modelId)).pipe(concatAll(), mergeMap((categoryId) => this.getCategoryDisplayStatus({ modelId, categoryId, ignoreTooltip: true })), map((x) => x.state), getVisibilityFromTreeNodeChildren, map((visibilityByCategories) => {
|
|
168
|
-
const state = visibilityByCategories === "empty" ? "visible" : visibilityByCategories;
|
|
169
|
-
return createVisibilityStatus(state, getTooltipOptions(state === "partial" ? "modelsTree.model.someCategoriesHidden" : `modelsTree.model.allCategories${state ? "Visible" : "Hidden"}`, ignoreTooltip));
|
|
170
|
-
}));
|
|
170
|
+
}), mergeVisibilityStatuses());
|
|
171
171
|
});
|
|
172
|
-
return createVisibilityHandlerResult(this, {
|
|
172
|
+
return createVisibilityHandlerResult(this, { ids: modelIds }, result, this._props.overrides?.getModelDisplayStatus);
|
|
173
173
|
}
|
|
174
|
-
getDefaultCategoryVisibilityStatus({ modelId,
|
|
174
|
+
getDefaultCategoryVisibilityStatus({ modelId, categoryIds, ignoreTooltip, }) {
|
|
175
175
|
const viewport = this._props.viewport;
|
|
176
|
-
if (!viewport.view.viewsModel(modelId)) {
|
|
176
|
+
if (!viewport.view.viewsModel(modelId) || Id64.sizeOf(categoryIds) === 0) {
|
|
177
177
|
return createVisibilityStatus("hidden", getTooltipOptions("modelsTree.category.hiddenThroughModel", ignoreTooltip));
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
let visibility = "unknown";
|
|
180
|
+
for (const categoryId of Id64.iterable(categoryIds)) {
|
|
181
|
+
const override = this._props.viewport.perModelCategoryVisibility.getOverride(modelId, categoryId);
|
|
182
|
+
if (override === PerModelCategoryVisibility.Override.Show) {
|
|
183
|
+
if (visibility === "hidden") {
|
|
184
|
+
return createVisibilityStatus("partial");
|
|
185
|
+
}
|
|
186
|
+
visibility = "visible";
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (override === PerModelCategoryVisibility.Override.Hide) {
|
|
190
|
+
if (visibility === "visible") {
|
|
191
|
+
return createVisibilityStatus("partial");
|
|
192
|
+
}
|
|
193
|
+
visibility = "hidden";
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const isVisible = viewport.view.viewsCategory(categoryId);
|
|
197
|
+
if (isVisible && visibility === "hidden") {
|
|
198
|
+
return createVisibilityStatus("partial");
|
|
199
|
+
}
|
|
200
|
+
if (!isVisible && visibility === "visible") {
|
|
201
|
+
return createVisibilityStatus("partial");
|
|
202
|
+
}
|
|
203
|
+
visibility = isVisible ? "visible" : "hidden";
|
|
184
204
|
}
|
|
185
|
-
|
|
186
|
-
return
|
|
187
|
-
? createVisibilityStatus("visible", getTooltipOptions("modelsTree.category.displayedThroughCategorySelector", ignoreTooltip))
|
|
188
|
-
: createVisibilityStatus("hidden", getTooltipOptions("modelsTree.category.hiddenThroughCategorySelector", ignoreTooltip));
|
|
205
|
+
assert(visibility !== "unknown");
|
|
206
|
+
return createVisibilityStatus(visibility);
|
|
189
207
|
}
|
|
190
208
|
getCategoryDisplayStatus({ ignoreTooltip, ...props }) {
|
|
191
209
|
const result = defer(() => {
|
|
192
210
|
if (!this._props.viewport.view.viewsModel(props.modelId)) {
|
|
193
|
-
return from(this._idsCache.getCategoriesModeledElements(props.modelId,
|
|
211
|
+
return from(this._idsCache.getCategoriesModeledElements(props.modelId, props.categoryIds)).pipe(this.getSubModeledElementsVisibilityStatus({
|
|
194
212
|
ignoreTooltips: ignoreTooltip,
|
|
195
213
|
parentNodeVisibilityStatus: createVisibilityStatus("hidden"),
|
|
196
214
|
tooltips: {
|
|
@@ -202,17 +220,19 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
202
220
|
}));
|
|
203
221
|
}
|
|
204
222
|
return this.getVisibilityFromAlwaysAndNeverDrawnElements({
|
|
205
|
-
|
|
223
|
+
categoryProps: { categoryIds: props.categoryIds, modelId: props.modelId },
|
|
206
224
|
tooltips: {
|
|
207
225
|
allElementsInAlwaysDrawnList: "modelsTree.category.allElementsVisible",
|
|
208
226
|
allElementsInNeverDrawnList: "modelsTree.category.allElementsHidden",
|
|
209
227
|
elementsInBothAlwaysAndNeverDrawn: "modelsTree.category.someElementsAreHidden",
|
|
210
228
|
noElementsInExclusiveAlwaysDrawnList: "modelsTree.category.allElementsHidden",
|
|
211
229
|
},
|
|
212
|
-
defaultStatus: () =>
|
|
230
|
+
defaultStatus: (categoryId) => categoryId
|
|
231
|
+
? this.getDefaultCategoryVisibilityStatus({ modelId: props.modelId, categoryIds: categoryId })
|
|
232
|
+
: this.getDefaultCategoryVisibilityStatus({ modelId: props.modelId, categoryIds: props.categoryIds }),
|
|
213
233
|
ignoreTooltip,
|
|
214
234
|
}).pipe(mergeMap((visibilityStatusAlwaysAndNeverDraw) => {
|
|
215
|
-
return from(this._idsCache.getCategoriesModeledElements(props.modelId,
|
|
235
|
+
return from(this._idsCache.getCategoriesModeledElements(props.modelId, props.categoryIds)).pipe(this.getSubModeledElementsVisibilityStatus({
|
|
216
236
|
tooltips: {
|
|
217
237
|
visible: undefined,
|
|
218
238
|
hidden: "modelsTree.category.allElementsAndSubModelsHidden",
|
|
@@ -244,7 +264,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
244
264
|
return this.getVisibilityFromAlwaysAndNeverDrawnElements({
|
|
245
265
|
elements: elementIds,
|
|
246
266
|
defaultStatus: () => {
|
|
247
|
-
const status = this.getDefaultCategoryVisibilityStatus({ categoryId, modelId, ignoreTooltip: true });
|
|
267
|
+
const status = this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true });
|
|
248
268
|
return createVisibilityStatus(status.state, getTooltipOptions(`modelsTree.groupingNode.${status.state}ThroughCategory`));
|
|
249
269
|
},
|
|
250
270
|
tooltips: {
|
|
@@ -321,7 +341,9 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
321
341
|
const { elementId, modelId, categoryId } = props;
|
|
322
342
|
const viewsModel = viewport.view.viewsModel(modelId);
|
|
323
343
|
const elementStatus = this.getElementOverriddenVisibility(elementId, ignoreTooltip);
|
|
324
|
-
return from(this._idsCache.hasSubModel(elementId)).pipe(mergeMap((hasSubModel) => (hasSubModel ? this.getModelVisibilityStatus({
|
|
344
|
+
return from(this._idsCache.hasSubModel(elementId)).pipe(mergeMap((hasSubModel) => (hasSubModel ? this.getModelVisibilityStatus({ modelIds: [elementId] }) : of(undefined))), map((subModelVisibilityStatus) => this.getElementVisibility(ignoreTooltip, viewsModel, elementStatus,
|
|
345
|
+
// Single category will always return "visible" or "hidden"
|
|
346
|
+
this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true }), subModelVisibilityStatus)));
|
|
325
347
|
});
|
|
326
348
|
return createVisibilityHandlerResult(this, props, result, this._props.overrides?.getElementDisplayStatus);
|
|
327
349
|
}
|
|
@@ -340,7 +362,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
340
362
|
return this.changeSubjectNodeState(node.key.instanceKeys.map((key) => key.id), on);
|
|
341
363
|
}
|
|
342
364
|
if (ModelsTreeNode.isModelNode(node)) {
|
|
343
|
-
return this.changeModelState({ ids: node.key.instanceKeys
|
|
365
|
+
return this.changeModelState({ ids: node.key.instanceKeys.map(({ id }) => id), on });
|
|
344
366
|
}
|
|
345
367
|
const modelId = ModelsTreeNode.getModelId(node);
|
|
346
368
|
if (!modelId) {
|
|
@@ -348,7 +370,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
348
370
|
}
|
|
349
371
|
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
350
372
|
return this.changeCategoryState({
|
|
351
|
-
|
|
373
|
+
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
352
374
|
modelId,
|
|
353
375
|
on,
|
|
354
376
|
});
|
|
@@ -380,7 +402,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
380
402
|
if (categories?.size) {
|
|
381
403
|
observables.push(from(categories).pipe(mergeMap((key) => {
|
|
382
404
|
const { modelId, categoryId } = parseCategoryKey(key);
|
|
383
|
-
return this.changeCategoryState({ modelId, categoryId, on });
|
|
405
|
+
return this.changeCategoryState({ modelId, categoryIds: categoryId, on });
|
|
384
406
|
})));
|
|
385
407
|
}
|
|
386
408
|
if (elements?.size) {
|
|
@@ -420,7 +442,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
420
442
|
viewport.perModelCategoryVisibility.clearOverrides(ids);
|
|
421
443
|
return from(viewport.addViewedModels(ids));
|
|
422
444
|
}), idsObs.pipe(mergeMap((modelId) => {
|
|
423
|
-
return from(this._idsCache.getModelCategories(modelId)).pipe(
|
|
445
|
+
return from(this._idsCache.getModelCategories(modelId)).pipe(mergeMap((categoryIds) => this.changeCategoryState({ categoryIds, modelId, on: true })));
|
|
424
446
|
})));
|
|
425
447
|
});
|
|
426
448
|
return createVisibilityHandlerResult(this, props, result, this._props.overrides?.changeModelState);
|
|
@@ -459,11 +481,13 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
459
481
|
changeCategoryState(props) {
|
|
460
482
|
const result = defer(() => {
|
|
461
483
|
const viewport = this._props.viewport;
|
|
462
|
-
const { modelId,
|
|
484
|
+
const { modelId, categoryIds, on } = props;
|
|
463
485
|
return concat(props.on && !viewport.view.viewsModel(modelId) ? this.showModelWithoutAnyCategoriesOrElements(modelId) : EMPTY, defer(() => {
|
|
464
|
-
|
|
486
|
+
for (const categoryId of Id64.iterable(categoryIds)) {
|
|
487
|
+
this.changeCategoryStateInViewportAccordingToModelVisibility(modelId, categoryId, on);
|
|
488
|
+
}
|
|
465
489
|
return this.clearAlwaysAndNeverDrawnElements(props);
|
|
466
|
-
}), from(this._idsCache.getCategoriesModeledElements(modelId,
|
|
490
|
+
}), from(this._idsCache.getCategoriesModeledElements(modelId, categoryIds)).pipe(mergeMap((modeledElementIds) => this.changeModelState({ ids: modeledElementIds, on }))));
|
|
467
491
|
});
|
|
468
492
|
return createVisibilityHandlerResult(this, props, result, this._props.overrides?.changeCategoryState);
|
|
469
493
|
}
|
|
@@ -472,7 +496,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
472
496
|
const { modelId, categoryId, elementIds, on } = props;
|
|
473
497
|
const viewport = this._props.viewport;
|
|
474
498
|
return concat(on && !viewport.view.viewsModel(modelId) ? this.showModelWithoutAnyCategoriesOrElements(modelId) : EMPTY, defer(() => {
|
|
475
|
-
const categoryVisibility = this.getDefaultCategoryVisibilityStatus({ categoryId, modelId, ignoreTooltip: true });
|
|
499
|
+
const categoryVisibility = this.getDefaultCategoryVisibilityStatus({ categoryIds: categoryId, modelId, ignoreTooltip: true });
|
|
476
500
|
const isDisplayedByDefault = categoryVisibility.state === "visible";
|
|
477
501
|
return this.queueElementsVisibilityChange(elementIds, on, isDisplayedByDefault);
|
|
478
502
|
}), from(elementIds).pipe(mergeMap(async (elementId) => ({ elementId, isSubModel: await this._idsCache.hasSubModel(elementId) })), filter(({ isSubModel }) => isSubModel), map(({ elementId }) => elementId), toArray(), mergeMap((subModelIds) => this.changeModelState({ ids: subModelIds, on }))));
|
|
@@ -594,25 +618,28 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
594
618
|
ignoreTooltip,
|
|
595
619
|
}));
|
|
596
620
|
}
|
|
597
|
-
const { modelId,
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
621
|
+
const { modelId, categoryIds } = props.categoryProps;
|
|
622
|
+
return from(Id64.iterable(categoryIds)).pipe(mergeMap((categoryId) => {
|
|
623
|
+
const totalCount = this._idsCache.getCategoryElementsCount(modelId, categoryId);
|
|
624
|
+
return forkJoin({
|
|
625
|
+
totalCount,
|
|
626
|
+
alwaysDrawn: this.getAlwaysDrawnElements({ categoryIds: categoryId, modelId }),
|
|
627
|
+
neverDrawn: this.getNeverDrawnElements({ categoryIds: categoryId, modelId }),
|
|
628
|
+
}).pipe(map((state) => {
|
|
629
|
+
return this.getVisibilityFromAlwaysAndNeverDrawnElementsImpl({
|
|
630
|
+
...props,
|
|
631
|
+
...state,
|
|
632
|
+
defaultStatus: () => props.defaultStatus(categoryId),
|
|
633
|
+
ignoreTooltip,
|
|
634
|
+
});
|
|
635
|
+
}));
|
|
636
|
+
}), mergeVisibilityStatuses());
|
|
610
637
|
}
|
|
611
638
|
getAlwaysDrawnElements(props) {
|
|
612
|
-
return this._alwaysAndNeverDrawnElements.getElements({
|
|
639
|
+
return this._alwaysAndNeverDrawnElements.getElements({ modelId: props.modelId, categoryIds: props.categoryIds, setType: "always" });
|
|
613
640
|
}
|
|
614
641
|
getNeverDrawnElements(props) {
|
|
615
|
-
return this._alwaysAndNeverDrawnElements.getElements({
|
|
642
|
+
return this._alwaysAndNeverDrawnElements.getElements({ modelId: props.modelId, categoryIds: props.categoryIds, setType: "never" });
|
|
616
643
|
}
|
|
617
644
|
clearAlwaysAndNeverDrawnElements(props) {
|
|
618
645
|
return forkJoin({
|
|
@@ -650,12 +677,12 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
650
677
|
if (modeledElementIds.length === 0) {
|
|
651
678
|
return of(parentNodeVisibilityStatus);
|
|
652
679
|
}
|
|
653
|
-
return
|
|
680
|
+
return this.getModelVisibilityStatus({ modelIds: modeledElementIds }).pipe(startWith(parentNodeVisibilityStatus), mergeVisibilityStatuses(tooltips, ignoreTooltips));
|
|
654
681
|
}));
|
|
655
682
|
};
|
|
656
683
|
}
|
|
657
684
|
}
|
|
658
|
-
function
|
|
685
|
+
function mergeVisibilities(obs) {
|
|
659
686
|
return obs.pipe(reduceWhile((x) => x.allVisible || x.allHidden, (acc, val) => {
|
|
660
687
|
acc.allVisible &&= val === "visible";
|
|
661
688
|
acc.allHidden &&= val === "hidden";
|
|
@@ -667,13 +694,13 @@ function getVisibilityFromTreeNodeChildren(obs) {
|
|
|
667
694
|
return x.allVisible ? "visible" : x.allHidden ? "hidden" : "partial";
|
|
668
695
|
}));
|
|
669
696
|
}
|
|
670
|
-
function
|
|
697
|
+
function mergeVisibilityStatuses(tooltipMap, ignoreTooltip) {
|
|
671
698
|
return (obs) => {
|
|
672
|
-
return
|
|
699
|
+
return obs.pipe(map((visibilityStatus) => visibilityStatus.state), mergeVisibilities, map((visibility) => {
|
|
673
700
|
if (visibility === "empty") {
|
|
674
701
|
visibility = "visible";
|
|
675
702
|
}
|
|
676
|
-
return createVisibilityStatus(visibility, getTooltipOptions(tooltipMap[visibility], ignoreTooltip));
|
|
703
|
+
return createVisibilityStatus(visibility, getTooltipOptions(tooltipMap?.[visibility], ignoreTooltip));
|
|
677
704
|
}));
|
|
678
705
|
};
|
|
679
706
|
}
|