@itwin/presentation-hierarchies 1.7.18 → 1.7.20

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/cjs/hierarchies/HierarchyErrors.d.ts.map +1 -1
  3. package/lib/cjs/hierarchies/HierarchyErrors.js.map +1 -1
  4. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -1
  5. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  6. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  7. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  8. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  9. package/lib/cjs/hierarchies/Logging.js.map +1 -1
  10. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
  11. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
  12. package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
  13. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
  14. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  15. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  16. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  17. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -1
  18. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  19. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  20. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  21. package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -1
  22. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
  23. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -1
  24. package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
  25. package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -1
  26. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  28. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
  29. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -1
  30. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -1
  31. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  32. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  33. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -1
  34. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -1
  35. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  36. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -1
  37. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  38. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
  39. package/lib/cjs/hierarchies/internal/LoggingUtils.js.map +1 -1
  40. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
  41. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.d.ts.map +1 -1
  42. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.js.map +1 -1
  43. package/lib/cjs/hierarchies/internal/operators/Partition.js.map +1 -1
  44. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  45. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
  46. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +1 -1
  47. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.js.map +1 -1
  48. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.js.map +1 -1
  49. package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  50. package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
  51. package/lib/cjs/hierarchies/internal/operators/TapOnce.js.map +1 -1
  52. package/lib/esm/hierarchies/HierarchyErrors.d.ts.map +1 -1
  53. package/lib/esm/hierarchies/HierarchyErrors.js.map +1 -1
  54. package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -1
  55. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  56. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  57. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  58. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
  59. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
  60. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  61. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  62. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  63. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  64. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  65. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
  66. package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
  67. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  68. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
  69. package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
  70. package/lib/esm/hierarchies/internal/SubscriptionScheduler.d.ts.map +1 -1
  71. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  72. package/lib/esm/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +1 -1
  73. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  74. package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
  75. package/package.json +10 -9
