@itwin/presentation-hierarchies 0.6.0 → 0.7.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 +96 -0
- package/README.md +44 -47
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +64 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.js +80 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -0
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +29 -233
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js +25 -8
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +9 -8
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +31 -6
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js +26 -23
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +24 -89
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +24 -381
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +35 -73
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts +18 -0
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +4 -4
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js +21 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js +29 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +428 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
- package/lib/{esm/hierarchies → cjs/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +26 -36
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/Utils.d.ts +4 -0
- package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/Utils.js +59 -0
- package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.js +5 -5
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
- package/lib/cjs/hierarchies/internal/Common.d.ts +7 -4
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +0 -66
- package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts +3 -2
- package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +10 -6
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +18 -10
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts +64 -0
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -0
- package/lib/esm/hierarchies/HierarchyFiltering.js +76 -0
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -0
- package/lib/esm/hierarchies/HierarchyNode.d.ts +29 -233
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js +24 -7
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +9 -8
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +31 -6
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js +26 -23
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +24 -89
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +25 -382
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +36 -74
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts +18 -0
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +2 -2
- package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js +18 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js +26 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +425 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
- package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
- package/lib/{cjs/hierarchies → esm/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +25 -34
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -0
- package/lib/esm/hierarchies/imodel/Utils.d.ts +4 -0
- package/lib/esm/hierarchies/imodel/Utils.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/Utils.js +56 -0
- package/lib/esm/hierarchies/imodel/Utils.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.js +6 -6
- package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
- package/lib/esm/hierarchies/internal/Common.d.ts +7 -4
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +0 -65
- package/lib/esm/hierarchies/internal/Common.js.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.d.ts +3 -2
- package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +10 -6
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +8 -4
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/hierarchies/HierarchyDefinition.d.ts +0 -251
- package/lib/cjs/hierarchies/HierarchyDefinition.d.ts.map +0 -1
- package/lib/cjs/hierarchies/HierarchyDefinition.js.map +0 -1
- package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
- package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
- package/lib/cjs/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
- package/lib/cjs/hierarchies/NodeSelectQueryFactory.js.map +0 -1
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
- package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
- package/lib/cjs/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/TreeNodesReader.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/Grouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
- package/lib/esm/hierarchies/HierarchyDefinition.d.ts +0 -251
- package/lib/esm/hierarchies/HierarchyDefinition.d.ts.map +0 -1
- package/lib/esm/hierarchies/HierarchyDefinition.js.map +0 -1
- package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
- package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
- package/lib/esm/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
- package/lib/esm/hierarchies/NodeSelectQueryFactory.js.map +0 -1
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
- package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
- package/lib/esm/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/TreeNodesReader.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/Grouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
- /package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
- /package/lib/cjs/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
- /package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
- /package/lib/esm/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ECSQL_COLUMN_NAME_HasFilterTargetAncestor = exports.ECSQL_COLUMN_NAME_FilterTargetOptions = exports.ECSQL_COLUMN_NAME_IsFilterTarget = exports.ECSQL_COLUMN_NAME_FilteredChildrenPaths = exports.FilteringHierarchyDefinition = void 0;
|
|
8
8
|
exports.applyECInstanceIdsFilter = applyECInstanceIdsFilter;
|
|
9
|
-
const
|
|
9
|
+
const HierarchyFiltering_1 = require("../HierarchyFiltering");
|
|
10
10
|
const HierarchyNode_1 = require("../HierarchyNode");
|
|
11
11
|
const HierarchyNodeIdentifier_1 = require("../HierarchyNodeIdentifier");
|
|
12
|
+
const IModelHierarchyDefinition_1 = require("./IModelHierarchyDefinition");
|
|
13
|
+
const IModelHierarchyNode_1 = require("./IModelHierarchyNode");
|
|
12
14
|
const TreeNodesReader_1 = require("./TreeNodesReader");
|
|
13
15
|
/** @internal */
|
|
14
16
|
class FilteringHierarchyDefinition {
|
|
15
|
-
|
|
17
|
+
_imodelAccess;
|
|
16
18
|
_source;
|
|
17
19
|
_nodeIdentifierPaths;
|
|
18
20
|
constructor(props) {
|
|
19
|
-
this.
|
|
21
|
+
this._imodelAccess = props.imodelAccess;
|
|
20
22
|
this._source = props.source;
|
|
21
23
|
this._nodeIdentifierPaths = props.nodeIdentifierPaths;
|
|
22
24
|
}
|
|
@@ -70,7 +72,7 @@ class FilteringHierarchyDefinition {
|
|
|
70
72
|
return async (node) => {
|
|
71
73
|
const processedNode = this._source.postProcessNode ? await this._source.postProcessNode(node) : node;
|
|
72
74
|
// instance nodes get the auto-expand flag in `parseNode`, but grouping ones need to be handled during post-processing
|
|
73
|
-
if (
|
|
75
|
+
if (IModelHierarchyNode_1.ProcessedHierarchyNode.isGroupingNode(node) && this.shouldExpandGroupingNode(node)) {
|
|
74
76
|
Object.assign(processedNode, { autoExpand: true });
|
|
75
77
|
}
|
|
76
78
|
return processedNode;
|
|
@@ -98,20 +100,19 @@ class FilteringHierarchyDefinition {
|
|
|
98
100
|
}
|
|
99
101
|
async defineHierarchyLevel(props) {
|
|
100
102
|
const sourceDefinitions = await this._source.defineHierarchyLevel(props);
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
+
const filteringProps = (0, HierarchyFiltering_1.extractFilteringProps)(this._nodeIdentifierPaths, props.parentNode);
|
|
104
|
+
if (!filteringProps) {
|
|
103
105
|
return sourceDefinitions;
|
|
104
106
|
}
|
|
105
107
|
const filteredDefinitions = [];
|
|
106
108
|
await Promise.all(sourceDefinitions.map(async (definition) => {
|
|
107
109
|
let matchedDefinition;
|
|
108
|
-
if (
|
|
109
|
-
matchedDefinition = await matchFilters(definition,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, this._classHierarchy, (def, matchingFilters) => {
|
|
110
|
+
if (IModelHierarchyDefinition_1.HierarchyNodesDefinition.isGenericNode(definition)) {
|
|
111
|
+
matchedDefinition = await matchFilters(definition, filteringProps, async (id) => {
|
|
112
|
+
return (HierarchyNodeIdentifier_1.HierarchyNodeIdentifier.isGenericNodeIdentifier(id) &&
|
|
113
|
+
(!id.source || id.source === this._imodelAccess.imodelKey) &&
|
|
114
|
+
id.id === definition.node.key);
|
|
115
|
+
}, this._imodelAccess, (def, matchingFilters) => {
|
|
115
116
|
const filteredChildrenIdentifierPaths = matchingFilters.reduce((r, c) => [...r, ...c.childrenIdentifierPaths], new Array());
|
|
116
117
|
return {
|
|
117
118
|
...def,
|
|
@@ -119,18 +120,17 @@ class FilteringHierarchyDefinition {
|
|
|
119
120
|
node: def.node,
|
|
120
121
|
filteredChildrenIdentifierPaths,
|
|
121
122
|
isFilterTarget: matchingFilters.some((mc) => mc.isFilterTarget),
|
|
122
|
-
hasFilterTargetAncestor,
|
|
123
|
+
hasFilterTargetAncestor: filteringProps.hasFilterTargetAncestor,
|
|
123
124
|
}),
|
|
124
125
|
};
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
else {
|
|
128
|
-
matchedDefinition = await matchFilters(definition,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, this._classHierarchy, (def, matchingFilters) => applyECInstanceIdsFilter(def, matchingFilters, !!isDirectParentFilterTarget, !!hasFilterTargetAncestor));
|
|
129
|
+
matchedDefinition = await matchFilters(definition, filteringProps, async (id) => {
|
|
130
|
+
return (HierarchyNodeIdentifier_1.HierarchyNodeIdentifier.isInstanceNodeIdentifier(id) &&
|
|
131
|
+
(!id.imodelKey || id.imodelKey === this._imodelAccess.imodelKey) &&
|
|
132
|
+
(await this._imodelAccess.classDerivesFrom(id.className, definition.fullClassName)));
|
|
133
|
+
}, this._imodelAccess, (def, matchingFilters) => applyECInstanceIdsFilter(def, matchingFilters, !!filteringProps.hasFilterTargetAncestor));
|
|
134
134
|
}
|
|
135
135
|
if (matchedDefinition) {
|
|
136
136
|
filteredDefinitions.push(matchedDefinition);
|
|
@@ -138,23 +138,13 @@ class FilteringHierarchyDefinition {
|
|
|
138
138
|
}));
|
|
139
139
|
return filteredDefinitions;
|
|
140
140
|
}
|
|
141
|
-
getFilteringProps(parentNode) {
|
|
142
|
-
if (!parentNode) {
|
|
143
|
-
return { filteredNodePaths: this._nodeIdentifierPaths, isDirectParentFilterTarget: false, hasFilterTargetAncestor: false };
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
filteredNodePaths: parentNode.filtering?.filteredChildrenIdentifierPaths,
|
|
147
|
-
isDirectParentFilterTarget: parentNode.filtering?.isFilterTarget,
|
|
148
|
-
hasFilterTargetAncestor: !!parentNode.filtering?.hasFilterTargetAncestor,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
141
|
}
|
|
152
142
|
exports.FilteringHierarchyDefinition = FilteringHierarchyDefinition;
|
|
153
143
|
async function matchFilters(definition, filteringProps, predicate, classHierarchy, matchedDefinitionProcessor) {
|
|
154
|
-
const { filteredNodePaths,
|
|
144
|
+
const { filteredNodePaths, hasFilterTargetAncestor } = filteringProps;
|
|
155
145
|
const matchingFilters = [];
|
|
156
146
|
for (const filteredNodePath of filteredNodePaths) {
|
|
157
|
-
const { path, options } =
|
|
147
|
+
const { path, options } = HierarchyFiltering_1.HierarchyFilteringPath.normalize(filteredNodePath);
|
|
158
148
|
if (path.length === 0) {
|
|
159
149
|
continue;
|
|
160
150
|
}
|
|
@@ -173,47 +163,21 @@ async function matchFilters(definition, filteringProps, predicate, classHierarch
|
|
|
173
163
|
}
|
|
174
164
|
const remainingPath = path.slice(1);
|
|
175
165
|
if (remainingPath.length > 0) {
|
|
176
|
-
|
|
177
|
-
entry.childrenIdentifierPaths.push(remainingPathWithOptions);
|
|
166
|
+
entry.childrenIdentifierPaths.push(options ? { path: remainingPath, options } : remainingPath);
|
|
178
167
|
}
|
|
179
168
|
else if (entry.isFilterTarget) {
|
|
180
|
-
entry.filterTargetOptions =
|
|
169
|
+
entry.filterTargetOptions = HierarchyFiltering_1.HierarchyFilteringPath.mergeOptions(entry.filterTargetOptions, options);
|
|
181
170
|
}
|
|
182
171
|
else {
|
|
183
172
|
Object.assign(entry, { isFilterTarget: true, filterTargetOptions: options });
|
|
184
173
|
}
|
|
185
174
|
}
|
|
186
175
|
}
|
|
187
|
-
if (
|
|
176
|
+
if (hasFilterTargetAncestor || matchingFilters.length > 0) {
|
|
188
177
|
return matchedDefinitionProcessor(definition, matchingFilters);
|
|
189
178
|
}
|
|
190
179
|
return undefined;
|
|
191
180
|
}
|
|
192
|
-
function mergeFilterTargetOptions(target, source) {
|
|
193
|
-
// istanbul ignore next
|
|
194
|
-
if (!target && !source) {
|
|
195
|
-
return undefined;
|
|
196
|
-
}
|
|
197
|
-
// istanbul ignore next
|
|
198
|
-
if (!target) {
|
|
199
|
-
return source;
|
|
200
|
-
}
|
|
201
|
-
// istanbul ignore next
|
|
202
|
-
if (!source) {
|
|
203
|
-
return target;
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
autoExpand: (() => {
|
|
207
|
-
if (source.autoExpand === true) {
|
|
208
|
-
return source.autoExpand;
|
|
209
|
-
}
|
|
210
|
-
if (typeof target.autoExpand === "object" && typeof source.autoExpand === "object" && source.autoExpand.depth > target.autoExpand.depth) {
|
|
211
|
-
return source.autoExpand;
|
|
212
|
-
}
|
|
213
|
-
return target.autoExpand;
|
|
214
|
-
})(),
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
181
|
async function findMatchingFilterEntry(filters, nodeId, classHierarchy) {
|
|
218
182
|
for (const filter of filters) {
|
|
219
183
|
if (await identifiersEqual(filter.id, nodeId, classHierarchy)) {
|
|
@@ -231,20 +195,18 @@ async function identifiersEqual(lhs, rhs, classHierarchy) {
|
|
|
231
195
|
}
|
|
232
196
|
return HierarchyNodeIdentifier_1.HierarchyNodeIdentifier.equal(lhs, rhs);
|
|
233
197
|
}
|
|
234
|
-
function applyFilterAttributes(
|
|
198
|
+
function applyFilterAttributes(props) {
|
|
199
|
+
const { node, filteredChildrenIdentifierPaths } = props;
|
|
200
|
+
const result = { ...node };
|
|
235
201
|
const shouldAutoExpand = !!filteredChildrenIdentifierPaths?.some((childPath) => {
|
|
236
|
-
return
|
|
202
|
+
return !!HierarchyFiltering_1.HierarchyFilteringPath.normalize(childPath).options?.autoExpand;
|
|
237
203
|
});
|
|
238
|
-
const result = { ...node };
|
|
239
204
|
if (shouldAutoExpand) {
|
|
240
205
|
result.autoExpand = true;
|
|
241
206
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),
|
|
246
|
-
...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),
|
|
247
|
-
};
|
|
207
|
+
const filteringProps = HierarchyNode_1.HierarchyNodeFilteringProps.create(props);
|
|
208
|
+
if (filteringProps) {
|
|
209
|
+
result.filtering = filteringProps;
|
|
248
210
|
}
|
|
249
211
|
return result;
|
|
250
212
|
}
|
|
@@ -261,7 +223,7 @@ exports.ECSQL_COLUMN_NAME_FilterTargetOptions = "FilterTargetOptions";
|
|
|
261
223
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
262
224
|
exports.ECSQL_COLUMN_NAME_HasFilterTargetAncestor = "HasFilterTargetAncestor";
|
|
263
225
|
/** @internal */
|
|
264
|
-
function applyECInstanceIdsFilter(def, matchingFilters,
|
|
226
|
+
function applyECInstanceIdsFilter(def, matchingFilters, hasFilterTargetAncestor) {
|
|
265
227
|
if (matchingFilters.length === 0) {
|
|
266
228
|
return def;
|
|
267
229
|
}
|
|
@@ -286,12 +248,12 @@ function applyECInstanceIdsFilter(def, matchingFilters, isParentFilterTarget, ha
|
|
|
286
248
|
[q].*,
|
|
287
249
|
[f].[IsFilterTarget] AS [${exports.ECSQL_COLUMN_NAME_IsFilterTarget}],
|
|
288
250
|
[f].[FilterTargetOptions] AS [${exports.ECSQL_COLUMN_NAME_FilterTargetOptions}],
|
|
289
|
-
${hasFilterTargetAncestor
|
|
251
|
+
${hasFilterTargetAncestor ? "1" : "0"} AS [${exports.ECSQL_COLUMN_NAME_HasFilterTargetAncestor}],
|
|
290
252
|
[f].[FilteredChildrenPaths] AS [${exports.ECSQL_COLUMN_NAME_FilteredChildrenPaths}]
|
|
291
253
|
FROM (
|
|
292
254
|
${def.query.ecsql}
|
|
293
255
|
) [q]
|
|
294
|
-
${
|
|
256
|
+
${hasFilterTargetAncestor ? "LEFT " : ""} JOIN FilteringInfo [f] ON [f].[ECInstanceId] = [q].[ECInstanceId]
|
|
295
257
|
`,
|
|
296
258
|
},
|
|
297
259
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilteringHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAkThG,4DAwCC;AAvVD,8DAAqH;AACrH,oDAA+D;AAC/D,wEAAqE;AAErE,2EAUqC;AACrC,+DAAiJ;AACjJ,uDAAuD;AAQvD,gBAAgB;AAChB,MAAa,4BAA4B;IAC/B,aAAa,CAAoD;IACjE,OAAO,CAAsB;IAC7B,oBAAoB,CAA2B;IAEvD,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;IACxD,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC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C;gBACjC;YACI,eAAe;qBACd,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACV,EAAE,CAAC,cAAc;oBACf,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAoB,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,uBAAuB,CAAC,IAAI;oBAC9K,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,6BAA6B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,uBAAuB,CAAC,IAAI,CACnG;qBACA,IAAI,CAAC,aAAa,CAAC;UACtB;aACH;YACD,KAAK,EAAE;;;qCAGwB,wCAAgC;0CAC3B,6CAAqC;YACnE,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,iDAAyC;4CACpD,+CAAuC;;YAEvE,GAAG,CAAC,KAAK,CAAC,KAAK;;UAEjB,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;OACzC;SACF;KACF,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 { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport { extractFilteringProps, HierarchyFilteringPath, HierarchyFilteringPathOptions } from \"../HierarchyFiltering\";\nimport { HierarchyNodeFilteringProps } from \"../HierarchyNode\";\nimport { HierarchyNodeIdentifier } from \"../HierarchyNodeIdentifier\";\nimport { GenericNodeKey } from \"../HierarchyNodeKey\";\nimport {\n DefineHierarchyLevelProps,\n GenericHierarchyNodeDefinition,\n HierarchyDefinition,\n HierarchyLevelDefinition,\n HierarchyNodesDefinition,\n InstanceNodesQueryDefinition,\n NodeParser,\n NodePostProcessor,\n NodePreProcessor,\n} from \"./IModelHierarchyDefinition\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, SourceHierarchyNode, SourceInstanceHierarchyNode } from \"./IModelHierarchyNode\";\nimport { defaultNodesParser } from \"./TreeNodesReader\";\n\ninterface FilteringHierarchyDefinitionProps {\n imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n source: HierarchyDefinition;\n nodeIdentifierPaths: HierarchyFilteringPath[];\n}\n\n/** @internal */\nexport class FilteringHierarchyDefinition implements HierarchyDefinition {\n private _imodelAccess: ECClassHierarchyInspector & { imodelKey: string };\n private _source: HierarchyDefinition;\n private _nodeIdentifierPaths: HierarchyFilteringPath[];\n\n public constructor(props: FilteringHierarchyDefinitionProps) {\n this._imodelAccess = props.imodelAccess;\n this._source = props.source;\n this._nodeIdentifierPaths = props.nodeIdentifierPaths;\n }\n\n public get preProcessNode(): NodePreProcessor {\n return async (node) => {\n const processedNode = this._source.preProcessNode ? await this._source.preProcessNode(node) : node;\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 undefined;\n }\n return processedNode;\n };\n }\n\n private shouldExpandGroupingNode(node: ProcessedGroupingHierarchyNode) {\n for (const child of node.children) {\n // istanbul ignore next\n if (!child.filtering) {\n continue;\n }\n\n if (child.filtering.isFilterTarget) {\n const childAutoExpand = child.filtering.filterTargetOptions?.autoExpand;\n\n // If child is a filter target and is has no `autoExpand` flag, then it's always to be expanded.\n if (childAutoExpand === true) {\n return true;\n }\n\n // If it's not an object and not `true`, then it's falsy - continue looking\n if (typeof childAutoExpand !== \"object\") {\n continue;\n }\n\n // If grouping node's child has `autoExpandUntil` flag,\n // auto-expand the grouping node only if it's depth is lower than that of the grouping node in associated with the target.\n const nodeDepth = node.parentKeys.length;\n const filterTargetDepth = childAutoExpand.depth;\n if (nodeDepth < filterTargetDepth) {\n return true;\n }\n }\n\n if (!child.filtering.filteredChildrenIdentifierPaths) {\n // istanbul ignore next\n continue;\n }\n\n for (const path of child.filtering.filteredChildrenIdentifierPaths) {\n if (\"path\" in path && path.options?.autoExpand) {\n return true;\n }\n }\n }\n return false;\n }\n\n public get postProcessNode(): NodePostProcessor {\n return async (node: ProcessedHierarchyNode) => {\n const processedNode = this._source.postProcessNode ? await this._source.postProcessNode(node) : node;\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) && this.shouldExpandGroupingNode(node)) {\n Object.assign(processedNode, { autoExpand: true });\n }\n return processedNode;\n };\n }\n\n public get parseNode(): NodeParser {\n return (row: { [columnName: string]: any }): SourceInstanceHierarchyNode => {\n const hasFilterTargetAncestor: boolean = !!row[ECSQL_COLUMN_NAME_HasFilterTargetAncestor];\n const isFilterTarget: boolean = !!row[ECSQL_COLUMN_NAME_IsFilterTarget];\n const filterTargetOptions: HierarchyFilteringPathOptions | undefined = row[ECSQL_COLUMN_NAME_FilterTargetOptions]\n ? JSON.parse(row[ECSQL_COLUMN_NAME_FilterTargetOptions])\n : undefined;\n const filteredChildrenIdentifierPaths: HierarchyFilteringPath[] | undefined = row[ECSQL_COLUMN_NAME_FilteredChildrenPaths]\n ? JSON.parse(row[ECSQL_COLUMN_NAME_FilteredChildrenPaths])\n : undefined;\n const defaultNode = (this._source.parseNode ?? defaultNodesParser)(row);\n return applyFilterAttributes({\n node: defaultNode,\n filteredChildrenIdentifierPaths,\n isFilterTarget,\n filterTargetOptions,\n hasFilterTargetAncestor,\n });\n };\n }\n\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const sourceDefinitions = await this._source.defineHierarchyLevel(props);\n const filteringProps = extractFilteringProps(this._nodeIdentifierPaths, props.parentNode);\n if (!filteringProps) {\n return sourceDefinitions;\n }\n\n const filteredDefinitions: HierarchyLevelDefinition = [];\n await Promise.all(\n sourceDefinitions.map(async (definition) => {\n let matchedDefinition: HierarchyNodesDefinition | undefined;\n if (HierarchyNodesDefinition.isGenericNode(definition)) {\n matchedDefinition = await matchFilters<GenericNodeKey>(\n definition,\n filteringProps,\n async (id) => {\n return (\n HierarchyNodeIdentifier.isGenericNodeIdentifier(id) &&\n (!id.source || id.source === this._imodelAccess.imodelKey) &&\n id.id === definition.node.key\n );\n },\n this._imodelAccess,\n (def, matchingFilters) => {\n const filteredChildrenIdentifierPaths = matchingFilters.reduce(\n (r, c) => [...r, ...c.childrenIdentifierPaths],\n new Array<HierarchyFilteringPath>(),\n );\n return {\n ...def,\n node: applyFilterAttributes({\n node: def.node,\n filteredChildrenIdentifierPaths,\n isFilterTarget: matchingFilters.some((mc) => mc.isFilterTarget),\n hasFilterTargetAncestor: filteringProps.hasFilterTargetAncestor,\n }),\n };\n },\n );\n } else {\n matchedDefinition = await matchFilters<InstanceKey>(\n definition,\n filteringProps,\n async (id) => {\n return (\n HierarchyNodeIdentifier.isInstanceNodeIdentifier(id) &&\n (!id.imodelKey || id.imodelKey === this._imodelAccess.imodelKey) &&\n (await this._imodelAccess.classDerivesFrom(id.className, definition.fullClassName))\n );\n },\n this._imodelAccess,\n (def, matchingFilters) => applyECInstanceIdsFilter(def, matchingFilters, !!filteringProps.hasFilterTargetAncestor),\n );\n }\n if (matchedDefinition) {\n filteredDefinitions.push(matchedDefinition);\n }\n }),\n );\n return filteredDefinitions;\n }\n}\n\ntype MatchedFilter<TIdentifier extends HierarchyNodeIdentifier> = {\n id: TIdentifier;\n childrenIdentifierPaths: HierarchyFilteringPath[];\n} & ({ isFilterTarget: false } | { isFilterTarget: true; filterTargetOptions?: HierarchyFilteringPathOptions });\n\nasync function matchFilters<\n TIdentifier extends HierarchyNodeIdentifier,\n TDefinition = TIdentifier extends InstanceKey ? InstanceNodesQueryDefinition : GenericHierarchyNodeDefinition,\n>(\n definition: TDefinition,\n filteringProps: { filteredNodePaths: HierarchyFilteringPath[]; hasFilterTargetAncestor?: boolean },\n predicate: (id: HierarchyNodeIdentifier) => Promise<boolean>,\n classHierarchy: ECClassHierarchyInspector,\n matchedDefinitionProcessor: (def: TDefinition, matchingFilters: Array<MatchedFilter<TIdentifier>>) => TDefinition,\n): Promise<TDefinition | undefined> {\n const { filteredNodePaths, hasFilterTargetAncestor } = filteringProps;\n const matchingFilters: Array<MatchedFilter<TIdentifier>> = [];\n for (const filteredNodePath of filteredNodePaths) {\n const { path, options } = HierarchyFilteringPath.normalize(filteredNodePath);\n if (path.length === 0) {\n continue;\n }\n const nodeId = path[0];\n if (await predicate(nodeId)) {\n let entry = await findMatchingFilterEntry(matchingFilters, nodeId, classHierarchy);\n if (!entry) {\n entry = {\n // ideally, `predicate` would act as a type guard to guarantee that `id` is `TIdentifier`, but at the moment\n // async type guards aren't supported\n id: nodeId as TIdentifier,\n childrenIdentifierPaths: [],\n isFilterTarget: false,\n };\n matchingFilters.push(entry);\n }\n const remainingPath = path.slice(1);\n if (remainingPath.length > 0) {\n entry.childrenIdentifierPaths.push(options ? { path: remainingPath, options } : remainingPath);\n } else if (entry.isFilterTarget) {\n entry.filterTargetOptions = HierarchyFilteringPath.mergeOptions(entry.filterTargetOptions, options);\n } else {\n Object.assign(entry, { isFilterTarget: true, filterTargetOptions: options });\n }\n }\n }\n if (hasFilterTargetAncestor || matchingFilters.length > 0) {\n return matchedDefinitionProcessor(definition, matchingFilters);\n }\n return undefined;\n}\n\nasync function findMatchingFilterEntry<TEntry extends { id: TIdentifier }, TIdentifier extends HierarchyNodeIdentifier>(\n filters: TEntry[],\n nodeId: TIdentifier,\n classHierarchy: ECClassHierarchyInspector,\n): Promise<TEntry | undefined> {\n for (const filter of filters) {\n if (await identifiersEqual(filter.id, nodeId, classHierarchy)) {\n return filter;\n }\n }\n return undefined;\n}\n\nasync function identifiersEqual<TIdentifier extends HierarchyNodeIdentifier>(lhs: TIdentifier, rhs: TIdentifier, classHierarchy: ECClassHierarchyInspector) {\n if (HierarchyNodeIdentifier.isInstanceNodeIdentifier(lhs) && HierarchyNodeIdentifier.isInstanceNodeIdentifier(rhs)) {\n return (\n lhs.id === rhs.id &&\n (lhs.className === rhs.className ||\n (await classHierarchy.classDerivesFrom(lhs.className, rhs.className)) ||\n (await classHierarchy.classDerivesFrom(rhs.className, lhs.className)))\n );\n }\n return HierarchyNodeIdentifier.equal(lhs, rhs);\n}\n\nfunction applyFilterAttributes<TNode extends SourceHierarchyNode>(props: {\n node: TNode;\n filteredChildrenIdentifierPaths: HierarchyFilteringPath[] | undefined;\n isFilterTarget?: boolean;\n filterTargetOptions?: HierarchyFilteringPathOptions;\n hasFilterTargetAncestor: boolean;\n}): TNode {\n const { node, filteredChildrenIdentifierPaths } = props;\n const result = { ...node };\n\n const shouldAutoExpand = !!filteredChildrenIdentifierPaths?.some((childPath) => {\n return !!HierarchyFilteringPath.normalize(childPath).options?.autoExpand;\n });\n if (shouldAutoExpand) {\n result.autoExpand = true;\n }\n\n const filteringProps = HierarchyNodeFilteringProps.create(props);\n if (filteringProps) {\n result.filtering = filteringProps;\n }\n\n return result;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilteredChildrenPaths = \"FilteredChildrenPaths\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_IsFilterTarget = \"IsFilterTarget\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_FilterTargetOptions = \"FilterTargetOptions\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ECSQL_COLUMN_NAME_HasFilterTargetAncestor = \"HasFilterTargetAncestor\";\n\n/** @internal */\nexport function applyECInstanceIdsFilter(\n def: InstanceNodesQueryDefinition,\n matchingFilters: Array<MatchedFilter<InstanceKey>>,\n hasFilterTargetAncestor: boolean,\n): InstanceNodesQueryDefinition {\n if (matchingFilters.length === 0) {\n return def;\n }\n return {\n ...def,\n query: {\n ...def.query,\n ctes: [\n ...(def.query.ctes ?? []),\n // note: generally we'd use `VALUES (1,1),(2,2)`, but that doesn't work in ECSQL (https://github.com/iTwin/itwinjs-backlog/issues/865),\n // so using UNION as a workaround\n `FilteringInfo(ECInstanceId, IsFilterTarget, FilterTargetOptions, FilteredChildrenPaths) AS (\n ${matchingFilters\n .map((mc) =>\n mc.isFilterTarget\n ? `VALUES (${mc.id.id}, 1, ${mc.filterTargetOptions ? `'${JSON.stringify(mc.filterTargetOptions)}'` : \"CAST(NULL AS TEXT)\"}, '${JSON.stringify(mc.childrenIdentifierPaths)}')`\n : `VALUES (${mc.id.id}, 0, CAST(NULL AS TEXT), '${JSON.stringify(mc.childrenIdentifierPaths)}')`,\n )\n .join(\" UNION ALL \")}\n )`,\n ],\n ecsql: `\n SELECT\n [q].*,\n [f].[IsFilterTarget] AS [${ECSQL_COLUMN_NAME_IsFilterTarget}],\n [f].[FilterTargetOptions] AS [${ECSQL_COLUMN_NAME_FilterTargetOptions}],\n ${hasFilterTargetAncestor ? \"1\" : \"0\"} AS [${ECSQL_COLUMN_NAME_HasFilterTargetAncestor}],\n [f].[FilteredChildrenPaths] AS [${ECSQL_COLUMN_NAME_FilteredChildrenPaths}]\n FROM (\n ${def.query.ecsql}\n ) [q]\n ${hasFilterTargetAncestor ? \"LEFT \" : \"\"} JOIN FilteringInfo [f] ON [f].[ECInstanceId] = [q].[ECInstanceId]\n `,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GetHierarchyNodesProps } from "../HierarchyProvider";
|
|
2
|
+
interface ChildNodeObservablesCacheProps {
|
|
3
|
+
size: number;
|
|
4
|
+
variationsCount?: number;
|
|
5
|
+
}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare class HierarchyCache<T> {
|
|
8
|
+
private _map;
|
|
9
|
+
private _props;
|
|
10
|
+
constructor(props: ChildNodeObservablesCacheProps);
|
|
11
|
+
private createCacheKeys;
|
|
12
|
+
private getCacheAccessors;
|
|
13
|
+
set(requestProps: GetHierarchyNodesProps, value: T): void;
|
|
14
|
+
get(requestProps: GetHierarchyNodesProps): T | undefined;
|
|
15
|
+
clear(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=HierarchyCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchyCache.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAS9D,UAAU,8BAA8B;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gBAAgB;AAChB,qBAAa,cAAc,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAA4D;IACxE,OAAO,CAAC,MAAM,CAAiC;gBAE5B,KAAK,EAAE,8BAA8B;IAKxD,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,iBAAiB;IAyBlB,GAAG,CAAC,YAAY,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;IAKlD,GAAG,CAAC,YAAY,EAAE,sBAAsB,GAAG,CAAC,GAAG,SAAS;IAKxD,KAAK;CAGb"}
|
package/lib/cjs/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js}
RENAMED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.HierarchyCache = void 0;
|
|
8
8
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
9
|
const HierarchyNodeKey_1 = require("../HierarchyNodeKey");
|
|
10
10
|
/** @internal */
|
|
11
|
-
class
|
|
11
|
+
class HierarchyCache {
|
|
12
12
|
_map;
|
|
13
13
|
_props;
|
|
14
14
|
constructor(props) {
|
|
@@ -68,7 +68,7 @@ class ChildNodeObservablesCache {
|
|
|
68
68
|
this._map.clear();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
exports.
|
|
71
|
+
exports.HierarchyCache = HierarchyCache;
|
|
72
72
|
function compareHierarchyNodeKeys(lhs, rhs) {
|
|
73
73
|
if (lhs.length !== rhs.length) {
|
|
74
74
|
return lhs.length - rhs.length;
|
|
@@ -81,4 +81,4 @@ function compareHierarchyNodeKeys(lhs, rhs) {
|
|
|
81
81
|
}
|
|
82
82
|
return 0;
|
|
83
83
|
}
|
|
84
|
-
//# sourceMappingURL=
|
|
84
|
+
//# sourceMappingURL=HierarchyCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchyCache.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAsE;AAEtE,0DAAuD;AAevD,gBAAgB;AAChB,MAAa,cAAc;IACjB,IAAI,CAA4D;IAChE,MAAM,CAAiC;IAE/C,YAAmB,KAAqC;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,4BAAa,CAA6C,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;IAClH,CAAC;IAEO,eAAe,CACrB,KAGC;QAED,SAAS,kBAAkB;YACzB,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;YAChF,IAAI,cAAc,KAAK,SAAS,IAAI,uBAAuB,KAAK,SAAS,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBAChH,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,IAAI,CAAC,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AC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,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 { LRUCache, LRUDictionary, LRUMap } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey\";\nimport { GetHierarchyNodesProps } from \"../HierarchyProvider\";\n\ninterface HierarchyCacheEntry<T> {\n /** Stores observables for the default case - no instance filter or custom limit for the hierarchy level. */\n primary: T | undefined;\n /** Stores a limited number of variations with custom instance filter and/or custom limit for the hierarchy level. */\n variations: LRUCache<string, T>;\n}\n\ninterface ChildNodeObservablesCacheProps {\n size: number;\n variationsCount?: number;\n}\n\n/** @internal */\nexport class HierarchyCache<T> {\n private _map: LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>;\n private _props: ChildNodeObservablesCacheProps;\n\n public constructor(props: ChildNodeObservablesCacheProps) {\n this._props = props;\n this._map = new LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>(props.size, compareHierarchyNodeKeys);\n }\n\n private createCacheKeys(\n props: Omit<GetHierarchyNodesProps, \"parentNode\"> & {\n parentNode: { key: HierarchyNodeKey; parentKeys: HierarchyNodeKey[] } | undefined;\n filteredInstanceKeys?: InstanceKey[];\n },\n ) {\n function createVariationKey() {\n const { instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys } = props;\n if (instanceFilter === undefined && hierarchyLevelSizeLimit === undefined && filteredInstanceKeys === undefined) {\n return undefined;\n }\n return JSON.stringify({ instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys });\n }\n\n if (!props.parentNode) {\n return { primaryKey: [], variationKey: createVariationKey() };\n }\n\n const parentKeys = props.parentNode.parentKeys;\n\n return {\n primaryKey: [...parentKeys, props.parentNode.key],\n variationKey: createVariationKey(),\n };\n }\n\n private getCacheAccessors(primaryKey: HierarchyNodeKey[], variationKey?: string) {\n const getMapEntry = (create: boolean) => {\n let entry = this._map.get(primaryKey);\n if (!entry && create) {\n entry = { primary: undefined, variations: new LRUMap(this._props.variationsCount ?? 1) };\n this._map.set(primaryKey, entry);\n }\n return entry;\n };\n if (variationKey) {\n return {\n get: () => getMapEntry(false)?.variations.get(variationKey),\n set: (value: T) => {\n getMapEntry(true)!.variations.set(variationKey, value);\n },\n };\n }\n return {\n get: () => getMapEntry(false)?.primary,\n set: (value: T) => {\n getMapEntry(true)!.primary = value;\n },\n };\n }\n\n public set(requestProps: GetHierarchyNodesProps, value: T) {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n this.getCacheAccessors(primaryKey, variationKey).set(value);\n }\n\n public get(requestProps: GetHierarchyNodesProps): T | undefined {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n return this.getCacheAccessors(primaryKey, variationKey).get();\n }\n\n public clear() {\n this._map.clear();\n }\n}\n\nfunction compareHierarchyNodeKeys(lhs: HierarchyNodeKey[], rhs: HierarchyNodeKey[]) {\n if (lhs.length !== rhs.length) {\n return lhs.length - rhs.length;\n }\n for (let i = 0; i < lhs.length; ++i) {\n const keysCompareResult = HierarchyNodeKey.compare(lhs[i], rhs[i]);\n if (keysCompareResult !== 0) {\n return keysCompareResult;\n }\n }\n return 0;\n}\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { GenericInstanceFilter } from "@itwin/core-common";
|
|
2
|
+
import { ECSqlQueryDef } from "@itwin/presentation-shared";
|
|
3
|
+
import { NonGroupingHierarchyNode } from "../HierarchyNode";
|
|
4
|
+
import { ProcessedGenericHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from "./IModelHierarchyNode";
|
|
5
|
+
/**
|
|
6
|
+
* A nodes definition that returns a single generic node.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export interface GenericHierarchyNodeDefinition {
|
|
10
|
+
/** The node to be created in the hierarchy level */
|
|
11
|
+
node: SourceGenericHierarchyNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A nodes definition that returns an ECSQL query for selecting nodes from an iModel.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export interface InstanceNodesQueryDefinition {
|
|
18
|
+
/**
|
|
19
|
+
* Full name of the class whose instances are going to be returned. It's okay if the attribute
|
|
20
|
+
* points to a base class of multiple different classes of instances returned by the query, however
|
|
21
|
+
* the more specific this class is, the more efficient hierarchy building process is.
|
|
22
|
+
*/
|
|
23
|
+
fullClassName: string;
|
|
24
|
+
/**
|
|
25
|
+
* An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected
|
|
26
|
+
* to be built using `NodeSelectQueryFactory.createSelectClause`.
|
|
27
|
+
*/
|
|
28
|
+
query: ECSqlQueryDef;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A definition of nodes included in a hierarchy level.
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;
|
|
35
|
+
/** @beta */
|
|
36
|
+
export declare namespace HierarchyNodesDefinition {
|
|
37
|
+
function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition;
|
|
38
|
+
function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A definition of a hierarchy level, which may consist of multiple node definitions.
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export type HierarchyLevelDefinition = HierarchyNodesDefinition[];
|
|
45
|
+
/**
|
|
46
|
+
* A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.
|
|
47
|
+
* @beta
|
|
48
|
+
*/
|
|
49
|
+
export type NodeParser = (row: {
|
|
50
|
+
[columnName: string]: any;
|
|
51
|
+
}) => SourceInstanceHierarchyNode;
|
|
52
|
+
/**
|
|
53
|
+
* A type for a function that pre-processes given node. Unless the function decides not to make any modifications,
|
|
54
|
+
* it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node
|
|
55
|
+
* from the hierarchy.
|
|
56
|
+
*
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
export type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* A type for a function that post-processes given node. Unless the function decides not to make any modifications,
|
|
62
|
+
* it should return a new - modified - node, rather than modifying the given one.
|
|
63
|
+
*
|
|
64
|
+
* @beta
|
|
65
|
+
*/
|
|
66
|
+
export type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;
|
|
67
|
+
/**
|
|
68
|
+
* A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means
|
|
69
|
+
* a `HierarchyNode` that:
|
|
70
|
+
* - knows nothing about its children,
|
|
71
|
+
* - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).
|
|
72
|
+
* @beta
|
|
73
|
+
*/
|
|
74
|
+
export type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, "children">;
|
|
75
|
+
/**
|
|
76
|
+
* Props for `HierarchyDefinition.defineHierarchyLevel`.
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
export interface DefineHierarchyLevelProps {
|
|
80
|
+
/** Parent node to get children for. Pass `undefined` to get root nodes. */
|
|
81
|
+
parentNode: HierarchyDefinitionParentNode | undefined;
|
|
82
|
+
/** Optional hierarchy level filter. */
|
|
83
|
+
instanceFilter?: GenericInstanceFilter;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* An interface for a factory that knows how define a hierarchy based on a given parent node.
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
export interface HierarchyDefinition {
|
|
90
|
+
/**
|
|
91
|
+
* An optional function for parsing ECInstance node from ECSQL row.
|
|
92
|
+
*
|
|
93
|
+
* Should be used in situations when the `HierarchyDefinition` implementation
|
|
94
|
+
* introduces additional ECSQL columns into the select clause and wants to assign additional
|
|
95
|
+
* data to the nodes it produces.
|
|
96
|
+
*
|
|
97
|
+
* Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT
|
|
98
|
+
* clause is created using `NodeSelectQueryFactory.createSelectClause`.
|
|
99
|
+
*/
|
|
100
|
+
parseNode?: NodeParser;
|
|
101
|
+
/**
|
|
102
|
+
* An optional function for pre-processing nodes.
|
|
103
|
+
*
|
|
104
|
+
* Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`
|
|
105
|
+
* returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.
|
|
106
|
+
* The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.
|
|
107
|
+
*/
|
|
108
|
+
preProcessNode?: NodePreProcessor;
|
|
109
|
+
/**
|
|
110
|
+
* An optional function for post-processing nodes.
|
|
111
|
+
*
|
|
112
|
+
* Post-processing happens after the loaded nodes go through all the merging, hiding and grouping
|
|
113
|
+
* steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data
|
|
114
|
+
* to nodes after they're processed. This is especially true for grouping nodes as they're only created during
|
|
115
|
+
* processing.
|
|
116
|
+
*/
|
|
117
|
+
postProcessNode?: NodePostProcessor;
|
|
118
|
+
/** A function to create a hierarchy level definition for given parent node. */
|
|
119
|
+
defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=IModelHierarchyDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":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AAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,UAAU,EAAE,6BAA6B,GAAG,SAAS,CAAC;IAEtD,uCAAuC;IACvC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC,+EAA+E;IAC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.HierarchyNodesDefinition = void 0;
|
|
8
|
+
/** @beta */
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
10
|
+
var HierarchyNodesDefinition;
|
|
11
|
+
(function (HierarchyNodesDefinition) {
|
|
12
|
+
function isGenericNode(def) {
|
|
13
|
+
return !!def.node;
|
|
14
|
+
}
|
|
15
|
+
HierarchyNodesDefinition.isGenericNode = isGenericNode;
|
|
16
|
+
function isInstanceNodesQuery(def) {
|
|
17
|
+
return !!def.query;
|
|
18
|
+
}
|
|
19
|
+
HierarchyNodesDefinition.isInstanceNodesQuery = isInstanceNodesQuery;
|
|
20
|
+
})(HierarchyNodesDefinition || (exports.HierarchyNodesDefinition = HierarchyNodesDefinition = {}));
|
|
21
|
+
//# sourceMappingURL=IModelHierarchyDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6ChG,YAAY;AACZ,2DAA2D;AAC3D,IAAiB,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,sCAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,6CAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,wCAAxB,wBAAwB,QAOxC","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 { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport { NonGroupingHierarchyNode } from \"../HierarchyNode\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @beta\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @beta\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: string;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @beta\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @beta */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @beta\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @beta\n */\nexport type NodeParser = (row: { [columnName: string]: any }) => SourceInstanceHierarchyNode;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @beta\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @beta\n */\nexport type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @beta\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @beta\n */\nexport interface DefineHierarchyLevelProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: HierarchyDefinitionParentNode | undefined;\n\n /** Optional hierarchy level filter. */\n instanceFilter?: GenericInstanceFilter;\n}\n\n/**\n * An interface for a factory that knows how define a hierarchy based on a given parent node.\n * @beta\n */\nexport interface HierarchyDefinition {\n /**\n * An optional function for parsing ECInstance node from ECSQL row.\n *\n * Should be used in situations when the `HierarchyDefinition` implementation\n * introduces additional ECSQL columns into the select clause and wants to assign additional\n * data to the nodes it produces.\n *\n * Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT\n * clause is created using `NodeSelectQueryFactory.createSelectClause`.\n */\n parseNode?: NodeParser;\n\n /**\n * An optional function for pre-processing nodes.\n *\n * Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`\n * returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.\n * The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.\n */\n preProcessNode?: NodePreProcessor;\n\n /**\n * An optional function for post-processing nodes.\n *\n * Post-processing happens after the loaded nodes go through all the merging, hiding and grouping\n * steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data\n * to nodes after they're processed. This is especially true for grouping nodes as they're only created during\n * processing.\n */\n postProcessNode?: NodePostProcessor;\n\n /** A function to create a hierarchy level definition for given parent node. */\n defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;\n}\n"]}
|