@itwin/tree-widget-react 4.0.0-alpha.24 → 4.0.0-alpha.25
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/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +12 -0
- 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/CategoriesTreeNode.d.ts +84 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js +50 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +1 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +20 -47
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.d.ts +34 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +28 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +10 -15
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +3 -0
- package/lib/esm/tree-widget-react/components/trees/index.js +3 -0
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +2 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +14 -0
- 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/ModelsTreeNode.d.ts +63 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js +56 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +1 -1
- 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/visibility/ModelsTreeVisibilityHandler.d.ts +1 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +18 -49
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react-internal.d.ts +0 -1
- package/lib/esm/tree-widget-react-internal.js +0 -1
- package/lib/esm/tree-widget-react-internal.js.map +1 -1
- package/package.json +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +0 -41
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +0 -50
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +0 -19
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +0 -32
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +0 -37
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js +0 -54
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +0 -1
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { concat, defer,
|
|
5
|
+
import { concat, defer, from, map, merge, mergeMap, of } from "rxjs";
|
|
6
6
|
import { assert, Guid, Id64 } from "@itwin/core-bentley";
|
|
7
|
-
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
8
|
-
import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
|
|
9
7
|
import { HierarchyVisibilityHandlerImpl } from "../../../common/internal/useTreeHooks/UseCachedVisibility.js";
|
|
10
8
|
import { fromWithRelease } from "../../../common/internal/Utils.js";
|
|
11
9
|
import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
|
|
12
|
-
import { ModelsTreeNode } from "
|
|
10
|
+
import { ModelsTreeNode } from "../../ModelsTreeNode.js";
|
|
13
11
|
import { ModelsTreeVisibilityHelper } from "./ModelsTreeVisibilityHelper.js";
|
|
14
12
|
import { createModelsSearchResultsTree } from "./SearchResultsTree.js";
|
|
15
13
|
/**
|
|
@@ -70,12 +68,11 @@ export class ModelsTreeVisibilityHandler {
|
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
getVisibilityStatus(node) {
|
|
73
|
-
if (
|
|
74
|
-
const nodeInfo = this.getGroupingNodeInfo(node);
|
|
71
|
+
if (ModelsTreeNode.isElementClassGroupingNode(node)) {
|
|
75
72
|
const result = this.#visibilityHelper.getGroupedElementsVisibilityStatus({
|
|
76
|
-
categoryId:
|
|
77
|
-
modelId:
|
|
78
|
-
elementIds:
|
|
73
|
+
categoryId: node.extendedData.categoryId,
|
|
74
|
+
modelId: node.extendedData.modelId,
|
|
75
|
+
elementIds: node.groupedInstanceKeys.map((key) => key.id),
|
|
79
76
|
});
|
|
80
77
|
return this.#props.overrideHandler.createVisibilityHandlerResult({
|
|
81
78
|
overrideProps: { node },
|
|
@@ -83,9 +80,6 @@ export class ModelsTreeVisibilityHandler {
|
|
|
83
80
|
override: this.#props.overrides?.getElementGroupingNodeVisibilityStatus,
|
|
84
81
|
});
|
|
85
82
|
}
|
|
86
|
-
if (!HierarchyNode.isInstancesNode(node)) {
|
|
87
|
-
return of(createVisibilityStatus("disabled"));
|
|
88
|
-
}
|
|
89
83
|
if (ModelsTreeNode.isSubjectNode(node)) {
|
|
90
84
|
// note: subject nodes may be merged to represent multiple subject instances
|
|
91
85
|
return this.#visibilityHelper.getSubjectsVisibilityStatus({ subjectIds: node.key.instanceKeys.map((key) => key.id) });
|
|
@@ -93,37 +87,29 @@ export class ModelsTreeVisibilityHandler {
|
|
|
93
87
|
if (ModelsTreeNode.isModelNode(node)) {
|
|
94
88
|
return this.#visibilityHelper.getModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), type: "GeometricModel3d" });
|
|
95
89
|
}
|
|
96
|
-
const modelId = ModelsTreeNode.getModelId(node);
|
|
97
|
-
if (!modelId) {
|
|
98
|
-
return of(createVisibilityStatus("disabled"));
|
|
99
|
-
}
|
|
100
90
|
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
101
91
|
return this.#visibilityHelper.getCategoriesVisibilityStatus({
|
|
102
92
|
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
103
|
-
modelId,
|
|
93
|
+
modelId: node.extendedData.modelIds[0],
|
|
104
94
|
type: "SpatialCategory",
|
|
105
95
|
});
|
|
106
96
|
}
|
|
107
|
-
|
|
108
|
-
if (!categoryId) {
|
|
109
|
-
return of(createVisibilityStatus("disabled"));
|
|
110
|
-
}
|
|
97
|
+
assert(ModelsTreeNode.isElementNode(node));
|
|
111
98
|
return this.#visibilityHelper.getElementsVisibilityStatus({
|
|
112
99
|
elementIds: node.key.instanceKeys.map(({ id }) => id),
|
|
113
|
-
modelId,
|
|
114
|
-
categoryId,
|
|
100
|
+
modelId: node.extendedData.modelId,
|
|
101
|
+
categoryId: node.extendedData.categoryId,
|
|
115
102
|
type: "GeometricElement3d",
|
|
116
103
|
});
|
|
117
104
|
}
|
|
118
105
|
/** Changes visibility of the items represented by the tree node. */
|
|
119
106
|
changeVisibilityStatus(node, on) {
|
|
120
107
|
const changeObs = defer(() => {
|
|
121
|
-
if (
|
|
122
|
-
const nodeInfo = this.getGroupingNodeInfo(node);
|
|
108
|
+
if (ModelsTreeNode.isElementClassGroupingNode(node)) {
|
|
123
109
|
const result = this.#visibilityHelper.changeGroupedElementsVisibilityStatus({
|
|
124
|
-
categoryId:
|
|
125
|
-
modelId:
|
|
126
|
-
elementIds:
|
|
110
|
+
categoryId: node.extendedData.categoryId,
|
|
111
|
+
modelId: node.extendedData.modelId,
|
|
112
|
+
elementIds: node.groupedInstanceKeys.map((key) => key.id),
|
|
127
113
|
on,
|
|
128
114
|
});
|
|
129
115
|
return this.#props.overrideHandler.createVisibilityHandlerResult({
|
|
@@ -132,9 +118,6 @@ export class ModelsTreeVisibilityHandler {
|
|
|
132
118
|
override: this.#props.overrides?.changeElementGroupingNodeVisibilityStatus,
|
|
133
119
|
});
|
|
134
120
|
}
|
|
135
|
-
if (!HierarchyNode.isInstancesNode(node)) {
|
|
136
|
-
return EMPTY;
|
|
137
|
-
}
|
|
138
121
|
if (ModelsTreeNode.isSubjectNode(node)) {
|
|
139
122
|
return this.#visibilityHelper.changeSubjectsVisibilityStatus({
|
|
140
123
|
subjectIds: node.key.instanceKeys.map((key) => key.id),
|
|
@@ -144,25 +127,18 @@ export class ModelsTreeVisibilityHandler {
|
|
|
144
127
|
if (ModelsTreeNode.isModelNode(node)) {
|
|
145
128
|
return this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), on });
|
|
146
129
|
}
|
|
147
|
-
const modelId = ModelsTreeNode.getModelId(node);
|
|
148
|
-
if (!modelId) {
|
|
149
|
-
return EMPTY;
|
|
150
|
-
}
|
|
151
130
|
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
152
131
|
return this.#visibilityHelper.changeCategoriesVisibilityStatus({
|
|
153
132
|
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
154
|
-
modelId,
|
|
133
|
+
modelId: node.extendedData.modelIds[0],
|
|
155
134
|
on,
|
|
156
135
|
});
|
|
157
136
|
}
|
|
158
|
-
|
|
159
|
-
if (!categoryId) {
|
|
160
|
-
return EMPTY;
|
|
161
|
-
}
|
|
137
|
+
assert(ModelsTreeNode.isElementNode(node));
|
|
162
138
|
return this.#visibilityHelper.changeElementsVisibilityStatus({
|
|
163
139
|
elementIds: node.key.instanceKeys.map(({ id }) => id),
|
|
164
|
-
modelId,
|
|
165
|
-
categoryId,
|
|
140
|
+
modelId: node.extendedData.modelId,
|
|
141
|
+
categoryId: node.extendedData.categoryId,
|
|
166
142
|
on,
|
|
167
143
|
});
|
|
168
144
|
});
|
|
@@ -228,13 +204,6 @@ export class ModelsTreeVisibilityHandler {
|
|
|
228
204
|
return from(models).pipe(mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)), map((subModels) => ({ id, subModels })));
|
|
229
205
|
}));
|
|
230
206
|
}
|
|
231
|
-
getGroupingNodeInfo(node) {
|
|
232
|
-
const modelId = ModelsTreeNode.getModelId(node);
|
|
233
|
-
const categoryId = ModelsTreeNode.getCategoryId(node);
|
|
234
|
-
assert(!!modelId && !!categoryId);
|
|
235
|
-
const elementIds = node.groupedInstanceKeys.map((key) => key.id);
|
|
236
|
-
return { modelId, categoryId, elementIds };
|
|
237
|
-
}
|
|
238
207
|
}
|
|
239
208
|
/**
|
|
240
209
|
* Creates models tree visibility handler. Is used by integration and performance tests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/models-tree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xC,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,mBAAmB,CAAC,IAA2B;QACrD,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;QAElC,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;IAC7C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,iCAAiC,CAAC,KAMjD;IACC,OAAO,IAAI,8BAA8B,CAA0B;QACjE,oBAAoB,EAAE,GAAoE,EAAE;YAC1F,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBACvB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,6BAA6B,CAAC;gBACnC,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;aACjC,CAAC,CAAC;QACL,CAAC;QACD,gCAAgC,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE;YAC1D,OAAO,IAAI,2BAA2B,CAAC;gBACrC,8BAA8B,EAAE,IAAI;gBACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,eAAe;gBACf,SAAS,EAAE,KAAK,CAAC,SAAS;aAC3B,CAAC,CAAC;QACL,CAAC;QACD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;KAChC,CAAC,CAAC;AACL,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 { concat, defer, EMPTY, from, map, merge, mergeMap, of } from \"rxjs\";\nimport { assert, Guid, Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { HierarchyVisibilityHandlerImpl } from \"../../../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { fromWithRelease } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ModelsTreeNode } from \"../ModelsTreeNode.js\";\nimport { ModelsTreeVisibilityHelper } from \"./ModelsTreeVisibilityHelper.js\";\nimport { createModelsSearchResultsTree } from \"./SearchResultsTree.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg } from \"@itwin/core-bentley\";\nimport type { GroupingHierarchyNode, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { SearchResultsTree } from \"../../../common/internal/visibility/BaseSearchResultsTree.js\";\nimport type {\n BaseIdsCache,\n BaseTreeVisibilityHandlerOverrides,\n TreeSpecificVisibilityHandler,\n} from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type {\n HierarchyVisibilityHandlerOverridableMethod,\n HierarchyVisibilityOverrideHandler,\n VisibilityStatus,\n} from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ModelsTreeIdsCache } from \"../ModelsTreeIdsCache.js\";\nimport type { ModelsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/**\n * Functionality of Models tree visibility handler that can be overridden.\n * Each callback is provided original implementation and reference to a `HierarchyVisibilityHandler`.\n * @beta\n */\nexport interface ModelsTreeVisibilityHandlerOverrides extends BaseTreeVisibilityHandlerOverrides {\n getSubjectsVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { subjectIds: Id64Arg }) => Promise<VisibilityStatus>>;\n getElementGroupingNodeVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { node: GroupingHierarchyNode }) => Promise<VisibilityStatus>>;\n\n changeSubjectsVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { subjectIds: Id64Arg; on: boolean }) => Promise<void>>;\n changeElementGroupingNodeVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<\n (props: { node: GroupingHierarchyNode; on: boolean }) => Promise<void>\n >;\n}\n\n/** @internal */\nexport interface ModelsTreeVisibilityHandlerProps {\n idsCache: ModelsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n overrideHandler: HierarchyVisibilityOverrideHandler;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n}\n\n/**\n * Handles visibility status of models tree nodes.\n *\n * It knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ModelsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ModelsTreeSearchTargets> {\n #visibilityHelper: ModelsTreeVisibilityHelper;\n readonly #props: ModelsTreeVisibilityHandlerProps;\n\n constructor(constructorProps: ModelsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n // Remove after https://github.com/iTwin/viewer-components-react/issues/1421.\n // We won't need to create a custom base ids cache.\n const baseIdsCache: BaseIdsCache = {\n getCategories: (props) => this.getCategories(props),\n getElementsCount: (props) => this.getElementsCount(props),\n getModels: (props) => this.getModels(props),\n getSubCategories: (props) => this.getSubCategories(props),\n getSubModels: (props) => this.getSubModels(props),\n hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),\n getAllCategories: () => this.getAllCategories(),\n };\n this.#visibilityHelper = new ModelsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n overrideHandler: this.#props.overrideHandler,\n baseIdsCache,\n overrides: this.#props.overrides,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ModelsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { subjectIds, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (subjectIds?.size) {\n observables.push(this.#visibilityHelper.changeSubjectsVisibilityStatus({ subjectIds, on }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds, on }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n on,\n }),\n ),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n const result = this.#visibilityHelper.getGroupedElementsVisibilityStatus({\n categoryId: nodeInfo.categoryId,\n modelId: nodeInfo.modelId,\n elementIds: nodeInfo.elementIds,\n });\n return this.#props.overrideHandler.createVisibilityHandlerResult({\n overrideProps: { node },\n nonOverriddenResult: result,\n override: this.#props.overrides?.getElementGroupingNodeVisibilityStatus,\n });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (ModelsTreeNode.isSubjectNode(node)) {\n // note: subject nodes may be merged to represent multiple subject instances\n return this.#visibilityHelper.getSubjectsVisibilityStatus({ subjectIds: node.key.instanceKeys.map((key) => key.id) });\n }\n\n if (ModelsTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.getModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), type: \"GeometricModel3d\" });\n }\n\n const modelId = ModelsTreeNode.getModelId(node);\n if (!modelId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (ModelsTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n type: \"SpatialCategory\",\n });\n }\n\n const categoryId = ModelsTreeNode.getCategoryId(node);\n if (!categoryId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n categoryId,\n type: \"GeometricElement3d\",\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n const result = this.#visibilityHelper.changeGroupedElementsVisibilityStatus({\n categoryId: nodeInfo.categoryId,\n modelId: nodeInfo.modelId,\n elementIds: nodeInfo.elementIds,\n on,\n });\n return this.#props.overrideHandler.createVisibilityHandlerResult({\n overrideProps: { node, on },\n nonOverriddenResult: result,\n override: this.#props.overrides?.changeElementGroupingNodeVisibilityStatus,\n });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return EMPTY;\n }\n\n if (ModelsTreeNode.isSubjectNode(node)) {\n return this.#visibilityHelper.changeSubjectsVisibilityStatus({\n subjectIds: node.key.instanceKeys.map((key) => key.id),\n on,\n });\n }\n\n if (ModelsTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), on });\n }\n\n const modelId = ModelsTreeNode.getModelId(node);\n if (!modelId) {\n return EMPTY;\n }\n\n if (ModelsTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n on,\n });\n }\n\n const categoryId = ModelsTreeNode.getCategoryId(node);\n if (!categoryId) {\n return EMPTY;\n }\n\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n categoryId,\n on,\n });\n });\n\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ModelsTreeSearchTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { subjectIds, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (subjectIds?.size) {\n observables.push(this.#visibilityHelper.getSubjectsVisibilityStatus({ subjectIds }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds, type: \"GeometricModel3d\" }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n type: \"SpatialCategory\",\n }),\n ),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: \"GeometricElement3d\" }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n }).pipe(mergeVisibilityStatuses);\n }\n\n private getCategories(props: Parameters<BaseIdsCache[\"getCategories\"]>[0]): ReturnType<BaseIdsCache[\"getCategories\"]> {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => this.#props.idsCache.getModelCategoryIds(modelId).pipe(map((categoryIds) => ({ id: modelId, spatialCategories: categoryIds })))),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(map((categories) => ({ spatialCategories: categories })));\n }\n\n private getElementsCount(props: Parameters<BaseIdsCache[\"getElementsCount\"]>[0]): ReturnType<BaseIdsCache[\"getElementsCount\"]> {\n return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);\n }\n\n private getModels(props: Parameters<BaseIdsCache[\"getModels\"]>[0]): ReturnType<BaseIdsCache[\"getModels\"]> {\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds);\n }\n\n private getSubCategories(props: Parameters<BaseIdsCache[\"getSubCategories\"]>[0]): ReturnType<BaseIdsCache[\"getSubCategories\"]> {\n return this.#props.idsCache.getSubCategories(props.categoryId);\n }\n\n private getSubModels(props: Parameters<BaseIdsCache[\"getSubModels\"]>[0]): ReturnType<BaseIdsCache[\"getSubModels\"]> {\n if (\"modelIds\" in props) {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => {\n if (props.categoryId) {\n return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));\n }\n return this.#props.idsCache.getModelCategoryIds(modelId).pipe(\n mergeMap((categoryIds) => this.#props.idsCache.getCategoriesModeledElements(modelId, categoryIds)),\n map((subModels) => ({ id: modelId, subModels })),\n );\n }),\n );\n }\n\n if (props.modelId) {\n return from(Id64.iterable(props.categoryIds)).pipe(\n mergeMap((categoryId) =>\n this.#props.idsCache.getCategoriesModeledElements(props.modelId!, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels }))),\n ),\n );\n }\n\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds).pipe(\n mergeMap(({ id, models }) => {\n if (!models) {\n return of({ id, subModels: undefined });\n }\n return from(models).pipe(\n mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)),\n map((subModels) => ({ id, subModels })),\n );\n }),\n );\n }\n\n private getGroupingNodeInfo(node: GroupingHierarchyNode) {\n const modelId = ModelsTreeNode.getModelId(node);\n const categoryId = ModelsTreeNode.getCategoryId(node);\n assert(!!modelId && !!categoryId);\n\n const elementIds = node.groupedInstanceKeys.map((key) => key.id);\n return { modelId, categoryId, elementIds };\n }\n}\n\n/**\n * Creates models tree visibility handler. Is used by integration and performance tests.\n * @internal\n */\nexport function createModelsTreeVisibilityHandler(props: {\n viewport: TreeWidgetViewport;\n idsCache: ModelsTreeIdsCache;\n imodelAccess: ECClassHierarchyInspector;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n searchPaths?: HierarchySearchPath[];\n}) {\n return new HierarchyVisibilityHandlerImpl<ModelsTreeSearchTargets>({\n getSearchResultsTree: (): undefined | Promise<SearchResultsTree<ModelsTreeSearchTargets>> => {\n if (!props.searchPaths) {\n return undefined;\n }\n return createModelsSearchResultsTree({\n searchPaths: props.searchPaths,\n imodelAccess: props.imodelAccess,\n });\n },\n getTreeSpecificVisibilityHandler: (info, overrideHandler) => {\n return new ModelsTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache: props.idsCache,\n viewport: props.viewport,\n overrideHandler,\n overrides: props.overrides,\n });\n },\n viewport: props.viewport,\n componentId: Guid.createValue(),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModelsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAA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K,CAAC,QAAQ;QACxB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;KAChC,CAAC,CAAC;AACL,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 { concat, defer, from, map, merge, mergeMap, of } from \"rxjs\";\nimport { assert, Guid, Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyVisibilityHandlerImpl } from \"../../../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { fromWithRelease } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ModelsTreeNode } from \"../../ModelsTreeNode.js\";\nimport { ModelsTreeVisibilityHelper } from \"./ModelsTreeVisibilityHelper.js\";\nimport { createModelsSearchResultsTree } from \"./SearchResultsTree.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg } from \"@itwin/core-bentley\";\nimport type { GroupingHierarchyNode, HierarchyNode, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { SearchResultsTree } from \"../../../common/internal/visibility/BaseSearchResultsTree.js\";\nimport type {\n BaseIdsCache,\n BaseTreeVisibilityHandlerOverrides,\n TreeSpecificVisibilityHandler,\n} from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type {\n HierarchyVisibilityHandlerOverridableMethod,\n HierarchyVisibilityOverrideHandler,\n VisibilityStatus,\n} from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ModelsTreeIdsCache } from \"../ModelsTreeIdsCache.js\";\nimport type { ModelsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/**\n * Functionality of Models tree visibility handler that can be overridden.\n * Each callback is provided original implementation and reference to a `HierarchyVisibilityHandler`.\n * @beta\n */\nexport interface ModelsTreeVisibilityHandlerOverrides extends BaseTreeVisibilityHandlerOverrides {\n getSubjectsVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { subjectIds: Id64Arg }) => Promise<VisibilityStatus>>;\n getElementGroupingNodeVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { node: GroupingHierarchyNode }) => Promise<VisibilityStatus>>;\n\n changeSubjectsVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: { subjectIds: Id64Arg; on: boolean }) => Promise<void>>;\n changeElementGroupingNodeVisibilityStatus?: HierarchyVisibilityHandlerOverridableMethod<\n (props: { node: GroupingHierarchyNode; on: boolean }) => Promise<void>\n >;\n}\n\n/** @internal */\nexport interface ModelsTreeVisibilityHandlerProps {\n idsCache: ModelsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n overrideHandler: HierarchyVisibilityOverrideHandler;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n}\n\n/**\n * Handles visibility status of models tree nodes.\n *\n * It knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ModelsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ModelsTreeSearchTargets> {\n #visibilityHelper: ModelsTreeVisibilityHelper;\n readonly #props: ModelsTreeVisibilityHandlerProps;\n\n constructor(constructorProps: ModelsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n // Remove after https://github.com/iTwin/viewer-components-react/issues/1421.\n // We won't need to create a custom base ids cache.\n const baseIdsCache: BaseIdsCache = {\n getCategories: (props) => this.getCategories(props),\n getElementsCount: (props) => this.getElementsCount(props),\n getModels: (props) => this.getModels(props),\n getSubCategories: (props) => this.getSubCategories(props),\n getSubModels: (props) => this.getSubModels(props),\n hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),\n getAllCategories: () => this.getAllCategories(),\n };\n this.#visibilityHelper = new ModelsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n overrideHandler: this.#props.overrideHandler,\n baseIdsCache,\n overrides: this.#props.overrides,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ModelsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { subjectIds, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (subjectIds?.size) {\n observables.push(this.#visibilityHelper.changeSubjectsVisibilityStatus({ subjectIds, on }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds, on }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n on,\n }),\n ),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (ModelsTreeNode.isElementClassGroupingNode(node)) {\n const result = this.#visibilityHelper.getGroupedElementsVisibilityStatus({\n categoryId: node.extendedData.categoryId,\n modelId: node.extendedData.modelId,\n elementIds: node.groupedInstanceKeys.map((key) => key.id),\n });\n return this.#props.overrideHandler.createVisibilityHandlerResult({\n overrideProps: { node },\n nonOverriddenResult: result,\n override: this.#props.overrides?.getElementGroupingNodeVisibilityStatus,\n });\n }\n\n if (ModelsTreeNode.isSubjectNode(node)) {\n // note: subject nodes may be merged to represent multiple subject instances\n return this.#visibilityHelper.getSubjectsVisibilityStatus({ subjectIds: node.key.instanceKeys.map((key) => key.id) });\n }\n\n if (ModelsTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.getModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), type: \"GeometricModel3d\" });\n }\n\n if (ModelsTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: node.extendedData.modelIds[0],\n type: \"SpatialCategory\",\n });\n }\n\n assert(ModelsTreeNode.isElementNode(node));\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n type: \"GeometricElement3d\",\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (ModelsTreeNode.isElementClassGroupingNode(node)) {\n const result = this.#visibilityHelper.changeGroupedElementsVisibilityStatus({\n categoryId: node.extendedData.categoryId,\n modelId: node.extendedData.modelId,\n elementIds: node.groupedInstanceKeys.map((key) => key.id),\n on,\n });\n return this.#props.overrideHandler.createVisibilityHandlerResult({\n overrideProps: { node, on },\n nonOverriddenResult: result,\n override: this.#props.overrides?.changeElementGroupingNodeVisibilityStatus,\n });\n }\n\n if (ModelsTreeNode.isSubjectNode(node)) {\n return this.#visibilityHelper.changeSubjectsVisibilityStatus({\n subjectIds: node.key.instanceKeys.map((key) => key.id),\n on,\n });\n }\n\n if (ModelsTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id), on });\n }\n\n if (ModelsTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: node.extendedData.modelIds[0],\n on,\n });\n }\n\n assert(ModelsTreeNode.isElementNode(node));\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n on,\n });\n });\n\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ModelsTreeSearchTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { subjectIds, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (subjectIds?.size) {\n observables.push(this.#visibilityHelper.getSubjectsVisibilityStatus({ subjectIds }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds, type: \"GeometricModel3d\" }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n type: \"SpatialCategory\",\n }),\n ),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: \"GeometricElement3d\" }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n }).pipe(mergeVisibilityStatuses);\n }\n\n private getCategories(props: Parameters<BaseIdsCache[\"getCategories\"]>[0]): ReturnType<BaseIdsCache[\"getCategories\"]> {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => this.#props.idsCache.getModelCategoryIds(modelId).pipe(map((categoryIds) => ({ id: modelId, spatialCategories: categoryIds })))),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(map((categories) => ({ spatialCategories: categories })));\n }\n\n private getElementsCount(props: Parameters<BaseIdsCache[\"getElementsCount\"]>[0]): ReturnType<BaseIdsCache[\"getElementsCount\"]> {\n return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);\n }\n\n private getModels(props: Parameters<BaseIdsCache[\"getModels\"]>[0]): ReturnType<BaseIdsCache[\"getModels\"]> {\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds);\n }\n\n private getSubCategories(props: Parameters<BaseIdsCache[\"getSubCategories\"]>[0]): ReturnType<BaseIdsCache[\"getSubCategories\"]> {\n return this.#props.idsCache.getSubCategories(props.categoryId);\n }\n\n private getSubModels(props: Parameters<BaseIdsCache[\"getSubModels\"]>[0]): ReturnType<BaseIdsCache[\"getSubModels\"]> {\n if (\"modelIds\" in props) {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => {\n if (props.categoryId) {\n return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));\n }\n return this.#props.idsCache.getModelCategoryIds(modelId).pipe(\n mergeMap((categoryIds) => this.#props.idsCache.getCategoriesModeledElements(modelId, categoryIds)),\n map((subModels) => ({ id: modelId, subModels })),\n );\n }),\n );\n }\n\n if (props.modelId) {\n return from(Id64.iterable(props.categoryIds)).pipe(\n mergeMap((categoryId) =>\n this.#props.idsCache.getCategoriesModeledElements(props.modelId!, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels }))),\n ),\n );\n }\n\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds).pipe(\n mergeMap(({ id, models }) => {\n if (!models) {\n return of({ id, subModels: undefined });\n }\n return from(models).pipe(\n mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)),\n map((subModels) => ({ id, subModels })),\n );\n }),\n );\n }\n}\n\n/**\n * Creates models tree visibility handler. Is used by integration and performance tests.\n * @internal\n */\nexport function createModelsTreeVisibilityHandler(props: {\n viewport: TreeWidgetViewport;\n idsCache: ModelsTreeIdsCache;\n imodelAccess: ECClassHierarchyInspector;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n searchPaths?: HierarchySearchPath[];\n}) {\n return new HierarchyVisibilityHandlerImpl<ModelsTreeSearchTargets>({\n getSearchResultsTree: (): undefined | Promise<SearchResultsTree<ModelsTreeSearchTargets>> => {\n if (!props.searchPaths) {\n return undefined;\n }\n return createModelsSearchResultsTree({\n searchPaths: props.searchPaths,\n imodelAccess: props.imodelAccess,\n });\n },\n getTreeSpecificVisibilityHandler: (info, overrideHandler) => {\n return new ModelsTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache: props.idsCache,\n viewport: props.viewport,\n overrideHandler,\n overrides: props.overrides,\n });\n },\n viewport: props.viewport,\n componentId: Guid.createValue(),\n });\n}\n"]}
|
|
@@ -5,7 +5,6 @@ export { createModelsTreeVisibilityHandler } from "./tree-widget-react/component
|
|
|
5
5
|
export { CategoriesTreeDefinition, defaultHierarchyConfiguration as defaultCategoriesTreeHierarchyConfiguration, } from "./tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js";
|
|
6
6
|
export { CategoriesTreeIdsCache } from "./tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js";
|
|
7
7
|
export { createCategoriesTreeVisibilityHandler } from "./tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js";
|
|
8
|
-
export { CategoriesTreeNode } from "./tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js";
|
|
9
8
|
export { ClassificationsTreeDefinition } from "./tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js";
|
|
10
9
|
export { ClassificationsTreeIdsCache } from "./tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js";
|
|
11
10
|
export { releaseMainThreadOnItemsCount } from "./tree-widget-react/components/trees/common/internal/Utils.js";
|
|
@@ -11,7 +11,6 @@ export { createModelsTreeVisibilityHandler } from "./tree-widget-react/component
|
|
|
11
11
|
export { CategoriesTreeDefinition, defaultHierarchyConfiguration as defaultCategoriesTreeHierarchyConfiguration, } from "./tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js";
|
|
12
12
|
export { CategoriesTreeIdsCache } from "./tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js";
|
|
13
13
|
export { createCategoriesTreeVisibilityHandler } from "./tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js";
|
|
14
|
-
export { CategoriesTreeNode } from "./tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js";
|
|
15
14
|
export { ClassificationsTreeDefinition } from "./tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js";
|
|
16
15
|
export { ClassificationsTreeIdsCache } from "./tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js";
|
|
17
16
|
export { releaseMainThreadOnItemsCount } from "./tree-widget-react/components/trees/common/internal/Utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-widget-react-internal.js","sourceRoot":"","sources":["../../src/tree-widget-react-internal.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,6IAA6I;AAC7I,qHAAqH;AAErH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAEtG,OAAO,EACL,oBAAoB,EACpB,6BAA6B,IAAI,uCAAuC,GACzE,MAAM,0EAA0E,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iFAAiF,CAAC;AACrH,OAAO,EAAE,iCAAiC,EAAE,MAAM,qGAAqG,CAAC;AAExJ,OAAO,EACL,wBAAwB,EACxB,6BAA6B,IAAI,2CAA2C,GAC7E,MAAM,kFAAkF,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,yFAAyF,CAAC;AACjI,OAAO,EAAE,qCAAqC,EAAE,MAAM,6GAA6G,CAAC;
|
|
1
|
+
{"version":3,"file":"tree-widget-react-internal.js","sourceRoot":"","sources":["../../src/tree-widget-react-internal.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,6IAA6I;AAC7I,qHAAqH;AAErH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAEtG,OAAO,EACL,oBAAoB,EACpB,6BAA6B,IAAI,uCAAuC,GACzE,MAAM,0EAA0E,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iFAAiF,CAAC;AACrH,OAAO,EAAE,iCAAiC,EAAE,MAAM,qGAAqG,CAAC;AAExJ,OAAO,EACL,wBAAwB,EACxB,6BAA6B,IAAI,2CAA2C,GAC7E,MAAM,kFAAkF,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,yFAAyF,CAAC;AACjI,OAAO,EAAE,qCAAqC,EAAE,MAAM,6GAA6G,CAAC;AAEpK,OAAO,EAAE,6BAA6B,EAAE,MAAM,4FAA4F,CAAC;AAC3I,OAAO,EAAE,2BAA2B,EAAE,MAAM,mGAAmG,CAAC;AAChJ,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,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\n// WARNING: This barrel file exports internal APIs only for use by `@itwin/presentation-backend` and `@itwin/presentation-frontend` packages.\n// They should not be used outside of these packages. These APIs may be broken or removed at any time without notice.\n\nexport { toVoidPromise, collect } from \"./tree-widget-react/components/trees/common/internal/Rxjs.js\";\n\nexport {\n ModelsTreeDefinition,\n defaultHierarchyConfiguration as defaultModelsTreeHierarchyConfiguration,\n} from \"./tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js\";\nexport { ModelsTreeIdsCache } from \"./tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js\";\nexport { createModelsTreeVisibilityHandler } from \"./tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js\";\n\nexport {\n CategoriesTreeDefinition,\n defaultHierarchyConfiguration as defaultCategoriesTreeHierarchyConfiguration,\n} from \"./tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js\";\nexport { CategoriesTreeIdsCache } from \"./tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js\";\nexport { createCategoriesTreeVisibilityHandler } from \"./tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js\";\n\nexport { ClassificationsTreeDefinition } from \"./tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js\";\nexport { ClassificationsTreeIdsCache } from \"./tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js\";\nexport { releaseMainThreadOnItemsCount } from \"./tree-widget-react/components/trees/common/internal/Utils.js\";\n"]}
|
package/package.json
CHANGED
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Id64String } from "@itwin/core-bentley";
|
|
2
|
-
import type { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
3
|
-
interface CategoriesTreeNode {
|
|
4
|
-
key: HierarchyNodeKey;
|
|
5
|
-
extendedData?: {
|
|
6
|
-
[id: string]: any;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/** @internal */
|
|
10
|
-
export declare namespace CategoriesTreeNode {
|
|
11
|
-
/**
|
|
12
|
-
* Determines if node represents a definition container.
|
|
13
|
-
*/
|
|
14
|
-
const isDefinitionContainerNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Determines if node represents a category.
|
|
17
|
-
*/
|
|
18
|
-
const isCategoryNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Determines if node represents a model.
|
|
21
|
-
*/
|
|
22
|
-
const isModelNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Determines if node represents an element.
|
|
25
|
-
*/
|
|
26
|
-
const isElementNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Determines if node represents a sub-category.
|
|
29
|
-
*/
|
|
30
|
-
const isSubCategoryNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves model ID from node's extended data.
|
|
33
|
-
*/
|
|
34
|
-
const getModelId: (node: Pick<CategoriesTreeNode, "extendedData">) => Id64String | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves category ID from node's extended data.
|
|
37
|
-
*/
|
|
38
|
-
const getCategoryId: (node: Pick<CategoriesTreeNode, "extendedData">) => Id64String | undefined;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=CategoriesTreeNode.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
/** @internal */
|
|
6
|
-
export var CategoriesTreeNode;
|
|
7
|
-
(function (CategoriesTreeNode) {
|
|
8
|
-
/**
|
|
9
|
-
* Determines if node represents a definition container.
|
|
10
|
-
*/
|
|
11
|
-
CategoriesTreeNode.isDefinitionContainerNode = (node) => node.extendedData && "isDefinitionContainer" in node.extendedData && !!node.extendedData.isDefinitionContainer;
|
|
12
|
-
/**
|
|
13
|
-
* Determines if node represents a category.
|
|
14
|
-
*/
|
|
15
|
-
CategoriesTreeNode.isCategoryNode = (node) => node.extendedData && "isCategory" in node.extendedData && !!node.extendedData.isCategory;
|
|
16
|
-
/**
|
|
17
|
-
* Determines if node represents a model.
|
|
18
|
-
*/
|
|
19
|
-
CategoriesTreeNode.isModelNode = (node) => node.extendedData && "isModel" in node.extendedData && !!node.extendedData.isModel;
|
|
20
|
-
/**
|
|
21
|
-
* Determines if node represents an element.
|
|
22
|
-
*/
|
|
23
|
-
CategoriesTreeNode.isElementNode = (node) => node.extendedData && "isElement" in node.extendedData && !!node.extendedData.isElement;
|
|
24
|
-
/**
|
|
25
|
-
* Determines if node represents a sub-category.
|
|
26
|
-
*/
|
|
27
|
-
CategoriesTreeNode.isSubCategoryNode = (node) => node.extendedData && "isSubCategory" in node.extendedData && !!node.extendedData.isSubCategory;
|
|
28
|
-
/**
|
|
29
|
-
* Retrieves model ID from node's extended data.
|
|
30
|
-
*/
|
|
31
|
-
CategoriesTreeNode.getModelId = (node) => {
|
|
32
|
-
// Elements have modelId property set
|
|
33
|
-
if (node.extendedData?.modelId) {
|
|
34
|
-
return node.extendedData?.modelId;
|
|
35
|
-
}
|
|
36
|
-
// This is for categories:
|
|
37
|
-
// a) If category is at root, then it won't have 'modelId' or 'modelIds' set - it will return undefined;
|
|
38
|
-
// b) If category is under subModel then it will have 'modelIds' set just like in models tree.
|
|
39
|
-
const modelIds = node.extendedData?.modelIds?.[0];
|
|
40
|
-
return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves category ID from node's extended data.
|
|
44
|
-
*/
|
|
45
|
-
CategoriesTreeNode.getCategoryId = (node) => {
|
|
46
|
-
// Elements have categoryId property set
|
|
47
|
-
return node.extendedData?.categoryId;
|
|
48
|
-
};
|
|
49
|
-
})(CategoriesTreeNode || (CategoriesTreeNode = {}));
|
|
50
|
-
//# sourceMappingURL=CategoriesTreeNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAUhG,gBAAgB;AAChB,MAAM,KAAW,kBAAkB,CAsDlC;AAtDD,WAAiB,kBAAkB;IACjC;;OAEG;IACU,4CAAyB,GAAG,CAAC,IAA8C,EAAE,EAAE,CAC1F,IAAI,CAAC,YAAY,IAAI,uBAAuB,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC;IAEjH;;OAEG;IACU,iCAAc,GAAG,CAAC,IAA8C,EAAE,EAAE,CAC/E,IAAI,CAAC,YAAY,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IAE3F;;OAEG;IACU,8BAAW,GAAG,CAAC,IAA8C,EAAE,EAAE,CAC5E,IAAI,CAAC,YAAY,IAAI,SAAS,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAErF;;OAEG;IACU,gCAAa,GAAG,CAAC,IAA8C,EAAE,EAAE,CAC9E,IAAI,CAAC,YAAY,IAAI,WAAW,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;IAEzF;;OAEG;IACU,oCAAiB,GAAG,CAAC,IAA8C,EAAE,EAAE,CAClF,IAAI,CAAC,YAAY,IAAI,eAAe,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;IAEjG;;OAEG;IACU,6BAAU,GAAG,CAAC,IAA8C,EAA0B,EAAE;QACnG,qCAAqC;QACrC,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;QACpC,CAAC;QAED,0BAA0B;QAC1B,wGAAwG;QACxG,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAClD,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF;;OAEG;IACU,gCAAa,GAAG,CAAC,IAA8C,EAA0B,EAAE;QACtG,wCAAwC;QACxC,OAAO,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC,EAtDgB,kBAAkB,KAAlB,kBAAkB,QAsDlC","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 type { Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\ninterface CategoriesTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/** @internal */\nexport namespace CategoriesTreeNode {\n /**\n * Determines if node represents a definition container.\n */\n export const isDefinitionContainerNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isDefinitionContainer\" in node.extendedData && !!node.extendedData.isDefinitionContainer;\n\n /**\n * Determines if node represents a category.\n */\n export const isCategoryNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isCategory\" in node.extendedData && !!node.extendedData.isCategory;\n\n /**\n * Determines if node represents a model.\n */\n export const isModelNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isModel\" in node.extendedData && !!node.extendedData.isModel;\n\n /**\n * Determines if node represents an element.\n */\n export const isElementNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isElement\" in node.extendedData && !!node.extendedData.isElement;\n\n /**\n * Determines if node represents a sub-category.\n */\n export const isSubCategoryNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isSubCategory\" in node.extendedData && !!node.extendedData.isSubCategory;\n\n /**\n * Retrieves model ID from node's extended data.\n */\n export const getModelId = (node: Pick<CategoriesTreeNode, \"extendedData\">): Id64String | undefined => {\n // Elements have modelId property set\n if (node.extendedData?.modelId) {\n return node.extendedData?.modelId;\n }\n\n // This is for categories:\n // a) If category is at root, then it won't have 'modelId' or 'modelIds' set - it will return undefined;\n // b) If category is under subModel then it will have 'modelIds' set just like in models tree.\n const modelIds = node.extendedData?.modelIds?.[0];\n return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);\n };\n\n /**\n * Retrieves category ID from node's extended data.\n */\n export const getCategoryId = (node: Pick<CategoriesTreeNode, \"extendedData\">): Id64String | undefined => {\n // Elements have categoryId property set\n return node.extendedData?.categoryId;\n };\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Id64Array, Id64String } from "@itwin/core-bentley";
|
|
2
|
-
import type { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
3
|
-
interface ClassificationsTreeNode {
|
|
4
|
-
key: HierarchyNodeKey;
|
|
5
|
-
extendedData?: {
|
|
6
|
-
[id: string]: any;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/** @internal */
|
|
10
|
-
export declare namespace ClassificationsTreeNode {
|
|
11
|
-
const isClassificationTableNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
12
|
-
const isClassificationNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
13
|
-
const isGeometricElementNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
14
|
-
const getClassificationIds: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64Array;
|
|
15
|
-
const getModelId: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64String;
|
|
16
|
-
const getCategoryId: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64String;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=ClassificationsTreeNode.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
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 { assert } from "@itwin/core-bentley";
|
|
6
|
-
import { parseIdsSelectorResult } from "../../common/internal/Utils.js";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export var ClassificationsTreeNode;
|
|
9
|
-
(function (ClassificationsTreeNode) {
|
|
10
|
-
ClassificationsTreeNode.isClassificationTableNode = (node) => getNodeType(node) === "ClassificationTable";
|
|
11
|
-
ClassificationsTreeNode.isClassificationNode = (node) => getNodeType(node) === "Classification";
|
|
12
|
-
ClassificationsTreeNode.isGeometricElementNode = (node) => {
|
|
13
|
-
const type = getNodeType(node);
|
|
14
|
-
return type === "GeometricElement3d" || type === "GeometricElement2d";
|
|
15
|
-
};
|
|
16
|
-
ClassificationsTreeNode.getClassificationIds = (node) => {
|
|
17
|
-
assert(!!node.extendedData && "classificationIds" in node.extendedData);
|
|
18
|
-
return parseIdsSelectorResult(node.extendedData.classificationIds);
|
|
19
|
-
};
|
|
20
|
-
ClassificationsTreeNode.getModelId = (node) => {
|
|
21
|
-
assert(typeof node.extendedData?.modelId === "string");
|
|
22
|
-
return node.extendedData.modelId;
|
|
23
|
-
};
|
|
24
|
-
ClassificationsTreeNode.getCategoryId = (node) => {
|
|
25
|
-
assert(typeof node.extendedData?.categoryId === "string");
|
|
26
|
-
return node.extendedData.categoryId;
|
|
27
|
-
};
|
|
28
|
-
})(ClassificationsTreeNode || (ClassificationsTreeNode = {}));
|
|
29
|
-
function getNodeType(node) {
|
|
30
|
-
return node.extendedData && "type" in node.extendedData ? node.extendedData.type : undefined;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ClassificationsTreeNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationsTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAUxE,gBAAgB;AAChB,MAAM,KAAW,uBAAuB,CAwBvC;AAxBD,WAAiB,uBAAuB;IACzB,iDAAyB,GAAG,CAAC,IAAmD,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,qBAAqB,CAAC;IAEjI,4CAAoB,GAAG,CAAC,IAAmD,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,gBAAgB,CAAC;IAEvH,8CAAsB,GAAG,CAAC,IAAmD,EAAE,EAAE;QAC5F,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,KAAK,oBAAoB,IAAI,IAAI,KAAK,oBAAoB,CAAC;IACxE,CAAC,CAAC;IAEW,4CAAoB,GAAG,CAAC,IAAmD,EAAa,EAAE;QACrG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,mBAAmB,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QACxE,OAAO,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC,CAAC;IAEW,kCAAU,GAAG,CAAC,IAAmD,EAAc,EAAE;QAC5F,MAAM,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IACnC,CAAC,CAAC;IAEW,qCAAa,GAAG,CAAC,IAAmD,EAAc,EAAE;QAC/F,MAAM,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,EAxBgB,uBAAuB,KAAvB,uBAAuB,QAwBvC;AAED,SAAS,WAAW,CAAC,IAAmD;IACtE,OAAO,IAAI,CAAC,YAAY,IAAI,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/F,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 { assert } from \"@itwin/core-bentley\";\nimport { parseIdsSelectorResult } from \"../../common/internal/Utils.js\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\ninterface ClassificationsTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/** @internal */\nexport namespace ClassificationsTreeNode {\n export const isClassificationTableNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => getNodeType(node) === \"ClassificationTable\";\n\n export const isClassificationNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => getNodeType(node) === \"Classification\";\n\n export const isGeometricElementNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => {\n const type = getNodeType(node);\n return type === \"GeometricElement3d\" || type === \"GeometricElement2d\";\n };\n\n export const getClassificationIds = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64Array => {\n assert(!!node.extendedData && \"classificationIds\" in node.extendedData);\n return parseIdsSelectorResult(node.extendedData.classificationIds);\n };\n\n export const getModelId = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64String => {\n assert(typeof node.extendedData?.modelId === \"string\");\n return node.extendedData.modelId;\n };\n\n export const getCategoryId = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64String => {\n assert(typeof node.extendedData?.categoryId === \"string\");\n return node.extendedData.categoryId;\n };\n}\n\nfunction getNodeType(node: Pick<ClassificationsTreeNode, \"extendedData\">) {\n return node.extendedData && \"type\" in node.extendedData ? node.extendedData.type : undefined;\n}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
2
|
-
import type { Id64String } from "@itwin/core-bentley";
|
|
3
|
-
interface ModelsTreeNode {
|
|
4
|
-
key: HierarchyNodeKey;
|
|
5
|
-
extendedData?: {
|
|
6
|
-
[id: string]: any;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare namespace ModelsTreeNode {
|
|
13
|
-
/**
|
|
14
|
-
* Determines if a node represents a subject.
|
|
15
|
-
*/
|
|
16
|
-
const isSubjectNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Determines if a node represents a model.
|
|
19
|
-
*/
|
|
20
|
-
const isModelNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Determines if a node represents a category.
|
|
23
|
-
*/
|
|
24
|
-
const isCategoryNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
25
|
-
/** Returns type of the node. */
|
|
26
|
-
const getType: (node: ModelsTreeNode) => "subject" | "model" | "category" | "element" | "elements-class-group";
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves model ID from node's extended data.
|
|
29
|
-
*/
|
|
30
|
-
const getModelId: (node: Pick<ModelsTreeNode, "extendedData">) => Id64String | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves category ID from node's extended data.
|
|
33
|
-
*/
|
|
34
|
-
const getCategoryId: (node: Pick<ModelsTreeNode, "extendedData">) => Id64String | undefined;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=ModelsTreeNode.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
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 { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export var ModelsTreeNode;
|
|
10
|
-
(function (ModelsTreeNode) {
|
|
11
|
-
/**
|
|
12
|
-
* Determines if a node represents a subject.
|
|
13
|
-
*/
|
|
14
|
-
ModelsTreeNode.isSubjectNode = (node) => !!node.extendedData?.isSubject;
|
|
15
|
-
/**
|
|
16
|
-
* Determines if a node represents a model.
|
|
17
|
-
*/
|
|
18
|
-
ModelsTreeNode.isModelNode = (node) => !!node.extendedData?.isModel;
|
|
19
|
-
/**
|
|
20
|
-
* Determines if a node represents a category.
|
|
21
|
-
*/
|
|
22
|
-
ModelsTreeNode.isCategoryNode = (node) => !!node.extendedData?.isCategory;
|
|
23
|
-
/** Returns type of the node. */
|
|
24
|
-
ModelsTreeNode.getType = (node) => {
|
|
25
|
-
if (HierarchyNodeKey.isClassGrouping(node.key)) {
|
|
26
|
-
return "elements-class-group";
|
|
27
|
-
}
|
|
28
|
-
if (ModelsTreeNode.isSubjectNode(node)) {
|
|
29
|
-
return "subject";
|
|
30
|
-
}
|
|
31
|
-
if (ModelsTreeNode.isModelNode(node)) {
|
|
32
|
-
return "model";
|
|
33
|
-
}
|
|
34
|
-
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
35
|
-
return "category";
|
|
36
|
-
}
|
|
37
|
-
return "element";
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Retrieves model ID from node's extended data.
|
|
41
|
-
*/
|
|
42
|
-
ModelsTreeNode.getModelId = (node) => {
|
|
43
|
-
if (node.extendedData?.modelId) {
|
|
44
|
-
return node.extendedData?.modelId;
|
|
45
|
-
}
|
|
46
|
-
const modelIds = node.extendedData?.modelIds?.[0];
|
|
47
|
-
return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Retrieves category ID from node's extended data.
|
|
51
|
-
*/
|
|
52
|
-
ModelsTreeNode.getCategoryId = (node) => node.extendedData?.categoryId;
|
|
53
|
-
})(ModelsTreeNode || (ModelsTreeNode = {}));
|
|
54
|
-
//# sourceMappingURL=ModelsTreeNode.js.map
|
package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AASnE;;GAEG;AACH,MAAM,KAAW,cAAc,CAiD9B;AAjDD,WAAiB,cAAc;IAC7B;;OAEG;IACU,4BAAa,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAE5G;;OAEG;IACU,0BAAW,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;IAExG;;OAEG;IACU,6BAAc,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IAE9G,gCAAgC;IACnB,sBAAO,GAAG,CAAC,IAAoB,EAAyE,EAAE;QACrH,IAAI,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/C,OAAO,sBAAsB,CAAC;QAChC,CAAC;QACD,IAAI,eAAA,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,eAAA,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,eAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF;;OAEG;IACU,yBAAU,GAAG,CAAC,IAA0C,EAA0B,EAAE;QAC/F,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;QACpC,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAClD,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF;;OAEG;IACU,4BAAa,GAAG,CAAC,IAA0C,EAA0B,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;AACrI,CAAC,EAjDgB,cAAc,KAAd,cAAc,QAiD9B","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 { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\n\ninterface ModelsTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/**\n * @internal\n */\nexport namespace ModelsTreeNode {\n /**\n * Determines if a node represents a subject.\n */\n export const isSubjectNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isSubject;\n\n /**\n * Determines if a node represents a model.\n */\n export const isModelNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isModel;\n\n /**\n * Determines if a node represents a category.\n */\n export const isCategoryNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isCategory;\n\n /** Returns type of the node. */\n export const getType = (node: ModelsTreeNode): \"subject\" | \"model\" | \"category\" | \"element\" | \"elements-class-group\" => {\n if (HierarchyNodeKey.isClassGrouping(node.key)) {\n return \"elements-class-group\";\n }\n if (isSubjectNode(node)) {\n return \"subject\";\n }\n if (isModelNode(node)) {\n return \"model\";\n }\n if (isCategoryNode(node)) {\n return \"category\";\n }\n return \"element\";\n };\n\n /**\n * Retrieves model ID from node's extended data.\n */\n export const getModelId = (node: Pick<ModelsTreeNode, \"extendedData\">): Id64String | undefined => {\n if (node.extendedData?.modelId) {\n return node.extendedData?.modelId;\n }\n\n const modelIds = node.extendedData?.modelIds?.[0];\n return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);\n };\n\n /**\n * Retrieves category ID from node's extended data.\n */\n export const getCategoryId = (node: Pick<ModelsTreeNode, \"extendedData\">): Id64String | undefined => node.extendedData?.categoryId;\n}\n"]}
|