@@ -1 +1 @@
1
- {"version":3,"file":"Sorting.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,UAAU,EAAU,MAAM,MAAM,CAAC;AAI1D;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CASrH"}
1
+ {"version":3,"file":"Sorting.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,UAAU,EAAU,MAAM,MAAM,CAAC;AAI1D;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAYrH"}
@@ -1 +1 @@
1
- {"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAchG,4DASC;AArBD,+BAA0D;AAC1D,sDAAmE;AACnE,4CAAmD;AAEnD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAkC,KAAwB;IAChG,OAAO,KAAK,CAAC,IAAI,CACf,IAAA,aAAM,EAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,IAAI,0BAAW,CAAQ,+BAAmB,EAAE,8BAAe,CAAC,KAAK,CAAC,CAAC,EACtE,IAAA,UAAG,EAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,EAChD,IAAA,gBAAS,GAAE,CACZ,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 { concatAll, map, Observable, reduce } from \"rxjs\";\nimport { DuplicatePolicy, SortedArray } from \"@itwin/core-bentley\";\nimport { compareNodesByLabel } from \"../Common.js\";\n\n/**\n * This should accept sorting params in some form:\n * - is sorting disabled?\n * - are we sorting by label or some property value, in case of the latter - how do we get the value?\n *\n * @note Nodes with same labels are returned in undefined order.\n * @internal\n */\nexport function sortNodesByLabelOperator<TNode extends { label: string }>(nodes: Observable<TNode>): Observable<TNode> {\n return nodes.pipe(\n reduce((sorted, node) => {\n sorted.insert(node);\n return sorted;\n }, new SortedArray<TNode>(compareNodesByLabel, DuplicatePolicy.Allow)),\n map((sortedArray) => sortedArray.extractArray()),\n concatAll(),\n );\n}\n"]}
1
+ {"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAA0D;AAC1D,sDAAmE;AACnE,4CAAmD;AAEnD;;;;;;;GAOG;AACH,kCAA0E,KAAwB;IAChG,OAAO,KAAK,CAAC,IAAI,CACf,IAAA,aAAM,EACJ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,IAAI,0BAAW,CAAQ,+BAAmB,EAAE,8BAAe,CAAC,KAAK,CAAC,CACnE,EACD,IAAA,UAAG,EAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,EAChD,IAAA,gBAAS,GAAE,CACZ,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 { concatAll, map, Observable, reduce } from \"rxjs\";\nimport { DuplicatePolicy, SortedArray } from \"@itwin/core-bentley\";\nimport { compareNodesByLabel } from \"../Common.js\";\n\n/**\n * This should accept sorting params in some form:\n * - is sorting disabled?\n * - are we sorting by label or some property value, in case of the latter - how do we get the value?\n *\n * @note Nodes with same labels are returned in undefined order.\n * @internal\n */\nexport function sortNodesByLabelOperator<TNode extends { label: string }>(nodes: Observable<TNode>): Observable<TNode> {\n return nodes.pipe(\n reduce(\n (sorted, node) => {\n sorted.insert(node);\n return sorted;\n },\n new SortedArray<TNode>(compareNodesByLabel, DuplicatePolicy.Allow),\n ),\n map((sortedArray) => sortedArray.extractArray()),\n concatAll(),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TapOnce.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/TapOnce.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAKhG,0BAWC;AAdD,+BAAqD;AAErD,gBAAgB;AAChB,SAAgB,OAAO,CAAI,QAAoB;IAC7C,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,MAAM,CAAC,IAAI,CACT,IAAA,UAAG,EAAC,GAAG,EAAE;QACP,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,GAAG,KAAK,CAAC;YACd,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,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 { MonoTypeOperatorFunction, tap } from \"rxjs\";\n\n/** @internal */\nexport function tapOnce<T>(observer: () => void): MonoTypeOperatorFunction<T> {\n let first = true;\n return (source) =>\n source.pipe(\n tap(() => {\n if (first) {\n first = false;\n observer();\n }\n }),\n );\n}\n"]}
1
+ {"version":3,"file":"TapOnce.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/TapOnce.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAqD;AAErD,gBAAgB;AAChB,iBAA2B,QAAoB;IAC7C,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,MAAM,CAAC,IAAI,CACT,IAAA,UAAG,EAAC,GAAG,EAAE;QACP,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,GAAG,KAAK,CAAC;YACd,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,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 { MonoTypeOperatorFunction, tap } from \"rxjs\";\n\n/** @internal */\nexport function tapOnce<T>(observer: () => void): MonoTypeOperatorFunction<T> {\n let first = true;\n return (source) =>\n source.pipe(\n tap(() => {\n if (first) {\n first = false;\n observer();\n }\n }),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyErrors.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyErrors.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aACZ,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAGjD"}
1
+ {"version":3,"file":"HierarchyErrors.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyErrors.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aACZ,KAAK,EAAE,MAAM;IAAhD,YAAmC,KAAK,EAAE,MAAM,EAE/C;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyErrors.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyErrors.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACZ;IAAnC,YAAmC,KAAa;QAC9C,KAAK,CAAC,uBAAuB,KAAK,WAAW,CAAC,CAAC;QADd,UAAK,GAAL,KAAK,CAAQ;IAEhD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Error that is thrown when rows amount exceed hierarchy level limit.\n * @public\n */\nexport class RowsLimitExceededError extends Error {\n public constructor(public readonly limit: number) {\n super(`Query rows limit of ${limit} exceeded`);\n }\n}\n"]}
1
+ {"version":3,"file":"HierarchyErrors.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyErrors.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACZ,KAAK;IAAxC,YAAmC,KAAa;QAC9C,KAAK,CAAC,uBAAuB,KAAK,WAAW,CAAC,CAAC;qBADd,KAAK;IAExC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Error that is thrown when rows amount exceed hierarchy level limit.\n * @public\n */\nexport class RowsLimitExceededError extends Error {\n public constructor(public readonly limit: number) {\n super(`Query rows limit of ${limit} exceeded`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version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AC,iBAAiB,CAAC,WAAW,GAAG,CAAC,CAAC;YAEpE,OAAO,YAAY,GAAG,KAAK,CAAC;QAC9B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,YAAY,CACjB,UAAoE;QAEpE,OAAO;YACL,GAAG,CAAC,IAAI,CAAC,wBAAwB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,gCAAgC,CAAC,MAAM,GAAG,CAAC;gBAC3G,CAAC,CAAC;oBACE,SAAS,EAAE;wBACT,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;wBAClF,GAAG,CAAC,IAAI,CAAC,eAAe;4BACtB,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,EAAE;4BAC1E,CAAC,CAAC,SAAS,CAAC;wBACd,GAAG,CAAC,IAAI,CAAC,gCAAgC,CAAC,MAAM,GAAG,CAAC;4BAClD,CAAC,CAAC,EAAE,+BAA+B,EAAE,IAAI,CAAC,gCAAgC,EAAE;4BAC5E,CAAC,CAAC,SAAS,CAAC;qBACf;iBACF;gBACH,CAAC,CAAC,SAAS,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC5E,CAAC;IACJ,CAAC;CACF","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 { HierarchyNode, NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/**\n * @public\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\nexport interface FilterTargetGroupingNodeInfo {\n /**\n * Key of the grouping node.\n * @deprecated in 1.6. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n key: GroupingNodeKey;\n\n /**\n * Depth up to which nodes in the hierarchy should be expanded.\n * @deprecated in 1.6. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n depth: number;\n}\n\n/**\n * @public\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInPath` or `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\nexport interface FilteringPathAutoExpandOption {\n /**\n * Depth up to which nodes in the hierarchy should be expanded.\n *\n * If `includeGroupingNodes` is set to true, then depth should take into account the number of grouping nodes in hierarchy.\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInPath` or `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n depth: number;\n /**\n * Whether or not `depth` includes grouping nodes.\n *\n * Use when you want to autoExpand only some of the grouping nodes.\n *\n * **Use case example:**\n *\n * You want to `autoExpand` only `Node1` and `GroupingNode1` in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n * Then you provide `autoExpand: { depth: 2, includeGroupingNodes: true }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n includeGroupingNodes?: boolean;\n}\n\n/** @public */\nexport interface FilteringPathAutoExpandDepthInPath {\n /**\n * Depth that tells which nodes in the filtering path should be expanded.\n *\n * Use when you want to expand up to specific instance node and don't care about grouping nodes.\n *\n * **NOTE**: All nodes that are up to `depthInPath` will be expanded. Node at the `depthInPath` position won't be expanded.\n */\n depthInPath: number;\n}\n\n/** @public */\nexport interface FilteringPathAutoExpandDepthInHierarchy {\n /**\n * Depth that tells which nodes in the hierarchy should be expanded.\n *\n * This should take into account the number of grouping nodes in hierarchy.\n *\n * * **Use case example:**\n *\n * You want to `autoExpand` only `Node1` and `GroupingNode1` in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n * Then you provide `autoExpand: { depthInHierarchy: 2 }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n *\n * **NOTE**: All nodes that are up to and including `depthInHierarchy` will be expanded.\n */\n depthInHierarchy: number;\n}\n\n/** @public */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandOption`, then all nodes up to and including `depth` will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandDepthInHierarchy`, then all nodes up to and including `depthInHierarchy` will have `autoExpand` flag.\n */\n autoExpand?:\n | boolean\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | FilterTargetGroupingNodeInfo\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | FilteringPathAutoExpandOption\n | FilteringPathAutoExpandDepthInHierarchy\n | FilteringPathAutoExpandDepthInPath;\n}\n\nnamespace HierarchyFilteringPathOptions {\n export function mergeAutoExpandOptions(\n lhs: HierarchyFilteringPathOptions[\"autoExpand\"],\n rhs: HierarchyFilteringPathOptions[\"autoExpand\"],\n ): HierarchyFilteringPathOptions[\"autoExpand\"] {\n if (rhs === true || lhs === true) {\n return true;\n }\n if (!rhs || !lhs) {\n return !!rhs ? rhs : lhs;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const lhsDepth = \"depth\" in lhs ? lhs.depth : \"depthInPath\" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const rhsDepth = \"depth\" in rhs ? rhs.depth : \"depthInPath\" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;\n const isLhsDepthBasedOnPath =\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n \"depthInPath\" in lhs ? true : !(\"key\" in lhs) && !(\"depthInHierarchy\" in lhs) && !lhs.includeGroupingNodes;\n const isRhsDepthBasedOnPath =\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n \"depthInPath\" in rhs ? true : !(\"key\" in rhs) && !(\"depthInHierarchy\" in rhs) && !rhs.includeGroupingNodes;\n\n if (isLhsDepthBasedOnPath) {\n if (isRhsDepthBasedOnPath) {\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n return lhs;\n }\n if (isRhsDepthBasedOnPath) {\n return rhs;\n }\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @public\n */\nexport type HierarchyFilteringPath =\n | HierarchyNodeIdentifiersPath\n | { path: HierarchyNodeIdentifiersPath; options?: HierarchyFilteringPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyFilteringPath {\n /**\n * Normalizes the hierarchy filtering path to the object form.\n * @public\n */\n export function normalize(\n source: HierarchyFilteringPath,\n ): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchyFilteringPathOptions` objects.\n * - if both inputs are `undefined`, `undefined` is returned,\n * - else if one of the inputs is `undefined`, the other one is returned.\n * - else, merge each option individually.\n *\n * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if only one of the inputs is an object, return it,\n * - else if both inputs are falsy, return `false` or `undefined`,\n * - else:\n * - if only one of the inputs has `includeGroupingNodes` set to `true` or `key` defined or `depthInHierarchy` set, return the other one,\n * - else return the one with greater `depth`, `depthInPath` or `depthInHierarchy`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchyFilteringPathOptions | undefined,\n rhs: HierarchyFilteringPathOptions | undefined,\n ): HierarchyFilteringPathOptions | undefined {\n if (!lhs || !rhs) {\n return lhs ?? rhs;\n }\n\n return { autoExpand: HierarchyFilteringPathOptions.mergeAutoExpandOptions(lhs.autoExpand, rhs.autoExpand) };\n }\n}\n\n/**\n * An utility that extracts filtering properties from given root level filtering props or\n * the parent node. Returns `undefined` if filtering props are not present.\n * @public\n * @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.\n */\n/* v8 ignore start */\nexport function extractFilteringProps(\n rootLevelFilteringProps: HierarchyFilteringPath[],\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n): { filteredNodePaths: HierarchyFilteringPath[]; hasFilterTargetAncestor: boolean } | undefined {\n return extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n}\n/* v8 ignore stop */\n\nfunction extractFilteringPropsInternal(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n): { filteredNodePaths: HierarchyFilteringPath[]; hasFilterTargetAncestor: boolean } | undefined {\n if (!parentNode) {\n return rootLevelFilteringProps\n ? { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false }\n : /** v8 ignore next */ undefined;\n }\n return parentNode.filtering?.filteredChildrenIdentifierPaths\n ? {\n filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,\n hasFilterTargetAncestor:\n !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,\n }\n : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to filter the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchyFilteringHelper(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\" | \"parentKeys\"> | undefined,\n) {\n const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n const hasFilter = !!filteringProps;\n return {\n /**\n * Returns a flag indicating if the hierarchy level is filtered.\n */\n hasFilter,\n\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a filter target. That generally means that this and all downstream hierarchy\n * levels should be displayed without filter being applied to them, even if filter paths\n * say otherwise.\n */\n hasFilterTargetAncestor: filteringProps?.hasFilterTargetAncestor ?? false,\n\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if filtering is not applied to this level.\n */\n getChildNodeFilteringIdentifiers: () => {\n if (!hasFilter) {\n return undefined;\n }\n return filteringProps.filteredNodePaths\n .map(HierarchyFilteringPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `filtering`\n * and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n */\n createChildNodeProps: (\n props:\n | { nodeKey: InstancesNodeKey | GenericNodeKey }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean },\n ): Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> | undefined => {\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n filteringProps.filteredNodePaths.forEach((filteredPath) => {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredPath);\n // TODO: MISSING_COVERAGE\n /* v8 ignore start */\n if (\n \"nodeKey\" in props &&\n ((HierarchyNodeKey.isGeneric(props.nodeKey) &&\n HierarchyNodeIdentifier.equal(normalizedPath.path[0], props.nodeKey)) ||\n (HierarchyNodeKey.isInstances(props.nodeKey) &&\n props.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik))))\n ) {\n reducer.accept(normalizedPath);\n /* v8 ignore stop */\n } else if (\"pathMatcher\" in props && props.pathMatcher(normalizedPath.path[0])) {\n reducer.accept(normalizedPath);\n }\n });\n return reducer.getNodeProps(parentNode);\n },\n\n /**\n * Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.\n */\n createChildNodePropsAsync: (props: {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }):\n | Promise<Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> | undefined>\n | Pick<HierarchyNode, \"autoExpand\" | \"filtering\">\n | undefined => {\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n const matchedPathPromises = new Array<Promise<NormalizedFilteringPath | undefined>>();\n for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n\n const matchesPossiblyPromise = props.pathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));\n continue;\n }\n if (!matchesPossiblyPromise) {\n continue;\n }\n\n reducer.accept(normalizedPath);\n }\n if (matchedPathPromises.length === 0) {\n return reducer.getNodeProps(parentNode);\n }\n return Promise.all(matchedPathPromises)\n .then((matchedPath) =>\n matchedPath.forEach((normalizedPath) => normalizedPath && reducer.accept(normalizedPath)),\n )\n .then(() => reducer.getNodeProps(parentNode));\n },\n };\n}\n\ntype NormalizedFilteringPath = ReturnType<(typeof HierarchyFilteringPath)[\"normalize\"]>;\n\nclass MatchingFilteringPathsReducer {\n private _filteredChildrenIdentifierPaths = new Array<NormalizedFilteringPath>();\n private _isFilterTarget = false;\n private _filterTargetOptions = undefined as HierarchyFilteringPathOptions | undefined;\n private _autoExpandOption: HierarchyFilteringPathOptions[\"autoExpand\"] = false;\n\n public constructor(private _hasFilterTargetAncestor: boolean) {}\n\n public accept(normalizedPath: NormalizedFilteringPath): void {\n const { path, options } = normalizedPath;\n // TODO: MISSING_COVERAGE\n /* v8 ignore else -- @preserve */\n if (path.length === 1) {\n this._isFilterTarget = true;\n this._filterTargetOptions = HierarchyFilteringPath.mergeOptions(this._filterTargetOptions, options);\n } else if (path.length > 1) {\n this._filteredChildrenIdentifierPaths.push({ path: path.slice(1), options });\n this._autoExpandOption = HierarchyFilteringPathOptions.mergeAutoExpandOptions(\n options?.autoExpand,\n this._autoExpandOption,\n );\n }\n }\n\n private getNeedsAutoExpand(parentNode: Pick<NonGroupingHierarchyNode, \"parentKeys\"> | undefined): boolean {\n if (this._autoExpandOption === true) {\n return true;\n }\n if (typeof this._autoExpandOption === \"object\") {\n const parentLength = !parentNode\n ? 0\n : \"key\" in this._autoExpandOption ||\n \"depthInHierarchy\" in this._autoExpandOption ||\n // TODO: MISSING_COVERAGE\n /* v8 ignore start */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (\"includeGroupingNodes\" in this._autoExpandOption && this._autoExpandOption.includeGroupingNodes)\n ? // TODO: MISSING_COVERAGE\n /* v8 ignore stop */\n 1 + parentNode.parentKeys.length\n : 1 + parentNode.parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length;\n const depth =\n \"depthInHierarchy\" in this._autoExpandOption\n ? this._autoExpandOption.depthInHierarchy\n : \"depth\" in this._autoExpandOption\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._autoExpandOption.depth\n : // With `depthInPath` option we don't want to expand node that is at the `depthInPath` position\n // TODO: MISSING_COVERAGE\n /* v8 ignore next */ this._autoExpandOption.depthInPath - 1;\n\n return parentLength < depth;\n }\n return false;\n }\n\n public getNodeProps(\n parentNode: Pick<NonGroupingHierarchyNode, \"parentKeys\"> | undefined,\n ): Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> {\n return {\n ...(this._hasFilterTargetAncestor || this._isFilterTarget || this._filteredChildrenIdentifierPaths.length > 0\n ? {\n filtering: {\n ...(this._hasFilterTargetAncestor ? { hasFilterTargetAncestor: true } : undefined),\n ...(this._isFilterTarget\n ? { isFilterTarget: true, filterTargetOptions: this._filterTargetOptions }\n : undefined),\n ...(this._filteredChildrenIdentifierPaths.length > 0\n ? { filteredChildrenIdentifierPaths: this._filteredChildrenIdentifierPaths }\n : undefined),\n },\n }\n : undefined),\n ...(this.getNeedsAutoExpand(parentNode) ? { autoExpand: true } : undefined),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"HierarchyFiltering.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,uBAAuB,EAAgC,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAmC,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AA+G5G,IAAU,6BAA6B,CAiCtC;AAjCD,WAAU,6BAA6B;IACrC,SAAgB,sBAAsB,CACpC,GAAgD,EAChD,GAAgD;QAEhD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3B,CAAC;QACD,4DAA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AC1E,CAAC,CAAC,SAAS,CAAC;wBACd,GAAG,CAAC,IAAI,CAAC,gCAAgC,CAAC,MAAM,GAAG,CAAC;4BAClD,CAAC,CAAC,EAAE,+BAA+B,EAAE,IAAI,CAAC,gCAAgC,EAAE;4BAC5E,CAAC,CAAC,SAAS,CAAC;qBACf;iBACF;gBACH,CAAC,CAAC,SAAS,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC5E,CAAC;IACJ,CAAC;CACF","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 { HierarchyNode, NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/**\n * @public\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\nexport interface FilterTargetGroupingNodeInfo {\n /**\n * Key of the grouping node.\n * @deprecated in 1.6. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n key: GroupingNodeKey;\n\n /**\n * Depth up to which nodes in the hierarchy should be expanded.\n * @deprecated in 1.6. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n depth: number;\n}\n\n/**\n * @public\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInPath` or `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\nexport interface FilteringPathAutoExpandOption {\n /**\n * Depth up to which nodes in the hierarchy should be expanded.\n *\n * If `includeGroupingNodes` is set to true, then depth should take into account the number of grouping nodes in hierarchy.\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInPath` or `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n depth: number;\n /**\n * Whether or not `depth` includes grouping nodes.\n *\n * Use when you want to autoExpand only some of the grouping nodes.\n *\n * **Use case example:**\n *\n * You want to `autoExpand` only `Node1` and `GroupingNode1` in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n * Then you provide `autoExpand: { depth: 2, includeGroupingNodes: true }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n * @deprecated in 1.7. Use `FilteringPathAutoExpandDepthInHierarchy` instead.\n */\n includeGroupingNodes?: boolean;\n}\n\n/** @public */\nexport interface FilteringPathAutoExpandDepthInPath {\n /**\n * Depth that tells which nodes in the filtering path should be expanded.\n *\n * Use when you want to expand up to specific instance node and don't care about grouping nodes.\n *\n * **NOTE**: All nodes that are up to `depthInPath` will be expanded. Node at the `depthInPath` position won't be expanded.\n */\n depthInPath: number;\n}\n\n/** @public */\nexport interface FilteringPathAutoExpandDepthInHierarchy {\n /**\n * Depth that tells which nodes in the hierarchy should be expanded.\n *\n * This should take into account the number of grouping nodes in hierarchy.\n *\n * * **Use case example:**\n *\n * You want to `autoExpand` only `Node1` and `GroupingNode1` in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n * Then you provide `autoExpand: { depthInHierarchy: 2 }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n *\n * **NOTE**: All nodes that are up to and including `depthInHierarchy` will be expanded.\n */\n depthInHierarchy: number;\n}\n\n/** @public */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandOption`, then all nodes up to and including `depth` will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.\n * - If it's an instance of `FilteringPathAutoExpandDepthInHierarchy`, then all nodes up to and including `depthInHierarchy` will have `autoExpand` flag.\n */\n autoExpand?:\n | boolean\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | FilterTargetGroupingNodeInfo\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | FilteringPathAutoExpandOption\n | FilteringPathAutoExpandDepthInHierarchy\n | FilteringPathAutoExpandDepthInPath;\n}\n\nnamespace HierarchyFilteringPathOptions {\n export function mergeAutoExpandOptions(\n lhs: HierarchyFilteringPathOptions[\"autoExpand\"],\n rhs: HierarchyFilteringPathOptions[\"autoExpand\"],\n ): HierarchyFilteringPathOptions[\"autoExpand\"] {\n if (rhs === true || lhs === true) {\n return true;\n }\n if (!rhs || !lhs) {\n return !!rhs ? rhs : lhs;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const lhsDepth = \"depth\" in lhs ? lhs.depth : \"depthInPath\" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const rhsDepth = \"depth\" in rhs ? rhs.depth : \"depthInPath\" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;\n const isLhsDepthBasedOnPath =\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n \"depthInPath\" in lhs ? true : !(\"key\" in lhs) && !(\"depthInHierarchy\" in lhs) && !lhs.includeGroupingNodes;\n const isRhsDepthBasedOnPath =\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n \"depthInPath\" in rhs ? true : !(\"key\" in rhs) && !(\"depthInHierarchy\" in rhs) && !rhs.includeGroupingNodes;\n\n if (isLhsDepthBasedOnPath) {\n if (isRhsDepthBasedOnPath) {\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n return lhs;\n }\n if (isRhsDepthBasedOnPath) {\n return rhs;\n }\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @public\n */\nexport type HierarchyFilteringPath =\n | HierarchyNodeIdentifiersPath\n | { path: HierarchyNodeIdentifiersPath; options?: HierarchyFilteringPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyFilteringPath {\n /**\n * Normalizes the hierarchy filtering path to the object form.\n * @public\n */\n export function normalize(\n source: HierarchyFilteringPath,\n ): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchyFilteringPathOptions` objects.\n * - if both inputs are `undefined`, `undefined` is returned,\n * - else if one of the inputs is `undefined`, the other one is returned.\n * - else, merge each option individually.\n *\n * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if only one of the inputs is an object, return it,\n * - else if both inputs are falsy, return `false` or `undefined`,\n * - else:\n * - if only one of the inputs has `includeGroupingNodes` set to `true` or `key` defined or `depthInHierarchy` set, return the other one,\n * - else return the one with greater `depth`, `depthInPath` or `depthInHierarchy`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchyFilteringPathOptions | undefined,\n rhs: HierarchyFilteringPathOptions | undefined,\n ): HierarchyFilteringPathOptions | undefined {\n if (!lhs || !rhs) {\n return lhs ?? rhs;\n }\n\n return { autoExpand: HierarchyFilteringPathOptions.mergeAutoExpandOptions(lhs.autoExpand, rhs.autoExpand) };\n }\n}\n\n/**\n * An utility that extracts filtering properties from given root level filtering props or\n * the parent node. Returns `undefined` if filtering props are not present.\n * @public\n * @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.\n */\n/* v8 ignore start */\nexport function extractFilteringProps(\n rootLevelFilteringProps: HierarchyFilteringPath[],\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n): { filteredNodePaths: HierarchyFilteringPath[]; hasFilterTargetAncestor: boolean } | undefined {\n return extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n}\n/* v8 ignore stop */\n\nfunction extractFilteringPropsInternal(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n): { filteredNodePaths: HierarchyFilteringPath[]; hasFilterTargetAncestor: boolean } | undefined {\n if (!parentNode) {\n return rootLevelFilteringProps\n ? { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false }\n : /** v8 ignore next */ undefined;\n }\n return parentNode.filtering?.filteredChildrenIdentifierPaths\n ? {\n filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,\n hasFilterTargetAncestor:\n !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,\n }\n : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to filter the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchyFilteringHelper(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\" | \"parentKeys\"> | undefined,\n) {\n const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n const hasFilter = !!filteringProps;\n return {\n /**\n * Returns a flag indicating if the hierarchy level is filtered.\n */\n hasFilter,\n\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a filter target. That generally means that this and all downstream hierarchy\n * levels should be displayed without filter being applied to them, even if filter paths\n * say otherwise.\n */\n hasFilterTargetAncestor: filteringProps?.hasFilterTargetAncestor ?? false,\n\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if filtering is not applied to this level.\n */\n getChildNodeFilteringIdentifiers: () => {\n if (!hasFilter) {\n return undefined;\n }\n return filteringProps.filteredNodePaths\n .map(HierarchyFilteringPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `filtering`\n * and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n */\n createChildNodeProps: (\n props:\n | { nodeKey: InstancesNodeKey | GenericNodeKey }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean },\n ): Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> | undefined => {\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n filteringProps.filteredNodePaths.forEach((filteredPath) => {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredPath);\n // TODO: MISSING_COVERAGE\n /* v8 ignore start */\n if (\n \"nodeKey\" in props &&\n ((HierarchyNodeKey.isGeneric(props.nodeKey) &&\n HierarchyNodeIdentifier.equal(normalizedPath.path[0], props.nodeKey)) ||\n (HierarchyNodeKey.isInstances(props.nodeKey) &&\n props.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik))))\n ) {\n reducer.accept(normalizedPath);\n /* v8 ignore stop */\n } else if (\"pathMatcher\" in props && props.pathMatcher(normalizedPath.path[0])) {\n reducer.accept(normalizedPath);\n }\n });\n return reducer.getNodeProps(parentNode);\n },\n\n /**\n * Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.\n */\n createChildNodePropsAsync: (props: {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }):\n | Promise<Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> | undefined>\n | Pick<HierarchyNode, \"autoExpand\" | \"filtering\">\n | undefined => {\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n const matchedPathPromises = new Array<Promise<NormalizedFilteringPath | undefined>>();\n for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);\n // TODO: MISSING_COVERAGE\n /* v8 ignore if -- @preserve */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n\n const matchesPossiblyPromise = props.pathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));\n continue;\n }\n if (!matchesPossiblyPromise) {\n continue;\n }\n\n reducer.accept(normalizedPath);\n }\n if (matchedPathPromises.length === 0) {\n return reducer.getNodeProps(parentNode);\n }\n return Promise.all(matchedPathPromises)\n .then((matchedPath) =>\n matchedPath.forEach((normalizedPath) => normalizedPath && reducer.accept(normalizedPath)),\n )\n .then(() => reducer.getNodeProps(parentNode));\n },\n };\n}\n\ntype NormalizedFilteringPath = ReturnType<(typeof HierarchyFilteringPath)[\"normalize\"]>;\n\nclass MatchingFilteringPathsReducer {\n private _filteredChildrenIdentifierPaths = new Array<NormalizedFilteringPath>();\n private _isFilterTarget = false;\n private _filterTargetOptions = undefined as HierarchyFilteringPathOptions | undefined;\n private _autoExpandOption: HierarchyFilteringPathOptions[\"autoExpand\"] = false;\n\n public constructor(private _hasFilterTargetAncestor: boolean) {}\n\n public accept(normalizedPath: NormalizedFilteringPath): void {\n const { path, options } = normalizedPath;\n // TODO: MISSING_COVERAGE\n /* v8 ignore else -- @preserve */\n if (path.length === 1) {\n this._isFilterTarget = true;\n this._filterTargetOptions = HierarchyFilteringPath.mergeOptions(this._filterTargetOptions, options);\n } else if (path.length > 1) {\n this._filteredChildrenIdentifierPaths.push({ path: path.slice(1), options });\n this._autoExpandOption = HierarchyFilteringPathOptions.mergeAutoExpandOptions(\n options?.autoExpand,\n this._autoExpandOption,\n );\n }\n }\n\n private getNeedsAutoExpand(parentNode: Pick<NonGroupingHierarchyNode, \"parentKeys\"> | undefined): boolean {\n if (this._autoExpandOption === true) {\n return true;\n }\n if (typeof this._autoExpandOption === \"object\") {\n const parentLength = !parentNode\n ? 0\n : \"key\" in this._autoExpandOption ||\n \"depthInHierarchy\" in this._autoExpandOption ||\n // TODO: MISSING_COVERAGE\n /* v8 ignore start */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (\"includeGroupingNodes\" in this._autoExpandOption && this._autoExpandOption.includeGroupingNodes)\n ? // TODO: MISSING_COVERAGE\n /* v8 ignore stop */\n 1 + parentNode.parentKeys.length\n : 1 + parentNode.parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length;\n const depth =\n \"depthInHierarchy\" in this._autoExpandOption\n ? this._autoExpandOption.depthInHierarchy\n : \"depth\" in this._autoExpandOption\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._autoExpandOption.depth\n : // With `depthInPath` option we don't want to expand node that is at the `depthInPath` position\n // TODO: MISSING_COVERAGE\n /* v8 ignore next */ this._autoExpandOption.depthInPath - 1;\n\n return parentLength < depth;\n }\n return false;\n }\n\n public getNodeProps(\n parentNode: Pick<NonGroupingHierarchyNode, \"parentKeys\"> | undefined,\n ): Pick<HierarchyNode, \"autoExpand\" | \"filtering\"> {\n return {\n ...(this._hasFilterTargetAncestor || this._isFilterTarget || this._filteredChildrenIdentifierPaths.length > 0\n ? {\n filtering: {\n ...(this._hasFilterTargetAncestor ? { hasFilterTargetAncestor: true } : undefined),\n ...(this._isFilterTarget\n ? { isFilterTarget: true, filterTargetOptions: this._filterTargetOptions }\n : undefined),\n ...(this._filteredChildrenIdentifierPaths.length > 0\n ? { filteredChildrenIdentifierPaths: this._filteredChildrenIdentifierPaths }\n : undefined),\n },\n }\n : undefined),\n ...(this.getNeedsAutoExpand(parentNode) ? { autoExpand: true } : undefined),\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNode.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAIL,gBAAgB,GASjB,MAAM,uBAAuB,CAAC;AAoB/B,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,2BAA2B,CAoB3C;AApBD,WAAiB,2BAA2B;IAC1C,4IAA4I;IAC5I,qBAAqB;IACrB,SAAgB,MAAM,CAAC,KAKtB;QACC,MAAM,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;QAChH,IAAI,cAAc,IAAI,uBAAuB,IAAI,+BAA+B,EAAE,MAAM,EAAE,CAAC;YACzF,OAAO;gBACL,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzE,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACtE,GAAG,CAAC,CAAC,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,+BAA+B,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;aACjG,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAfe,kCAAM,SAerB,CAAA;IACD,oBAAoB;AACtB,CAAC,EApBgB,2BAA2B,KAA3B,2BAA2B,QAoB3C;AA2DD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,aAAa,CAgE7B;AAhED,WAAiB,aAAa;IAC5B,sDAAsD;IACtD,SAAgB,SAAS,CACvB,IAAW;QAEX,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,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B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAJe,8CAAgC,mCAI/C,CAAA;IACD,gEAAgE;IAChE,SAAgB,sBAAsB,CACpC,IAAW;QAEX,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAJe,oCAAsB,yBAIrC,CAAA;AACH,CAAC,EAhEgB,aAAa,KAAb,aAAa,QAgE7B","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 { OmitOverUnion } from \"@itwin/presentation-shared\";\nimport { HierarchyFilteringPath, HierarchyFilteringPathOptions } from \"./HierarchyFiltering.js\";\nimport {\n ClassGroupingNodeKey,\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n IModelHierarchyNodeKey,\n IModelInstanceKey,\n InstancesNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n} from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport type HierarchyNodeFilteringProps = {\n /** If set to true, then one of the ancestor nodes in the hierarchy is the filter target. */\n hasFilterTargetAncestor?: boolean;\n /** Paths to node's children that are filter targets. */\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n} & (\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget?: false;\n }\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget: true;\n /** Options that were used to filter the node. */\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }\n);\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeFilteringProps {\n /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */\n /* v8 ignore start */\n export function create(props: {\n hasFilterTargetAncestor?: boolean;\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n isFilterTarget?: boolean;\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }): HierarchyNodeFilteringProps | undefined {\n const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;\n if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {\n return {\n ...(isFilterTarget ? { isFilterTarget, filterTargetOptions } : undefined),\n ...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),\n ...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),\n };\n }\n return undefined;\n }\n /* v8 ignore stop */\n}\n\n/**\n * A data structure that defines attributes that are common to all types of hierarchy nodes.\n * @public\n */\ninterface BaseHierarchyNode {\n /** Identifiers of all node ancestors. Can be used to identify a node in the hierarchy. */\n parentKeys: HierarchyNodeKey[];\n /** Node's display label. */\n label: string;\n /** A flag indicating whether the node has children or not. */\n children: boolean;\n /** A flag indicating whether this node should be auto-expanded in the UI. */\n autoExpand?: boolean;\n /** Additional data that may be assigned to this node. */\n extendedData?: { [key: string]: any };\n /** Data that may be assigned to the node if filtering is enabled */\n filtering?: HierarchyNodeFilteringProps;\n}\n\n/**\n * A data structure that represents a single non-grouping hierarchy node.\n * @public\n */\nexport interface NonGroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify the node in its hierarchy level. */\n key: GenericNodeKey | InstancesNodeKey;\n /**\n * Identifies whether the hierarchy level below this node supports filtering. If not, supplying an instance\n * filter when requesting child hierarchy level will have no effect.\n */\n supportsFiltering?: boolean;\n}\n\n/**\n * A data structure that represents a grouping node that groups other nodes.\n * @public\n */\nexport interface GroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify this grouping node in its hierarchy level. */\n key: GroupingNodeKey;\n\n /**\n * Keys of all instances grouped by this node, including deeply nested under\n * other grouping nodes.\n */\n groupedInstanceKeys: IModelInstanceKey[];\n\n /** The closest ancestor node that is not a grouping node. May be `undefined` if the grouping node grouped root level nodes. */\n nonGroupingAncestor?: ParentHierarchyNode<NonGroupingHierarchyNode>;\n}\n\n/**\n * A data structure that represents a single hierarchy node.\n * @public\n */\nexport type HierarchyNode = NonGroupingHierarchyNode | GroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & NonGroupingHierarchyNode & { key: GenericNodeKey } {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is a standard (iModel content based) node */\n export function isIModelNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: IModelHierarchyNodeKey } {\n return HierarchyNodeKey.isIModelNodeKey(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & NonGroupingHierarchyNode & { key: InstancesNodeKey } {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & GroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n /** Checks whether the given node is a class grouping node */\n export function isClassGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: ClassGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isClassGrouping(node.key);\n }\n /** Checks whether the given node is a label grouping node */\n export function isLabelGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: LabelGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isLabelGrouping(node.key);\n }\n /** Checks whether the given node is property grouping node for other values */\n export function isPropertyOtherValuesGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & {\n key: PropertyOtherValuesGroupingNodeKey;\n supportsFiltering?: undefined;\n } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyOtherValuesGrouping(node.key);\n }\n /** Checks whether the given node is a property value grouping node */\n export function isPropertyValueGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueGrouping(node.key);\n }\n /** Checks whether the given node is a property value range grouping node */\n export function isPropertyValueRangeGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueRangeGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueRangeGrouping(node.key);\n }\n /** Checks whether the given node is a property grouping node */\n export function isPropertyGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyGrouping(node.key);\n }\n}\n\n/**\n * A type of `HierarchyNode` that doesn't know about its children and is an input when requesting\n * them using `HierarchyProvider.getNodes`.\n * @public\n */\nexport type ParentHierarchyNode<TBase = HierarchyNode> = OmitOverUnion<TBase, \"children\">;\n"]}
1
+ {"version":3,"file":"HierarchyNode.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAIL,gBAAgB,GASjB,MAAM,uBAAuB,CAAC;AAoB/B,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,2BAA2B,CAoB3C;AApBD,WAAiB,2BAA2B;IAC1C,4IAA4I;IAC5I,qBAAqB;IACrB,SAAgB,MAAM,CAAC,KAKtB;QACC,MAAM,EAAE,uBAAuB,EAAE,+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gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAJe,cAAA,cAAc,iBAI7B,CAAA;IACD,6DAA6D;IAC7D,SAAgB,mBAAmB,CACjC,IAAW;QAEX,OAAO,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAJe,cAAA,mBAAmB,sBAIlC,CAAA;IACD,6DAA6D;IAC7D,SAAgB,mBAAmB,CACjC,IAAW;QAEX,OAAO,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAJe,cAAA,mBAAmB,sBAIlC,CAAA;IACD,gFAAgF;IAChF,SAAgB,iCAAiC,CAC/C,IAAW;QAKX,OAAO,gBAAgB,CAAC,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAPe,cAAA,iCAAiC,oCAOhD,CAAA;IACD,sEAAsE;IACtE,SAAgB,2BAA2B,CACzC,IAAW;QAEX,OAAO,gBAAgB,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAJe,cAAA,2BAA2B,8BAI1C,CAAA;IACD,4EAA4E;IAC5E,SAAgB,gCAAgC,CAC9C,IAAW;QAEX,OAAO,gBAAgB,CAAC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAJe,cAAA,gCAAgC,mCAI/C,CAAA;IACD,gEAAgE;IAChE,SAAgB,sBAAsB,CACpC,IAAW;QAEX,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAJe,cAAA,sBAAsB,yBAIrC,CAAA;AACH,CAAC,EAhEgB,aAAa,KAAb,aAAa,QAgE7B","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 { OmitOverUnion } from \"@itwin/presentation-shared\";\nimport { HierarchyFilteringPath, HierarchyFilteringPathOptions } from \"./HierarchyFiltering.js\";\nimport {\n ClassGroupingNodeKey,\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n IModelHierarchyNodeKey,\n IModelInstanceKey,\n InstancesNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n} from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport type HierarchyNodeFilteringProps = {\n /** If set to true, then one of the ancestor nodes in the hierarchy is the filter target. */\n hasFilterTargetAncestor?: boolean;\n /** Paths to node's children that are filter targets. */\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n} & (\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget?: false;\n }\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget: true;\n /** Options that were used to filter the node. */\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }\n);\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeFilteringProps {\n /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */\n /* v8 ignore start */\n export function create(props: {\n hasFilterTargetAncestor?: boolean;\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n isFilterTarget?: boolean;\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }): HierarchyNodeFilteringProps | undefined {\n const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;\n if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {\n return {\n ...(isFilterTarget ? { isFilterTarget, filterTargetOptions } : undefined),\n ...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),\n ...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),\n };\n }\n return undefined;\n }\n /* v8 ignore stop */\n}\n\n/**\n * A data structure that defines attributes that are common to all types of hierarchy nodes.\n * @public\n */\ninterface BaseHierarchyNode {\n /** Identifiers of all node ancestors. Can be used to identify a node in the hierarchy. */\n parentKeys: HierarchyNodeKey[];\n /** Node's display label. */\n label: string;\n /** A flag indicating whether the node has children or not. */\n children: boolean;\n /** A flag indicating whether this node should be auto-expanded in the UI. */\n autoExpand?: boolean;\n /** Additional data that may be assigned to this node. */\n extendedData?: { [key: string]: any };\n /** Data that may be assigned to the node if filtering is enabled */\n filtering?: HierarchyNodeFilteringProps;\n}\n\n/**\n * A data structure that represents a single non-grouping hierarchy node.\n * @public\n */\nexport interface NonGroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify the node in its hierarchy level. */\n key: GenericNodeKey | InstancesNodeKey;\n /**\n * Identifies whether the hierarchy level below this node supports filtering. If not, supplying an instance\n * filter when requesting child hierarchy level will have no effect.\n */\n supportsFiltering?: boolean;\n}\n\n/**\n * A data structure that represents a grouping node that groups other nodes.\n * @public\n */\nexport interface GroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify this grouping node in its hierarchy level. */\n key: GroupingNodeKey;\n\n /**\n * Keys of all instances grouped by this node, including deeply nested under\n * other grouping nodes.\n */\n groupedInstanceKeys: IModelInstanceKey[];\n\n /** The closest ancestor node that is not a grouping node. May be `undefined` if the grouping node grouped root level nodes. */\n nonGroupingAncestor?: ParentHierarchyNode<NonGroupingHierarchyNode>;\n}\n\n/**\n * A data structure that represents a single hierarchy node.\n * @public\n */\nexport type HierarchyNode = NonGroupingHierarchyNode | GroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & NonGroupingHierarchyNode & { key: GenericNodeKey } {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is a standard (iModel content based) node */\n export function isIModelNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: IModelHierarchyNodeKey } {\n return HierarchyNodeKey.isIModelNodeKey(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & NonGroupingHierarchyNode & { key: InstancesNodeKey } {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & GroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n /** Checks whether the given node is a class grouping node */\n export function isClassGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: ClassGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isClassGrouping(node.key);\n }\n /** Checks whether the given node is a label grouping node */\n export function isLabelGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: LabelGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isLabelGrouping(node.key);\n }\n /** Checks whether the given node is property grouping node for other values */\n export function isPropertyOtherValuesGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & {\n key: PropertyOtherValuesGroupingNodeKey;\n supportsFiltering?: undefined;\n } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyOtherValuesGrouping(node.key);\n }\n /** Checks whether the given node is a property value grouping node */\n export function isPropertyValueGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueGrouping(node.key);\n }\n /** Checks whether the given node is a property value range grouping node */\n export function isPropertyValueRangeGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueRangeGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueRangeGrouping(node.key);\n }\n /** Checks whether the given node is a property grouping node */\n export function isPropertyGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyGrouping(node.key);\n }\n}\n\n/**\n * A type of `HierarchyNode` that doesn't know about its children and is an input when requesting\n * them using `HierarchyProvider.getNodes`.\n * @public\n */\nexport type ParentHierarchyNode<TBase = HierarchyNode> = OmitOverUnion<TBase, \"children\">;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNodeIdentifier.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNodeIdentifier.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAezD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,uBAAuB,CAqBvC;AArBD,WAAiB,uBAAuB;IACtC,yEAAyE;IACzE,SAAgB,wBAAwB,CAAC,EAA2B;QAClE,OAAO,WAAW,IAAI,EAAE,CAAC;IAC3B,CAAC;IAFe,gDAAwB,2BAEvC,CAAA;IAED,uEAAuE;IACvE,SAAgB,uBAAuB,CAAC,EAA2B;QACjE,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAFe,+CAAuB,0BAEtC,CAAA;IAED,0CAA0C;IAC1C,SAAgB,KAAK,CAAC,GAA4B,EAAE,GAA4B;QAC9E,IAAI,wBAAwB,CAAC,GAAG,CAAC,IAAI,wBAAwB,CAAC,GAAG,CAAC,EAAE,CAAC;YACnE,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS,CAAC;QACzE,CAAC;QACD,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC;YACjE,OAAO,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;QACxD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IARe,6BAAK,QAQpB,CAAA;AACH,CAAC,EArBgB,uBAAuB,KAAvB,uBAAuB,QAqBvC","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 { InstanceKey } from \"@itwin/presentation-shared\";\nimport { GenericNodeKey, IModelInstanceKey } from \"./HierarchyNodeKey.js\";\n\n/**\n * An identifier that can be used to identify either an ECInstance or a generic node.\n *\n * This is different from `HierarchyNodeKey` - the key can represent more types of nodes and,\n * in case of `InstancesNodeKey`, contains information about all instances the node represents.\n * `HierarchyNodeIdentifier`, on the other hand, is used for matching a node, so it only needs\n * to contain information about a single instance.\n *\n * @public\n */\nexport type HierarchyNodeIdentifier = IModelInstanceKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeIdentifier {\n /** Checks whether the given identifier is an instance node identifier */\n export function isInstanceNodeIdentifier(id: HierarchyNodeIdentifier): id is IModelInstanceKey {\n return \"className\" in id;\n }\n\n /** Checks whether the given identifier is a generic node identifier */\n export function isGenericNodeIdentifier(id: HierarchyNodeIdentifier): id is GenericNodeKey {\n return !isInstanceNodeIdentifier(id);\n }\n\n /** Checks two identifiers for equality */\n export function equal(lhs: HierarchyNodeIdentifier, rhs: HierarchyNodeIdentifier) {\n if (isInstanceNodeIdentifier(lhs) && isInstanceNodeIdentifier(rhs)) {\n return InstanceKey.equals(lhs, rhs) && lhs.imodelKey === rhs.imodelKey;\n }\n if (isGenericNodeIdentifier(lhs) && isGenericNodeIdentifier(rhs)) {\n return lhs.source === rhs.source && lhs.id === rhs.id;\n }\n return false;\n }\n}\n\n/**\n * A path of hierarchy node identifiers, typically used to describe a path from root down\n * to specific node deep in the hierarchy.\n *\n * @public\n */\nexport type HierarchyNodeIdentifiersPath = HierarchyNodeIdentifier[];\n"]}
1
+ {"version":3,"file":"HierarchyNodeIdentifier.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNodeIdentifier.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAezD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,uBAAuB,CAqBvC;AArBD,WAAiB,uBAAuB;IACtC,yEAAyE;IACzE,SAAgB,wBAAwB,CAAC,EAA2B;QAClE,OAAO,WAAW,IAAI,EAAE,CAAC;IAC3B,CAAC;IAFe,wBAAA,wBAAwB,2BAEvC,CAAA;IAED,uEAAuE;IACvE,SAAgB,uBAAuB,CAAC,EAA2B;QACjE,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAFe,wBAAA,uBAAuB,0BAEtC,CAAA;IAED,0CAA0C;IAC1C,SAAgB,KAAK,CAAC,GAA4B,EAAE,GAA4B;QAC9E,IAAI,wBAAwB,CAAC,GAAG,CAAC,IAAI,wBAAwB,CAAC,GAAG,CAAC,EAAE,CAAC;YACnE,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS,CAAC;QACzE,CAAC;QACD,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC;YACjE,OAAO,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;QACxD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IARe,wBAAA,KAAK,QAQpB,CAAA;AACH,CAAC,EArBgB,uBAAuB,KAAvB,uBAAuB,QAqBvC","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 { InstanceKey } from \"@itwin/presentation-shared\";\nimport { GenericNodeKey, IModelInstanceKey } from \"./HierarchyNodeKey.js\";\n\n/**\n * An identifier that can be used to identify either an ECInstance or a generic node.\n *\n * This is different from `HierarchyNodeKey` - the key can represent more types of nodes and,\n * in case of `InstancesNodeKey`, contains information about all instances the node represents.\n * `HierarchyNodeIdentifier`, on the other hand, is used for matching a node, so it only needs\n * to contain information about a single instance.\n *\n * @public\n */\nexport type HierarchyNodeIdentifier = IModelInstanceKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeIdentifier {\n /** Checks whether the given identifier is an instance node identifier */\n export function isInstanceNodeIdentifier(id: HierarchyNodeIdentifier): id is IModelInstanceKey {\n return \"className\" in id;\n }\n\n /** Checks whether the given identifier is a generic node identifier */\n export function isGenericNodeIdentifier(id: HierarchyNodeIdentifier): id is GenericNodeKey {\n return !isInstanceNodeIdentifier(id);\n }\n\n /** Checks two identifiers for equality */\n export function equal(lhs: HierarchyNodeIdentifier, rhs: HierarchyNodeIdentifier) {\n if (isInstanceNodeIdentifier(lhs) && isInstanceNodeIdentifier(rhs)) {\n return InstanceKey.equals(lhs, rhs) && lhs.imodelKey === rhs.imodelKey;\n }\n if (isGenericNodeIdentifier(lhs) && isGenericNodeIdentifier(rhs)) {\n return lhs.source === rhs.source && lhs.id === rhs.id;\n }\n return false;\n }\n}\n\n/**\n * A path of hierarchy node identifiers, typically used to describe a path from root down\n * to specific node deep in the hierarchy.\n *\n * @public\n */\nexport type HierarchyNodeIdentifiersPath = HierarchyNodeIdentifier[];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNodeKey.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNodeKey.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AA0JzD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,gBAAgB,CA0JhC;AA1JD,WAAiB,gBAAgB;IAC/B,+DAA+D;IAC/D,SAAgB,SAAS,CAAC,GAAqB;QAC7C,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;IAChC,CAAC;IAFe,0BAAS,YAExB,CAAA;IAED,yEAAyE;IACzE,SAAgB,eAAe,CAAC,GAAqB;QACnD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAFe,gCAAe,kBAE9B,CAAA;IAED,kEAAkE;IAClE,SAAgB,WAAW,CAAC,GAAqB;QAC/C,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;IAClC,CAAC;IAFe,4BAAW,cAE1B,CAAA;IAED,gEAAgE;IAChE,SAAgB,UAAU,CAAC,GAAqB;QAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAFe,2BAAU,aAEzB,CAAA;IAED,qEAAqE;IACrE,SAAgB,eAAe,CAAC,GAAqB;QACnD,OAAO,GAAG,CAAC,IAAI,KAAK,gBAAgB,CAAC;IACvC,CAAC;IAFe,gCAAe,kBAE9B,CAAA;IAED,qEAAqE;IACrE,SAAgB,eAAe,CAAC,GAAqB;QACnD,OAAO,GAAG,CAAC,IAAI,KAAK,g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SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC;gBACD,OAAO,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IA3Fe,wBAAO,UA2FtB,CAAA;IAED,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAqB,EAAE,GAAqB;QACjE,OAAO,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAFe,uBAAM,SAErB,CAAA;AACH,CAAC,EA1JgB,gBAAgB,KAAhB,gBAAgB,QA0JhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assert, compareStrings, compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\n\n/**\n * An instance key that may be associated with specific iModel.\n * @public\n */\nexport interface IModelInstanceKey extends InstanceKey {\n imodelKey?: string;\n}\n\n/**\n * A key for a generic node.\n * @public\n */\nexport interface GenericNodeKey {\n /** Type of the node */\n type: \"generic\";\n\n /**\n * Node key identifier, which uniquely identifies the node within the hierarchy level the node is used.\n * The format of the identifier is not specified and is up to the data source.\n */\n id: string;\n\n /**\n * Optional data source identifier. Useful when a hierarchy is built using multiple hierarchy providers - in that\n * case each provider can assign a unique source identifier to its nodes.\n */\n source?: string;\n}\n\n/**\n * A key for a node that represents one or more ECInstances.\n * @public\n */\nexport interface InstancesNodeKey {\n /** Type of the node */\n type: \"instances\";\n\n /**\n * Keys of ECInstances that are represented by the node. Generally, one node represents a single\n * ECInstance, but in some cases (e.g. node merging) there could be more.\n */\n instanceKeys: IModelInstanceKey[];\n}\n\n/**\n * A key for a class-grouping node.\n * @public\n */\nexport interface ClassGroupingNodeKey {\n /** Type of the node */\n type: \"class-grouping\";\n\n /** Full name of the ECClass that this grouping node is grouping by. */\n className: string;\n}\n\n/**\n * A key for a label-grouping node.\n * @public\n */\nexport interface LabelGroupingNodeKey {\n /** Type of the node */\n type: \"label-grouping\";\n\n /** Node label that this grouping node is grouping by. */\n label: string;\n\n /**\n * Optional group identifier that is assigned to the node key when multiple nodes\n * with the same label shouldn't be grouped together.\n */\n groupId?: string;\n}\n\n/**\n * A key property grouping node that groups nodes whose values don't fall into any other\n * property group in the hierarchy level.\n * @public\n */\nexport interface PropertyOtherValuesGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:other\";\n /** Identifiers of properties whose values are grouped under this node. */\n properties: Array<{ className: string; propertyName: string }>;\n}\n\n/**\n * A key for a property grouping node that groups nodes by formatted property value.\n * @public\n */\nexport interface PropertyValueGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:value\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: string;\n\n /** Formatted property value that this node is grouping by. */\n formattedPropertyValue: string;\n}\n\n/**\n * A key for a property grouping node that groups nodes by a range of property values.\n * @public\n */\nexport interface PropertyValueRangeGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:range\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: string;\n\n /** Defines the start of the values' range that this node is grouping by. */\n fromValue: number;\n\n /** Defines the end of the values' range that this node is grouping by. */\n toValue: number;\n}\n\n/**\n * A key for a property grouping node.\n * @public\n */\nexport type PropertyGroupingNodeKey =\n | PropertyValueRangeGroupingNodeKey\n | PropertyValueGroupingNodeKey\n | PropertyOtherValuesGroupingNodeKey;\n\n/**\n * A key for one of the instance grouping nodes.\n * @public\n */\nexport type GroupingNodeKey = ClassGroupingNodeKey | LabelGroupingNodeKey | PropertyGroupingNodeKey;\n\n/**\n * A key for either an instance node or one of the instance grouping nodes.\n * @public\n */\nexport type IModelHierarchyNodeKey = InstancesNodeKey | GroupingNodeKey;\n\n/**\n * A key that uniquely identifies a node in a hierarchy level.\n * @public\n */\nexport type HierarchyNodeKey = IModelHierarchyNodeKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeKey {\n /** Checks whether the given node key is a generic node key. */\n export function isGeneric(key: HierarchyNodeKey): key is GenericNodeKey {\n return key.type === \"generic\";\n }\n\n /** Checks whether the given node key is a `StandardHierarchyNodeKey`. */\n export function isIModelNodeKey(key: HierarchyNodeKey): key is IModelHierarchyNodeKey {\n return !isGeneric(key);\n }\n\n /** Checks whether the given node key is an `InstancesNodeKey`. */\n export function isInstances(key: HierarchyNodeKey): key is InstancesNodeKey {\n return key.type === \"instances\";\n }\n\n /** Checks whether the given node key is a `GroupingNodeKey`. */\n export function isGrouping(key: HierarchyNodeKey): key is GroupingNodeKey {\n return !isGeneric(key) && !isInstances(key);\n }\n\n /** Checks whether the given node key is a `ClassGroupingNodeKey`. */\n export function isClassGrouping(key: HierarchyNodeKey): key is ClassGroupingNodeKey {\n return key.type === \"class-grouping\";\n }\n\n /** Checks whether the given node key is a `LabelGroupingNodeKey`. */\n export function isLabelGrouping(key: HierarchyNodeKey): key is LabelGroupingNodeKey {\n return key.type === \"label-grouping\";\n }\n\n /** Checks whether the given node key is a `PropertyOtherValuesGroupingNodeKey`. */\n export function isPropertyOtherValuesGrouping(key: HierarchyNodeKey): key is PropertyOtherValuesGroupingNodeKey {\n return key.type === \"property-grouping:other\";\n }\n\n /** Checks whether the given node key is a `PropertyValueRangeGroupingNodeKey`. */\n export function isPropertyValueRangeGrouping(key: HierarchyNodeKey): key is PropertyValueRangeGroupingNodeKey {\n return key.type === \"property-grouping:range\";\n }\n\n /** Checks whether the given node key is a `PropertyValueGroupingNodeKey`. */\n export function isPropertyValueGrouping(key: HierarchyNodeKey): key is PropertyValueGroupingNodeKey {\n return key.type === \"property-grouping:value\";\n }\n\n /** Checks whether the given node key is a `PropertyGroupingNodeKey`. */\n export function isPropertyGrouping(key: HierarchyNodeKey): key is PropertyGroupingNodeKey {\n return isPropertyOtherValuesGrouping(key) || isPropertyValueRangeGrouping(key) || isPropertyValueGrouping(key);\n }\n\n /**\n * Compares two given keys. Returns:\n * - `0` if they are equal,\n * - `negative value` if lhs key is less than rhs key,\n * - `positive value` if lhs key is more than rhs key.\n */\n export function compare(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): number {\n const typeCompareResult = compareStrings(lhs.type, rhs.type);\n if (typeCompareResult !== 0) {\n return typeCompareResult;\n }\n switch (lhs.type) {\n case \"generic\": {\n assert(rhs.type === \"generic\");\n const idCompareResult = compareStrings(lhs.id, rhs.id);\n if (idCompareResult !== 0) {\n return idCompareResult;\n }\n return compareStringsOrUndefined(lhs.source, rhs.source);\n }\n case \"instances\": {\n assert(rhs.type === \"instances\");\n if (lhs.instanceKeys.length !== rhs.instanceKeys.length) {\n return lhs.instanceKeys.length > rhs.instanceKeys.length ? 1 : -1;\n }\n for (let i = 0; i < lhs.instanceKeys.length; ++i) {\n const instanceKeyCompareResult = InstanceKey.compare(lhs.instanceKeys[i], rhs.instanceKeys[i]);\n if (instanceKeyCompareResult !== 0) {\n return instanceKeyCompareResult;\n }\n const imodelKeyCompareResult = compareStringsOrUndefined(\n lhs.instanceKeys[0].imodelKey,\n rhs.instanceKeys[0].imodelKey,\n );\n if (imodelKeyCompareResult !== 0) {\n return imodelKeyCompareResult;\n }\n }\n return 0;\n }\n case \"class-grouping\": {\n assert(rhs.type === \"class-grouping\");\n return compareStrings(lhs.className, rhs.className);\n }\n case \"label-grouping\": {\n assert(rhs.type === \"label-grouping\");\n const labelCompareResult = compareStrings(lhs.label, rhs.label);\n if (labelCompareResult !== 0) {\n return labelCompareResult;\n }\n return compareStringsOrUndefined(lhs.groupId, rhs.groupId);\n }\n case \"property-grouping:other\": {\n assert(rhs.type === \"property-grouping:other\");\n if (lhs.properties.length !== rhs.properties.length) {\n return lhs.properties.length - rhs.properties.length;\n }\n for (let i = 0; i < lhs.properties.length; ++i) {\n const classCompareResult = compareStrings(lhs.properties[i].className, rhs.properties[i].className);\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(lhs.properties[i].propertyName, rhs.properties[i].propertyName);\n if (nameCompareResult !== 0) {\n return nameCompareResult;\n }\n }\n return 0;\n }\n case \"property-grouping:value\": {\n assert(rhs.type === \"property-grouping:value\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n return compareStrings(lhs.formattedPropertyValue, rhs.formattedPropertyValue);\n }\n case \"property-grouping:range\": {\n assert(rhs.type === \"property-grouping:range\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n if (lhs.fromValue !== rhs.fromValue) {\n return lhs.fromValue > rhs.fromValue ? 1 : -1;\n }\n return lhs.toValue > rhs.toValue ? 1 : lhs.toValue < rhs.toValue ? -1 : 0;\n }\n }\n }\n\n /** Checks whether the two given keys are equal. */\n export function equals(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): boolean {\n return compare(lhs, rhs) === 0;\n }\n}\n"]}
1
+ {"version":3,"file":"HierarchyNodeKey.js","sourceRoot":"","sources":["../../../src/hierarchies/Hierarch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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IA3Fe,iBAAA,OAAO,UA2FtB,CAAA;IAED,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAqB,EAAE,GAAqB;QACjE,OAAO,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAFe,iBAAA,MAAM,SAErB,CAAA;AACH,CAAC,EA1JgB,gBAAgB,KAAhB,gBAAgB,QA0JhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assert, compareStrings, compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\n\n/**\n * An instance key that may be associated with specific iModel.\n * @public\n */\nexport interface IModelInstanceKey extends InstanceKey {\n imodelKey?: string;\n}\n\n/**\n * A key for a generic node.\n * @public\n */\nexport interface GenericNodeKey {\n /** Type of the node */\n type: \"generic\";\n\n /**\n * Node key identifier, which uniquely identifies the node within the hierarchy level the node is used.\n * The format of the identifier is not specified and is up to the data source.\n */\n id: string;\n\n /**\n * Optional data source identifier. Useful when a hierarchy is built using multiple hierarchy providers - in that\n * case each provider can assign a unique source identifier to its nodes.\n */\n source?: string;\n}\n\n/**\n * A key for a node that represents one or more ECInstances.\n * @public\n */\nexport interface InstancesNodeKey {\n /** Type of the node */\n type: \"instances\";\n\n /**\n * Keys of ECInstances that are represented by the node. Generally, one node represents a single\n * ECInstance, but in some cases (e.g. node merging) there could be more.\n */\n instanceKeys: IModelInstanceKey[];\n}\n\n/**\n * A key for a class-grouping node.\n * @public\n */\nexport interface ClassGroupingNodeKey {\n /** Type of the node */\n type: \"class-grouping\";\n\n /** Full name of the ECClass that this grouping node is grouping by. */\n className: string;\n}\n\n/**\n * A key for a label-grouping node.\n * @public\n */\nexport interface LabelGroupingNodeKey {\n /** Type of the node */\n type: \"label-grouping\";\n\n /** Node label that this grouping node is grouping by. */\n label: string;\n\n /**\n * Optional group identifier that is assigned to the node key when multiple nodes\n * with the same label shouldn't be grouped together.\n */\n groupId?: string;\n}\n\n/**\n * A key property grouping node that groups nodes whose values don't fall into any other\n * property group in the hierarchy level.\n * @public\n */\nexport interface PropertyOtherValuesGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:other\";\n /** Identifiers of properties whose values are grouped under this node. */\n properties: Array<{ className: string; propertyName: string }>;\n}\n\n/**\n * A key for a property grouping node that groups nodes by formatted property value.\n * @public\n */\nexport interface PropertyValueGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:value\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: string;\n\n /** Formatted property value that this node is grouping by. */\n formattedPropertyValue: string;\n}\n\n/**\n * A key for a property grouping node that groups nodes by a range of property values.\n * @public\n */\nexport interface PropertyValueRangeGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:range\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: string;\n\n /** Defines the start of the values' range that this node is grouping by. */\n fromValue: number;\n\n /** Defines the end of the values' range that this node is grouping by. */\n toValue: number;\n}\n\n/**\n * A key for a property grouping node.\n * @public\n */\nexport type PropertyGroupingNodeKey =\n | PropertyValueRangeGroupingNodeKey\n | PropertyValueGroupingNodeKey\n | PropertyOtherValuesGroupingNodeKey;\n\n/**\n * A key for one of the instance grouping nodes.\n * @public\n */\nexport type GroupingNodeKey = ClassGroupingNodeKey | LabelGroupingNodeKey | PropertyGroupingNodeKey;\n\n/**\n * A key for either an instance node or one of the instance grouping nodes.\n * @public\n */\nexport type IModelHierarchyNodeKey = InstancesNodeKey | GroupingNodeKey;\n\n/**\n * A key that uniquely identifies a node in a hierarchy level.\n * @public\n */\nexport type HierarchyNodeKey = IModelHierarchyNodeKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeKey {\n /** Checks whether the given node key is a generic node key. */\n export function isGeneric(key: HierarchyNodeKey): key is GenericNodeKey {\n return key.type === \"generic\";\n }\n\n /** Checks whether the given node key is a `StandardHierarchyNodeKey`. */\n export function isIModelNodeKey(key: HierarchyNodeKey): key is IModelHierarchyNodeKey {\n return !isGeneric(key);\n }\n\n /** Checks whether the given node key is an `InstancesNodeKey`. */\n export function isInstances(key: HierarchyNodeKey): key is InstancesNodeKey {\n return key.type === \"instances\";\n }\n\n /** Checks whether the given node key is a `GroupingNodeKey`. */\n export function isGrouping(key: HierarchyNodeKey): key is GroupingNodeKey {\n return !isGeneric(key) && !isInstances(key);\n }\n\n /** Checks whether the given node key is a `ClassGroupingNodeKey`. */\n export function isClassGrouping(key: HierarchyNodeKey): key is ClassGroupingNodeKey {\n return key.type === \"class-grouping\";\n }\n\n /** Checks whether the given node key is a `LabelGroupingNodeKey`. */\n export function isLabelGrouping(key: HierarchyNodeKey): key is LabelGroupingNodeKey {\n return key.type === \"label-grouping\";\n }\n\n /** Checks whether the given node key is a `PropertyOtherValuesGroupingNodeKey`. */\n export function isPropertyOtherValuesGrouping(key: HierarchyNodeKey): key is PropertyOtherValuesGroupingNodeKey {\n return key.type === \"property-grouping:other\";\n }\n\n /** Checks whether the given node key is a `PropertyValueRangeGroupingNodeKey`. */\n export function isPropertyValueRangeGrouping(key: HierarchyNodeKey): key is PropertyValueRangeGroupingNodeKey {\n return key.type === \"property-grouping:range\";\n }\n\n /** Checks whether the given node key is a `PropertyValueGroupingNodeKey`. */\n export function isPropertyValueGrouping(key: HierarchyNodeKey): key is PropertyValueGroupingNodeKey {\n return key.type === \"property-grouping:value\";\n }\n\n /** Checks whether the given node key is a `PropertyGroupingNodeKey`. */\n export function isPropertyGrouping(key: HierarchyNodeKey): key is PropertyGroupingNodeKey {\n return isPropertyOtherValuesGrouping(key) || isPropertyValueRangeGrouping(key) || isPropertyValueGrouping(key);\n }\n\n /**\n * Compares two given keys. Returns:\n * - `0` if they are equal,\n * - `negative value` if lhs key is less than rhs key,\n * - `positive value` if lhs key is more than rhs key.\n */\n export function compare(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): number {\n const typeCompareResult = compareStrings(lhs.type, rhs.type);\n if (typeCompareResult !== 0) {\n return typeCompareResult;\n }\n switch (lhs.type) {\n case \"generic\": {\n assert(rhs.type === \"generic\");\n const idCompareResult = compareStrings(lhs.id, rhs.id);\n if (idCompareResult !== 0) {\n return idCompareResult;\n }\n return compareStringsOrUndefined(lhs.source, rhs.source);\n }\n case \"instances\": {\n assert(rhs.type === \"instances\");\n if (lhs.instanceKeys.length !== rhs.instanceKeys.length) {\n return lhs.instanceKeys.length > rhs.instanceKeys.length ? 1 : -1;\n }\n for (let i = 0; i < lhs.instanceKeys.length; ++i) {\n const instanceKeyCompareResult = InstanceKey.compare(lhs.instanceKeys[i], rhs.instanceKeys[i]);\n if (instanceKeyCompareResult !== 0) {\n return instanceKeyCompareResult;\n }\n const imodelKeyCompareResult = compareStringsOrUndefined(\n lhs.instanceKeys[0].imodelKey,\n rhs.instanceKeys[0].imodelKey,\n );\n if (imodelKeyCompareResult !== 0) {\n return imodelKeyCompareResult;\n }\n }\n return 0;\n }\n case \"class-grouping\": {\n assert(rhs.type === \"class-grouping\");\n return compareStrings(lhs.className, rhs.className);\n }\n case \"label-grouping\": {\n assert(rhs.type === \"label-grouping\");\n const labelCompareResult = compareStrings(lhs.label, rhs.label);\n if (labelCompareResult !== 0) {\n return labelCompareResult;\n }\n return compareStringsOrUndefined(lhs.groupId, rhs.groupId);\n }\n case \"property-grouping:other\": {\n assert(rhs.type === \"property-grouping:other\");\n if (lhs.properties.length !== rhs.properties.length) {\n return lhs.properties.length - rhs.properties.length;\n }\n for (let i = 0; i < lhs.properties.length; ++i) {\n const classCompareResult = compareStrings(lhs.properties[i].className, rhs.properties[i].className);\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(lhs.properties[i].propertyName, rhs.properties[i].propertyName);\n if (nameCompareResult !== 0) {\n return nameCompareResult;\n }\n }\n return 0;\n }\n case \"property-grouping:value\": {\n assert(rhs.type === \"property-grouping:value\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n return compareStrings(lhs.formattedPropertyValue, rhs.formattedPropertyValue);\n }\n case \"property-grouping:range\": {\n assert(rhs.type === \"property-grouping:range\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n if (lhs.fromValue !== rhs.fromValue) {\n return lhs.fromValue > rhs.fromValue ? 1 : -1;\n }\n return lhs.toValue > rhs.toValue ? 1 : lhs.toValue < rhs.toValue ? -1 : 0;\n }\n }\n }\n\n /** Checks whether the two given keys are equal. */\n export function equals(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): boolean {\n return compare(lhs, rhs) === 0;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FilteringHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuD,UAAU,EAAe,MAAM,MAAM,CAAC;AAEpG,OAAO,EAAE,yBAAyB,EAAE,WAAW,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EACjC,oBAAoB,EAAE,WAAW,EAAE,GAClC,4BAA4B,CAgC9B;AAED,gBAAgB;AAChB,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,4BAA4B,GAAG,4BAA4B,CAc1G"}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyCache.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AASjE,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;IAuBvB,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"}
1
+ {"version":3,"file":"HierarchyCache.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AASjE,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;IAE/C,YAAmB,KAAK,EAAE,8BAA8B,EAGvD;IAED,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,iBAAiB;IAyBlB,GAAG,CAAC,YAAY,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC,QAGxD;IAEM,GAAG,CAAC,YAAY,EAAE,sBAAsB,GAAG,CAAC,GAAG,SAAS,CAG9D;IAEM,KAAK,SAEX;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,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,KAAxB,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.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\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 * @public\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 * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\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 * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (\n row: { [columnName: string]: any },\n parentNode?: HierarchyDefinitionParentNode,\n) => SourceInstanceHierarchyNode | Promise<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 * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(\n node: TNode,\n) => 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 * @public\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 * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\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 * @public\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"]}
1
+ {"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,yBAAA,aAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,yBAAA,oBAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,KAAxB,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.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\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 * @public\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 * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\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 * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (\n row: { [columnName: string]: any },\n parentNode?: HierarchyDefinitionParentNode,\n) => SourceInstanceHierarchyNode | Promise<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 * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(\n node: TNode,\n) => 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 * @public\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 * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\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 * @public\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHierarchyNode.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAAkB,gBAAgB,EAAoB,MAAM,wBAAwB,CAAC;AA8N5F,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,sBAAsB,CAatC;AAbD,WAAiB,sBAAsB;IACrC,sDAAsD;IACtD,SAAgB,SAAS,CAAC,IAA4B;QACpD,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAFe,gCAAS,YAExB,CAAA;IACD,iEAAiE;IACjE,SAAgB,eAAe,CAAC,IAA4B;QAC1D,OAAO,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAFe,sCAAe,kBAE9B,CAAA;IACD,uDAAuD;IACvD,SAAgB,cAAc,CAAC,IAA4B;QACzD,OAAO,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAFe,qCAAc,iBAE7B,CAAA;AACH,CAAC,EAbgB,sBAAsB,KAAtB,sBAAsB,QAatC","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 { ConcatenatedValue, InstanceKey, OmitOverUnion, PrimitiveValue } from \"@itwin/presentation-shared\";\nimport { GroupingHierarchyNode, NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * Base processing parameters that apply to every node.\n * @public\n */\ninterface HierarchyNodeProcessingParamsBase {\n /** Indicates if this node should be hidden if it has no child nodes. */\n hideIfNoChildren?: boolean;\n /** Indicates that this node should always be hidden and its children should be loaded in its place. */\n hideInHierarchy?: boolean;\n}\n\n/**\n * A data structure for defining nodes' grouping requirements.\n * @public\n */\ninterface HierarchyNodeGroupingParams {\n byLabel?: HierarchyNodeLabelGroupingParams;\n byClass?: boolean | HierarchyNodeGroupingParamsBase;\n byBaseClasses?: HierarchyNodeBaseClassGroupingParams;\n byProperties?: HierarchyNodePropertiesGroupingParams;\n}\n\n/**\n * A data structure for defining params specifically used for label grouping.\n * @public\n */\ninterface HierarchyNodeLabelGroupingBaseParams {\n /** Label grouping option that determines whether to group nodes or to merge them. Defaults to \"group\".*/\n action?: \"group\" | \"merge\";\n /** Value that needs to match in order for nodes to be grouped or merged.*/\n groupId?: string;\n}\n\n/**\n * A data structure for defining label merging.\n * @public\n */\ninterface HierarchyNodeLabelGroupingMergeParams extends HierarchyNodeLabelGroupingBaseParams {\n action: \"merge\";\n}\n\n/**\n * A data structure for defining label grouping with additional parameters.\n * @public\n */\ninterface HierarchyNodeLabelGroupingGroupParams\n extends HierarchyNodeLabelGroupingBaseParams, HierarchyNodeGroupingParamsBase {\n action?: \"group\";\n}\n\n/**\n * A data structure for defining possible label grouping types.\n * @public\n */\nexport type HierarchyNodeLabelGroupingParams =\n | boolean\n | HierarchyNodeLabelGroupingMergeParams\n | HierarchyNodeLabelGroupingGroupParams;\n\n/**\n * Grouping parameters that are shared across all types of groupings.\n * @public\n */\nexport interface HierarchyNodeGroupingParamsBase {\n /** Hiding option that determines whether to hide group nodes which have no siblings at the same hierarchy level. */\n hideIfNoSiblings?: boolean;\n /** Hiding option that determines whether to hide group nodes which have only one node as its children. */\n hideIfOneGroupedNode?: boolean;\n /** Option which auto expands grouping nodes' children when it has single child or always. */\n autoExpand?: HierarchyNodeAutoExpandProp;\n}\n\n/**\n * Defines possible values for `BaseGroupingParams.autoExpand` attribute:\n * - `single-child` - set the grouping node to auto-expand if it groups a single node.\n * - `always` - always set the grouping node to auto-expand.\n * @public\n */\nexport type HierarchyNodeAutoExpandProp = \"single-child\" | \"always\";\n\n/**\n * A data structure that represents base class grouping.\n * @public\n */\ninterface HierarchyNodeBaseClassGroupingParams extends HierarchyNodeGroupingParamsBase {\n /**\n * Full names of classes, which should be used to group the node. Only has effect if the node\n * represents an instance of that class.\n *\n * Full class name format: `SchemaName.ClassName`.\n */\n fullClassNames: string[];\n}\n\n/**\n * A data structure that represents properties grouping.\n * @public\n */\nexport interface HierarchyNodePropertiesGroupingParams extends HierarchyNodeGroupingParamsBase {\n /**\n * Full name of a class whose properties are used to group the node. Only has effect if the node\n * represents an instance of that class.\n *\n * Full class name format: `SchemaName.ClassName`.\n */\n propertiesClassName: string;\n /**\n * Property grouping option that determines whether to group nodes whose grouping value is not set or is set to an empty string.\n *\n * Label of the created grouping node will be `Not Specified`.\n */\n createGroupForUnspecifiedValues?: boolean;\n /**\n * Property grouping option that determines whether to group nodes whose grouping value doesn't fit within any of the provided\n * ranges, or is not a numeric value.\n *\n * Label of the created grouping node will be `Other`.\n */\n createGroupForOutOfRangeValues?: boolean;\n /**\n * Properties of the specified class, by which the nodes should be grouped. Each provided group definition results in a\n * grouping hierarchy level.\n *\n * Example usage:\n * ```ts\n * propertyGroups: [\n * {\n * propertyName: \"type\",\n * propertyValue: \"Wall\"\n * },\n * {\n * propertyName: \"length\",\n * propertyValue: 15,\n * ranges: [\n * { fromValue: 1, toValue: 10, rangeLabel: \"Small\" },\n * { fromValue: 11, toValue: 20, rangeLabel: \"Medium\" }\n * ]\n * },\n * ]\n * ```\n */\n propertyGroups: HierarchyNodePropertyGroup[];\n}\n\n/**\n * A data structure that represents specific properties' grouping params.\n * @public\n */\nexport interface HierarchyNodePropertyGroup {\n /** A string indicating the name of the property to group by. */\n propertyName: string;\n /** Value of the property, which will be used to group the node. */\n propertyValue?: PrimitiveValue | ConcatenatedValue;\n /** Ranges are used to group nodes by numeric properties which are within specified bounds. */\n ranges?: HierarchyNodePropertyValueRange[];\n}\n\n/**\n * A data structure that represents boundaries for a value.\n * @public\n */\nexport interface HierarchyNodePropertyValueRange {\n /** Defines the lower bound of the range. */\n fromValue: number;\n /** Defines the upper bound of the range. */\n toValue: number;\n /** Defines the range label. Will be used as `PropertyValueRangeGroupingNode` node's display label. */\n rangeLabel?: string;\n}\n\n/**\n * Processing parameters that apply to instance nodes.\n * @public\n */\nexport interface InstanceHierarchyNodeProcessingParams extends HierarchyNodeProcessingParamsBase {\n grouping?: HierarchyNodeGroupingParams;\n}\n\n/**\n * A generic (not based on data in an iModel) node that has processing parameters.\n * @public\n */\nexport type ProcessedGenericHierarchyNode = Omit<NonGroupingHierarchyNode, \"key\" | \"children\"> & {\n key: GenericNodeKey;\n children?: boolean;\n processingParams?: HierarchyNodeProcessingParamsBase;\n};\n\n/**\n * An instances' (based on data in an iModel) node that has processing parameters.\n * @public\n */\nexport type ProcessedInstanceHierarchyNode = Omit<NonGroupingHierarchyNode, \"key\" | \"children\"> & {\n key: InstancesNodeKey;\n children?: boolean;\n processingParams?: InstanceHierarchyNodeProcessingParams;\n};\n\n/**\n * A grouping node that groups either instance nodes or other grouping nodes.\n * @public\n */\nexport type ProcessedGroupingHierarchyNode = Omit<GroupingHierarchyNode, \"children\"> & {\n children: Array<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>;\n};\n\n/**\n * A `HierarchyNode` that may have processing parameters defining whether it should be hidden under some conditions,\n * how it should be grouped, sorted, etc.\n *\n * Type guards under `HierarchyNode` namespace can be used to differentiate between different sub-types of\n * `ProcessedHierarchyNode`.\n *\n * @public\n */\nexport type ProcessedHierarchyNode =\n | ProcessedGenericHierarchyNode\n | ProcessedInstanceHierarchyNode\n | ProcessedGroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace ProcessedHierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric(node: ProcessedHierarchyNode): node is ProcessedGenericHierarchyNode {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode(node: ProcessedHierarchyNode): node is ProcessedInstanceHierarchyNode {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode(node: ProcessedHierarchyNode): node is ProcessedGroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n}\n\n/**\n * A `ProcessedHierarchyNode` that has an unformatted label in a form of `ConcatenatedValue`. Generally this is\n * returned by hierarchy definitions as a generic node or when the node is just parsed from query results.\n * @public\n */\nexport type SourceHierarchyNode<TBase = SourceGenericHierarchyNode | SourceInstanceHierarchyNode> = OmitOverUnion<\n TBase,\n \"label\" | \"parentKeys\"\n> & { label: string | ConcatenatedValue };\n\n/**\n * A kind of `ProcessedGenericHierarchyNode` that has unformatted label and doesn't know about its ancestors.\n * @public\n */\nexport type SourceGenericHierarchyNode = SourceHierarchyNode<\n Omit<ProcessedGenericHierarchyNode, \"key\"> & { key: string }\n>;\n\n/**\n * A kind of `ProcessedInstanceHierarchyNode` that has unformatted label and doesn't know about its ancestors.\n * @public\n */\nexport type SourceInstanceHierarchyNode = SourceHierarchyNode<\n Omit<ProcessedInstanceHierarchyNode, \"key\"> & {\n key: Omit<InstancesNodeKey, \"instanceKeys\"> & { instanceKeys: InstanceKey[] };\n }\n>;\n"]}
1
+ {"version":3,"file":"IModelHierarchyNode.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAAkB,gBAAgB,EAAoB,MAAM,wBAAwB,CAAC;AA8N5F,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,sBAAsB,CAatC;AAbD,WAAiB,sBAAsB;IACrC,sDAAsD;IACtD,SAAgB,SAAS,CAAC,IAA4B;QACpD,OAAO,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAFe,uBAAA,SAAS,YAExB,CAAA;IACD,iEAAiE;IACjE,SAAgB,eAAe,CAAC,IAA4B;QAC1D,OAAO,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAFe,uBAAA,eAAe,kBAE9B,CAAA;IACD,uDAAuD;IACvD,SAAgB,cAAc,CAAC,IAA4B;QACzD,OAAO,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAFe,uBAAA,cAAc,iBAE7B,CAAA;AACH,CAAC,EAbgB,sBAAsB,KAAtB,sBAAsB,QAatC","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 { ConcatenatedValue, InstanceKey, OmitOverUnion, PrimitiveValue } from \"@itwin/presentation-shared\";\nimport { GroupingHierarchyNode, NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * Base processing parameters that apply to every node.\n * @public\n */\ninterface HierarchyNodeProcessingParamsBase {\n /** Indicates if this node should be hidden if it has no child nodes. */\n hideIfNoChildren?: boolean;\n /** Indicates that this node should always be hidden and its children should be loaded in its place. */\n hideInHierarchy?: boolean;\n}\n\n/**\n * A data structure for defining nodes' grouping requirements.\n * @public\n */\ninterface HierarchyNodeGroupingParams {\n byLabel?: HierarchyNodeLabelGroupingParams;\n byClass?: boolean | HierarchyNodeGroupingParamsBase;\n byBaseClasses?: HierarchyNodeBaseClassGroupingParams;\n byProperties?: HierarchyNodePropertiesGroupingParams;\n}\n\n/**\n * A data structure for defining params specifically used for label grouping.\n * @public\n */\ninterface HierarchyNodeLabelGroupingBaseParams {\n /** Label grouping option that determines whether to group nodes or to merge them. Defaults to \"group\".*/\n action?: \"group\" | \"merge\";\n /** Value that needs to match in order for nodes to be grouped or merged.*/\n groupId?: string;\n}\n\n/**\n * A data structure for defining label merging.\n * @public\n */\ninterface HierarchyNodeLabelGroupingMergeParams extends HierarchyNodeLabelGroupingBaseParams {\n action: \"merge\";\n}\n\n/**\n * A data structure for defining label grouping with additional parameters.\n * @public\n */\ninterface HierarchyNodeLabelGroupingGroupParams\n extends HierarchyNodeLabelGroupingBaseParams, HierarchyNodeGroupingParamsBase {\n action?: \"group\";\n}\n\n/**\n * A data structure for defining possible label grouping types.\n * @public\n */\nexport type HierarchyNodeLabelGroupingParams =\n | boolean\n | HierarchyNodeLabelGroupingMergeParams\n | HierarchyNodeLabelGroupingGroupParams;\n\n/**\n * Grouping parameters that are shared across all types of groupings.\n * @public\n */\nexport interface HierarchyNodeGroupingParamsBase {\n /** Hiding option that determines whether to hide group nodes which have no siblings at the same hierarchy level. */\n hideIfNoSiblings?: boolean;\n /** Hiding option that determines whether to hide group nodes which have only one node as its children. */\n hideIfOneGroupedNode?: boolean;\n /** Option which auto expands grouping nodes' children when it has single child or always. */\n autoExpand?: HierarchyNodeAutoExpandProp;\n}\n\n/**\n * Defines possible values for `BaseGroupingParams.autoExpand` attribute:\n * - `single-child` - set the grouping node to auto-expand if it groups a single node.\n * - `always` - always set the grouping node to auto-expand.\n * @public\n */\nexport type HierarchyNodeAutoExpandProp = \"single-child\" | \"always\";\n\n/**\n * A data structure that represents base class grouping.\n * @public\n */\ninterface HierarchyNodeBaseClassGroupingParams extends HierarchyNodeGroupingParamsBase {\n /**\n * Full names of classes, which should be used to group the node. Only has effect if the node\n * represents an instance of that class.\n *\n * Full class name format: `SchemaName.ClassName`.\n */\n fullClassNames: string[];\n}\n\n/**\n * A data structure that represents properties grouping.\n * @public\n */\nexport interface HierarchyNodePropertiesGroupingParams extends HierarchyNodeGroupingParamsBase {\n /**\n * Full name of a class whose properties are used to group the node. Only has effect if the node\n * represents an instance of that class.\n *\n * Full class name format: `SchemaName.ClassName`.\n */\n propertiesClassName: string;\n /**\n * Property grouping option that determines whether to group nodes whose grouping value is not set or is set to an empty string.\n *\n * Label of the created grouping node will be `Not Specified`.\n */\n createGroupForUnspecifiedValues?: boolean;\n /**\n * Property grouping option that determines whether to group nodes whose grouping value doesn't fit within any of the provided\n * ranges, or is not a numeric value.\n *\n * Label of the created grouping node will be `Other`.\n */\n createGroupForOutOfRangeValues?: boolean;\n /**\n * Properties of the specified class, by which the nodes should be grouped. Each provided group definition results in a\n * grouping hierarchy level.\n *\n * Example usage:\n * ```ts\n * propertyGroups: [\n * {\n * propertyName: \"type\",\n * propertyValue: \"Wall\"\n * },\n * {\n * propertyName: \"length\",\n * propertyValue: 15,\n * ranges: [\n * { fromValue: 1, toValue: 10, rangeLabel: \"Small\" },\n * { fromValue: 11, toValue: 20, rangeLabel: \"Medium\" }\n * ]\n * },\n * ]\n * ```\n */\n propertyGroups: HierarchyNodePropertyGroup[];\n}\n\n/**\n * A data structure that represents specific properties' grouping params.\n * @public\n */\nexport interface HierarchyNodePropertyGroup {\n /** A string indicating the name of the property to group by. */\n propertyName: string;\n /** Value of the property, which will be used to group the node. */\n propertyValue?: PrimitiveValue | ConcatenatedValue;\n /** Ranges are used to group nodes by numeric properties which are within specified bounds. */\n ranges?: HierarchyNodePropertyValueRange[];\n}\n\n/**\n * A data structure that represents boundaries for a value.\n * @public\n */\nexport interface HierarchyNodePropertyValueRange {\n /** Defines the lower bound of the range. */\n fromValue: number;\n /** Defines the upper bound of the range. */\n toValue: number;\n /** Defines the range label. Will be used as `PropertyValueRangeGroupingNode` node's display label. */\n rangeLabel?: string;\n}\n\n/**\n * Processing parameters that apply to instance nodes.\n * @public\n */\nexport interface InstanceHierarchyNodeProcessingParams extends HierarchyNodeProcessingParamsBase {\n grouping?: HierarchyNodeGroupingParams;\n}\n\n/**\n * A generic (not based on data in an iModel) node that has processing parameters.\n * @public\n */\nexport type ProcessedGenericHierarchyNode = Omit<NonGroupingHierarchyNode, \"key\" | \"children\"> & {\n key: GenericNodeKey;\n children?: boolean;\n processingParams?: HierarchyNodeProcessingParamsBase;\n};\n\n/**\n * An instances' (based on data in an iModel) node that has processing parameters.\n * @public\n */\nexport type ProcessedInstanceHierarchyNode = Omit<NonGroupingHierarchyNode, \"key\" | \"children\"> & {\n key: InstancesNodeKey;\n children?: boolean;\n processingParams?: InstanceHierarchyNodeProcessingParams;\n};\n\n/**\n * A grouping node that groups either instance nodes or other grouping nodes.\n * @public\n */\nexport type ProcessedGroupingHierarchyNode = Omit<GroupingHierarchyNode, \"children\"> & {\n children: Array<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>;\n};\n\n/**\n * A `HierarchyNode` that may have processing parameters defining whether it should be hidden under some conditions,\n * how it should be grouped, sorted, etc.\n *\n * Type guards under `HierarchyNode` namespace can be used to differentiate between different sub-types of\n * `ProcessedHierarchyNode`.\n *\n * @public\n */\nexport type ProcessedHierarchyNode =\n | ProcessedGenericHierarchyNode\n | ProcessedInstanceHierarchyNode\n | ProcessedGroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace ProcessedHierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric(node: ProcessedHierarchyNode): node is ProcessedGenericHierarchyNode {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode(node: ProcessedHierarchyNode): node is ProcessedInstanceHierarchyNode {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode(node: ProcessedHierarchyNode): node is ProcessedGroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n}\n\n/**\n * A `ProcessedHierarchyNode` that has an unformatted label in a form of `ConcatenatedValue`. Generally this is\n * returned by hierarchy definitions as a generic node or when the node is just parsed from query results.\n * @public\n */\nexport type SourceHierarchyNode<TBase = SourceGenericHierarchyNode | SourceInstanceHierarchyNode> = OmitOverUnion<\n TBase,\n \"label\" | \"parentKeys\"\n> & { label: string | ConcatenatedValue };\n\n/**\n * A kind of `ProcessedGenericHierarchyNode` that has unformatted label and doesn't know about its ancestors.\n * @public\n */\nexport type SourceGenericHierarchyNode = SourceHierarchyNode<\n Omit<ProcessedGenericHierarchyNode, \"key\"> & { key: string }\n>;\n\n/**\n * A kind of `ProcessedInstanceHierarchyNode` that has unformatted label and doesn't know about its ancestors.\n * @public\n */\nexport type SourceInstanceHierarchyNode = SourceHierarchyNode<\n Omit<ProcessedInstanceHierarchyNode, \"key\"> & {\n key: Omit<InstancesNodeKey, \"instanceKeys\"> & { instanceKeys: InstanceKey[] };\n }\n>;\n"]}