@itwin/presentation-hierarchies 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/cjs/hierarchies/HierarchyErrors.d.ts +1 -1
- package/lib/cjs/hierarchies/HierarchyErrors.js +1 -1
- package/lib/cjs/hierarchies/HierarchyErrors.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +12 -11
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.js +16 -21
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +10 -10
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js +13 -13
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +4 -4
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +13 -13
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +6 -6
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +6 -6
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/Logging.d.ts +2 -2
- package/lib/cjs/hierarchies/Logging.js +3 -3
- package/lib/cjs/hierarchies/Logging.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +5 -17
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +66 -54
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js +2 -2
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +13 -13
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +23 -23
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js +5 -5
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +8 -8
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +88 -87
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js +17 -14
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +16 -16
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +2 -2
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +10 -10
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +5 -10
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +4 -4
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +1 -2
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/Utils.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/Utils.js +2 -2
- package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js +8 -8
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js +42 -42
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +16 -16
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js +25 -25
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +3 -3
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +13 -18
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.d.ts +1 -1
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +2 -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 +3 -0
- package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
- package/lib/cjs/hierarchies/internal/LoggingUtils.js +2 -2
- package/lib/cjs/hierarchies/internal/LoggingUtils.js.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.js +2 -2
- package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +13 -13
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +29 -29
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyErrors.d.ts +1 -1
- package/lib/esm/hierarchies/HierarchyErrors.js +1 -1
- package/lib/esm/hierarchies/HierarchyErrors.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts +12 -11
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.js +16 -21
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.d.ts +10 -10
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js +3 -3
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +4 -4
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +13 -13
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +6 -6
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +3 -3
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/Logging.d.ts +2 -2
- package/lib/esm/hierarchies/Logging.js +3 -3
- package/lib/esm/hierarchies/Logging.js.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +5 -17
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +52 -40
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/HierarchyCache.js +1 -1
- package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +13 -13
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +23 -23
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js +2 -2
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +8 -8
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +41 -40
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js +11 -8
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +16 -16
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +2 -2
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +10 -10
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +5 -10
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts +4 -4
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js +1 -2
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/esm/hierarchies/imodel/Utils.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/Utils.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/Utils.js +1 -1
- package/lib/esm/hierarchies/imodel/Utils.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js +6 -6
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.js +22 -22
- package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js +10 -10
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js +14 -14
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +2 -2
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +9 -14
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +1 -1
- package/lib/esm/hierarchies/internal/Common.d.ts +1 -1
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +2 -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 +3 -0
- package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
- package/lib/esm/hierarchies/internal/LoggingUtils.js +1 -1
- package/lib/esm/hierarchies/internal/LoggingUtils.js.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.js +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +13 -13
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +13 -13
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +21 -13
|
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.LOGGING_NAMESPACE = void 0;
|
|
8
8
|
exports.createDetermineChildrenOperator = createDetermineChildrenOperator;
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
const Common_js_1 = require("../../internal/Common.js");
|
|
11
|
+
const LoggingUtils_js_1 = require("../../internal/LoggingUtils.js");
|
|
12
|
+
const ReleaseMainThread_js_1 = require("../../internal/operators/ReleaseMainThread.js");
|
|
13
13
|
const OPERATOR_NAME = "DetermineChildren";
|
|
14
14
|
/** @internal */
|
|
15
|
-
exports.LOGGING_NAMESPACE = (0,
|
|
15
|
+
exports.LOGGING_NAMESPACE = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_INTERNAL);
|
|
16
16
|
/**
|
|
17
17
|
* Ensures all input nodes have their children determined.
|
|
18
18
|
*
|
|
@@ -20,15 +20,15 @@ exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATO
|
|
|
20
20
|
*/
|
|
21
21
|
function createDetermineChildrenOperator(hasNodes) {
|
|
22
22
|
return function (nodes) {
|
|
23
|
-
return nodes.pipe((0,
|
|
23
|
+
return nodes.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }), (0, ReleaseMainThread_js_1.releaseMainThreadOnItemsCount)(200), (0, rxjs_1.concatMap)((n) => {
|
|
24
24
|
if (n.children !== undefined) {
|
|
25
25
|
return (0, rxjs_1.of)(n);
|
|
26
26
|
}
|
|
27
|
-
return hasNodes(n).pipe((0,
|
|
27
|
+
return hasNodes(n).pipe((0, LoggingUtils_js_1.log)({
|
|
28
28
|
category: exports.LOGGING_NAMESPACE,
|
|
29
|
-
message: /*
|
|
29
|
+
message: /* c8 ignore next */ (hasChildrenFlag) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: determined children: ${hasChildrenFlag}`,
|
|
30
30
|
}), (0, rxjs_1.map)((hasChildrenFlag) => Object.assign(n, { children: hasChildrenFlag })));
|
|
31
|
-
}), (0,
|
|
31
|
+
}), (0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=DetermineChildren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetermineChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/DetermineChildren.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiBhG,0EAoBC;AAnCD,+BAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"DetermineChildren.js","sourceRoot":"","sources":["../../../../../src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AAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAA,0CAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACvH,CAAC;IACJ,CAAC,CAAC;AACJ,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 { concatMap, map, Observable, of } from \"rxjs\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, LOGGING_NAMESPACE_INTERNAL } from \"../../internal/Common.js\";\nimport { log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nconst OPERATOR_NAME = \"DetermineChildren\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Ensures all input nodes have their children determined.\n *\n * @internal\n */\nexport function createDetermineChildrenOperator(hasNodes: (node: ProcessedHierarchyNode) => Observable<boolean>) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n releaseMainThreadOnItemsCount(200),\n concatMap((n: ProcessedHierarchyNode): Observable<ProcessedHierarchyNode> => {\n if (n.children !== undefined) {\n return of(n);\n }\n return hasNodes(n).pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (hasChildrenFlag) => `${createNodeIdentifierForLogging(n)}: determined children: ${hasChildrenFlag}`,\n }),\n map((hasChildrenFlag) => Object.assign(n, { children: hasChildrenFlag })),\n );\n }),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
2
|
import { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
|
|
3
|
-
import { ParentHierarchyNode } from "../../HierarchyNode";
|
|
4
|
-
import { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from "../IModelHierarchyNode";
|
|
5
|
-
import { PropertiesGroupingLocalizedStrings } from "./grouping/PropertiesGrouping";
|
|
3
|
+
import { ParentHierarchyNode } from "../../HierarchyNode.js";
|
|
4
|
+
import { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from "../IModelHierarchyNode.js";
|
|
5
|
+
import { PropertiesGroupingLocalizedStrings } from "./grouping/PropertiesGrouping.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare const LOGGING_NAMESPACE: string;
|
|
8
8
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuF,UAAU,EAA4B,MAAM,MAAM,CAAC;AAEjJ,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACnH,OAAO,EAAiB,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Grouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuF,UAAU,EAA4B,MAAM,MAAM,CAAC;AAEjJ,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACnH,OAAO,EAAiB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAW5E,OAAO,EAAE,8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AS,EAC3C,sBAAsB,EAAE,8BAA8B,EAAE,EACxD,cAAc,EAAE,wBAAwB,EACxC,gBAAgB,EAAE,kCAAkC,GACnD,UAAU,CAAC,eAAe,CAAC,CA+B7B"}
|
|
@@ -9,32 +9,32 @@ exports.createGroupingOperator = createGroupingOperator;
|
|
|
9
9
|
exports.createGroupingHandlers = createGroupingHandlers;
|
|
10
10
|
const rxjs_1 = require("rxjs");
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
12
|
+
const HierarchyNode_js_1 = require("../../HierarchyNode.js");
|
|
13
|
+
const Common_js_1 = require("../../internal/Common.js");
|
|
14
|
+
const LoggingUtils_js_1 = require("../../internal/LoggingUtils.js");
|
|
15
|
+
const ReleaseMainThread_js_1 = require("../../internal/operators/ReleaseMainThread.js");
|
|
16
|
+
const TapOnce_js_1 = require("../../internal/operators/TapOnce.js");
|
|
17
|
+
const AutoExpand_js_1 = require("./grouping/AutoExpand.js");
|
|
18
|
+
const BaseClassGrouping_js_1 = require("./grouping/BaseClassGrouping.js");
|
|
19
|
+
const ClassGrouping_js_1 = require("./grouping/ClassGrouping.js");
|
|
20
|
+
const GroupHiding_js_1 = require("./grouping/GroupHiding.js");
|
|
21
|
+
const LabelGrouping_js_1 = require("./grouping/LabelGrouping.js");
|
|
22
|
+
const PropertiesGrouping_js_1 = require("./grouping/PropertiesGrouping.js");
|
|
23
23
|
const OPERATOR_NAME = "Grouping";
|
|
24
24
|
/** @internal */
|
|
25
|
-
exports.LOGGING_NAMESPACE = (0,
|
|
26
|
-
const LOGGING_NAMESPACE_PERFORMANCE = (0,
|
|
27
|
-
const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = (0,
|
|
25
|
+
exports.LOGGING_NAMESPACE = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_INTERNAL);
|
|
26
|
+
const LOGGING_NAMESPACE_PERFORMANCE = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_PERFORMANCE);
|
|
27
|
+
const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);
|
|
28
28
|
/** @internal */
|
|
29
29
|
function createGroupingOperator(imodelAccess, parentNode, valueFormatter, localizedStrings, onGroupingNodeCreated, groupingHandlers) {
|
|
30
30
|
return function (nodes) {
|
|
31
|
-
return nodes.pipe((0,
|
|
32
|
-
(0,
|
|
31
|
+
return nodes.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }), (0, TapOnce_js_1.tapOnce)(() => {
|
|
32
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
33
33
|
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
34
|
-
message: /*
|
|
34
|
+
message: /* c8 ignore next */ () => `Starting grouping (parent: ${(0, Common_js_1.createNodeIdentifierForLogging)(parentNode)})`,
|
|
35
35
|
});
|
|
36
36
|
}), (0, rxjs_1.reduce)((resolvedNodes, node) => {
|
|
37
|
-
if (
|
|
37
|
+
if (HierarchyNode_js_1.HierarchyNode.isInstancesNode(node)) {
|
|
38
38
|
resolvedNodes.instanceNodes.push(node);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
@@ -42,14 +42,14 @@ function createGroupingOperator(imodelAccess, parentNode, valueFormatter, locali
|
|
|
42
42
|
}
|
|
43
43
|
return resolvedNodes;
|
|
44
44
|
}, { instanceNodes: [], restNodes: [] }), (0, rxjs_1.tap)(({ instanceNodes, restNodes }) => {
|
|
45
|
-
(0,
|
|
45
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
46
46
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
47
|
-
message: /*
|
|
47
|
+
message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,
|
|
48
48
|
});
|
|
49
49
|
}), (0, rxjs_1.mergeMap)((res) => {
|
|
50
50
|
const out = (0, rxjs_1.of)(res);
|
|
51
51
|
const totalNodes = res.instanceNodes.length + res.restNodes.length;
|
|
52
|
-
|
|
52
|
+
/* c8 ignore next */
|
|
53
53
|
return totalNodes <= 1000 ? out : out.pipe((0, rxjs_1.delay)(0));
|
|
54
54
|
}), (0, rxjs_1.mergeMap)(({ instanceNodes, restNodes }) => {
|
|
55
55
|
const timer = new core_bentley_1.StopWatch(undefined, true);
|
|
@@ -57,12 +57,12 @@ function createGroupingOperator(imodelAccess, parentNode, valueFormatter, locali
|
|
|
57
57
|
? (0, rxjs_1.from)(groupingHandlers)
|
|
58
58
|
: createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);
|
|
59
59
|
return (0, rxjs_1.merge)(groupingHandlersObs.pipe((0, rxjs_1.toArray)(), (0, rxjs_1.mergeMap)((createdGroupingHandlers) => groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onGroupingNodeCreated)), (0, rxjs_1.finalize)(() => {
|
|
60
|
-
(0,
|
|
60
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
61
61
|
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
62
|
-
message: /*
|
|
62
|
+
message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,
|
|
63
63
|
});
|
|
64
64
|
})), (0, rxjs_1.from)(restNodes));
|
|
65
|
-
}), (0,
|
|
65
|
+
}), (0, ReleaseMainThread_js_1.releaseMainThreadOnItemsCount)(500), (0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode, onGroupingNodeCreated) {
|
|
@@ -75,21 +75,21 @@ function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode,
|
|
|
75
75
|
}
|
|
76
76
|
const timer = new core_bentley_1.StopWatch(undefined, true);
|
|
77
77
|
const currentHandler = groupingHandlers[handlerIndex];
|
|
78
|
-
return (0, rxjs_1.from)(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe((0,
|
|
78
|
+
return (0, rxjs_1.from)(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe((0, LoggingUtils_js_1.log)({
|
|
79
79
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
80
|
-
message: /*
|
|
80
|
+
message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,
|
|
81
81
|
}), (0, rxjs_1.mergeMap)((result) => {
|
|
82
82
|
if (result.grouped.length === 0) {
|
|
83
83
|
return (0, rxjs_1.of)({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });
|
|
84
84
|
}
|
|
85
85
|
const groupingPostProcessingTimer = new core_bentley_1.StopWatch(undefined, true);
|
|
86
|
-
return (0, rxjs_1.of)(result).pipe((0, rxjs_1.map)((r) => (0,
|
|
86
|
+
return (0, rxjs_1.of)(result).pipe((0, rxjs_1.map)((r) => (0, GroupHiding_js_1.applyGroupHidingParams)(r, extraSiblings)), (0, rxjs_1.map)((r) => (0, AutoExpand_js_1.assignAutoExpand)(r)), (0, rxjs_1.map)((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })), (0, LoggingUtils_js_1.log)({
|
|
87
87
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
88
|
-
message: /*
|
|
88
|
+
message: /* c8 ignore next */ () => `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,
|
|
89
89
|
}), (0, rxjs_1.delay)(0));
|
|
90
|
-
}), (0,
|
|
90
|
+
}), (0, LoggingUtils_js_1.log)({
|
|
91
91
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
92
|
-
message: /*
|
|
92
|
+
message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,
|
|
93
93
|
}));
|
|
94
94
|
}), (0, rxjs_1.last)(), (0, rxjs_1.mergeMap)(({ result }) => {
|
|
95
95
|
result.grouped.forEach((groupingNode) => {
|
|
@@ -97,12 +97,12 @@ function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode,
|
|
|
97
97
|
if (!parentNode) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
100
|
+
if (HierarchyNode_js_1.HierarchyNode.isGroupingNode(parentNode)) {
|
|
101
101
|
groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
// not sure why type checker doesn't pick this up
|
|
105
|
-
(0, core_bentley_1.assert)(
|
|
105
|
+
(0, core_bentley_1.assert)(HierarchyNode_js_1.HierarchyNode.isGeneric(parentNode) || HierarchyNode_js_1.HierarchyNode.isInstancesNode(parentNode));
|
|
106
106
|
groupingNode.nonGroupingAncestor = parentNode;
|
|
107
107
|
});
|
|
108
108
|
return mergeInPlace(result.grouped, result.ungrouped);
|
|
@@ -122,32 +122,32 @@ function createGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes
|
|
|
122
122
|
const timer = new core_bentley_1.StopWatch();
|
|
123
123
|
const groupingLevel = getNodeGroupingLevel(parentNode);
|
|
124
124
|
return (0, rxjs_1.concat)(groupingLevel <= GroupingLevel.Class
|
|
125
|
-
? (0, rxjs_1.concat)((0, rxjs_1.from)((0,
|
|
125
|
+
? (0, rxjs_1.concat)((0, rxjs_1.from)((0, BaseClassGrouping_js_1.createBaseClassGroupingHandlers)(imodelAccess, parentNode, processedInstanceNodes)).pipe((0, rxjs_1.concatAll)()), (0, rxjs_1.of)(async (allNodes) => (0, ClassGrouping_js_1.createClassGroups)(imodelAccess, parentNode, allNodes)))
|
|
126
126
|
: rxjs_1.EMPTY, groupingLevel <= GroupingLevel.Property
|
|
127
|
-
? (0, rxjs_1.from)((0,
|
|
128
|
-
: rxjs_1.EMPTY, groupingLevel < GroupingLevel.Label ? (0, rxjs_1.of)(async (allNodes) => (0,
|
|
127
|
+
? (0, rxjs_1.from)((0, PropertiesGrouping_js_1.createPropertiesGroupingHandlers)(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe((0, rxjs_1.concatAll)())
|
|
128
|
+
: rxjs_1.EMPTY, groupingLevel < GroupingLevel.Label ? (0, rxjs_1.of)(async (allNodes) => (0, LabelGrouping_js_1.createLabelGroups)(allNodes)) : rxjs_1.EMPTY).pipe((0, rxjs_1.tap)({
|
|
129
129
|
subscribe: () => {
|
|
130
|
-
(0,
|
|
130
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
131
131
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
132
|
-
message: /*
|
|
132
|
+
message: /* c8 ignore next */ () => `Start creating grouping handlers`,
|
|
133
133
|
});
|
|
134
134
|
timer.start();
|
|
135
135
|
},
|
|
136
136
|
}), (0, rxjs_1.finalize)(() => {
|
|
137
|
-
(0,
|
|
137
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
138
138
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
139
|
-
message: /*
|
|
139
|
+
message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,
|
|
140
140
|
});
|
|
141
141
|
}));
|
|
142
142
|
}
|
|
143
143
|
function getNodeGroupingLevel(node) {
|
|
144
|
-
if (node &&
|
|
144
|
+
if (node && HierarchyNode_js_1.HierarchyNode.isClassGroupingNode(node)) {
|
|
145
145
|
return GroupingLevel.Class;
|
|
146
146
|
}
|
|
147
|
-
if (node &&
|
|
147
|
+
if (node && HierarchyNode_js_1.HierarchyNode.isPropertyGroupingNode(node)) {
|
|
148
148
|
return GroupingLevel.Property;
|
|
149
149
|
}
|
|
150
|
-
if (node &&
|
|
150
|
+
if (node && HierarchyNode_js_1.HierarchyNode.isLabelGroupingNode(node)) {
|
|
151
151
|
return GroupingLevel.Label;
|
|
152
152
|
}
|
|
153
153
|
return GroupingLevel.None;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA+BhG,wDAiEC;AAmGD,wDAqCC;AAtOD,+BAAiJ;AACjJ,sDAAwD;AAExD,uDAAyE;AACzE,kDAM+B;AAC/B,8DAAyD;AACzD,kFAA2F;AAC3F,8DAA2D;AAE3D,sDAAyD;AACzD,oEAA+E;AAC/E,4DAA6D;AAC7D,wDAAgE;AAChE,4DAA6D;AAC7D,sEAAqH;AAErH,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,uCAA8B,EAAC,aAAa,EAAE,mCAA0B,CAAC,CAAC;AAC3G,MAAM,6BAA6B,GAAG,IAAA,uCAA8B,EAAC,aAAa,EAAE,sCAAkC,CAAC,CAAC;AACxH,MAAM,sCAAsC,GAAG,IAAA,uCAA8B,EAAC,aAAa,EAAE,+CAA2C,CAAC,CAAC;AAE1I,gBAAgB;AAChB,SAAgB,sBAAsB,CACpC,YAA0D,EAC1D,UAA2C,EAC3C,cAAwC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,CAAC,CAAC,IAAI;SACjH,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAqC;IACjE,IAAI,IAAI,IAAI,6BAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAI,IAAI,IAAI,6BAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,IAAI,IAAI,IAAI,6BAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,IAAK,aAKJ;AALD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","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, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"../../HierarchyNode\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common\";\nimport { doLog, log } from \"../../internal/LoggingUtils\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread\";\nimport { tapOnce } from \"../../internal/operators/TapOnce\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping\";\nimport { createClassGroups } from \"./grouping/ClassGrouping\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<ProcessedHierarchyNode, { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }>(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n // istanbul ignore next\n return totalNodes <= 1000 ? out : out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & { children: ProcessedInstanceHierarchyNode[] };\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(result.grouped, result.ungrouped);\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\n/** @internal */\nexport function createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA+BhG,wDAiEC;AAmGD,wDAqCC;AAtOD,+BAAiJ;AACjJ,sDAAwD;AAExD,6DAA4E;AAC5E,wDAMkC;AAClC,oEAA4D;AAC5D,wFAA8F;AAC9F,oEAA8D;AAE9D,4DAA4D;AAC5D,0EAAkF;AAClF,kEAAgE;AAChE,8DAAmE;AACnE,kEAAgE;AAChE,4EAAwH;AAExH,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,gBAAgB;AACH,QAAA,iBAAiB,GA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CAAC,GAAG,EAAE,CAAC,kCAAkC;aACvE,CAAC,CAAC;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC,EACF,IAAA,eAAQ,EAAC,GAAG,EAAE;QACZ,IAAA,uBAAK,EAAC;YACJ,QAAQ,EAAE,sCAAsC;YAChD,OAAO,EAAE,oBAAoB,CAAC,GAAG,EAAE,CAAC,mCAAmC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SAC3G,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAqC;IACjE,IAAI,IAAI,IAAI,gCAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAI,IAAI,IAAI,gCAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,IAAI,IAAI,IAAI,gCAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,IAAK,aAKJ;AALD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","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, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"../../HierarchyNode.js\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { tapOnce } from \"../../internal/operators/TapOnce.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand.js\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping.js\";\nimport { createClassGroups } from \"./grouping/ClassGrouping.js\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding.js\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping.js\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping.js\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<ProcessedHierarchyNode, { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }>(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n /* c8 ignore next */\n return totalNodes <= 1000 ? out : out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & { children: ProcessedInstanceHierarchyNode[] };\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(result.grouped, result.ungrouped);\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\n/** @internal */\nexport function createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuC,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvE,OAAO,EAAiC,sBAAsB,EAAkC,MAAM,
|
|
1
|
+
{"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuC,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvE,OAAO,EAAiC,sBAAsB,EAAkC,MAAM,2BAA2B,CAAC;AAGlI,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,UAAU,CAAC,OAAO,CAAC,WACpF,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAkDhG"}
|
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.LOGGING_NAMESPACE = void 0;
|
|
8
8
|
exports.createHideIfNoChildrenOperator = createHideIfNoChildrenOperator;
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const Common_js_1 = require("../../internal/Common.js");
|
|
11
|
+
const LoggingUtils_js_1 = require("../../internal/LoggingUtils.js");
|
|
12
|
+
const Partition_js_1 = require("../../internal/operators/Partition.js");
|
|
13
|
+
const IModelHierarchyNode_js_1 = require("../IModelHierarchyNode.js");
|
|
14
14
|
const OPERATOR_NAME = "HideIfNoChildren";
|
|
15
15
|
/** @internal */
|
|
16
|
-
exports.LOGGING_NAMESPACE = (0,
|
|
16
|
+
exports.LOGGING_NAMESPACE = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_INTERNAL);
|
|
17
17
|
/**
|
|
18
18
|
* Creates an operator that hides nodes with no children if they have a `hideIfNoChildren` handling param.
|
|
19
19
|
*
|
|
@@ -21,21 +21,21 @@ exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATO
|
|
|
21
21
|
*/
|
|
22
22
|
function createHideIfNoChildrenOperator(hasNodes) {
|
|
23
23
|
return function (nodes) {
|
|
24
|
-
const inputNodes = nodes.pipe((0,
|
|
24
|
+
const inputNodes = nodes.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
25
25
|
// split input into 3 pieces:
|
|
26
26
|
// - `doesntNeedHide` - nodes without the flag (return no matter if they have children or not)
|
|
27
27
|
// - `determinedChildren` - nodes with the flag and known children
|
|
28
28
|
// - `undeterminedChildren` - nodes with the flag and unknown children
|
|
29
|
-
const [needsHide, doesntNeedHide] = (0,
|
|
30
|
-
const [determinedChildren, undeterminedChildren] = (0,
|
|
31
|
-
return (0, rxjs_1.merge)(doesntNeedHide.pipe((0,
|
|
32
|
-
(0,
|
|
29
|
+
const [needsHide, doesntNeedHide] = (0, Partition_js_1.partition)(inputNodes, (n) => (IModelHierarchyNode_js_1.ProcessedHierarchyNode.isGeneric(n) || IModelHierarchyNode_js_1.ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren);
|
|
30
|
+
const [determinedChildren, undeterminedChildren] = (0, Partition_js_1.partition)(needsHide, (n) => n.children !== undefined);
|
|
31
|
+
return (0, rxjs_1.merge)(doesntNeedHide.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: doesn't need hide` })), (0, rxjs_1.merge)(determinedChildren.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: needs hide, has children` })), undeterminedChildren.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: needs hide, needs children` }), (0, rxjs_1.mergeMap)((n) => (0, rxjs_1.defer)(() => {
|
|
32
|
+
(0, LoggingUtils_js_1.doLog)({
|
|
33
33
|
category: exports.LOGGING_NAMESPACE,
|
|
34
|
-
message: /*
|
|
34
|
+
message: /* c8 ignore next */ () => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: requesting children flag`,
|
|
35
35
|
});
|
|
36
|
-
return hasNodes(n).pipe((0,
|
|
36
|
+
return hasNodes(n).pipe((0, LoggingUtils_js_1.log)({
|
|
37
37
|
category: exports.LOGGING_NAMESPACE,
|
|
38
|
-
message: /*
|
|
38
|
+
message: /* c8 ignore next */ (childrenFlag) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: determined children: ${childrenFlag}`,
|
|
39
39
|
}), (0, rxjs_1.map)((children) => Object.assign(n, { children })));
|
|
40
40
|
}),
|
|
41
41
|
// Sending child check requests for all nodes without any limit greatly slows down
|
|
@@ -43,10 +43,10 @@ function createHideIfNoChildrenOperator(hasNodes) {
|
|
|
43
43
|
// - NodeX (determining children) -> ... lots of children with "hide if no children" -> ...
|
|
44
44
|
// We check the nodes with "hide if no children" at most 2 at a time to prefer going deep into
|
|
45
45
|
// the hierarchy, where we're more likely to find an answer, rather than going wide.
|
|
46
|
-
2), (0,
|
|
46
|
+
2), (0, LoggingUtils_js_1.log)({
|
|
47
47
|
category: exports.LOGGING_NAMESPACE,
|
|
48
|
-
message: /*
|
|
49
|
-
}))).pipe((0, rxjs_1.filter)(
|
|
48
|
+
message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)}: needs hide, determined children: ${(0, Common_js_1.hasChildren)(n)}`,
|
|
49
|
+
}))).pipe((0, rxjs_1.filter)(Common_js_1.hasChildren))).pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
//# sourceMappingURL=HideIfNoChildren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiBhG,
|
|
1
|
+
{"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiBhG,wEAmDC;AAlED,+BAAuE;AACvE,wDAAmJ;AACnJ,oEAA4D;AAC5D,wEAAkE;AAClE,sEAAkI;AAElI,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,0CAA8B,EAAC,aAAa,EAAE,sCAA0B,CAAC,CAAC;AAE3G;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,QAA+D;IAC5G,OAAO,UAAU,KAAyC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,qBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,0CAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACrJ,6BAA6B;QAC7B,8FAA8F;QAC9F,kEAAkE;QAClE,sEAAsE;QACtE,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,IAAA,wBAAS,EAC3C,UAAU,EACV,CAAC,CAAC,EAAuE,EAAE,CACzE,CAAC,+CAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,IA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B,IAAA,qBAAG,EAAC;gBACF,QAAQ,EAAE,yBAAiB;gBAC3B,OAAO,EAAE,oBAAoB,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,GAAG,IAAA,0CAA8B,EAAC,CAAC,CAAC,0BAA0B,YAAY,EAAE;aAC7H,CAAC,EACF,IAAA,UAAG,EAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAClD,CAAC;QACJ,CAAC,CAAC;QACJ,kFAAkF;QAClF,sBAAsB;QACtB,2FAA2F;QAC3F,8FAA8F;QAC9F,oFAAoF;QACpF,CAAC,CACF,EACD,IAAA,qBAAG,EAAC;YACF,QAAQ,EAAE,yBAAiB;YAC3B,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAA,0CAA8B,EAAC,CAAC,CAAC,sCAAsC,IAAA,uBAAW,EAAC,CAAC,CAAC,EAAE;SAChI,CAAC,CACH,CACF,CAAC,IAAI,CAAC,IAAA,aAAM,EAAC,uBAAW,CAAC,CAAC,CAC5B,CAAC,IAAI,CAAC,IAAA,qBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAA,0CAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjI,CAAC,CAAC;AACJ,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, map, merge, mergeMap, Observable } from \"rxjs\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { ProcessedGenericHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nconst OPERATOR_NAME = \"HideIfNoChildren\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes with no children if they have a `hideIfNoChildren` handling param.\n *\n * @internal\n */\nexport function createHideIfNoChildrenOperator(hasNodes: (node: ProcessedHierarchyNode) => Observable<boolean>) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));\n // split input into 3 pieces:\n // - `doesntNeedHide` - nodes without the flag (return no matter if they have children or not)\n // - `determinedChildren` - nodes with the flag and known children\n // - `undeterminedChildren` - nodes with the flag and unknown children\n const [needsHide, doesntNeedHide] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren,\n );\n const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);\n return merge(\n doesntNeedHide.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` })),\n merge(\n determinedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children` }),\n ),\n undeterminedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children` }),\n mergeMap(\n (n) =>\n defer(() => {\n doLog({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,\n });\n return hasNodes(n).pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (childrenFlag) => `${createNodeIdentifierForLogging(n)}: determined children: ${childrenFlag}`,\n }),\n map((children) => Object.assign(n, { children })),\n );\n }),\n // Sending child check requests for all nodes without any limit greatly slows down\n // the following case:\n // - NodeX (determining children) -> ... lots of children with \"hide if no children\" -> ...\n // We check the nodes with \"hide if no children\" at most 2 at a time to prefer going deep into\n // the hierarchy, where we're more likely to find an answer, rather than going wide.\n 2,\n ),\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,\n }),\n ),\n ).pipe(filter(hasChildren)),\n ).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0E,UAAU,EAAQ,MAAM,MAAM,CAAC;AAOhH,OAAO,EAAiC,sBAAsB,EAAkC,MAAM,
|
|
1
|
+
{"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0E,UAAU,EAAQ,MAAM,MAAM,CAAC;AAOhH,OAAO,EAAiC,sBAAsB,EAAkC,MAAM,2BAA2B,CAAC;AAIlI,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,UAAU,CAAC,sBAAsB,CAAC,EACpF,gBAAgB,EAAE,OAAO,WAED,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAqEhG"}
|
|
@@ -8,16 +8,16 @@ exports.LOGGING_NAMESPACE = void 0;
|
|
|
8
8
|
exports.createHideNodesInHierarchyOperator = createHideNodesInHierarchyOperator;
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
10
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
11
|
+
const HierarchyNodeKey_js_1 = require("../../HierarchyNodeKey.js");
|
|
12
|
+
const Common_js_1 = require("../../internal/Common.js");
|
|
13
|
+
const LoggingUtils_js_1 = require("../../internal/LoggingUtils.js");
|
|
14
|
+
const Partition_js_1 = require("../../internal/operators/Partition.js");
|
|
15
|
+
const ReduceToMergeMap_js_1 = require("../../internal/operators/ReduceToMergeMap.js");
|
|
16
|
+
const IModelHierarchyNode_js_1 = require("../IModelHierarchyNode.js");
|
|
17
|
+
const Utils_js_1 = require("../Utils.js");
|
|
18
18
|
const OPERATOR_NAME = "HideNodesInHierarchy";
|
|
19
19
|
/** @internal */
|
|
20
|
-
exports.LOGGING_NAMESPACE = (0,
|
|
20
|
+
exports.LOGGING_NAMESPACE = (0, Common_js_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_js_1.LOGGING_NAMESPACE_INTERNAL);
|
|
21
21
|
/**
|
|
22
22
|
* Creates an operator that hides nodes and instead returns their children if the nodes have a `hideInHierarchy` handling param.
|
|
23
23
|
*
|
|
@@ -25,42 +25,42 @@ exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATO
|
|
|
25
25
|
*/
|
|
26
26
|
function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
|
|
27
27
|
return function (nodes) {
|
|
28
|
-
const inputNodes = nodes.pipe((0,
|
|
29
|
-
const [withFlag, withoutFlag] = (0,
|
|
28
|
+
const inputNodes = nodes.pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
29
|
+
const [withFlag, withoutFlag] = (0, Partition_js_1.partition)(inputNodes, (n) => (IModelHierarchyNode_js_1.ProcessedHierarchyNode.isGeneric(n) || IModelHierarchyNode_js_1.ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideInHierarchy);
|
|
30
30
|
// Defer to create a new seed for reduce on every subscribe
|
|
31
|
-
const withLoadedChildren = (0, rxjs_1.defer)(() => withFlag.pipe((0,
|
|
31
|
+
const withLoadedChildren = (0, rxjs_1.defer)(() => withFlag.pipe((0, LoggingUtils_js_1.log)({
|
|
32
32
|
category: exports.LOGGING_NAMESPACE,
|
|
33
|
-
message: /*
|
|
34
|
-
}), (0, rxjs_1.filter)((node) => node.children !== false), (0,
|
|
33
|
+
message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)} needs hide and needs children to be loaded`,
|
|
34
|
+
}), (0, rxjs_1.filter)((node) => node.children !== false), (0, ReduceToMergeMap_js_1.reduceToMergeMapItem)((node) => createMergeMapKey(node), (node, mergedNode) => {
|
|
35
35
|
if (mergedNode) {
|
|
36
|
-
if (
|
|
36
|
+
if (IModelHierarchyNode_js_1.ProcessedHierarchyNode.isGeneric(mergedNode)) {
|
|
37
37
|
// we don't merge generic nodes, just return the first one
|
|
38
38
|
return mergedNode;
|
|
39
39
|
}
|
|
40
|
-
(0, core_bentley_1.assert)(
|
|
41
|
-
return (0,
|
|
40
|
+
(0, core_bentley_1.assert)(IModelHierarchyNode_js_1.ProcessedHierarchyNode.isInstancesNode(node));
|
|
41
|
+
return (0, Utils_js_1.mergeInstanceNodes)(mergedNode, node);
|
|
42
42
|
}
|
|
43
43
|
return node;
|
|
44
|
-
}), (0,
|
|
45
|
-
return (0, rxjs_1.merge)(withoutFlag.pipe((0,
|
|
44
|
+
}), (0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (mm) => `created a merge map of size ${mm.size}` }), (0, rxjs_1.mergeMap)((mm) => [...mm.values()].map((mergedNode) => (0, rxjs_1.defer)(() => getNodes(mergedNode)))), (0, rxjs_1.mergeAll)(), (0, rxjs_1.map)((n) => n)));
|
|
45
|
+
return (0, rxjs_1.merge)(withoutFlag.pipe((0, LoggingUtils_js_1.log)({
|
|
46
46
|
category: exports.LOGGING_NAMESPACE,
|
|
47
|
-
message: /*
|
|
47
|
+
message: /* c8 ignore next */ (n) => `${(0, Common_js_1.createNodeIdentifierForLogging)(n)} doesn't need hide, return the node`,
|
|
48
48
|
})), stopOnFirstChild
|
|
49
49
|
? (0, rxjs_1.concat)(
|
|
50
50
|
// a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag
|
|
51
51
|
// with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy
|
|
52
|
-
inputNodes.pipe((0, rxjs_1.filter)(
|
|
52
|
+
inputNodes.pipe((0, rxjs_1.filter)(Common_js_1.hasChildren), (0, LoggingUtils_js_1.log)({
|
|
53
53
|
category: exports.LOGGING_NAMESPACE,
|
|
54
|
-
message: /*
|
|
55
|
-
})), rxjs_1.EMPTY.pipe((0, rxjs_1.finalize)(() => (0,
|
|
54
|
+
message: /* c8 ignore next */ (n) => `\`stopOnFirstChild = true\` and node ${(0, Common_js_1.createNodeIdentifierForLogging)(n)} is set to always have nodes - return the hidden node without loading children`,
|
|
55
|
+
})), rxjs_1.EMPTY.pipe((0, rxjs_1.finalize)(() => (0, LoggingUtils_js_1.doLog)({
|
|
56
56
|
category: exports.LOGGING_NAMESPACE,
|
|
57
|
-
message: /*
|
|
57
|
+
message: /* c8 ignore next */ () => `\`stopOnFirstChild = true\` but none of the nodes had children determined to \`true\` - do load children`,
|
|
58
58
|
}))), withLoadedChildren).pipe((0, rxjs_1.take)(1))
|
|
59
|
-
: withLoadedChildren).pipe((0,
|
|
59
|
+
: withLoadedChildren).pipe((0, LoggingUtils_js_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${(0, Common_js_1.createNodeIdentifierForLogging)(n)}` }));
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
function createMergeMapKey(node) {
|
|
63
|
-
if (
|
|
63
|
+
if (HierarchyNodeKey_js_1.HierarchyNodeKey.isGeneric(node.key)) {
|
|
64
64
|
return `${node.key.source ? `${node.key.source}:` : ""}${node.key.id}`;
|
|
65
65
|
}
|
|
66
66
|
return node.key.instanceKeys[0].className;
|