@itwin/tree-widget-react 4.0.0-alpha.6 → 4.0.0-alpha.7
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 -1
- package/README.md +2 -1
- package/lib/esm/tree-widget-react/TreeWidget.js +1 -1
- package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +2 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +50 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +17 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +561 -161
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +6 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +115 -40
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +30 -15
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +192 -38
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +18 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +30 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.d.ts +24 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js +785 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.d.ts +39 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js +221 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +5 -17
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +5 -62
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +4 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +33 -23
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +60 -47
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +3 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.d.ts +44 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/AlwaysAndNeverDrawnElementInfo.js +81 -31
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.d.ts +33 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +37 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.d.ts +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +72 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.d.ts → internal/Rxjs.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.js → internal/Rxjs.js} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/Rxjs.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts} +5 -1
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.js → internal/Tooltip.js} +7 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +14 -0
- package/lib/esm/tree-widget-react/components/trees/{categories-tree/internal/ClassNameDefinitions.js → common/internal/Types.js} +2 -7
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.js → internal/UseHierarchiesLocalization.js} +6 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.d.ts → internal/UseHierarchyFiltering.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +4 -3
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.d.ts → internal/UseIModelChangeListener.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.js → internal/UseIModelChangeListener.js} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +101 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/VisibilityChangeEventListener.js +17 -9
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +82 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +234 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +3 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +13 -9
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +13 -0
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +39 -38
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +5 -5
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +25 -24
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +9 -5
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +1 -1
- 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/ModelsTreeDefinition.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +73 -70
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +47 -29
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +7 -9
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +4 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +4 -5
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +54 -104
- 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 +0 -26
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +75 -291
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +51 -6
- package/package.json +17 -18
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +0 -37
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +0 -214
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +0 -21
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.d.ts → internal/UseActiveViewport.d.ts} +0 -0
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.js → internal/UseActiveViewport.js} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { filter, from, map, mergeAll, mergeMap, of, reduce, startWith, toArray } from "rxjs";
|
|
6
|
+
import { QueryRowFormat } from "@itwin/core-common";
|
|
7
|
+
import { PerModelCategoryVisibility } from "@itwin/core-frontend";
|
|
8
|
+
import { reduceWhile } from "./Rxjs.js";
|
|
9
|
+
import { createVisibilityStatus, getTooltipOptions } from "./Tooltip.js";
|
|
10
|
+
import { getClassesByView, releaseMainThreadOnItemsCount } from "./Utils.js";
|
|
11
|
+
function mergeVisibilities(obs) {
|
|
12
|
+
return obs.pipe(reduceWhile((x) => x.allVisible || x.allHidden, (acc, val) => {
|
|
13
|
+
acc.allVisible &&= val === "visible";
|
|
14
|
+
acc.allHidden &&= val === "hidden";
|
|
15
|
+
return acc;
|
|
16
|
+
}, { allVisible: true, allHidden: true }), map((x) => {
|
|
17
|
+
if (!x) {
|
|
18
|
+
return "empty";
|
|
19
|
+
}
|
|
20
|
+
return x.allVisible ? "visible" : x.allHidden ? "hidden" : "partial";
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
export function mergeVisibilityStatuses(tooltipMap, ignoreTooltip) {
|
|
25
|
+
return (obs) => {
|
|
26
|
+
return obs.pipe(map((visibilityStatus) => visibilityStatus.state), mergeVisibilities, map((visibility) => {
|
|
27
|
+
if (visibility === "empty") {
|
|
28
|
+
visibility = "visible";
|
|
29
|
+
}
|
|
30
|
+
return createVisibilityStatus(visibility, getTooltipOptions(tooltipMap[visibility], ignoreTooltip));
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** @internal */
|
|
35
|
+
export function getSubModeledElementsVisibilityStatus({ parentNodeVisibilityStatus, tooltips, ignoreTooltips, getModelVisibilityStatus, }) {
|
|
36
|
+
return (obs) => {
|
|
37
|
+
return obs.pipe(
|
|
38
|
+
// combine visibility status of sub-models with visibility status of parent node
|
|
39
|
+
mergeMap((modeledElementIds) => {
|
|
40
|
+
if (modeledElementIds.length === 0) {
|
|
41
|
+
return of(parentNodeVisibilityStatus);
|
|
42
|
+
}
|
|
43
|
+
return from(modeledElementIds).pipe(mergeMap((modeledElementId) => getModelVisibilityStatus({ modelId: modeledElementId })), startWith(parentNodeVisibilityStatus), mergeVisibilityStatuses(tooltips, ignoreTooltips));
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
48
|
+
export function filterSubModeledElementIds({ doesSubModelExist, }) {
|
|
49
|
+
return (obs) => {
|
|
50
|
+
return obs.pipe(mergeAll(), mergeMap(async (elementId) => ({ elementId, hasSubModel: await doesSubModelExist(elementId) })), filter(({ hasSubModel }) => hasSubModel), map(({ elementId }) => elementId), toArray());
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** @internal */
|
|
54
|
+
export function changeElementStateNoChildrenOperator(props) {
|
|
55
|
+
return (elementIds) => {
|
|
56
|
+
const { on, isDisplayedByDefault } = props;
|
|
57
|
+
const isAlwaysDrawnExclusive = props.viewport.isAlwaysDrawnExclusive;
|
|
58
|
+
return elementIds.pipe(releaseMainThreadOnItemsCount(500), reduce((acc, elementId) => {
|
|
59
|
+
if (acc.alwaysDrawn === undefined || acc.neverDrawn === undefined) {
|
|
60
|
+
acc.alwaysDrawn = new Set(props.viewport.alwaysDrawn || []);
|
|
61
|
+
acc.neverDrawn = new Set(props.viewport.neverDrawn || []);
|
|
62
|
+
}
|
|
63
|
+
if (on) {
|
|
64
|
+
const wasRemoved = acc.neverDrawn.delete(elementId);
|
|
65
|
+
acc.changedNeverDrawn ||= wasRemoved;
|
|
66
|
+
// If exclusive mode is enabled, we must add the element to the always drawn list.
|
|
67
|
+
if ((!isDisplayedByDefault || isAlwaysDrawnExclusive) && !acc.alwaysDrawn.has(elementId)) {
|
|
68
|
+
acc.alwaysDrawn.add(elementId);
|
|
69
|
+
acc.changedAlwaysDrawn = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const wasRemoved = acc.alwaysDrawn.delete(elementId);
|
|
74
|
+
acc.changedAlwaysDrawn ||= wasRemoved;
|
|
75
|
+
// If exclusive mode is not enabled, we have to add the element to the never drawn list.
|
|
76
|
+
if (isDisplayedByDefault && !isAlwaysDrawnExclusive && !acc.neverDrawn.has(elementId)) {
|
|
77
|
+
acc.neverDrawn.add(elementId);
|
|
78
|
+
acc.changedNeverDrawn = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return acc;
|
|
82
|
+
}, {
|
|
83
|
+
changedNeverDrawn: false,
|
|
84
|
+
changedAlwaysDrawn: false,
|
|
85
|
+
neverDrawn: undefined,
|
|
86
|
+
alwaysDrawn: undefined,
|
|
87
|
+
}), map((state) => {
|
|
88
|
+
state.changedNeverDrawn && state.neverDrawn && props.viewport.setNeverDrawn(state.neverDrawn);
|
|
89
|
+
state.changedAlwaysDrawn && state.alwaysDrawn && props.viewport.setAlwaysDrawn(state.alwaysDrawn, props.viewport.isAlwaysDrawnExclusive);
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** @internal */
|
|
94
|
+
export function getVisibilityFromAlwaysAndNeverDrawnElementsImpl(props) {
|
|
95
|
+
const { alwaysDrawn, neverDrawn, totalCount, ignoreTooltip } = props;
|
|
96
|
+
if (neverDrawn?.size === totalCount) {
|
|
97
|
+
return createVisibilityStatus("hidden", getTooltipOptions(props.tooltips.allElementsInNeverDrawnList, ignoreTooltip));
|
|
98
|
+
}
|
|
99
|
+
if (alwaysDrawn?.size === totalCount) {
|
|
100
|
+
return createVisibilityStatus("visible", getTooltipOptions(props.tooltips.allElementsInAlwaysDrawnList, ignoreTooltip));
|
|
101
|
+
}
|
|
102
|
+
const viewport = props.viewport;
|
|
103
|
+
if (viewport.isAlwaysDrawnExclusive && viewport.alwaysDrawn?.size) {
|
|
104
|
+
return alwaysDrawn?.size
|
|
105
|
+
? createVisibilityStatus("partial", getTooltipOptions(props.tooltips.elementsInBothAlwaysAndNeverDrawn, ignoreTooltip))
|
|
106
|
+
: createVisibilityStatus("hidden", getTooltipOptions(props.tooltips.noElementsInExclusiveAlwaysDrawnList, ignoreTooltip));
|
|
107
|
+
}
|
|
108
|
+
const status = props.defaultStatus();
|
|
109
|
+
if ((status.state === "visible" && neverDrawn?.size) || (status.state === "hidden" && alwaysDrawn?.size)) {
|
|
110
|
+
return createVisibilityStatus("partial", getTooltipOptions(undefined, ignoreTooltip));
|
|
111
|
+
}
|
|
112
|
+
return status;
|
|
113
|
+
}
|
|
114
|
+
/** @internal */
|
|
115
|
+
export function getElementOverriddenVisibility(props) {
|
|
116
|
+
const { ignoreTooltip, viewport, elementId, tooltips } = props;
|
|
117
|
+
if (viewport.neverDrawn?.has(elementId)) {
|
|
118
|
+
return createVisibilityStatus("hidden", getTooltipOptions(tooltips.hiddenThroughNeverDrawn, ignoreTooltip));
|
|
119
|
+
}
|
|
120
|
+
if (viewport.alwaysDrawn?.size) {
|
|
121
|
+
if (viewport.alwaysDrawn.has(elementId)) {
|
|
122
|
+
return createVisibilityStatus("visible", getTooltipOptions(tooltips.visibileThorughAlwaysDrawn, ignoreTooltip));
|
|
123
|
+
}
|
|
124
|
+
if (viewport.isAlwaysDrawnExclusive) {
|
|
125
|
+
return createVisibilityStatus("hidden", getTooltipOptions(tooltips.hiddenThroughAlwaysDrawnExclusive, ignoreTooltip));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
/** @internal */
|
|
131
|
+
export function getElementVisibility(ignoreTooltip, viewsModel, overridenVisibility, categoryVisibility, treeType, subModelVisibilityStatus) {
|
|
132
|
+
if (subModelVisibilityStatus === undefined) {
|
|
133
|
+
if (!viewsModel) {
|
|
134
|
+
return createVisibilityStatus("hidden", getTooltipOptions(`${treeType}.element.hiddenThroughModel`, ignoreTooltip));
|
|
135
|
+
}
|
|
136
|
+
if (overridenVisibility) {
|
|
137
|
+
return overridenVisibility;
|
|
138
|
+
}
|
|
139
|
+
return createVisibilityStatus(categoryVisibility.state, getTooltipOptions(categoryVisibility.state === "visible" ? undefined : `${treeType}.element.hiddenThroughCategory`, ignoreTooltip));
|
|
140
|
+
}
|
|
141
|
+
if (subModelVisibilityStatus.state === "partial") {
|
|
142
|
+
return createVisibilityStatus("partial", getTooltipOptions(`${treeType}.element.someElementsAreHidden`, ignoreTooltip));
|
|
143
|
+
}
|
|
144
|
+
if (subModelVisibilityStatus.state === "visible") {
|
|
145
|
+
if (!viewsModel || overridenVisibility?.state === "hidden" || (categoryVisibility.state === "hidden" && !overridenVisibility)) {
|
|
146
|
+
return createVisibilityStatus("partial", getTooltipOptions(`${treeType}.element.partialThroughSubModel`, ignoreTooltip));
|
|
147
|
+
}
|
|
148
|
+
return createVisibilityStatus("visible", getTooltipOptions(undefined, ignoreTooltip));
|
|
149
|
+
}
|
|
150
|
+
if (!viewsModel) {
|
|
151
|
+
return createVisibilityStatus("hidden", getTooltipOptions(`${treeType}.element.hiddenThroughModel`, ignoreTooltip));
|
|
152
|
+
}
|
|
153
|
+
if (overridenVisibility) {
|
|
154
|
+
if (overridenVisibility.state === "hidden") {
|
|
155
|
+
return overridenVisibility;
|
|
156
|
+
}
|
|
157
|
+
return createVisibilityStatus("partial", getTooltipOptions(`${treeType}.element.partialThroughElement`, ignoreTooltip));
|
|
158
|
+
}
|
|
159
|
+
if (categoryVisibility.state === "visible") {
|
|
160
|
+
return createVisibilityStatus("partial", getTooltipOptions(`${treeType}.element.partialThroughCategory`, ignoreTooltip));
|
|
161
|
+
}
|
|
162
|
+
return createVisibilityStatus("hidden", getTooltipOptions(`${treeType}.element.hiddenThroughCategory`, ignoreTooltip));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Toggles visibility of categories to show or hide.
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
export async function toggleAllCategories(viewport, display) {
|
|
169
|
+
const categoryIds = await getCategoryIds(viewport);
|
|
170
|
+
if (categoryIds.length === 0) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
await enableCategoryDisplay(viewport, categoryIds, display);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Gets ids of all categories from specified imodel and viewport.
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
async function getCategoryIds(viewport) {
|
|
180
|
+
const categories = await loadCategoriesFromViewport(viewport);
|
|
181
|
+
return categories.map((category) => category.categoryId);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Changes category display in the viewport.
|
|
185
|
+
* @internal
|
|
186
|
+
*/
|
|
187
|
+
export async function enableCategoryDisplay(viewport, categoryIds, enabled, enableAllSubCategories = true) {
|
|
188
|
+
viewport.changeCategoryDisplay(categoryIds, enabled, enableAllSubCategories);
|
|
189
|
+
// remove category overrides per model
|
|
190
|
+
const modelsContainingOverrides = new Array();
|
|
191
|
+
for (const ovr of viewport.perModelCategoryVisibility) {
|
|
192
|
+
if (categoryIds.findIndex((id) => id === ovr.categoryId) !== -1) {
|
|
193
|
+
modelsContainingOverrides.push(ovr.modelId);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, categoryIds, PerModelCategoryVisibility.Override.None);
|
|
197
|
+
// changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.
|
|
198
|
+
if (false === enabled) {
|
|
199
|
+
(await viewport.iModel.categories.getCategoryInfo(categoryIds)).forEach((categoryInfo) => {
|
|
200
|
+
categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Changes subcategory display in the viewport
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
export function enableSubCategoryDisplay(viewport, subCategoryId, enabled) {
|
|
209
|
+
viewport.changeSubCategoryDisplay(subCategoryId, enabled);
|
|
210
|
+
}
|
|
211
|
+
/** @internal */
|
|
212
|
+
export async function loadCategoriesFromViewport(vp) {
|
|
213
|
+
// Query categories and add them to state
|
|
214
|
+
const { categoryClass, elementClass } = getClassesByView(vp.view.is3d() ? "3d" : "2d");
|
|
215
|
+
const ecsql = `
|
|
216
|
+
SELECT ECInstanceId as id
|
|
217
|
+
FROM ${categoryClass}
|
|
218
|
+
WHERE
|
|
219
|
+
ECInstanceId IN (
|
|
220
|
+
SELECT DISTINCT Category.Id
|
|
221
|
+
FROM ${elementClass}
|
|
222
|
+
WHERE
|
|
223
|
+
Category.Id IN (SELECT ECInstanceId FROM ${categoryClass})
|
|
224
|
+
${vp.view.is3d() ? "" : "AND Model.Id=?"}
|
|
225
|
+
)
|
|
226
|
+
`;
|
|
227
|
+
const categories = [];
|
|
228
|
+
const rows = await vp.iModel.createQueryReader(ecsql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();
|
|
229
|
+
(await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {
|
|
230
|
+
categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });
|
|
231
|
+
});
|
|
232
|
+
return categories;
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=VisibilityUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibilityUtils.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/VisibilityUtils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAU7E,SAAS,iBAAiB,CAAC,GAA2B;IACpD,OAAO,GAAG,CAAC,IAAI,CACb,WAAW,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,EAClC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACX,GAAG,CAAC,UAAU,KAAK,GAAG,KAAK,SAAS,CAAC;QACrC,GAAG,CAAC,SAAS,KAAK,GAAG,KAAK,QAAQ,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,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M,CAAC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7H,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACtF,UAAU,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IAC9H,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { filter, from, map, mergeAll, mergeMap, of, reduce, startWith, toArray } from \"rxjs\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\nimport { reduceWhile } from \"./Rxjs.js\";\nimport { createVisibilityStatus, getTooltipOptions } from \"./Tooltip.js\";\nimport { getClassesByView, releaseMainThreadOnItemsCount } from \"./Utils.js\";\n\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { Observable, OperatorFunction } from \"rxjs\";\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { NonPartialVisibilityStatus, Visibility } from \"./Tooltip.js\";\nimport type { VisibilityStatus } from \"../UseHierarchyVisibility.js\";\nimport type { ElementId, ModelId } from \"./Types.js\";\nimport type { CategoryInfo } from \"../CategoriesVisibilityUtils.js\";\n\nfunction mergeVisibilities(obs: Observable<Visibility>): Observable<Visibility | \"empty\"> {\n return obs.pipe(\n reduceWhile(\n (x) => x.allVisible || x.allHidden,\n (acc, val) => {\n acc.allVisible &&= val === \"visible\";\n acc.allHidden &&= val === \"hidden\";\n return acc;\n },\n { allVisible: true, allHidden: true },\n ),\n map((x) => {\n if (!x) {\n return \"empty\";\n }\n return x.allVisible ? \"visible\" : x.allHidden ? \"hidden\" : \"partial\";\n }),\n );\n}\n\n/** @internal */\nexport function mergeVisibilityStatuses(\n tooltipMap: { [key in Visibility]: string | undefined },\n ignoreTooltip?: boolean,\n): OperatorFunction<VisibilityStatus, VisibilityStatus> {\n return (obs) => {\n return obs.pipe(\n map((visibilityStatus) => visibilityStatus.state),\n mergeVisibilities,\n map((visibility) => {\n if (visibility === \"empty\") {\n visibility = \"visible\";\n }\n return createVisibilityStatus(visibility, getTooltipOptions(tooltipMap[visibility], ignoreTooltip));\n }),\n );\n };\n}\n\n/** @internal */\nexport function getSubModeledElementsVisibilityStatus({\n parentNodeVisibilityStatus,\n tooltips,\n ignoreTooltips,\n getModelVisibilityStatus,\n}: {\n parentNodeVisibilityStatus: VisibilityStatus;\n getModelVisibilityStatus: ({ modelId }: { modelId: Id64String }) => Observable<VisibilityStatus>;\n tooltips: { [key in Visibility]: string | undefined };\n ignoreTooltips?: boolean;\n}): OperatorFunction<Id64Array, VisibilityStatus> {\n return (obs) => {\n return obs.pipe(\n // combine visibility status of sub-models with visibility status of parent node\n mergeMap((modeledElementIds) => {\n if (modeledElementIds.length === 0) {\n return of(parentNodeVisibilityStatus);\n }\n return from(modeledElementIds).pipe(\n mergeMap((modeledElementId) => getModelVisibilityStatus({ modelId: modeledElementId })),\n startWith<VisibilityStatus>(parentNodeVisibilityStatus),\n mergeVisibilityStatuses(tooltips, ignoreTooltips),\n );\n }),\n );\n };\n}\n\n/** @internal */\nexport function filterSubModeledElementIds({\n doesSubModelExist,\n}: {\n doesSubModelExist: (elementId: Id64String) => Promise<boolean>;\n}): OperatorFunction<Array<ElementId>, Array<ModelId>> {\n return (obs) => {\n return obs.pipe(\n mergeAll(),\n mergeMap(async (elementId) => ({ elementId, hasSubModel: await doesSubModelExist(elementId) })),\n filter(({ hasSubModel }) => hasSubModel),\n map(({ elementId }) => elementId),\n toArray(),\n );\n };\n}\n\n/** @internal */\nexport function changeElementStateNoChildrenOperator(props: {\n on: boolean;\n isDisplayedByDefault: boolean;\n viewport: Viewport;\n}): OperatorFunction<string, void> {\n return (elementIds: Observable<Id64String>) => {\n const { on, isDisplayedByDefault } = props;\n const isAlwaysDrawnExclusive = props.viewport.isAlwaysDrawnExclusive;\n return elementIds.pipe(\n releaseMainThreadOnItemsCount(500),\n reduce<\n string,\n { changedNeverDrawn: boolean; changedAlwaysDrawn: boolean; neverDrawn: Set<ElementId> | undefined; alwaysDrawn: Set<ElementId> | undefined }\n >(\n (acc, elementId) => {\n if (acc.alwaysDrawn === undefined || acc.neverDrawn === undefined) {\n acc.alwaysDrawn = new Set(props.viewport.alwaysDrawn || []);\n acc.neverDrawn = new Set(props.viewport.neverDrawn || []);\n }\n if (on) {\n const wasRemoved = acc.neverDrawn.delete(elementId);\n acc.changedNeverDrawn ||= wasRemoved;\n // If exclusive mode is enabled, we must add the element to the always drawn list.\n if ((!isDisplayedByDefault || isAlwaysDrawnExclusive) && !acc.alwaysDrawn.has(elementId)) {\n acc.alwaysDrawn.add(elementId);\n acc.changedAlwaysDrawn = true;\n }\n } else {\n const wasRemoved = acc.alwaysDrawn.delete(elementId);\n acc.changedAlwaysDrawn ||= wasRemoved;\n // If exclusive mode is not enabled, we have to add the element to the never drawn list.\n if (isDisplayedByDefault && !isAlwaysDrawnExclusive && !acc.neverDrawn.has(elementId)) {\n acc.neverDrawn.add(elementId);\n acc.changedNeverDrawn = true;\n }\n }\n return acc;\n },\n {\n changedNeverDrawn: false,\n changedAlwaysDrawn: false,\n neverDrawn: undefined,\n alwaysDrawn: undefined,\n },\n ),\n map((state) => {\n state.changedNeverDrawn && state.neverDrawn && props.viewport.setNeverDrawn(state.neverDrawn);\n state.changedAlwaysDrawn && state.alwaysDrawn && props.viewport.setAlwaysDrawn(state.alwaysDrawn, props.viewport.isAlwaysDrawnExclusive);\n }),\n );\n };\n}\n\n/** @internal */\nexport function getVisibilityFromAlwaysAndNeverDrawnElementsImpl(\n props: {\n alwaysDrawn: Set<ElementId> | undefined;\n neverDrawn: Set<ElementId> | undefined;\n totalCount: number;\n ignoreTooltip?: boolean;\n viewport: Viewport;\n } & GetVisibilityFromAlwaysAndNeverDrawnElementsProps,\n): VisibilityStatus {\n const { alwaysDrawn, neverDrawn, totalCount, ignoreTooltip } = props;\n\n if (neverDrawn?.size === totalCount) {\n return createVisibilityStatus(\"hidden\", getTooltipOptions(props.tooltips.allElementsInNeverDrawnList, ignoreTooltip));\n }\n\n if (alwaysDrawn?.size === totalCount) {\n return createVisibilityStatus(\"visible\", getTooltipOptions(props.tooltips.allElementsInAlwaysDrawnList, ignoreTooltip));\n }\n\n const viewport = props.viewport;\n if (viewport.isAlwaysDrawnExclusive && viewport.alwaysDrawn?.size) {\n return alwaysDrawn?.size\n ? createVisibilityStatus(\"partial\", getTooltipOptions(props.tooltips.elementsInBothAlwaysAndNeverDrawn, ignoreTooltip))\n : createVisibilityStatus(\"hidden\", getTooltipOptions(props.tooltips.noElementsInExclusiveAlwaysDrawnList, ignoreTooltip));\n }\n\n const status = props.defaultStatus();\n if ((status.state === \"visible\" && neverDrawn?.size) || (status.state === \"hidden\" && alwaysDrawn?.size)) {\n return createVisibilityStatus(\"partial\", getTooltipOptions(undefined, ignoreTooltip));\n }\n return status;\n}\n\n/** @internal */\nexport function getElementOverriddenVisibility(props: {\n elementId: Id64String;\n ignoreTooltip?: boolean;\n viewport: Viewport;\n tooltips: {\n hiddenThroughNeverDrawn?: string;\n hiddenThroughAlwaysDrawnExclusive?: string;\n visibileThorughAlwaysDrawn?: string;\n };\n}): NonPartialVisibilityStatus | undefined {\n const { ignoreTooltip, viewport, elementId, tooltips } = props;\n if (viewport.neverDrawn?.has(elementId)) {\n return createVisibilityStatus(\"hidden\", getTooltipOptions(tooltips.hiddenThroughNeverDrawn, ignoreTooltip));\n }\n\n if (viewport.alwaysDrawn?.size) {\n if (viewport.alwaysDrawn.has(elementId)) {\n return createVisibilityStatus(\"visible\", getTooltipOptions(tooltips.visibileThorughAlwaysDrawn, ignoreTooltip));\n }\n\n if (viewport.isAlwaysDrawnExclusive) {\n return createVisibilityStatus(\"hidden\", getTooltipOptions(tooltips.hiddenThroughAlwaysDrawnExclusive, ignoreTooltip));\n }\n }\n\n return undefined;\n}\n\n/** @internal */\nexport interface GetVisibilityFromAlwaysAndNeverDrawnElementsProps {\n tooltips: {\n allElementsInNeverDrawnList: string;\n allElementsInAlwaysDrawnList: string;\n elementsInBothAlwaysAndNeverDrawn: string;\n noElementsInExclusiveAlwaysDrawnList: string;\n };\n /** Status when always/never lists are empty and exclusive mode is off */\n defaultStatus: () => VisibilityStatus;\n}\n\n/** @internal */\nexport function getElementVisibility(\n ignoreTooltip: boolean | undefined,\n viewsModel: boolean,\n overridenVisibility: NonPartialVisibilityStatus | undefined,\n categoryVisibility: NonPartialVisibilityStatus,\n treeType: \"modelsTree\" | \"categoriesTree\",\n subModelVisibilityStatus?: VisibilityStatus,\n): VisibilityStatus {\n if (subModelVisibilityStatus === undefined) {\n if (!viewsModel) {\n return createVisibilityStatus(\"hidden\", getTooltipOptions(`${treeType}.element.hiddenThroughModel`, ignoreTooltip));\n }\n\n if (overridenVisibility) {\n return overridenVisibility;\n }\n\n return createVisibilityStatus(\n categoryVisibility.state,\n getTooltipOptions(categoryVisibility.state === \"visible\" ? undefined : `${treeType}.element.hiddenThroughCategory`, ignoreTooltip),\n );\n }\n\n if (subModelVisibilityStatus.state === \"partial\") {\n return createVisibilityStatus(\"partial\", getTooltipOptions(`${treeType}.element.someElementsAreHidden`, ignoreTooltip));\n }\n\n if (subModelVisibilityStatus.state === \"visible\") {\n if (!viewsModel || overridenVisibility?.state === \"hidden\" || (categoryVisibility.state === \"hidden\" && !overridenVisibility)) {\n return createVisibilityStatus(\"partial\", getTooltipOptions(`${treeType}.element.partialThroughSubModel`, ignoreTooltip));\n }\n return createVisibilityStatus(\"visible\", getTooltipOptions(undefined, ignoreTooltip));\n }\n\n if (!viewsModel) {\n return createVisibilityStatus(\"hidden\", getTooltipOptions(`${treeType}.element.hiddenThroughModel`, ignoreTooltip));\n }\n\n if (overridenVisibility) {\n if (overridenVisibility.state === \"hidden\") {\n return overridenVisibility;\n }\n return createVisibilityStatus(\"partial\", getTooltipOptions(`${treeType}.element.partialThroughElement`, ignoreTooltip));\n }\n\n if (categoryVisibility.state === \"visible\") {\n return createVisibilityStatus(\"partial\", getTooltipOptions(`${treeType}.element.partialThroughCategory`, ignoreTooltip));\n }\n return createVisibilityStatus(\"hidden\", getTooltipOptions(`${treeType}.element.hiddenThroughCategory`, ignoreTooltip));\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n * @internal\n */\nexport async function toggleAllCategories(viewport: Viewport, display: boolean) {\n const categoryIds = await getCategoryIds(viewport);\n if (categoryIds.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewport, categoryIds, display);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n * @internal\n */\nasync function getCategoryIds(viewport: Viewport): Promise<Id64Array> {\n const categories = await loadCategoriesFromViewport(viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n * @internal\n */\nexport async function enableCategoryDisplay(viewport: Viewport, categoryIds: Id64Array, enabled: boolean, enableAllSubCategories = true) {\n viewport.changeCategoryDisplay(categoryIds, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides = new Array<ModelId>();\n for (const ovr of viewport.perModelCategoryVisibility) {\n if (categoryIds.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, categoryIds, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await viewport.iModel.categories.getCategoryInfo(categoryIds)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));\n });\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n * @internal\n */\nexport function enableSubCategoryDisplay(viewport: Viewport, subCategoryId: Id64String, enabled: boolean) {\n viewport.changeSubCategoryDisplay(subCategoryId, enabled);\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(vp: Viewport) {\n // Query categories and add them to state\n const { categoryClass, elementClass } = getClassesByView(vp.view.is3d() ? \"3d\" : \"2d\");\n const ecsql = `\n SELECT ECInstanceId as id\n FROM ${categoryClass}\n WHERE\n ECInstanceId IN (\n SELECT DISTINCT Category.Id\n FROM ${elementClass}\n WHERE\n Category.Id IN (SELECT ECInstanceId FROM ${categoryClass})\n ${vp.view.is3d() ? \"\" : \"AND Model.Id=?\"}\n )\n `;\n\n const categories: CategoryInfo[] = [];\n\n const rows = await vp.iModel.createQueryReader(ecsql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n return categories;\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAcnF,YAAY;AACZ,MAAM,UAAU,mBAAmB,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,IAAI,EAA4B;IAC/G,OAAO,CACL,KAAC,IAAI,IACH,gBAAgB,EAAE,KAAC,gBAAgB,IAAC,IAAI,EAAE,WAAW,GAAI,KACrD,IAAI,EACR,QAAQ,EAAE,4BAA4B,CAAC,EAAE,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,aAAa,IAAI,MAAM,EACtC,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAC3B,KAAC,YAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAC,uBAAuB,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,GAAI,CACzI,GACD,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAwC,CAAC,KAAK,EAAE,EAAE;IAC5E,OAAO,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,oCAAoC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACrF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,sCAAsC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACzF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,mCAAmC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACvF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEjG,YAAY;AACZ,MAAM,UAAU,uBAAuB,CAAC,EAAE,IAAI,EAAuC;IACnF,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,IAAI,CAAC,YAAa,CAAC,OAAO,EAAE;YAClC,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,eAAe;gBAClB,OAAO,WAAW,CAAC;YACrB,KAAK,gBAAgB;gBACnB,OAAO,WAAW,CAAC;YACrB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Icon } from \"@itwin/itwinui-react/bricks\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }: ExternalSourcesTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={documentSvg} />}\n {...rest}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <ExternalSourcesTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst documentSvg = new URL(\"@itwin/itwinui-icons/document.svg\", import.meta.url).href;\nconst ecSchemaSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function ExternalSourcesTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n const getIcon = () => {\n switch (node.extendedData!.imageId) {\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-document\":\n return documentSvg;\n case \"icon-ec-schema\":\n return ecSchemaSvg;\n default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAc/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,4BAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,KAAC,cAAc,cACb,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACnC,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,4BAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,4BAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree.js\";\n\nimport type { ExternalSourcesTreeProps } from \"./ExternalSourcesTree.js\";\n\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ExternalSourcesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ExternalSourcesTree`.\n * @beta\n */\nexport const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: ExternalSourcesTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={ExternalSourcesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <ExternalSourcesTree {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.id = \"external-sources-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.getLabel = () => TreeWidget.translate(\"externalSourcesTree.label\");\n"]}
|
|
@@ -3,6 +3,7 @@ import type { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefi
|
|
|
3
3
|
interface ExternalSourcesTreeDefinitionProps {
|
|
4
4
|
imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & LimitingECSqlQueryExecutor;
|
|
5
5
|
}
|
|
6
|
+
/** @internal */
|
|
6
7
|
export declare class ExternalSourcesTreeDefinition implements HierarchyDefinition {
|
|
7
8
|
private _impl;
|
|
8
9
|
private _selectQueryFactory;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { createNodesQueryClauseFactory, createPredicateBasedHierarchyDefinition, HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
6
6
|
import { createBisInstanceLabelSelectClauseFactory, ECSql } from "@itwin/presentation-shared";
|
|
7
|
+
/** @internal */
|
|
7
8
|
export class ExternalSourcesTreeDefinition {
|
|
8
9
|
constructor(props) {
|
|
9
10
|
this._impl = createPredicateBasedHierarchyDefinition({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,6BAA6B,EAAE,uCAAuC,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACxI,OAAO,EAAE,yCAAyC,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAmB9F,MAAM,OAAO,6BAA6B;IAOxC,YAAmB,KAAyC;QAC1D,IAAI,CAAC,KAAK,GAAG,uCAAuC,CAAC;YACnD,uBAAuB,EAAE,KAAK,CAAC,YAAY;YAC3C,SAAS,EAAE;gBACT,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAAC,YAAY,CAAC;gBACxF,UAAU,EAAE;oBACV;wBACE,4BAA4B,EAAE,6BAA6B;wBAC3D,WAAW,EAAE,KAAK,EAAE,YAAwD,EAAE,EAAE,CAAC,IAAI,CAAC,uCAAuC,CAAC,YAAY,CAAC;qBAC5I;oBACD;wBACE,4BAA4B,EAAE,wBAAwB;wBACtD,WAAW,EAAE,KAAK,EAAE,YAAwD,EAAE,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,YAAY,CAAC;qBACtI;oBACD;wBACE,0BAA0B,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,cAAc;wBACnE,WAAW,EAAE,KAAK,EAAE,YAAuD,EAAE,EAAE,CAAC,IAAI,CAAC,+BAA+B,CAAC,YAAY,CAAC;qBACnI;iBACF;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,6BAA6B,GAAG,yCAAyC,CAAC,EAAE,uBAAuB,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QAChI,IAAI,CAAC,mBAAmB,GAAG,6BAA6B,CAAC;YACvD,YAAY,EAAE,KAAK,C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;yBACpC,CAAC;qBACH;oBACD;wBACE,IAAI,EAAE,QAAQ;wBACd,KAAK,EAAE,KAAK;qBACb;iBACF,CAAC;;UAEF;aACH;YACD;gBACE,QAAQ,EAAE,MAAM,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC;oBACpE,UAAU,EAAE,mBAAmB;oBAC/B,SAAS,EAAE,wBAAwB;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,KAAK,GAAG;;;;KAIb,CAAC;QAEF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;YAChF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createNodesQueryClauseFactory, createPredicateBasedHierarchyDefinition, HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { createBisInstanceLabelSelectClauseFactory, ECSql } from \"@itwin/presentation-shared\";\n\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IInstanceLabelSelectClauseFactory } from \"@itwin/presentation-shared\";\nimport type {\n DefineGenericNodeChildHierarchyLevelProps,\n DefineHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n HierarchyDefinition,\n HierarchyLevelDefinition,\n LimitingECSqlQueryExecutor,\n NodesQueryClauseFactory,\n ProcessedHierarchyNode,\n} from \"@itwin/presentation-hierarchies\";\n\ninterface ExternalSourcesTreeDefinitionProps {\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & LimitingECSqlQueryExecutor;\n}\n\nexport class ExternalSourcesTreeDefinition implements HierarchyDefinition {\n private _impl: HierarchyDefinition;\n private _selectQueryFactory: NodesQueryClauseFactory;\n private _nodeLabelSelectClauseFactory: IInstanceLabelSelectClauseFactory;\n private _queryExecutor: LimitingECSqlQueryExecutor;\n private _isSupported?: Promise<boolean>;\n\n public constructor(props: ExternalSourcesTreeDefinitionProps) {\n this._impl = createPredicateBasedHierarchyDefinition({\n classHierarchyInspector: props.imodelAccess,\n hierarchy: {\n rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition(requestProps),\n childNodes: [\n {\n parentInstancesNodePredicate: \"BisCore.ExternalSourceGroup\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createExternalSourcesGroupChildrenQuery(requestProps),\n },\n {\n parentInstancesNodePredicate: \"BisCore.ExternalSource\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createExternalSourceChildrenQuery(requestProps),\n },\n {\n parentGenericNodePredicate: async ({ id }) => id === \"ElementsNode\",\n definitions: async (requestProps: DefineGenericNodeChildHierarchyLevelProps) => this.createElementsNodeChildrenQuery(requestProps),\n },\n ],\n },\n });\n this._queryExecutor = props.imodelAccess;\n this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n this._selectQueryFactory = createNodesQueryClauseFactory({\n imodelAccess: props.imodelAccess,\n instanceLabelSelectClauseFactory: this._nodeLabelSelectClauseFactory,\n });\n }\n\n public async postProcessNode(node: ProcessedHierarchyNode): Promise<ProcessedHierarchyNode> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n // `imageId` is assigned to instance nodes at query time, but grouping ones need to be handled during post-processing\n return { ...node, extendedData: { ...node.extendedData, imageId: \"icon-ec-class\" } };\n }\n return node;\n }\n\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps) {\n if (this._isSupported === undefined) {\n this._isSupported = this.isSupported();\n }\n\n if ((await this._isSupported) === false) {\n return [];\n }\n\n return this._impl.defineHierarchyLevel(props);\n }\n\n private async createRootHierarchyLevelDefinition(props: DefineRootHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: props.instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: ECSql.createRawPropertyValueSelector(\"this\", \"ECClassId\") },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n autoExpand: true,\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n JOIN BisCore.SynchronizationConfigSpecifiesRootSources scsrs ON scsrs.TargetECInstanceId = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.where ? `WHERE ${instanceFilterClauses.where}` : \"\"}\n `,\n },\n },\n ];\n }\n\n private async createExternalSourcesGroupChildrenQuery({\n parentNodeInstanceIds: groupIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceGroupGroupsSources esggs ON esggs.TargetECInstanceId = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.joins}\n WHERE\n esggs.SourceECInstanceId IN (${groupIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: groupIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n private async createExternalSourceChildrenQuery({\n parentNodeInstanceIds: sourceIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceAttachment esa ON esa.Attaches.Id = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.joins}\n WHERE\n esa.Parent.Id IN (${sourceIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: sourceIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n {\n node: {\n key: \"ElementsNode\",\n label: \"Elements\",\n extendedData: {\n sourceIds,\n imageId: \"icon-ec-schema\",\n },\n supportsFiltering: true,\n processingParams: {\n hideIfNoChildren: true,\n },\n },\n },\n ];\n }\n\n private createExternalSourceSupportsFilteringSelector(alias: string) {\n return `\n IFNULL((\n SELECT 1\n FROM (\n SELECT 1 FROM BisCore.ExternalSourceGroupGroupsSources WHERE SourceECInstanceId = ${alias}.ECInstanceId\n UNION ALL\n SELECT 1 FROM BisCore.ExternalSourceAttachment WHERE Parent.Id = ${alias}.ECInstanceId\n )\n LIMIT 1\n ), 0)\n `;\n }\n\n private async createElementsNodeChildrenQuery({ parentNode, instanceFilter }: DefineGenericNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const sourceIds: string[] = parentNode.extendedData?.sourceIds;\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.GeometricElement\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.GeometricElement\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.GeometricElement\",\n }),\n },\n extendedData: {\n imageId: \"icon-item\",\n },\n grouping: { byClass: true },\n hasChildren: false,\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceAspect esa ON esa.Element.Id = this.ECInstanceId\n ${instanceFilterClauses.joins}\n WHERE\n esa.Source.Id IN (${sourceIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: sourceIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n private async createCompositeLabelSelectClause({ externalSourceAlias, repositoryLinkAlias }: { externalSourceAlias: string; repositoryLinkAlias: string }) {\n return ECSql.createConcatenatedValueJsonSelector([\n {\n selector: `IIF(\n ${repositoryLinkAlias}.ECInstanceId IS NOT NULL,\n ${ECSql.createConcatenatedValueJsonSelector([\n {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: repositoryLinkAlias,\n className: \"BisCore.RepositoryLink\",\n }),\n },\n {\n type: \"String\",\n value: \" - \",\n },\n ])},\n ''\n )`,\n },\n {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: externalSourceAlias,\n className: \"BisCore.ExternalSource\",\n }),\n },\n ]);\n }\n\n private async isSupported() {\n const query = `\n SELECT 1\n FROM ECDbMeta.ECSchemaDef\n WHERE Name = 'BisCore' AND (VersionMajor > 1 OR (VersionMajor = 1 AND VersionMinor > 12))\n `;\n\n for await (const _row of this._queryExecutor.createQueryReader({ ecsql: query })) {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,6BAA6B,EAAE,uCAAuC,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACxI,OAAO,EAAE,yCAAyC,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAmB9F,gBAAgB;AAChB,MAAM,OAAO,6BAA6B;IAOxC,YAAmB,KAAyC;QAC1D,IAAI,CAAC,KAAK,GAAG,uCAAuC,CAAC;YACnD,uBAAuB,EAAE,KAAK,CAAC,YAAY;YAC3C,SAAS,EAAE;gBACT,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAAC,YAAY,CAAC;gBACxF,UAAU,EAAE;oBACV;wBACE,4BAA4B,EAAE,6BAA6B;wBAC3D,WAAW,EAAE,KAAK,EAAE,YAAwD,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AE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBACpD,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,qBAAqB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;WAC5E;oBACD,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,gCAAgC,CAAC,EAAE,mBAAmB,EAAE,mBAAmB,EAAgE;QACvJ,OAAO,KAAK,CAAC,mCAAmC,CAAC;YAC/C;gBACE,QAAQ,EAAE;YACN,mBAAmB;YACnB,KAAK,CAAC,mCAAmC,CAAC;oBAC1C;wBACE,QAAQ,EAAE,MAAM,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC;4BACpE,UAAU,EAAE,mBAAmB;4BAC/B,SAAS,EAAE,wBAAwB;yBACpC,CAAC;qBACH;oBACD;wBACE,IAAI,EAAE,QAAQ;wBACd,KAAK,EAAE,KAAK;qBACb;iBACF,CAAC;;UAEF;aACH;YACD;gBACE,QAAQ,EAAE,MAAM,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC;oBACpE,UAAU,EAAE,mBAAmB;oBAC/B,SAAS,EAAE,wBAAwB;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,KAAK,GAAG;;;;KAIb,CAAC;QAEF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;YAChF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createNodesQueryClauseFactory, createPredicateBasedHierarchyDefinition, HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { createBisInstanceLabelSelectClauseFactory, ECSql } from \"@itwin/presentation-shared\";\n\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IInstanceLabelSelectClauseFactory } from \"@itwin/presentation-shared\";\nimport type {\n DefineGenericNodeChildHierarchyLevelProps,\n DefineHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n HierarchyDefinition,\n HierarchyLevelDefinition,\n LimitingECSqlQueryExecutor,\n NodesQueryClauseFactory,\n ProcessedHierarchyNode,\n} from \"@itwin/presentation-hierarchies\";\n\ninterface ExternalSourcesTreeDefinitionProps {\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & LimitingECSqlQueryExecutor;\n}\n\n/** @internal */\nexport class ExternalSourcesTreeDefinition implements HierarchyDefinition {\n private _impl: HierarchyDefinition;\n private _selectQueryFactory: NodesQueryClauseFactory;\n private _nodeLabelSelectClauseFactory: IInstanceLabelSelectClauseFactory;\n private _queryExecutor: LimitingECSqlQueryExecutor;\n private _isSupported?: Promise<boolean>;\n\n public constructor(props: ExternalSourcesTreeDefinitionProps) {\n this._impl = createPredicateBasedHierarchyDefinition({\n classHierarchyInspector: props.imodelAccess,\n hierarchy: {\n rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition(requestProps),\n childNodes: [\n {\n parentInstancesNodePredicate: \"BisCore.ExternalSourceGroup\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createExternalSourcesGroupChildrenQuery(requestProps),\n },\n {\n parentInstancesNodePredicate: \"BisCore.ExternalSource\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createExternalSourceChildrenQuery(requestProps),\n },\n {\n parentGenericNodePredicate: async ({ id }) => id === \"ElementsNode\",\n definitions: async (requestProps: DefineGenericNodeChildHierarchyLevelProps) => this.createElementsNodeChildrenQuery(requestProps),\n },\n ],\n },\n });\n this._queryExecutor = props.imodelAccess;\n this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n this._selectQueryFactory = createNodesQueryClauseFactory({\n imodelAccess: props.imodelAccess,\n instanceLabelSelectClauseFactory: this._nodeLabelSelectClauseFactory,\n });\n }\n\n public async postProcessNode(node: ProcessedHierarchyNode): Promise<ProcessedHierarchyNode> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n // `imageId` is assigned to instance nodes at query time, but grouping ones need to be handled during post-processing\n return { ...node, extendedData: { ...node.extendedData, imageId: \"icon-ec-class\" } };\n }\n return node;\n }\n\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps) {\n if (this._isSupported === undefined) {\n this._isSupported = this.isSupported();\n }\n\n if ((await this._isSupported) === false) {\n return [];\n }\n\n return this._impl.defineHierarchyLevel(props);\n }\n\n private async createRootHierarchyLevelDefinition(props: DefineRootHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: props.instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: ECSql.createRawPropertyValueSelector(\"this\", \"ECClassId\") },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n autoExpand: true,\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n JOIN BisCore.SynchronizationConfigSpecifiesRootSources scsrs ON scsrs.TargetECInstanceId = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.where ? `WHERE ${instanceFilterClauses.where}` : \"\"}\n `,\n },\n },\n ];\n }\n\n private async createExternalSourcesGroupChildrenQuery({\n parentNodeInstanceIds: groupIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceGroupGroupsSources esggs ON esggs.TargetECInstanceId = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.joins}\n WHERE\n esggs.SourceECInstanceId IN (${groupIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: groupIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n private async createExternalSourceChildrenQuery({\n parentNodeInstanceIds: sourceIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.ExternalSource\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.ExternalSource\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this.createCompositeLabelSelectClause({ externalSourceAlias: \"this\", repositoryLinkAlias: \"rl\" }),\n },\n extendedData: {\n imageId: \"icon-document\",\n },\n supportsFiltering: { selector: this.createExternalSourceSupportsFilteringSelector(\"this\") },\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceAttachment esa ON esa.Attaches.Id = this.ECInstanceId\n LEFT JOIN BisCore.RepositoryLink rl ON rl.ECInstanceId = this.Repository.Id\n ${instanceFilterClauses.joins}\n WHERE\n esa.Parent.Id IN (${sourceIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: sourceIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n {\n node: {\n key: \"ElementsNode\",\n label: \"Elements\",\n extendedData: {\n sourceIds,\n imageId: \"icon-ec-schema\",\n },\n supportsFiltering: true,\n processingParams: {\n hideIfNoChildren: true,\n },\n },\n },\n ];\n }\n\n private createExternalSourceSupportsFilteringSelector(alias: string) {\n return `\n IFNULL((\n SELECT 1\n FROM (\n SELECT 1 FROM BisCore.ExternalSourceGroupGroupsSources WHERE SourceECInstanceId = ${alias}.ECInstanceId\n UNION ALL\n SELECT 1 FROM BisCore.ExternalSourceAttachment WHERE Parent.Id = ${alias}.ECInstanceId\n )\n LIMIT 1\n ), 0)\n `;\n }\n\n private async createElementsNodeChildrenQuery({ parentNode, instanceFilter }: DefineGenericNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const sourceIds: string[] = parentNode.extendedData?.sourceIds;\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.GeometricElement\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.GeometricElement\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.GeometricElement\",\n }),\n },\n extendedData: {\n imageId: \"icon-item\",\n },\n grouping: { byClass: true },\n hasChildren: false,\n })}\n FROM ${instanceFilterClauses.from} this\n JOIN BisCore.ExternalSourceAspect esa ON esa.Element.Id = this.ECInstanceId\n ${instanceFilterClauses.joins}\n WHERE\n esa.Source.Id IN (${sourceIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: sourceIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n private async createCompositeLabelSelectClause({ externalSourceAlias, repositoryLinkAlias }: { externalSourceAlias: string; repositoryLinkAlias: string }) {\n return ECSql.createConcatenatedValueJsonSelector([\n {\n selector: `IIF(\n ${repositoryLinkAlias}.ECInstanceId IS NOT NULL,\n ${ECSql.createConcatenatedValueJsonSelector([\n {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: repositoryLinkAlias,\n className: \"BisCore.RepositoryLink\",\n }),\n },\n {\n type: \"String\",\n value: \" - \",\n },\n ])},\n ''\n )`,\n },\n {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: externalSourceAlias,\n className: \"BisCore.ExternalSource\",\n }),\n },\n ]);\n }\n\n private async isSupported() {\n const query = `\n SELECT 1\n FROM ECDbMeta.ECSchemaDef\n WHERE Name = 'BisCore' AND (VersionMajor > 1 OR (VersionMajor = 1 AND VersionMinor > 12))\n `;\n\n for await (const _row of this._queryExecutor.createQueryReader({ ecsql: query })) {\n return true;\n }\n return false;\n }\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IModelContentTreeHierarchyConfiguration } from "./IModelContentTreeDefinition.js";
|
|
1
2
|
import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
2
3
|
import type { BaseTreeRendererProps } from "../common/components/BaseTreeRenderer.js";
|
|
3
4
|
import type { TreeProps } from "../common/components/Tree.js";
|
|
@@ -6,9 +7,10 @@ export type IModelContentTreeProps = Pick<TreeProps, "imodel" | "getSchemaContex
|
|
|
6
7
|
hierarchyLevelConfig?: {
|
|
7
8
|
sizeLimit?: number;
|
|
8
9
|
};
|
|
10
|
+
hierarchyConfig?: Partial<IModelContentTreeHierarchyConfiguration>;
|
|
9
11
|
};
|
|
10
12
|
/** @beta */
|
|
11
|
-
export declare function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }: IModelContentTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function IModelContentTree({ actions, getDecorations, selectionMode, hierarchyConfig: hierarchyConfigProp, ...rest }: IModelContentTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
/** @beta */
|
|
13
15
|
export declare function IModelContentTreeIcon({ node }: {
|
|
14
16
|
node: PresentationHierarchyNode;
|
|
@@ -3,23 +3,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import { useCallback } from "react";
|
|
6
7
|
import { Icon } from "@itwin/itwinui-react/bricks";
|
|
7
8
|
import { EmptyTreeContent } from "../common/components/EmptyTree.js";
|
|
8
9
|
import { Tree } from "../common/components/Tree.js";
|
|
9
10
|
import { TreeRenderer } from "../common/components/TreeRenderer.js";
|
|
10
11
|
import { IModelContentTreeComponent } from "./IModelContentTreeComponent.js";
|
|
11
|
-
import { IModelContentTreeDefinition } from "./IModelContentTreeDefinition.js";
|
|
12
|
+
import { defaultHierarchyConfiguration, IModelContentTreeDefinition } from "./IModelContentTreeDefinition.js";
|
|
12
13
|
import { IModelContentTreeIdsCache } from "./internal/IModelContentTreeIdsCache.js";
|
|
13
14
|
/** @beta */
|
|
14
|
-
export function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }) {
|
|
15
|
-
|
|
15
|
+
export function IModelContentTree({ actions, getDecorations, selectionMode, hierarchyConfig: hierarchyConfigProp, ...rest }) {
|
|
16
|
+
const getHierarchyDefinition = useCallback(({ imodelAccess }) => {
|
|
17
|
+
const hierarchyConfig = {
|
|
18
|
+
...defaultHierarchyConfiguration,
|
|
19
|
+
...hierarchyConfigProp,
|
|
20
|
+
};
|
|
21
|
+
return new IModelContentTreeDefinition({ imodelAccess, idsCache: new IModelContentTreeIdsCache(imodelAccess), hierarchyConfig });
|
|
22
|
+
},
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
Object.values(hierarchyConfigProp ?? {}));
|
|
25
|
+
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...rest, treeName: IModelContentTreeComponent.id, getHierarchyDefinition: getHierarchyDefinition, selectionMode: selectionMode ?? "extended", treeRenderer: (treeProps) => (_jsx(TreeRenderer, { ...treeProps, actions: actions, getDecorations: getDecorations ?? ((node) => _jsx(IModelContentTreeIcon, { node: node })) })) }));
|
|
16
26
|
}
|
|
17
|
-
const getDefinitionsProvider = ({ imodelAccess }) => {
|
|
18
|
-
return new IModelContentTreeDefinition({
|
|
19
|
-
imodelAccess,
|
|
20
|
-
idsCache: new IModelContentTreeIdsCache(imodelAccess),
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
27
|
const categorySvg = new URL("@itwin/itwinui-icons/bis-category-3d.svg", import.meta.url).href;
|
|
24
28
|
const classSvg = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
|
|
25
29
|
const elementSvg = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
|
package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAiBpF,YAAY;AACZ,MAAM,UAAU,iBAAiB,CA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CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACzF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,sCAAsC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACzF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,gCAAgC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACjF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,qCAAqC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACtF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEtG,YAAY;AACZ,MAAM,UAAU,qBAAqB,CAAC,EAAE,IAAI,EAAuC;IACjF,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,IAAI,CAAC,YAAa,CAAC,OAAO,EAAE;YAClC,KAAK,aAAa;gBAChB,OAAO,WAAW,CAAC;YACrB,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,aAAa;gBAChB,OAAO,UAAU,CAAC;YACpB,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB,KAAK,qBAAqB;gBACxB,OAAO,gBAAgB,CAAC;YAC1B,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback } from \"react\";\nimport { Icon } from \"@itwin/itwinui-react/bricks\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { IModelContentTreeComponent } from \"./IModelContentTreeComponent.js\";\nimport { defaultHierarchyConfiguration, IModelContentTreeDefinition } from \"./IModelContentTreeDefinition.js\";\nimport { IModelContentTreeIdsCache } from \"./internal/IModelContentTreeIdsCache.js\";\n\nimport type { IModelContentTreeHierarchyConfiguration } from \"./IModelContentTreeDefinition.js\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n\n\n/** @beta */\nexport type IModelContentTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n hierarchyConfig?: Partial<IModelContentTreeHierarchyConfiguration>;\n};\n\n/** @beta */\nexport function IModelContentTree({ actions, getDecorations, selectionMode, hierarchyConfig: hierarchyConfigProp, ...rest }: IModelContentTreeProps) {\n const getHierarchyDefinition = useCallback<TreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => {\n const hierarchyConfig = {\n ...defaultHierarchyConfiguration,\n ...hierarchyConfigProp,\n };\n return new IModelContentTreeDefinition({ imodelAccess, idsCache: new IModelContentTreeIdsCache(imodelAccess), hierarchyConfig });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfigProp ?? {}),\n );\n\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={modelSvg} />}\n {...rest}\n treeName={IModelContentTreeComponent.id}\n getHierarchyDefinition={getHierarchyDefinition}\n selectionMode={selectionMode ?? \"extended\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <IModelContentTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst categorySvg = new URL(\"@itwin/itwinui-icons/bis-category-3d.svg\", import.meta.url).href;\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst subjectSvg = new URL(\"@itwin/itwinui-icons/bis-subject.svg\", import.meta.url).href;\nconst groupSvg = new URL(\"@itwin/itwinui-icons/group.svg\", import.meta.url).href;\nconst modelSvg = new URL(\"@itwin/itwinui-icons/model-cube.svg\", import.meta.url).href;\nconst hierarchyTreeSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function IModelContentTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n const getIcon = () => {\n switch (node.extendedData!.imageId) {\n case \"icon-layers\":\n return categorySvg;\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-folder\":\n return subjectSvg;\n case \"icon-model\":\n return modelSvg;\n case \"icon-hierarchy-tree\":\n return hierarchyTreeSvg;\n case \"icon-group\":\n return groupSvg;\n default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IModelContentTreeProps } from "./IModelContentTree.js";
|
|
2
2
|
/** @beta */
|
|
3
|
-
interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
|
|
3
|
+
interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyConfig" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
|
|
4
4
|
onPerformanceMeasured?: (featureId: string, duration: number) => void;
|
|
5
5
|
onFeatureUsed?: (feature: string) => void;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,0BAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,KAAC,cAAc,cACb,KAAC,iBAAiB,IAAC,OAAO,EAAE,SAAS,KAAM,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACrD,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,0BAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,0BAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { IModelContentTree } from \"./IModelContentTree.js\";\n\nimport type { IModelContentTreeProps } from \"./IModelContentTree.js\";\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<\n IModelContentTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `IModelContentTree`.\n * @beta\n */\nexport const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: IModelContentTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={IModelContentTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <IModelContentTree actions={undefined} {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.id = \"imodel-content-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.getLabel = () => TreeWidget.translate(\"imodelContentTree.label\");\n"]}
|
|
1
|
+
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,0BAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,KAAC,cAAc,cACb,KAAC,iBAAiB,IAAC,OAAO,EAAE,SAAS,KAAM,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACrD,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,0BAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,0BAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { IModelContentTree } from \"./IModelContentTree.js\";\n\nimport type { IModelContentTreeProps } from \"./IModelContentTree.js\";\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<\n IModelContentTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"hierarchyConfig\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `IModelContentTree`.\n * @beta\n */\nexport const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: IModelContentTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={IModelContentTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <IModelContentTree actions={undefined} {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.id = \"imodel-content-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.getLabel = () => TreeWidget.translate(\"imodelContentTree.label\");\n"]}
|
|
@@ -2,13 +2,26 @@ import { ProcessedHierarchyNode } from "@itwin/presentation-hierarchies";
|
|
|
2
2
|
import type { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefinition } from "@itwin/presentation-hierarchies";
|
|
3
3
|
import type { ECClassHierarchyInspector, ECSchemaProvider } from "@itwin/presentation-shared";
|
|
4
4
|
import type { IModelContentTreeIdsCache } from "./internal/IModelContentTreeIdsCache.js";
|
|
5
|
+
/**
|
|
6
|
+
* Defines hierarchy configuration supported by `IModelContentTree`.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export interface IModelContentTreeHierarchyConfiguration {
|
|
10
|
+
/** Should the root Subject node be hidden. Defaults to `false`. */
|
|
11
|
+
hideRootSubject: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const defaultHierarchyConfiguration: IModelContentTreeHierarchyConfiguration;
|
|
5
15
|
interface IModelContentTreeDefinitionProps {
|
|
6
16
|
imodelAccess: ECSchemaProvider & ECClassHierarchyInspector;
|
|
7
17
|
idsCache: IModelContentTreeIdsCache;
|
|
18
|
+
hierarchyConfig: IModelContentTreeHierarchyConfiguration;
|
|
8
19
|
}
|
|
20
|
+
/** @internal */
|
|
9
21
|
export declare class IModelContentTreeDefinition implements HierarchyDefinition {
|
|
10
22
|
private _impl;
|
|
11
23
|
private _idsCache;
|
|
24
|
+
private _hierarchyConfig;
|
|
12
25
|
private _selectQueryFactory;
|
|
13
26
|
private _nodeLabelSelectClauseFactory;
|
|
14
27
|
constructor(props: IModelContentTreeDefinitionProps);
|