@itwin/tree-widget-react 3.16.1 → 3.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -2
- package/lib/cjs/tree-widget-react/components/SelectableTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/TreeSelector.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +13 -0
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +92 -74
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +3 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +21 -8
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +21 -9
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +300 -251
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +2 -0
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +66 -107
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +22 -12
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -2
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +3 -3
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/internal/Utils.d.ts +25 -0
- package/lib/cjs/tree-widget-react/components/trees/common/internal/Utils.js +83 -0
- package/lib/cjs/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -0
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +86 -28
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +2 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +5 -6
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js +5 -17
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +5 -4
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +7 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +52 -0
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +28 -12
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +382 -278
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +272 -139
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/cjs/tree-widget-react-internal.d.ts +2 -1
- package/lib/cjs/tree-widget-react-internal.js +4 -1
- package/lib/cjs/tree-widget-react-internal.js.map +1 -1
- package/lib/esm/tree-widget-react/components/SelectableTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeSelector.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeWithHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- 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.d.ts +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 +13 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +92 -74
- 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 +3 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +22 -9
- 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 +21 -9
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +301 -252
- 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/CategoriesVisibilityHandler.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +67 -108
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +23 -13
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- 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.d.ts +2 -2
- 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/TreeNodeCheckbox.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +3 -3
- 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.d.ts +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/Utils.d.ts +25 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +74 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- 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.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +83 -25
- 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 +2 -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/Utils.d.ts +5 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +4 -16
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +4 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +7 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +52 -0
- 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 +28 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +382 -278
- 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/ModelsTreeNode.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +257 -124
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react-internal.d.ts +2 -1
- package/lib/esm/tree-widget-react-internal.js +2 -1
- package/lib/esm/tree-widget-react-internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.CategoriesTreeIdsCache = void 0;
|
|
8
8
|
exports.getClassesByView = getClassesByView;
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
9
10
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
|
+
const Utils_js_1 = require("../../common/internal/Utils.js");
|
|
10
12
|
const ClassNameDefinitions_js_1 = require("./ClassNameDefinitions.js");
|
|
11
13
|
/** @internal */
|
|
12
14
|
class CategoriesTreeIdsCache {
|
|
@@ -31,311 +33,355 @@ class CategoriesTreeIdsCache {
|
|
|
31
33
|
this.#componentName = "CategoriesTreeIdsCache";
|
|
32
34
|
}
|
|
33
35
|
[Symbol.dispose]() { }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
36
|
+
queryElementModelCategories() {
|
|
37
|
+
return (0, rxjs_1.defer)(() => {
|
|
38
|
+
const query = `
|
|
39
|
+
SELECT this.Model.Id modelId, this.Category.Id categoryId
|
|
40
|
+
FROM ${this.#categoryModelClass} m
|
|
41
|
+
JOIN ${this.#categoryElementClass} this ON m.ECInstanceId = this.Model.Id
|
|
42
|
+
WHERE m.IsPrivate = false
|
|
43
|
+
GROUP BY modelId, categoryId
|
|
44
|
+
`;
|
|
45
|
+
return this.#queryExecutor.createQueryReader({ ecsql: query }, {
|
|
46
|
+
rowFormat: "ECSqlPropertyNames",
|
|
47
|
+
limit: "unbounded",
|
|
48
|
+
restartToken: `${this.#componentName}/${this.#componentId}/element-models-and-categories`,
|
|
49
|
+
});
|
|
50
|
+
}).pipe((0, rxjs_1.map)((row) => {
|
|
51
|
+
return { modelId: row.modelId, categoryId: row.categoryId };
|
|
52
|
+
}));
|
|
49
53
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
queryCategories() {
|
|
55
|
+
return this.getIsDefinitionContainerSupported().pipe((0, rxjs_1.mergeMap)((isDefinitionContainerSupported) => (0, rxjs_1.defer)(() => {
|
|
56
|
+
const categoriesQuery = `
|
|
57
|
+
SELECT
|
|
58
|
+
this.ECInstanceId id,
|
|
59
|
+
COUNT(sc.ECInstanceId) childCount,
|
|
60
|
+
this.Model.Id modelId,
|
|
61
|
+
${isDefinitionContainerSupported
|
|
62
|
+
? `
|
|
63
|
+
IIF(this.Model.Id IN (SELECT dc.ECInstanceId FROM ${ClassNameDefinitions_js_1.DEFINITION_CONTAINER_CLASS} dc),
|
|
64
|
+
true,
|
|
65
|
+
false
|
|
66
|
+
)`
|
|
67
|
+
: "false"} parentDefinitionContainerExists,
|
|
68
|
+
IFNULL(
|
|
69
|
+
(SELECT 1 FROM ${this.#categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId LIMIT 1),
|
|
70
|
+
0
|
|
71
|
+
) hasElements
|
|
72
|
+
FROM
|
|
73
|
+
${this.#categoryClass} this
|
|
74
|
+
JOIN ${ClassNameDefinitions_js_1.SUB_CATEGORY_CLASS} sc ON sc.Parent.Id = this.ECInstanceId
|
|
75
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
76
|
+
WHERE
|
|
77
|
+
NOT this.IsPrivate
|
|
78
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
79
|
+
GROUP BY this.ECInstanceId
|
|
80
|
+
`;
|
|
81
|
+
return this.#queryExecutor.createQueryReader({ ecsql: categoriesQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/categories` });
|
|
82
|
+
}).pipe((0, rxjs_1.map)((row) => {
|
|
83
|
+
return {
|
|
84
|
+
id: row.id,
|
|
85
|
+
modelId: row.modelId,
|
|
86
|
+
parentDefinitionContainerExists: row.parentDefinitionContainerExists,
|
|
87
|
+
childCount: row.childCount,
|
|
88
|
+
hasElements: !!row.hasElements,
|
|
89
|
+
};
|
|
90
|
+
}))));
|
|
77
91
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
queryIsDefinitionContainersSupported() {
|
|
93
|
+
return (0, rxjs_1.defer)(() => {
|
|
94
|
+
const query = `
|
|
95
|
+
SELECT
|
|
96
|
+
1
|
|
97
|
+
FROM
|
|
98
|
+
ECDbMeta.ECSchemaDef s
|
|
99
|
+
JOIN ECDbMeta.ECClassDef c ON c.Schema.Id = s.ECInstanceId
|
|
100
|
+
WHERE
|
|
101
|
+
s.Name = 'BisCore'
|
|
102
|
+
AND c.Name = 'DefinitionContainer'
|
|
103
|
+
LIMIT 1
|
|
104
|
+
`;
|
|
105
|
+
return this.#queryExecutor.createQueryReader({ ecsql: query }, { restartToken: `${this.#componentName}/${this.#componentId}/is-definition-container-supported` });
|
|
106
|
+
}).pipe((0, rxjs_1.toArray)(), (0, rxjs_1.map)((rows) => rows.length > 0));
|
|
93
107
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
queryDefinitionContainers() {
|
|
109
|
+
return (0, rxjs_1.defer)(() => {
|
|
110
|
+
// DefinitionModel ECInstanceId will always be the same as modeled DefinitionContainer ECInstanceId, if this wasn't the case, we would need to do something like:
|
|
111
|
+
// JOIN BisCore.DefinitionModel dm ON dm.ECInstanceId = ${modelIdAccessor}
|
|
112
|
+
// JOIN BisCore.DefinitionModelBreaksDownDefinitionContainer dr ON dr.SourceECInstanceId = dm.ECInstanceId
|
|
113
|
+
// JOIN BisCore.DefinitionContainer dc ON dc.ECInstanceId = dr.TargetECInstanceId
|
|
114
|
+
const DEFINITION_CONTAINERS_CTE = "DefinitionContainers";
|
|
115
|
+
const CATEGORIES_MODELS_CTE = "CategoriesModels";
|
|
116
|
+
const ctes = [
|
|
117
|
+
`${CATEGORIES_MODELS_CTE}(ModelId, HasElements) AS (
|
|
103
118
|
SELECT
|
|
104
|
-
|
|
105
|
-
|
|
119
|
+
c.Model.Id,
|
|
120
|
+
IFNULL((
|
|
121
|
+
SELECT 1
|
|
122
|
+
FROM ${this.#categoryElementClass} e
|
|
123
|
+
WHERE e.Category.Id = c.ECInstanceId
|
|
124
|
+
LIMIT 1
|
|
125
|
+
), 0)
|
|
106
126
|
FROM
|
|
107
|
-
${
|
|
127
|
+
${this.#categoryClass} c
|
|
108
128
|
WHERE
|
|
109
|
-
|
|
110
|
-
|
|
129
|
+
NOT c.IsPrivate
|
|
130
|
+
)`,
|
|
131
|
+
`
|
|
132
|
+
${DEFINITION_CONTAINERS_CTE}(ECInstanceId, ModelId, HasElements) AS (
|
|
133
|
+
SELECT
|
|
134
|
+
dc.ECInstanceId,
|
|
135
|
+
dc.Model.Id,
|
|
136
|
+
c.HasElements
|
|
137
|
+
FROM ${ClassNameDefinitions_js_1.DEFINITION_CONTAINER_CLASS} dc
|
|
138
|
+
JOIN ${CATEGORIES_MODELS_CTE} c ON dc.ECInstanceId = c.ModelId
|
|
139
|
+
WHERE NOT dc.IsPrivate
|
|
111
140
|
|
|
112
|
-
|
|
141
|
+
UNION ALL
|
|
113
142
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
NOT pdc.IsPrivate
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
SELECT
|
|
144
|
+
pdc.ECInstanceId,
|
|
145
|
+
pdc.Model.Id,
|
|
146
|
+
cdc.HasElements
|
|
147
|
+
FROM
|
|
148
|
+
${DEFINITION_CONTAINERS_CTE} cdc
|
|
149
|
+
JOIN ${ClassNameDefinitions_js_1.DEFINITION_CONTAINER_CLASS} pdc ON pdc.ECInstanceId = cdc.ModelId
|
|
150
|
+
WHERE NOT pdc.IsPrivate
|
|
151
|
+
)
|
|
152
|
+
`,
|
|
153
|
+
];
|
|
154
|
+
const definitionsQuery = `
|
|
155
|
+
SELECT dc.ECInstanceId id, dc.ModelId modelId, MAX(dc.HasElements) hasElements FROM ${DEFINITION_CONTAINERS_CTE} dc GROUP BY dc.ECInstanceId
|
|
156
|
+
`;
|
|
157
|
+
return this.#queryExecutor.createQueryReader({ ctes, ecsql: definitionsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/definition-containers` });
|
|
158
|
+
}).pipe((0, rxjs_1.map)((row) => {
|
|
159
|
+
return { id: row.id, modelId: row.modelId, hasElements: !!row.hasElements };
|
|
160
|
+
}));
|
|
131
161
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
162
|
+
queryVisibleSubCategories(categoriesInfo) {
|
|
163
|
+
return (0, rxjs_1.defer)(() => {
|
|
164
|
+
const definitionsQuery = `
|
|
165
|
+
SELECT
|
|
166
|
+
sc.ECInstanceId id,
|
|
167
|
+
sc.Parent.Id categoryId
|
|
168
|
+
FROM
|
|
169
|
+
${ClassNameDefinitions_js_1.SUB_CATEGORY_CLASS} sc
|
|
170
|
+
WHERE
|
|
171
|
+
NOT sc.IsPrivate
|
|
172
|
+
AND sc.Parent.Id IN (${categoriesInfo.join(",")})
|
|
173
|
+
`;
|
|
174
|
+
return this.#queryExecutor.createQueryReader({ ecsql: definitionsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/visible-sub-categories` });
|
|
175
|
+
}).pipe((0, rxjs_1.map)((row) => {
|
|
176
|
+
return { id: row.id, parentId: row.categoryId };
|
|
177
|
+
}));
|
|
146
178
|
}
|
|
147
|
-
|
|
148
|
-
this.#modelsCategoriesInfo ??= (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
allModelsCategories.set(queriedCategory.modelId, modelCategories);
|
|
155
|
-
}
|
|
156
|
-
modelCategories.childCategories.push({ id: queriedCategory.id, childCount: queriedCategory.childCount });
|
|
179
|
+
getModelsCategoriesInfo() {
|
|
180
|
+
this.#modelsCategoriesInfo ??= this.queryCategories()
|
|
181
|
+
.pipe((0, rxjs_1.reduce)((acc, queriedCategory) => {
|
|
182
|
+
let modelCategories = acc.get(queriedCategory.modelId);
|
|
183
|
+
if (modelCategories === undefined) {
|
|
184
|
+
modelCategories = { parentDefinitionContainerExists: queriedCategory.parentDefinitionContainerExists, childCategories: [] };
|
|
185
|
+
acc.set(queriedCategory.modelId, modelCategories);
|
|
157
186
|
}
|
|
158
|
-
|
|
159
|
-
|
|
187
|
+
modelCategories.childCategories.push({ id: queriedCategory.id, childCount: queriedCategory.childCount, hasElements: queriedCategory.hasElements });
|
|
188
|
+
return acc;
|
|
189
|
+
}, new Map()))
|
|
190
|
+
.pipe((0, rxjs_1.shareReplay)());
|
|
160
191
|
return this.#modelsCategoriesInfo;
|
|
161
192
|
}
|
|
162
|
-
|
|
163
|
-
this.#elementModelsCategories ??= (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
elementModelsCategories.set(queriedCategory.modelId, modelEntry);
|
|
170
|
-
}
|
|
171
|
-
modelEntry.add(queriedCategory.categoryId);
|
|
193
|
+
getElementModelsCategories() {
|
|
194
|
+
this.#elementModelsCategories ??= this.queryElementModelCategories()
|
|
195
|
+
.pipe((0, rxjs_1.reduce)((acc, queriedCategory) => {
|
|
196
|
+
let modelEntry = acc.get(queriedCategory.modelId);
|
|
197
|
+
if (modelEntry === undefined) {
|
|
198
|
+
modelEntry = new Set();
|
|
199
|
+
acc.set(queriedCategory.modelId, modelEntry);
|
|
172
200
|
}
|
|
173
|
-
|
|
174
|
-
|
|
201
|
+
modelEntry.add(queriedCategory.categoryId);
|
|
202
|
+
return acc;
|
|
203
|
+
}, new Map()))
|
|
204
|
+
.pipe((0, rxjs_1.shareReplay)());
|
|
175
205
|
return this.#elementModelsCategories;
|
|
176
206
|
}
|
|
177
|
-
|
|
178
|
-
this.#subCategoriesInfo ??= (
|
|
207
|
+
getSubCategoriesInfo() {
|
|
208
|
+
this.#subCategoriesInfo ??= this.getModelsCategoriesInfo()
|
|
209
|
+
.pipe((0, rxjs_1.mergeMap)((modelsCategoriesInfo) => (0, rxjs_1.from)(modelsCategoriesInfo.values())), (0, rxjs_1.reduce)((acc, modelCategoriesInfo) => {
|
|
210
|
+
acc.push(...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.childCount > 1).map((categoryInfo) => categoryInfo.id));
|
|
211
|
+
return acc;
|
|
212
|
+
}, new Array()), (0, rxjs_1.mergeMap)((categoriesWithMoreThanOneSubCategory) => {
|
|
179
213
|
const allSubCategories = new Map();
|
|
180
|
-
const modelsCategoriesInfo = await this.getModelsCategoriesInfo();
|
|
181
|
-
const categoriesWithMoreThanOneSubCategory = new Array();
|
|
182
|
-
for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {
|
|
183
|
-
categoriesWithMoreThanOneSubCategory.push(...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.childCount > 1).map((categoryInfo) => categoryInfo.id));
|
|
184
|
-
}
|
|
185
214
|
if (categoriesWithMoreThanOneSubCategory.length === 0) {
|
|
186
|
-
return allSubCategories;
|
|
187
|
-
}
|
|
188
|
-
for await (const queriedSubCategory of this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory)) {
|
|
189
|
-
allSubCategories.set(queriedSubCategory.id, { categoryId: queriedSubCategory.parentId });
|
|
215
|
+
return (0, rxjs_1.of)(allSubCategories);
|
|
190
216
|
}
|
|
191
|
-
return
|
|
192
|
-
|
|
217
|
+
return this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory).pipe((0, rxjs_1.reduce)((acc, queriedSubCategory) => {
|
|
218
|
+
const entry = acc.get(queriedSubCategory.parentId);
|
|
219
|
+
if (!entry) {
|
|
220
|
+
acc.set(queriedSubCategory.parentId, new Set([queriedSubCategory.id]));
|
|
221
|
+
return acc;
|
|
222
|
+
}
|
|
223
|
+
entry.add(queriedSubCategory.id);
|
|
224
|
+
return acc;
|
|
225
|
+
}, allSubCategories));
|
|
226
|
+
}))
|
|
227
|
+
.pipe((0, rxjs_1.shareReplay)());
|
|
193
228
|
return this.#subCategoriesInfo;
|
|
194
229
|
}
|
|
195
|
-
|
|
196
|
-
this.#definitionContainersInfo ??= (
|
|
230
|
+
getDefinitionContainersInfo() {
|
|
231
|
+
this.#definitionContainersInfo ??= (0, rxjs_1.forkJoin)({
|
|
232
|
+
isDefinitionContainerSupported: this.getIsDefinitionContainerSupported(),
|
|
233
|
+
modelsCategoriesInfo: this.getModelsCategoriesInfo(),
|
|
234
|
+
})
|
|
235
|
+
.pipe((0, rxjs_1.mergeMap)(({ isDefinitionContainerSupported, modelsCategoriesInfo }) => {
|
|
197
236
|
const definitionContainersInfo = new Map();
|
|
198
|
-
const [isDefinitionContainerSupported, modelsCategoriesInfo] = await Promise.all([
|
|
199
|
-
this.getIsDefinitionContainerSupported(),
|
|
200
|
-
this.getModelsCategoriesInfo(),
|
|
201
|
-
]);
|
|
202
237
|
if (!isDefinitionContainerSupported || modelsCategoriesInfo.size === 0) {
|
|
203
|
-
return definitionContainersInfo;
|
|
238
|
+
return (0, rxjs_1.of)(definitionContainersInfo);
|
|
204
239
|
}
|
|
205
|
-
|
|
240
|
+
return this.queryDefinitionContainers().pipe((0, rxjs_1.reduce)((acc, queriedDefinitionContainer) => {
|
|
206
241
|
const modelCategoriesInfo = modelsCategoriesInfo.get(queriedDefinitionContainer.id);
|
|
207
|
-
|
|
242
|
+
acc.set(queriedDefinitionContainer.id, {
|
|
208
243
|
childCategories: modelCategoriesInfo?.childCategories ?? [],
|
|
209
244
|
modelId: queriedDefinitionContainer.modelId,
|
|
210
245
|
childDefinitionContainers: [],
|
|
211
246
|
parentDefinitionContainerExists: false,
|
|
247
|
+
hasElements: queriedDefinitionContainer.hasElements,
|
|
212
248
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
parentDefinitionContainer
|
|
218
|
-
|
|
249
|
+
return acc;
|
|
250
|
+
}, definitionContainersInfo), (0, rxjs_1.map)((result) => {
|
|
251
|
+
for (const [definitionContainerId, definitionContainerInfo] of result) {
|
|
252
|
+
const parentDefinitionContainer = result.get(definitionContainerInfo.modelId);
|
|
253
|
+
if (parentDefinitionContainer !== undefined) {
|
|
254
|
+
parentDefinitionContainer.childDefinitionContainers.push({ id: definitionContainerId, hasElements: definitionContainerInfo.hasElements });
|
|
255
|
+
definitionContainerInfo.parentDefinitionContainerExists = true;
|
|
256
|
+
parentDefinitionContainer.hasElements = parentDefinitionContainer.hasElements || definitionContainerInfo.hasElements;
|
|
257
|
+
}
|
|
219
258
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
})
|
|
259
|
+
return result;
|
|
260
|
+
}));
|
|
261
|
+
}))
|
|
262
|
+
.pipe((0, rxjs_1.shareReplay)());
|
|
223
263
|
return this.#definitionContainersInfo;
|
|
224
264
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const result = { definitionContainers: new Array(), categories: new Array() };
|
|
228
|
-
parentDefinitionContainerIds.forEach((parentDefinitionContainerId) => {
|
|
265
|
+
getDirectChildDefinitionContainersAndCategories({ parentDefinitionContainerIds, includeEmpty, }) {
|
|
266
|
+
return this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => (0, rxjs_1.from)(parentDefinitionContainerIds).pipe((0, rxjs_1.reduce)((acc, parentDefinitionContainerId) => {
|
|
229
267
|
const parentDefinitionContainerInfo = definitionContainersInfo.get(parentDefinitionContainerId);
|
|
230
268
|
if (parentDefinitionContainerInfo !== undefined) {
|
|
231
|
-
|
|
232
|
-
|
|
269
|
+
acc.definitionContainers.push(...applyElementsFilter(parentDefinitionContainerInfo.childDefinitionContainers, includeEmpty).map((dc) => dc.id));
|
|
270
|
+
acc.categories.push(...applyElementsFilter(parentDefinitionContainerInfo.childCategories, includeEmpty));
|
|
233
271
|
}
|
|
234
|
-
|
|
235
|
-
|
|
272
|
+
return acc;
|
|
273
|
+
}, { definitionContainers: new Array(), categories: new Array() }))));
|
|
236
274
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (categories.has(categoryId)) {
|
|
243
|
-
let categoryModels = result.get(categoryId);
|
|
244
|
-
if (!categoryModels) {
|
|
245
|
-
categoryModels = new Array();
|
|
246
|
-
result.set(categoryId, categoryModels);
|
|
247
|
-
}
|
|
248
|
-
categoryModels.push(modelId);
|
|
249
|
-
}
|
|
275
|
+
getCategoriesElementModels(categoryIds) {
|
|
276
|
+
return this.getElementModelsCategories().pipe((0, rxjs_1.mergeMap)((elementModelsCategories) => elementModelsCategories.entries()), (0, rxjs_1.reduce)((acc, [modelId, modelCategoryIds]) => {
|
|
277
|
+
const sharedCategories = (0, Utils_js_1.setIntersection)(core_bentley_1.Id64.iterable(categoryIds), modelCategoryIds);
|
|
278
|
+
if (sharedCategories.size > 0) {
|
|
279
|
+
acc.set(modelId, sharedCategories);
|
|
250
280
|
}
|
|
251
|
-
|
|
252
|
-
|
|
281
|
+
return acc;
|
|
282
|
+
}, new Map()));
|
|
253
283
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const definitionContainersInfo = await this.getDefinitionContainersInfo();
|
|
257
|
-
const indirectCategories = await Promise.all(definitionContainerIds.map(async (definitionContainerId) => {
|
|
284
|
+
getAllContainedCategories({ definitionContainerIds, includeEmptyCategories, }) {
|
|
285
|
+
return this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => (0, rxjs_1.from)(definitionContainerIds).pipe((0, rxjs_1.mergeMap)((definitionContainerId) => {
|
|
258
286
|
const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);
|
|
259
287
|
if (definitionContainerInfo === undefined) {
|
|
260
|
-
return
|
|
288
|
+
return (0, rxjs_1.of)({ directCategories: undefined, indirectCategories: undefined });
|
|
261
289
|
}
|
|
262
|
-
|
|
263
|
-
return
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
290
|
+
const childDefinitionContainerIds = definitionContainerInfo.childDefinitionContainers.map(({ id }) => id);
|
|
291
|
+
return (childDefinitionContainerIds.length > 0
|
|
292
|
+
? this.getAllContainedCategories({
|
|
293
|
+
definitionContainerIds: childDefinitionContainerIds,
|
|
294
|
+
includeEmptyCategories,
|
|
295
|
+
})
|
|
296
|
+
: (0, rxjs_1.of)(new Set())).pipe((0, rxjs_1.map)((indirectCategories) => {
|
|
297
|
+
return {
|
|
298
|
+
directCategories: applyElementsFilter(definitionContainerInfo.childCategories, includeEmptyCategories).map((category) => category.id),
|
|
299
|
+
indirectCategories,
|
|
300
|
+
};
|
|
301
|
+
}));
|
|
302
|
+
}), (0, rxjs_1.reduce)((acc, { directCategories, indirectCategories }) => {
|
|
303
|
+
directCategories?.forEach((categoryId) => acc.add(categoryId));
|
|
304
|
+
indirectCategories?.forEach((categoryId) => acc.add(categoryId));
|
|
305
|
+
return acc;
|
|
306
|
+
}, new Set()))));
|
|
269
307
|
}
|
|
270
|
-
|
|
308
|
+
getInstanceKeyPaths(props) {
|
|
271
309
|
if ("subCategoryId" in props) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
310
|
+
return this.getSubCategoriesInfo().pipe((0, rxjs_1.mergeMap)((subCategoriesInfo) => {
|
|
311
|
+
let categoryOfSubCategory;
|
|
312
|
+
for (const [categoryId, subCategories] of subCategoriesInfo.entries()) {
|
|
313
|
+
if (subCategories.has(props.subCategoryId)) {
|
|
314
|
+
categoryOfSubCategory = categoryId;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (categoryOfSubCategory === undefined) {
|
|
319
|
+
return (0, rxjs_1.of)([]);
|
|
320
|
+
}
|
|
321
|
+
return this.getInstanceKeyPaths({ categoryId: categoryOfSubCategory }).pipe((0, rxjs_1.map)((pathToCategory) => [...pathToCategory, { id: props.subCategoryId, className: ClassNameDefinitions_js_1.SUB_CATEGORY_CLASS }]));
|
|
322
|
+
}));
|
|
278
323
|
}
|
|
279
324
|
if ("categoryId" in props) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
325
|
+
return this.getModelsCategoriesInfo().pipe((0, rxjs_1.mergeMap)((modelsCategoriesInfo) => {
|
|
326
|
+
for (const [modelId, modelCategoriesInfo] of modelsCategoriesInfo) {
|
|
327
|
+
if (modelCategoriesInfo.childCategories.find((childCategory) => childCategory.id === props.categoryId)) {
|
|
328
|
+
const instanceKey = { id: props.categoryId, className: this.#categoryClass };
|
|
329
|
+
if (!modelCategoriesInfo.parentDefinitionContainerExists) {
|
|
330
|
+
return (0, rxjs_1.of)([instanceKey]);
|
|
331
|
+
}
|
|
332
|
+
return this.getInstanceKeyPaths({ definitionContainerId: modelId }).pipe((0, rxjs_1.map)((pathToDefinitionContainer) => [...pathToDefinitionContainer, instanceKey]));
|
|
285
333
|
}
|
|
286
|
-
return [...(await this.getInstanceKeyPaths({ definitionContainerId: modelId })), { id: props.categoryId, className: this.#categoryClass }];
|
|
287
334
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
const definitionContainersInfo = await this.getDefinitionContainersInfo();
|
|
292
|
-
const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);
|
|
293
|
-
if (definitionContainerInfo === undefined) {
|
|
294
|
-
return [];
|
|
335
|
+
return (0, rxjs_1.of)([]);
|
|
336
|
+
}));
|
|
295
337
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
...(await this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId })),
|
|
301
|
-
{ id: props.definitionContainerId, className: ClassNameDefinitions_js_1.DEFINITION_CONTAINER_CLASS },
|
|
302
|
-
];
|
|
303
|
-
}
|
|
304
|
-
async getAllDefinitionContainersAndCategories() {
|
|
305
|
-
const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);
|
|
306
|
-
const result = { definitionContainers: [...definitionContainersInfo.keys()], categories: new Array() };
|
|
307
|
-
for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {
|
|
308
|
-
result.categories.push(...modelCategoriesInfo.childCategories.map((childCategory) => childCategory.id));
|
|
309
|
-
}
|
|
310
|
-
return result;
|
|
311
|
-
}
|
|
312
|
-
async getRootDefinitionContainersAndCategories() {
|
|
313
|
-
const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);
|
|
314
|
-
const result = { definitionContainers: new Array(), categories: new Array() };
|
|
315
|
-
for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {
|
|
316
|
-
if (!modelCategoriesInfo.parentDefinitionContainerExists) {
|
|
317
|
-
result.categories.push(...modelCategoriesInfo.childCategories);
|
|
338
|
+
return this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => {
|
|
339
|
+
const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);
|
|
340
|
+
if (definitionContainerInfo === undefined) {
|
|
341
|
+
return (0, rxjs_1.of)([]);
|
|
318
342
|
}
|
|
319
|
-
|
|
320
|
-
for (const [definitionContainerId, definitionContainerInfo] of definitionContainersInfo) {
|
|
343
|
+
const instanceKey = { id: props.definitionContainerId, className: ClassNameDefinitions_js_1.DEFINITION_CONTAINER_CLASS };
|
|
321
344
|
if (!definitionContainerInfo.parentDefinitionContainerExists) {
|
|
322
|
-
|
|
345
|
+
return (0, rxjs_1.of)([instanceKey]);
|
|
323
346
|
}
|
|
324
|
-
|
|
325
|
-
|
|
347
|
+
return this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId }).pipe((0, rxjs_1.map)((pathToParentDefinitionContainer) => [...pathToParentDefinitionContainer, instanceKey]));
|
|
348
|
+
}));
|
|
326
349
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
350
|
+
getAllDefinitionContainersAndCategories(props) {
|
|
351
|
+
return (0, rxjs_1.forkJoin)({
|
|
352
|
+
categories: this.getModelsCategoriesInfo().pipe((0, rxjs_1.mergeMap)((modelsCategoriesInfo) => modelsCategoriesInfo.values()), (0, rxjs_1.reduce)((acc, modelCategoriesInfo) => {
|
|
353
|
+
applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo.id));
|
|
354
|
+
return acc;
|
|
355
|
+
}, new Array())),
|
|
356
|
+
definitionContainers: this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => definitionContainersInfo.entries()), (0, rxjs_1.reduce)((acc, [definitionContainerId, definitionContainerInfo]) => {
|
|
357
|
+
if (definitionContainerInfo.hasElements || !!props?.includeEmpty) {
|
|
358
|
+
acc.push(definitionContainerId);
|
|
359
|
+
}
|
|
360
|
+
return acc;
|
|
361
|
+
}, new Array())),
|
|
362
|
+
});
|
|
336
363
|
}
|
|
337
|
-
|
|
338
|
-
|
|
364
|
+
getRootDefinitionContainersAndCategories(props) {
|
|
365
|
+
return (0, rxjs_1.forkJoin)({
|
|
366
|
+
categories: this.getModelsCategoriesInfo().pipe((0, rxjs_1.mergeMap)((modelsCategoriesInfo) => modelsCategoriesInfo.values()), (0, rxjs_1.reduce)((acc, modelCategoriesInfo) => {
|
|
367
|
+
if (!modelCategoriesInfo.parentDefinitionContainerExists) {
|
|
368
|
+
applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo));
|
|
369
|
+
}
|
|
370
|
+
return acc;
|
|
371
|
+
}, new Array())),
|
|
372
|
+
definitionContainers: this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => definitionContainersInfo.entries()), (0, rxjs_1.reduce)((acc, [definitionContainerId, definitionContainerInfo]) => {
|
|
373
|
+
if (!definitionContainerInfo.parentDefinitionContainerExists && (definitionContainerInfo.hasElements || !!props?.includeEmpty)) {
|
|
374
|
+
acc.push(definitionContainerId);
|
|
375
|
+
}
|
|
376
|
+
return acc;
|
|
377
|
+
}, new Array())),
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
getSubCategories(categoryId) {
|
|
381
|
+
return this.getSubCategoriesInfo().pipe((0, rxjs_1.map)((subCategoriesInfo) => subCategoriesInfo.get(categoryId) ?? new Set()));
|
|
382
|
+
}
|
|
383
|
+
getIsDefinitionContainerSupported() {
|
|
384
|
+
this.#isDefinitionContainerSupported ??= this.queryIsDefinitionContainersSupported().pipe((0, rxjs_1.shareReplay)());
|
|
339
385
|
return this.#isDefinitionContainerSupported;
|
|
340
386
|
}
|
|
341
387
|
}
|
|
@@ -346,4 +392,7 @@ function getClassesByView(viewType) {
|
|
|
346
392
|
? { categoryClass: "BisCore.DrawingCategory", categoryElementClass: "BisCore.GeometricElement2d", categoryModelClass: "BisCore.GeometricModel2d" }
|
|
347
393
|
: { categoryClass: "BisCore.SpatialCategory", categoryElementClass: "BisCore.GeometricElement3d", categoryModelClass: "BisCore.GeometricModel3d" };
|
|
348
394
|
}
|
|
395
|
+
function applyElementsFilter(list, includeEmpty) {
|
|
396
|
+
return includeEmpty ? list : list.filter(({ hasElements }) => !!hasElements);
|
|
397
|
+
}
|
|
349
398
|
//# sourceMappingURL=CategoriesTreeIdsCache.js.map
|