@itwin/presentation-hierarchies 2.0.0-alpha.4 → 2.0.0-alpha.6
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 +56 -9
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +77 -36
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.js +126 -98
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyMerge.d.ts +19 -0
- package/lib/cjs/hierarchies/HierarchyMerge.d.ts.map +1 -0
- package/lib/cjs/hierarchies/HierarchyMerge.js +43 -0
- package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -0
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +2 -2
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js +8 -8
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +0 -18
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +0 -37
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +45 -30
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +42 -7
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +144 -45
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +10 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.d.ts +3 -0
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +12 -1
- package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
- package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/EachValueFrom.js +1 -0
- package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +2 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +3 -2
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +4 -3
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts +77 -36
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.js +125 -98
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyMerge.d.ts +19 -0
- package/lib/esm/hierarchies/HierarchyMerge.d.ts.map +1 -0
- package/lib/esm/hierarchies/HierarchyMerge.js +40 -0
- package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -0
- package/lib/esm/hierarchies/HierarchyNode.d.ts +2 -2
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js +9 -9
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +0 -18
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +1 -36
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +47 -32
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +42 -7
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +146 -48
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js +10 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
- package/lib/esm/hierarchies/internal/Common.d.ts +3 -0
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +11 -1
- package/lib/esm/hierarchies/internal/Common.js.map +1 -1
- package/lib/esm/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/EachValueFrom.js +1 -0
- package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js +3 -2
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +3 -2
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +2 -2
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"FilteringHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiF,UAAU,EAAqB,MAAM,MAAM,CAAC;AAEpI,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAkC,sBAAsB,EAAiC,MAAM,0BAA0B,CAAC;AAGjI,OAAO,EACL,yBAAyB,EAEzB,wBAAwB,EAExB,4BAA4B,EAC7B,MAAM,wCAAwC,CAAC;AAMhD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9I,UAAU,iCAAiC;IACzC,YAAY,EAAE,yBAAyB,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,MAAM,EAAE,uBAAuB,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;IAC9C,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,gBAAgB;AAChB,qBAAa,4BAA6B,YAAW,uBAAuB;;IAC1E,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,oBAAoB,CAA2B;IACvD,OAAO,CAAC,YAAY,CAAiB;gBAGlB,KAAK,EAAE,iCAAiC;IAQ3D,IAAW,cAAc,IAAI,oBAAoB,CAYhD;IAED,IAAW,eAAe,IAAI,qBAAqB,CA4BlD;IAED,IAAW,SAAS,IAAI,cAAc,CA8CrC;IAEM,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,UAAU,CAAC,wBAAwB,CAAC;CAoGpG;AAED,gBAAgB;AAEhB,eAAO,MAAM,oCAAoC,uBAAuB,CAAC;AAEzE,gBAAgB;AAEhB,eAAO,MAAM,iCAAiC,oBAAoB,CAAC;AAenE,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,WAAW,EAAE,GAAG,4BAA4B,CAgC7I;AAED,gBAAgB;AAChB,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,4BAA4B,GAAG,4BAA4B,CAc1G"}
|
|
@@ -15,6 +15,7 @@ const IModelHierarchyDefinition_js_1 = require("../imodel/IModelHierarchyDefinit
|
|
|
15
15
|
const IModelHierarchyNode_js_1 = require("../imodel/IModelHierarchyNode.js");
|
|
16
16
|
const NodeSelectQueryFactory_js_1 = require("../imodel/NodeSelectQueryFactory.js");
|
|
17
17
|
const TreeNodesReader_js_1 = require("../imodel/TreeNodesReader.js");
|
|
18
|
+
const Common_js_1 = require("../internal/Common.js");
|
|
18
19
|
const Partition_js_1 = require("../internal/operators/Partition.js");
|
|
19
20
|
/** @internal */
|
|
20
21
|
class FilteringHierarchyDefinition {
|
|
@@ -22,9 +23,11 @@ class FilteringHierarchyDefinition {
|
|
|
22
23
|
_source;
|
|
23
24
|
_nodeIdentifierPaths;
|
|
24
25
|
_nodesParser;
|
|
26
|
+
#sourceName;
|
|
25
27
|
constructor(props) {
|
|
26
28
|
this._imodelAccess = props.imodelAccess;
|
|
27
29
|
this._source = props.source;
|
|
30
|
+
this.#sourceName = props.sourceName;
|
|
28
31
|
this._nodeIdentifierPaths = props.nodeIdentifierPaths;
|
|
29
32
|
this._nodesParser = props.nodesParser ?? this._source.parseNode ?? ((row) => (0, rxjs_1.of)((0, TreeNodesReader_js_1.defaultNodesParser)(row)));
|
|
30
33
|
}
|
|
@@ -42,8 +45,21 @@ class FilteringHierarchyDefinition {
|
|
|
42
45
|
get postProcessNode() {
|
|
43
46
|
return (node) => {
|
|
44
47
|
return (this._source.postProcessNode ? this._source.postProcessNode(node) : (0, rxjs_1.of)(node)).pipe((0, rxjs_1.map)((processedNode) => {
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const parentKeysWithoutGroupingNodesLength = processedNode.parentKeys.filter((key) => !HierarchyNodeKey_js_1.HierarchyNodeKey.isGrouping(key)).length;
|
|
49
|
+
const parentKeysLength = processedNode.parentKeys.length;
|
|
50
|
+
const shouldAutoExpand = IModelHierarchyNode_js_1.ProcessedHierarchyNode.isGroupingNode(processedNode)
|
|
51
|
+
? shouldAutoExpandGroupingNodeBasedOnNestedChildren({
|
|
52
|
+
directOrIndirectChildren: processedNode.children,
|
|
53
|
+
parentKeysWithoutGroupingNodesLength,
|
|
54
|
+
parentKeysLength,
|
|
55
|
+
})
|
|
56
|
+
: (processedNode.filtering?.isFilterTarget && !!processedNode.filtering.filterTargetOptions?.autoExpand) ||
|
|
57
|
+
processedNode.filtering?.filteredChildrenIdentifierPaths?.some((path) => (0, HierarchyFiltering_js_1.shouldAutoExpandBasedOnReveal)({
|
|
58
|
+
reveal: HierarchyFiltering_js_1.HierarchyFilteringPath.normalize(path).options?.reveal,
|
|
59
|
+
nodePositionInPath: parentKeysWithoutGroupingNodesLength,
|
|
60
|
+
nodePositionInHierarchy: parentKeysLength,
|
|
61
|
+
}));
|
|
62
|
+
if (shouldAutoExpand) {
|
|
47
63
|
Object.assign(processedNode, { autoExpand: true });
|
|
48
64
|
}
|
|
49
65
|
return processedNode;
|
|
@@ -58,8 +74,8 @@ class FilteringHierarchyDefinition {
|
|
|
58
74
|
}
|
|
59
75
|
const rowInstanceKey = { className: row[exports.ECSQL_COLUMN_NAME_FilterClassName], id: row[exports.ECSQL_COLUMN_NAME_FilterECInstanceId] };
|
|
60
76
|
const filteringHelper = (0, HierarchyFiltering_js_1.createHierarchyFilteringHelper)(this._nodeIdentifierPaths, parentNode);
|
|
61
|
-
const
|
|
62
|
-
|
|
77
|
+
const nodeFilteringPropPossiblyPromise = filteringHelper.createChildNodeProps({
|
|
78
|
+
asyncPathMatcher: (identifier) => {
|
|
63
79
|
if (identifier.id !== rowInstanceKey.id) {
|
|
64
80
|
return false;
|
|
65
81
|
}
|
|
@@ -72,16 +88,10 @@ class FilteringHierarchyDefinition {
|
|
|
72
88
|
if (identifier.className === rowInstanceKey.className) {
|
|
73
89
|
return true;
|
|
74
90
|
}
|
|
75
|
-
return
|
|
76
|
-
this._imodelAccess.classDerivesFrom(identifier.className, rowInstanceKey.className),
|
|
77
|
-
this._imodelAccess.classDerivesFrom(rowInstanceKey.className, identifier.className),
|
|
78
|
-
]).then(([isDerivedFrom, isDerivedTo]) => isDerivedFrom || isDerivedTo);
|
|
91
|
+
return (0, rxjs_1.firstValueFrom)((0, rxjs_1.merge)((0, Common_js_1.fromPossiblyPromise)(this._imodelAccess.classDerivesFrom(identifier.className, rowInstanceKey.className)), (0, Common_js_1.fromPossiblyPromise)(this._imodelAccess.classDerivesFrom(rowInstanceKey.className, identifier.className))).pipe((0, rxjs_1.filter)((classDerives) => classDerives), (0, rxjs_1.defaultIfEmpty)(false), (0, rxjs_1.take)(1)));
|
|
79
92
|
},
|
|
80
93
|
});
|
|
81
|
-
return (
|
|
82
|
-
if (nodeExtraProps?.autoExpand) {
|
|
83
|
-
parsedNode.autoExpand = true;
|
|
84
|
-
}
|
|
94
|
+
return (0, Common_js_1.fromPossiblyPromise)(nodeFilteringPropPossiblyPromise).pipe((0, rxjs_1.map)((nodeExtraProps) => {
|
|
85
95
|
if (nodeExtraProps?.filtering) {
|
|
86
96
|
parsedNode.filtering = nodeExtraProps.filtering;
|
|
87
97
|
}
|
|
@@ -101,7 +111,7 @@ class FilteringHierarchyDefinition {
|
|
|
101
111
|
return (0, rxjs_1.merge)(genericNodeDefinitions.pipe((0, rxjs_1.map)((definition) => {
|
|
102
112
|
if (filteringHelper.hasFilterTargetAncestor ||
|
|
103
113
|
childNodeFilteringIdentifiers.some((identifier) => HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.isGenericNodeIdentifier(identifier) &&
|
|
104
|
-
(!identifier.source || identifier.source === this
|
|
114
|
+
(!identifier.source || identifier.source === this.#sourceName) &&
|
|
105
115
|
identifier.id === definition.node.key)) {
|
|
106
116
|
return {
|
|
107
117
|
...definition,
|
|
@@ -236,15 +246,26 @@ function applyECInstanceIdsSelector(def) {
|
|
|
236
246
|
},
|
|
237
247
|
};
|
|
238
248
|
}
|
|
239
|
-
function
|
|
240
|
-
const
|
|
241
|
-
|
|
249
|
+
function shouldAutoExpandGroupingNodeBasedOnNestedChildren({ directOrIndirectChildren, parentKeysLength, parentKeysWithoutGroupingNodesLength, }) {
|
|
250
|
+
for (const child of directOrIndirectChildren) {
|
|
251
|
+
if (IModelHierarchyNode_js_1.ProcessedHierarchyNode.isGroupingNode(child)) {
|
|
252
|
+
// Need to check if the same grouping node needs to be expanded, but check the indirect children instead
|
|
253
|
+
if (shouldAutoExpandGroupingNodeBasedOnNestedChildren({ directOrIndirectChildren: child.children, parentKeysLength, parentKeysWithoutGroupingNodesLength })) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
242
258
|
/* c8 ignore next 3 */
|
|
243
259
|
if (!child.filtering) {
|
|
244
260
|
continue;
|
|
245
261
|
}
|
|
246
262
|
if (child.filtering.isFilterTarget &&
|
|
247
|
-
|
|
263
|
+
(0, HierarchyFiltering_js_1.shouldAutoExpandBasedOnReveal)({
|
|
264
|
+
reveal: child.filtering.filterTargetOptions?.reveal,
|
|
265
|
+
nodePositionInHierarchy: parentKeysLength,
|
|
266
|
+
// Grouping node is not in filtering path, but we can assume that it is at the position of 1 less than `parentKeysWithoutGroupingNodesLength`
|
|
267
|
+
nodePositionInPath: parentKeysWithoutGroupingNodesLength - 1,
|
|
268
|
+
})) {
|
|
248
269
|
return true;
|
|
249
270
|
}
|
|
250
271
|
if (!child.filtering.filteredChildrenIdentifierPaths) {
|
|
@@ -252,23 +273,17 @@ function shouldExpandGroupingNode(node) {
|
|
|
252
273
|
continue;
|
|
253
274
|
}
|
|
254
275
|
for (const path of child.filtering.filteredChildrenIdentifierPaths) {
|
|
255
|
-
if ("path" in path &&
|
|
276
|
+
if ("path" in path &&
|
|
277
|
+
(0, HierarchyFiltering_js_1.shouldAutoExpandBasedOnReveal)({
|
|
278
|
+
reveal: path.options?.reveal,
|
|
279
|
+
nodePositionInHierarchy: parentKeysLength,
|
|
280
|
+
// Grouping node is not in filtering path, but we can assume that it is at the position of 1 less than `parentKeysWithoutGroupingNodesLength`
|
|
281
|
+
nodePositionInPath: parentKeysWithoutGroupingNodesLength - 1,
|
|
282
|
+
})) {
|
|
256
283
|
return true;
|
|
257
284
|
}
|
|
258
285
|
}
|
|
259
286
|
}
|
|
260
287
|
return false;
|
|
261
288
|
}
|
|
262
|
-
function getAutoExpandAsTrueFalse(autoExpand, numberOfNonGroupingParentNodes, numberOfParentNodes) {
|
|
263
|
-
if (!autoExpand) {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
if (autoExpand === true) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
// auto-expand should be set to true only if parentKeys length is smaller than depth.
|
|
270
|
-
const nodeDepth = "depthInHierarchy" in autoExpand ? numberOfParentNodes : numberOfNonGroupingParentNodes;
|
|
271
|
-
const filterTargetDepth = "depthInPath" in autoExpand ? autoExpand.depthInPath : autoExpand.depthInHierarchy;
|
|
272
|
-
return nodeDepth < filterTargetDepth;
|
|
273
|
-
}
|
|
274
289
|
//# sourceMappingURL=FilteringHierarchyDefinition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA+OhG,4DAgCC;AAGD,gEAcC;AA9RD,+BAAoG;AAGpG,oEAAiI;AACjI,8EAAwE;AACxE,gEAA6E;AAC7E,yFAMgD;AAChD,6EAA0G;AAC1G,mFAAkF;AAClF,qEAAkE;AAClE,qEAA+D;AAU/D,gBAAgB;AAChB,MAAa,4BAA4B;IAC/B,aAAa,CAAoD;IACjE,OAAO,CAA0B;IACjC,oBAAoB,CAA2B;IAC/C,YAAY,CAAiB;IAErC,YAAmB,KAAwC;QACzD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,SAAE,EAAC,IAAA,uCAAkB,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,CAAC,IAAI,EAAE,EAAE;YACd,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IA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C,SAAS,EAAE,CAAC;YACrB,SAAS;QACX,CAAC;QAED,IACE,KAAK,CAAC,SAAS,CAAC,cAAc;YAC9B,wBAAwB,CAAC,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,UAAU,EAAE,8BAA8B,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EACjI,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,+BAA+B,EAAE,CAAC;YACrD,oBAAoB;YACpB,SAAS;QACX,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,+BAA+B,EAAE,CAAC;YACnE,IAAI,MAAM,IAAI,IAAI,IAAI,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,8BAA8B,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjI,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,wBAAwB,CAC/B,UAAuD,EACvD,8BAAsC,EACtC,mBAA2B;IAE3B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qFAAqF;IACrF,MAAM,SAAS,GAAG,kBAAkB,IAAI,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,8BAA8B,CAAC;IAC1G,MAAM,iBAAiB,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC;IAC7G,OAAO,SAAS,GAAG,iBAAiB,CAAC;AACvC,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 { defer, filter, from, map, merge, mergeAll, mergeMap, Observable, of, toArray } from \"rxjs\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport { createHierarchyFilteringHelper, HierarchyFilteringPath, HierarchyFilteringPathOptions } from \"../HierarchyFiltering.js\";\nimport { HierarchyNodeIdentifier } from \"../HierarchyNodeIdentifier.js\";\nimport { HierarchyNodeKey, IModelInstanceKey } from \"../HierarchyNodeKey.js\";\nimport {\n DefineHierarchyLevelProps,\n GenericHierarchyNodeDefinition,\n HierarchyLevelDefinition,\n HierarchyNodesDefinition,\n InstanceNodesQueryDefinition,\n} from \"../imodel/IModelHierarchyDefinition.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode } from \"../imodel/IModelHierarchyNode.js\";\nimport { NodeSelectClauseColumnNames } from \"../imodel/NodeSelectQueryFactory.js\";\nimport { defaultNodesParser } from \"../imodel/TreeNodesReader.js\";\nimport { partition } from \"../internal/operators/Partition.js\";\nimport { RxjsHierarchyDefinition, RxjsNodeParser, RxjsNodePostProcessor, RxjsNodePreProcessor } from \"../internal/RxjsHierarchyDefinition.js\";\n\ninterface FilteringHierarchyDefinitionProps {\n imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n source: RxjsHierarchyDefinition;\n nodeIdentifierPaths: HierarchyFilteringPath[];\n nodesParser?: RxjsNodeParser;\n}\n\n/** @internal */\nexport class FilteringHierarchyDefinition implements RxjsHierarchyDefinition {\n private _imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n private _source: RxjsHierarchyDefinition;\n private _nodeIdentifierPaths: HierarchyFilteringPath[];\n private _nodesParser: RxjsNodeParser;\n\n public constructor(props: FilteringHierarchyDefinitionProps) {\n this._imodelAccess = props.imodelAccess;\n this._source = props.source;\n this._nodeIdentifierPaths = props.nodeIdentifierPaths;\n this._nodesParser = props.nodesParser ?? this._source.parseNode ?? ((row) => of(defaultNodesParser(row)));\n }\n\n public get preProcessNode(): RxjsNodePreProcessor {\n return (node) => {\n return (this._source.preProcessNode ? this._source.preProcessNode(node) : of(node)).pipe(\n filter((processedNode) => {\n if (processedNode.processingParams?.hideInHierarchy && processedNode.filtering?.isFilterTarget && !processedNode.filtering.hasFilterTargetAncestor) {\n // we want to hide target nodes if they have `hideInHierarchy` param, but only if they're not under another filter target\n return false;\n }\n return true;\n }),\n );\n };\n }\n\n public get postProcessNode(): RxjsNodePostProcessor {\n return (node) => {\n return (this._source.postProcessNode ? this._source.postProcessNode(node) : of(node)).pipe(\n map((processedNode) => {\n // instance nodes get the auto-expand flag in `parseNode`, but grouping ones need to be handled during post-processing\n if (ProcessedHierarchyNode.isGroupingNode(node) && shouldExpandGroupingNode(node)) {\n Object.assign(processedNode, { autoExpand: true });\n }\n return processedNode;\n }),\n );\n };\n }\n\n public get parseNode(): RxjsNodeParser {\n return (row, parentNode) => {\n return this._nodesParser(row).pipe(\n mergeMap((parsedNode) => {\n if (!row[ECSQL_COLUMN_NAME_FilterECInstanceId] || !row[ECSQL_COLUMN_NAME_FilterClassName]) {\n return of(parsedNode);\n }\n const rowInstanceKey = { className: row[ECSQL_COLUMN_NAME_FilterClassName], id: row[ECSQL_COLUMN_NAME_FilterECInstanceId] };\n const filteringHelper = createHierarchyFilteringHelper(this._nodeIdentifierPaths, parentNode);\n const nodeExtraPropsPossiblyPromise = filteringHelper.createChildNodePropsAsync({\n pathMatcher: (identifier): boolean | Promise<boolean> => {\n if (identifier.id !== rowInstanceKey.id) {\n return false;\n }\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(identifier)) {\n return false;\n }\n if (identifier.imodelKey && identifier.imodelKey !== this._imodelAccess.imodelKey) {\n return false;\n }\n if (identifier.className === rowInstanceKey.className) {\n return true;\n }\n return Promise.all([\n this._imodelAccess.classDerivesFrom(identifier.className, rowInstanceKey.className),\n this._imodelAccess.classDerivesFrom(rowInstanceKey.className, identifier.className),\n ]).then(([isDerivedFrom, isDerivedTo]) => isDerivedFrom || isDerivedTo);\n },\n });\n return (nodeExtraPropsPossiblyPromise instanceof Promise ? from(nodeExtraPropsPossiblyPromise) : of(nodeExtraPropsPossiblyPromise)).pipe(\n map((nodeExtraProps) => {\n if (nodeExtraProps?.autoExpand) {\n parsedNode.autoExpand = true;\n }\n if (nodeExtraProps?.filtering) {\n parsedNode.filtering = nodeExtraProps.filtering;\n }\n return parsedNode;\n }),\n );\n }),\n );\n };\n }\n\n public defineHierarchyLevel(props: DefineHierarchyLevelProps): Observable<HierarchyLevelDefinition> {\n const sourceDefinitions = this._source.defineHierarchyLevel(props);\n\n const filteringHelper = createHierarchyFilteringHelper(this._nodeIdentifierPaths, props.parentNode);\n const childNodeFilteringIdentifiers = filteringHelper.getChildNodeFilteringIdentifiers();\n if (!childNodeFilteringIdentifiers) {\n return sourceDefinitions;\n }\n\n const [genericNodeDefinitions, instanceNodeDefinitions] = partition(sourceDefinitions.pipe(mergeAll()), HierarchyNodesDefinition.isGenericNode);\n return merge(\n genericNodeDefinitions.pipe(\n map((definition) => {\n if (\n filteringHelper.hasFilterTargetAncestor ||\n childNodeFilteringIdentifiers.some(\n (identifier) =>\n HierarchyNodeIdentifier.isGenericNodeIdentifier(identifier) &&\n (!identifier.source || identifier.source === this._imodelAccess.imodelKey) &&\n identifier.id === definition.node.key,\n )\n ) {\n return {\n ...definition,\n node: {\n ...definition.node,\n ...filteringHelper.createChildNodeProps({ pathMatcher: ({ id }) => id === definition.node.key }),\n },\n };\n }\n return undefined;\n }),\n filter((def): def is GenericHierarchyNodeDefinition => !!def),\n ),\n\n instanceNodeDefinitions.pipe(\n mergeMap((definition) => {\n if (filteringHelper.hasFilterTargetAncestor) {\n // if we have a filter target ancestor, we don't need to filter the definitions - we use all of them\n return of(applyECInstanceIdsSelector(definition));\n }\n return defer(async () => {\n const imodelAccess = this._imodelAccess;\n const matches = new Map<Id64String, IModelInstanceKey[]>();\n async function getEntries(x: IModelInstanceKey) {\n let entries = matches.get(x.id);\n if (!entries) {\n entries = [];\n matches.set(x.id, entries);\n }\n // make sure that we don't have path identifiers that only differ by class name, where\n // class names are in the same class hierarchy, e.g.:\n // [{ className: \"bis.Element\", id: \"0x1\" }, { className: \"bis.Subject\", id: \"0x1\" }]\n // are actually the same instance, so we only need to keep one of them, or otherwise the query will\n // duplicate it\n for (const entry of entries) {\n if (\n entry.className === x.className ||\n (await imodelAccess.classDerivesFrom(entry.className, x.className)) ||\n (await imodelAccess.classDerivesFrom(x.className, entry.className))\n ) {\n return undefined;\n }\n }\n return entries;\n }\n for (const id of childNodeFilteringIdentifiers) {\n // take only identifiers that match the definition by type, source and class\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(id)) {\n continue;\n }\n if (id.imodelKey && id.imodelKey !== imodelAccess.imodelKey) {\n continue;\n }\n if (\n id.className !== definition.fullClassName &&\n !(await Promise.all([\n imodelAccess.classDerivesFrom(id.className, definition.fullClassName),\n imodelAccess.classDerivesFrom(definition.fullClassName, id.className),\n ]).then(([isDerivedFrom, isDerivedTo]) => isDerivedFrom || isDerivedTo))\n ) {\n continue;\n }\n const entriesTargetForPathIdentifier = await getEntries(id);\n if (entriesTargetForPathIdentifier) {\n entriesTargetForPathIdentifier.push(id);\n }\n }\n return Array.from(matches.values()).flat();\n }).pipe(\n // only take definitions that have matching path identifiers\n filter((pathIdentifiers) => pathIdentifiers.length > 0),\n\n // for each definition that we're going to use, apply query-level filter\n map((pathIdentifiers) => applyECInstanceIdsFilter(definition, pathIdentifiers)),\n );\n }),\n ),\n ).pipe(toArray());\n }\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilterECInstanceId = \"FilterECInstanceId\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilterClassName = \"FilterClassName\";\n\nfunction getClassECInstanceIds(filteredInstanceKeys: InstanceKey[]) {\n const classNameECInstanceIds = new Map<string, Id64String[]>();\n for (const key of filteredInstanceKeys) {\n const entry = classNameECInstanceIds.get(key.className);\n if (entry === undefined) {\n classNameECInstanceIds.set(key.className, [key.id]);\n continue;\n }\n entry.push(key.id);\n }\n return classNameECInstanceIds;\n}\n\n/** @internal */\nexport function applyECInstanceIdsFilter(def: InstanceNodesQueryDefinition, filteredInstanceKeys: InstanceKey[]): InstanceNodesQueryDefinition {\n const instanceIdsByClass = getClassECInstanceIds(filteredInstanceKeys);\n return {\n ...def,\n query: {\n ...def.query,\n ctes: [\n ...(def.query.ctes ?? []),\n `FilteringInfo(ECInstanceId, FilterClassName) AS (\n ${Array.from(instanceIdsByClass)\n .map(\n ([className, ecInstanceIds]) => `\n SELECT ECInstanceId, '${className}' AS FilterClassName\n FROM ${className}\n WHERE ECInstanceId IN (${ecInstanceIds.join(\", \")})\n `,\n )\n .join(\" UNION ALL \")}\n )`,\n ],\n ecsql: `\n SELECT\n [q].*,\n IdToHex([f].[ECInstanceId]) AS [${ECSQL_COLUMN_NAME_FilterECInstanceId}],\n [f].[FilterClassName] AS [${ECSQL_COLUMN_NAME_FilterClassName}]\n FROM (\n ${def.query.ecsql}\n ) [q]\n JOIN FilteringInfo [f] ON [f].[ECInstanceId] = [q].[ECInstanceId]\n `,\n },\n };\n}\n\n/** @internal */\nexport function applyECInstanceIdsSelector(def: InstanceNodesQueryDefinition): InstanceNodesQueryDefinition {\n return {\n ...def,\n query: {\n ...def.query,\n ecsql: `\n SELECT\n [q].*,\n IdToHex([q].[ECInstanceId]) AS [${ECSQL_COLUMN_NAME_FilterECInstanceId}],\n [q].[${NodeSelectClauseColumnNames.FullClassName}] AS [${ECSQL_COLUMN_NAME_FilterClassName}]\n FROM (${def.query.ecsql}) [q]\n `,\n },\n };\n}\n\nfunction shouldExpandGroupingNode(node: ProcessedGroupingHierarchyNode) {\n const numberOfNonGroupingParentNodes = node.parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length;\n for (const child of node.children) {\n /* c8 ignore next 3 */\n if (!child.filtering) {\n continue;\n }\n\n if (\n child.filtering.isFilterTarget &&\n getAutoExpandAsTrueFalse(child.filtering.filterTargetOptions?.autoExpand, numberOfNonGroupingParentNodes, node.parentKeys.length)\n ) {\n return true;\n }\n\n if (!child.filtering.filteredChildrenIdentifierPaths) {\n /* c8 ignore next */\n continue;\n }\n\n for (const path of child.filtering.filteredChildrenIdentifierPaths) {\n if (\"path\" in path && getAutoExpandAsTrueFalse(path.options?.autoExpand, numberOfNonGroupingParentNodes, node.parentKeys.length)) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction getAutoExpandAsTrueFalse(\n autoExpand: HierarchyFilteringPathOptions[\"autoExpand\"],\n numberOfNonGroupingParentNodes: number,\n numberOfParentNodes: number,\n): boolean {\n if (!autoExpand) {\n return false;\n }\n if (autoExpand === true) {\n return true;\n }\n\n // auto-expand should be set to true only if parentKeys length is smaller than depth.\n const nodeDepth = \"depthInHierarchy\" in autoExpand ? numberOfParentNodes : numberOfNonGroupingParentNodes;\n const filterTargetDepth = \"depthInPath\" in autoExpand ? autoExpand.depthInPath : autoExpand.depthInHierarchy;\n return nodeDepth < filterTargetDepth;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilteringHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAsQhG,4DAgCC;AAGD,gEAcC;AArTD,+BAAoI;AAGpI,oEAAiI;AACjI,8EAAwE;AACxE,gEAA6E;AAC7E,yFAMgD;AAChD,6EAA0I;AAC1I,mFAAkF;AAClF,qEAAkE;AAClE,qDAA4D;AAC5D,qEAA+D;AAW/D,gBAAgB;AAChB,MAAa,4BAA4B;IAC/B,aAAa,CAAoD;IACjE,OAAO,CAA0B;IACjC,oBAAoB,CAA2B;IAC/C,YAAY,CAAiB;IACrC,WAAW,CAAS;IAEp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AAE,oCAAoC,EAAE,CAAC,EACvJ,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,SAAS;QACX,CAAC;QAED,sBAAsB;QACtB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,SAAS;QACX,CAAC;QAED,IACE,KAAK,CAAC,SAAS,CAAC,cAAc;YAC9B,IAAA,qDAA6B,EAAC;gBAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,MAAM;gBACnD,uBAAuB,EAAE,gBAAgB;gBACzC,6IAA6I;gBAC7I,kBAAkB,EAAE,oCAAoC,GAAG,CAAC;aAC7D,CAAC,EACF,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,+BAA+B,EAAE,CAAC;YACrD,oBAAoB;YACpB,SAAS;QACX,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,+BAA+B,EAAE,CAAC;YACnE,IACE,MAAM,IAAI,IAAI;gBACd,IAAA,qDAA6B,EAAC;oBAC5B,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM;oBAC5B,uBAAuB,EAAE,gBAAgB;oBACzC,6IAA6I;oBAC7I,kBAAkB,EAAE,oCAAoC,GAAG,CAAC;iBAC7D,CAAC,EACF,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { defaultIfEmpty, defer, filter, firstValueFrom, map, merge, mergeAll, mergeMap, Observable, of, take, toArray } from \"rxjs\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport { createHierarchyFilteringHelper, HierarchyFilteringPath, shouldAutoExpandBasedOnReveal } from \"../HierarchyFiltering.js\";\nimport { HierarchyNodeIdentifier } from \"../HierarchyNodeIdentifier.js\";\nimport { HierarchyNodeKey, IModelInstanceKey } from \"../HierarchyNodeKey.js\";\nimport {\n DefineHierarchyLevelProps,\n GenericHierarchyNodeDefinition,\n HierarchyLevelDefinition,\n HierarchyNodesDefinition,\n InstanceNodesQueryDefinition,\n} from \"../imodel/IModelHierarchyDefinition.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../imodel/IModelHierarchyNode.js\";\nimport { NodeSelectClauseColumnNames } from \"../imodel/NodeSelectQueryFactory.js\";\nimport { defaultNodesParser } from \"../imodel/TreeNodesReader.js\";\nimport { fromPossiblyPromise } from \"../internal/Common.js\";\nimport { partition } from \"../internal/operators/Partition.js\";\nimport { RxjsHierarchyDefinition, RxjsNodeParser, RxjsNodePostProcessor, RxjsNodePreProcessor } from \"../internal/RxjsHierarchyDefinition.js\";\n\ninterface FilteringHierarchyDefinitionProps {\n imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n source: RxjsHierarchyDefinition;\n sourceName: string;\n nodeIdentifierPaths: HierarchyFilteringPath[];\n nodesParser?: RxjsNodeParser;\n}\n\n/** @internal */\nexport class FilteringHierarchyDefinition implements RxjsHierarchyDefinition {\n private _imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n private _source: RxjsHierarchyDefinition;\n private _nodeIdentifierPaths: HierarchyFilteringPath[];\n private _nodesParser: RxjsNodeParser;\n #sourceName: string;\n\n public constructor(props: FilteringHierarchyDefinitionProps) {\n this._imodelAccess = props.imodelAccess;\n this._source = props.source;\n this.#sourceName = props.sourceName;\n this._nodeIdentifierPaths = props.nodeIdentifierPaths;\n this._nodesParser = props.nodesParser ?? this._source.parseNode ?? ((row) => of(defaultNodesParser(row)));\n }\n\n public get preProcessNode(): RxjsNodePreProcessor {\n return (node) => {\n return (this._source.preProcessNode ? this._source.preProcessNode(node) : of(node)).pipe(\n filter((processedNode) => {\n if (processedNode.processingParams?.hideInHierarchy && processedNode.filtering?.isFilterTarget && !processedNode.filtering.hasFilterTargetAncestor) {\n // we want to hide target nodes if they have `hideInHierarchy` param, but only if they're not under another filter target\n return false;\n }\n return true;\n }),\n );\n };\n }\n\n public get postProcessNode(): RxjsNodePostProcessor {\n return (node) => {\n return (this._source.postProcessNode ? this._source.postProcessNode(node) : of(node)).pipe(\n map((processedNode) => {\n const parentKeysWithoutGroupingNodesLength = processedNode.parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length;\n const parentKeysLength = processedNode.parentKeys.length;\n const shouldAutoExpand = ProcessedHierarchyNode.isGroupingNode(processedNode)\n ? shouldAutoExpandGroupingNodeBasedOnNestedChildren({\n directOrIndirectChildren: processedNode.children,\n parentKeysWithoutGroupingNodesLength,\n parentKeysLength,\n })\n : (processedNode.filtering?.isFilterTarget && !!processedNode.filtering.filterTargetOptions?.autoExpand) ||\n processedNode.filtering?.filteredChildrenIdentifierPaths?.some((path) =>\n shouldAutoExpandBasedOnReveal({\n reveal: HierarchyFilteringPath.normalize(path).options?.reveal,\n nodePositionInPath: parentKeysWithoutGroupingNodesLength,\n nodePositionInHierarchy: parentKeysLength,\n }),\n );\n if (shouldAutoExpand) {\n Object.assign(processedNode, { autoExpand: true });\n }\n\n return processedNode;\n }),\n );\n };\n }\n\n public get parseNode(): RxjsNodeParser {\n return (row, parentNode) => {\n return this._nodesParser(row).pipe(\n mergeMap((parsedNode) => {\n if (!row[ECSQL_COLUMN_NAME_FilterECInstanceId] || !row[ECSQL_COLUMN_NAME_FilterClassName]) {\n return of(parsedNode);\n }\n const rowInstanceKey = { className: row[ECSQL_COLUMN_NAME_FilterClassName], id: row[ECSQL_COLUMN_NAME_FilterECInstanceId] };\n const filteringHelper = createHierarchyFilteringHelper(this._nodeIdentifierPaths, parentNode);\n const nodeFilteringPropPossiblyPromise = filteringHelper.createChildNodeProps({\n asyncPathMatcher: (identifier): boolean | Promise<boolean> => {\n if (identifier.id !== rowInstanceKey.id) {\n return false;\n }\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(identifier)) {\n return false;\n }\n if (identifier.imodelKey && identifier.imodelKey !== this._imodelAccess.imodelKey) {\n return false;\n }\n if (identifier.className === rowInstanceKey.className) {\n return true;\n }\n return firstValueFrom(\n merge(\n fromPossiblyPromise(this._imodelAccess.classDerivesFrom(identifier.className, rowInstanceKey.className)),\n fromPossiblyPromise(this._imodelAccess.classDerivesFrom(rowInstanceKey.className, identifier.className)),\n ).pipe(\n filter((classDerives) => classDerives),\n defaultIfEmpty(false),\n take(1),\n ),\n );\n },\n });\n return fromPossiblyPromise(nodeFilteringPropPossiblyPromise).pipe(\n map((nodeExtraProps) => {\n if (nodeExtraProps?.filtering) {\n parsedNode.filtering = nodeExtraProps.filtering;\n }\n return parsedNode;\n }),\n );\n }),\n );\n };\n }\n\n public defineHierarchyLevel(props: DefineHierarchyLevelProps): Observable<HierarchyLevelDefinition> {\n const sourceDefinitions = this._source.defineHierarchyLevel(props);\n\n const filteringHelper = createHierarchyFilteringHelper(this._nodeIdentifierPaths, props.parentNode);\n const childNodeFilteringIdentifiers = filteringHelper.getChildNodeFilteringIdentifiers();\n if (!childNodeFilteringIdentifiers) {\n return sourceDefinitions;\n }\n\n const [genericNodeDefinitions, instanceNodeDefinitions] = partition(sourceDefinitions.pipe(mergeAll()), HierarchyNodesDefinition.isGenericNode);\n return merge(\n genericNodeDefinitions.pipe(\n map((definition) => {\n if (\n filteringHelper.hasFilterTargetAncestor ||\n childNodeFilteringIdentifiers.some(\n (identifier) =>\n HierarchyNodeIdentifier.isGenericNodeIdentifier(identifier) &&\n (!identifier.source || identifier.source === this.#sourceName) &&\n identifier.id === definition.node.key,\n )\n ) {\n return {\n ...definition,\n node: {\n ...definition.node,\n ...filteringHelper.createChildNodeProps({ pathMatcher: ({ id }) => id === definition.node.key }),\n },\n };\n }\n return undefined;\n }),\n filter((def): def is GenericHierarchyNodeDefinition => !!def),\n ),\n\n instanceNodeDefinitions.pipe(\n mergeMap((definition) => {\n if (filteringHelper.hasFilterTargetAncestor) {\n // if we have a filter target ancestor, we don't need to filter the definitions - we use all of them\n return of(applyECInstanceIdsSelector(definition));\n }\n return defer(async () => {\n const imodelAccess = this._imodelAccess;\n const matches = new Map<Id64String, IModelInstanceKey[]>();\n async function getEntries(x: IModelInstanceKey) {\n let entries = matches.get(x.id);\n if (!entries) {\n entries = [];\n matches.set(x.id, entries);\n }\n // make sure that we don't have path identifiers that only differ by class name, where\n // class names are in the same class hierarchy, e.g.:\n // [{ className: \"bis.Element\", id: \"0x1\" }, { className: \"bis.Subject\", id: \"0x1\" }]\n // are actually the same instance, so we only need to keep one of them, or otherwise the query will\n // duplicate it\n for (const entry of entries) {\n if (\n entry.className === x.className ||\n (await imodelAccess.classDerivesFrom(entry.className, x.className)) ||\n (await imodelAccess.classDerivesFrom(x.className, entry.className))\n ) {\n return undefined;\n }\n }\n return entries;\n }\n for (const id of childNodeFilteringIdentifiers) {\n // take only identifiers that match the definition by type, source and class\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(id)) {\n continue;\n }\n if (id.imodelKey && id.imodelKey !== imodelAccess.imodelKey) {\n continue;\n }\n if (\n id.className !== definition.fullClassName &&\n !(await Promise.all([\n imodelAccess.classDerivesFrom(id.className, definition.fullClassName),\n imodelAccess.classDerivesFrom(definition.fullClassName, id.className),\n ]).then(([isDerivedFrom, isDerivedTo]) => isDerivedFrom || isDerivedTo))\n ) {\n continue;\n }\n const entriesTargetForPathIdentifier = await getEntries(id);\n if (entriesTargetForPathIdentifier) {\n entriesTargetForPathIdentifier.push(id);\n }\n }\n return Array.from(matches.values()).flat();\n }).pipe(\n // only take definitions that have matching path identifiers\n filter((pathIdentifiers) => pathIdentifiers.length > 0),\n\n // for each definition that we're going to use, apply query-level filter\n map((pathIdentifiers) => applyECInstanceIdsFilter(definition, pathIdentifiers)),\n );\n }),\n ),\n ).pipe(toArray());\n }\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilterECInstanceId = \"FilterECInstanceId\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilterClassName = \"FilterClassName\";\n\nfunction getClassECInstanceIds(filteredInstanceKeys: InstanceKey[]) {\n const classNameECInstanceIds = new Map<string, Id64String[]>();\n for (const key of filteredInstanceKeys) {\n const entry = classNameECInstanceIds.get(key.className);\n if (entry === undefined) {\n classNameECInstanceIds.set(key.className, [key.id]);\n continue;\n }\n entry.push(key.id);\n }\n return classNameECInstanceIds;\n}\n\n/** @internal */\nexport function applyECInstanceIdsFilter(def: InstanceNodesQueryDefinition, filteredInstanceKeys: InstanceKey[]): InstanceNodesQueryDefinition {\n const instanceIdsByClass = getClassECInstanceIds(filteredInstanceKeys);\n return {\n ...def,\n query: {\n ...def.query,\n ctes: [\n ...(def.query.ctes ?? []),\n `FilteringInfo(ECInstanceId, FilterClassName) AS (\n ${Array.from(instanceIdsByClass)\n .map(\n ([className, ecInstanceIds]) => `\n SELECT ECInstanceId, '${className}' AS FilterClassName\n FROM ${className}\n WHERE ECInstanceId IN (${ecInstanceIds.join(\", \")})\n `,\n )\n .join(\" UNION ALL \")}\n )`,\n ],\n ecsql: `\n SELECT\n [q].*,\n IdToHex([f].[ECInstanceId]) AS [${ECSQL_COLUMN_NAME_FilterECInstanceId}],\n [f].[FilterClassName] AS [${ECSQL_COLUMN_NAME_FilterClassName}]\n FROM (\n ${def.query.ecsql}\n ) [q]\n JOIN FilteringInfo [f] ON [f].[ECInstanceId] = [q].[ECInstanceId]\n `,\n },\n };\n}\n\n/** @internal */\nexport function applyECInstanceIdsSelector(def: InstanceNodesQueryDefinition): InstanceNodesQueryDefinition {\n return {\n ...def,\n query: {\n ...def.query,\n ecsql: `\n SELECT\n [q].*,\n IdToHex([q].[ECInstanceId]) AS [${ECSQL_COLUMN_NAME_FilterECInstanceId}],\n [q].[${NodeSelectClauseColumnNames.FullClassName}] AS [${ECSQL_COLUMN_NAME_FilterClassName}]\n FROM (${def.query.ecsql}) [q]\n `,\n },\n };\n}\n\nfunction shouldAutoExpandGroupingNodeBasedOnNestedChildren({\n directOrIndirectChildren,\n parentKeysLength,\n parentKeysWithoutGroupingNodesLength,\n}: {\n directOrIndirectChildren: Array<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>;\n parentKeysLength: number;\n parentKeysWithoutGroupingNodesLength: number;\n}) {\n for (const child of directOrIndirectChildren) {\n if (ProcessedHierarchyNode.isGroupingNode(child)) {\n // Need to check if the same grouping node needs to be expanded, but check the indirect children instead\n if (\n shouldAutoExpandGroupingNodeBasedOnNestedChildren({ directOrIndirectChildren: child.children, parentKeysLength, parentKeysWithoutGroupingNodesLength })\n ) {\n return true;\n }\n continue;\n }\n\n /* c8 ignore next 3 */\n if (!child.filtering) {\n continue;\n }\n\n if (\n child.filtering.isFilterTarget &&\n shouldAutoExpandBasedOnReveal({\n reveal: child.filtering.filterTargetOptions?.reveal,\n nodePositionInHierarchy: parentKeysLength,\n // Grouping node is not in filtering path, but we can assume that it is at the position of 1 less than `parentKeysWithoutGroupingNodesLength`\n nodePositionInPath: parentKeysWithoutGroupingNodesLength - 1,\n })\n ) {\n return true;\n }\n\n if (!child.filtering.filteredChildrenIdentifierPaths) {\n /* c8 ignore next */\n continue;\n }\n\n for (const path of child.filtering.filteredChildrenIdentifierPaths) {\n if (\n \"path\" in path &&\n shouldAutoExpandBasedOnReveal({\n reveal: path.options?.reveal,\n nodePositionInHierarchy: parentKeysLength,\n // Grouping node is not in filtering path, but we can assume that it is at the position of 1 less than `parentKeysWithoutGroupingNodesLength`\n nodePositionInPath: parentKeysWithoutGroupingNodesLength - 1,\n })\n ) {\n return true;\n }\n }\n }\n return false;\n}\n"]}
|
|
@@ -37,7 +37,10 @@ interface IModelHierarchyProviderProps {
|
|
|
37
37
|
* @see `ECClassHierarchyInspector`
|
|
38
38
|
*/
|
|
39
39
|
imodelAccess: IModelAccess;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider
|
|
42
|
+
* subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.
|
|
43
|
+
*/
|
|
41
44
|
imodelChanged?: Event<() => void>;
|
|
42
45
|
/**
|
|
43
46
|
* A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The
|
|
@@ -66,15 +69,47 @@ interface IModelHierarchyProviderProps {
|
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
71
|
/**
|
|
69
|
-
* Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and
|
|
72
|
+
* Creates an instance of `HierarchyProvider` that creates a hierarchy based on given the iModel and
|
|
70
73
|
* a hierarchy definition, which defines each hierarchy level through ECSQL queries.
|
|
71
74
|
*
|
|
72
75
|
* @public
|
|
73
76
|
*/
|
|
74
|
-
export declare function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider &
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
export declare function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & Disposable;
|
|
78
|
+
/**
|
|
79
|
+
* Props for `createMergedIModelHierarchyProvider`.
|
|
80
|
+
* @alpha
|
|
81
|
+
*/
|
|
82
|
+
interface MergedIModelHierarchyProviderProps extends Omit<IModelHierarchyProviderProps, "imodelAccess" | "imodelChanged"> {
|
|
83
|
+
/**
|
|
84
|
+
* A list of iModels to create merged hierarchy for.
|
|
85
|
+
*
|
|
86
|
+
* **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the
|
|
87
|
+
* latest version. Not obeying this rule may result in undefined behavior.
|
|
88
|
+
*/
|
|
89
|
+
imodels: Array<{
|
|
90
|
+
/**
|
|
91
|
+
* An object that provides access to iModel's data and metadata.
|
|
92
|
+
*
|
|
93
|
+
* @see `ECSchemaProvider`
|
|
94
|
+
* @see `LimitingECSqlQueryExecutor`
|
|
95
|
+
* @see `ECClassHierarchyInspector`
|
|
96
|
+
*/
|
|
97
|
+
imodelAccess: IModelAccess;
|
|
98
|
+
/**
|
|
99
|
+
* An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider
|
|
100
|
+
* subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.
|
|
101
|
+
*/
|
|
102
|
+
imodelChanged?: Event<() => void>;
|
|
103
|
+
}>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates an instance of `HierarchyProvider` that creates a hierarchy based on multiple version of **the same** iModel
|
|
107
|
+
* and a hierarchy definition, which defines each hierarchy level through ECSQL queries.
|
|
108
|
+
*
|
|
109
|
+
* **Warning:** This is an experimental API that **should not be used in production**.
|
|
110
|
+
*
|
|
111
|
+
* @alpha
|
|
112
|
+
*/
|
|
113
|
+
export declare function createMergedIModelHierarchyProvider(props: MergedIModelHierarchyProviderProps): HierarchyProvider & Disposable;
|
|
79
114
|
export {};
|
|
80
115
|
//# sourceMappingURL=IModelHierarchyProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;AA4BxC,OAAO,EAGL,yBAAyB,EACzB,gBAAgB,EAGhB,KAAK,EAIL,wBAAwB,EAEzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAA0B,iBAAiB,EAAE,MAAM,yBAAyB,CA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