@itwin/presentation-hierarchies 2.0.0-alpha.11 → 2.0.0-alpha.13

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 (121) hide show
  1. package/CHANGELOG.md +284 -16
  2. package/README.md +2 -2
  3. package/lib/cjs/hierarchies/HierarchyNode.d.ts +13 -11
  4. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  5. package/lib/cjs/hierarchies/HierarchyNode.js +18 -0
  6. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  7. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +2 -0
  8. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +23 -6
  10. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +5 -4
  12. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  13. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  14. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +3 -3
  15. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  16. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  17. package/lib/cjs/hierarchies/HierarchySearch.d.ts +184 -78
  18. package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -1
  19. package/lib/cjs/hierarchies/HierarchySearch.js +305 -113
  20. package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -1
  21. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +2 -2
  22. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  23. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  24. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +3 -3
  25. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
  26. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +9 -4
  28. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  29. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +25 -16
  30. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  31. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +4 -4
  32. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  33. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +12 -9
  34. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  35. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +3 -3
  36. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  37. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  38. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts +2 -2
  39. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
  40. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +31 -55
  41. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
  42. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +2 -2
  43. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  44. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +1 -1
  45. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  46. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  47. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  48. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -1
  49. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  50. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +1 -1
  51. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  52. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  53. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts +2 -2
  54. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  55. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
  56. package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  57. package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
  58. package/lib/cjs/presentation-hierarchies.d.ts +1 -1
  59. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  60. package/lib/cjs/presentation-hierarchies.js +2 -1
  61. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  62. package/lib/esm/hierarchies/HierarchyNode.d.ts +13 -11
  63. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  64. package/lib/esm/hierarchies/HierarchyNode.js +18 -0
  65. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  66. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +2 -0
  67. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
  68. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +23 -6
  69. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  70. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +5 -4
  71. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  72. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  73. package/lib/esm/hierarchies/HierarchyProvider.d.ts +3 -3
  74. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  75. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  76. package/lib/esm/hierarchies/HierarchySearch.d.ts +184 -78
  77. package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -1
  78. package/lib/esm/hierarchies/HierarchySearch.js +304 -111
  79. package/lib/esm/hierarchies/HierarchySearch.js.map +1 -1
  80. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +2 -2
  81. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  82. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  83. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +3 -3
  84. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
  85. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  86. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +9 -4
  87. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  88. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +26 -17
  89. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  90. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +4 -4
  91. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  92. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +13 -10
  93. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  94. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +3 -3
  95. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  96. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  97. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts +2 -2
  98. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
  99. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +32 -56
  100. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
  101. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts +2 -2
  102. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  103. package/lib/esm/hierarchies/imodel/TreeNodesReader.js +2 -2
  104. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  105. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  106. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  107. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -1
  108. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  109. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +1 -1
  110. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  111. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  112. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts +2 -2
  113. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  114. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
  115. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  116. package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
  117. package/lib/esm/presentation-hierarchies.d.ts +1 -1
  118. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  119. package/lib/esm/presentation-hierarchies.js +1 -1
  120. package/lib/esm/presentation-hierarchies.js.map +1 -1
  121. package/package.json +9 -9
@@ -5,6 +5,7 @@
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.HierarchyNodeIdentifier = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
8
9
  const presentation_shared_1 = require("@itwin/presentation-shared");
9
10
  /** @public */
10
11
  // eslint-disable-next-line @typescript-eslint/no-redeclare
@@ -22,14 +23,30 @@ var HierarchyNodeIdentifier;
22
23
  HierarchyNodeIdentifier.isGenericNodeIdentifier = isGenericNodeIdentifier;
23
24
  /** Checks two identifiers for equality */
24
25
  function equal(lhs, rhs) {
25
- if (isInstanceNodeIdentifier(lhs) && isInstanceNodeIdentifier(rhs)) {
26
- return presentation_shared_1.InstanceKey.equals(lhs, rhs) && lhs.imodelKey === rhs.imodelKey;
26
+ return compare(lhs, rhs) === 0;
27
+ }
28
+ HierarchyNodeIdentifier.equal = equal;
29
+ /** Compares two identifiers */
30
+ function compare(lhs, rhs) {
31
+ if (HierarchyNodeIdentifier.isGenericNodeIdentifier(lhs)) {
32
+ if (HierarchyNodeIdentifier.isGenericNodeIdentifier(rhs)) {
33
+ const sourceCompareResult = (0, core_bentley_1.compareStringsOrUndefined)(lhs.source, rhs.source);
34
+ if (sourceCompareResult !== 0) {
35
+ return sourceCompareResult;
36
+ }
37
+ return (0, core_bentley_1.compareStrings)(lhs.id, rhs.id);
38
+ }
39
+ return -1;
27
40
  }
28
- if (isGenericNodeIdentifier(lhs) && isGenericNodeIdentifier(rhs)) {
29
- return lhs.source === rhs.source && lhs.id === rhs.id;
41
+ if (HierarchyNodeIdentifier.isInstanceNodeIdentifier(rhs)) {
42
+ const imodelKeyCompareResult = (0, core_bentley_1.compareStringsOrUndefined)(lhs.imodelKey, rhs.imodelKey);
43
+ if (imodelKeyCompareResult !== 0) {
44
+ return imodelKeyCompareResult;
45
+ }
46
+ return presentation_shared_1.InstanceKey.compare(lhs, rhs);
30
47
  }
31
- return false;
48
+ return 1;
32
49
  }
33
- HierarchyNodeIdentifier.equal = equal;
50
+ HierarchyNodeIdentifier.compare = compare;
34
51
  })(HierarchyNodeIdentifier || (exports.HierarchyNodeIdentifier = HierarchyNodeIdentifier = {}));
35
52
  //# sourceMappingURL=HierarchyNodeIdentifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNodeIdentifier.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNodeIdentifier.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oEAAyD;AAgBzD,cAAc;AACd,2DAA2D;AAC3D,IAAiB,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,iCAAW,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,uCAAvB,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\";\n\nimport type { 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,sDAAgF;AAChF,oEAAyD;AAgBzD,cAAc;AACd,2DAA2D;AAC3D,I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AAC;YAChC,CAAC;YACD,OAAO,iCAAW,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAnBe,+BAAO,UAmBtB,CAAA;AACH,CAAC,EArCgB,uBAAuB,uCAAvB,uBAAuB,QAqCvC","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 { compareStrings, compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\n\nimport type { 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 return compare(lhs, rhs) === 0;\n }\n\n /** Compares two identifiers */\n export function compare(lhs: HierarchyNodeIdentifier, rhs: HierarchyNodeIdentifier): number {\n if (HierarchyNodeIdentifier.isGenericNodeIdentifier(lhs)) {\n if (HierarchyNodeIdentifier.isGenericNodeIdentifier(rhs)) {\n const sourceCompareResult = compareStringsOrUndefined(lhs.source, rhs.source);\n if (sourceCompareResult !== 0) {\n return sourceCompareResult;\n }\n return compareStrings(lhs.id, rhs.id);\n }\n return -1;\n }\n if (HierarchyNodeIdentifier.isInstanceNodeIdentifier(rhs)) {\n const imodelKeyCompareResult = compareStringsOrUndefined(lhs.imodelKey, rhs.imodelKey);\n if (imodelKeyCompareResult !== 0) {\n return imodelKeyCompareResult;\n }\n return InstanceKey.compare(lhs, rhs);\n }\n return 1;\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,4 +1,5 @@
1
1
  import { InstanceKey } from "@itwin/presentation-shared";
2
+ import type { EC } from "@itwin/presentation-shared";
2
3
  /**
3
4
  * An instance key that may be associated with specific iModel.
4
5
  * @public
@@ -45,7 +46,7 @@ export interface ClassGroupingNodeKey {
45
46
  /** Type of the node */
46
47
  type: "class-grouping";
47
48
  /** Full name of the ECClass that this grouping node is grouping by. */
48
- className: string;
49
+ className: EC.FullClassName;
49
50
  }
50
51
  /**
51
52
  * A key for a label-grouping node.
@@ -72,7 +73,7 @@ export interface PropertyOtherValuesGroupingNodeKey {
72
73
  type: "property-grouping:other";
73
74
  /** Identifiers of properties whose values are grouped under this node. */
74
75
  properties: Array<{
75
- className: string;
76
+ className: EC.FullClassName;
76
77
  propertyName: string;
77
78
  }>;
78
79
  }
@@ -86,7 +87,7 @@ export interface PropertyValueGroupingNodeKey {
86
87
  /** Name of the property that is used for grouping nodes. */
87
88
  propertyName: string;
88
89
  /** Full name of the ECClass containing the property. */
89
- propertyClassName: string;
90
+ propertyClassName: EC.FullClassName;
90
91
  /** Formatted property value that this node is grouping by. */
91
92
  formattedPropertyValue: string;
92
93
  }
@@ -100,7 +101,7 @@ export interface PropertyValueRangeGroupingNodeKey {
100
101
  /** Name of the property that is used for grouping nodes. */
101
102
  propertyName: string;
102
103
  /** Full name of the ECClass containing the property. */
103
- propertyClassName: string;
104
+ propertyClassName: EC.FullClassName;
104
105
  /** Defines the start of the values' range that this node is grouping by. */
105
106
  fromValue: number;
106
107
  /** Defines the end of the values' range that this node is grouping by. */
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNodeKey.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNodeKey.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAA0B,MAAM,4BAA4B,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAC;IAElB;;;OAGG;IACH,YAAY,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,IAAI,EAAE,gBAAgB,CAAC;IAEvB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,IAAI,EAAE,gBAAgB,CAAC;IAEvB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IACjD,uBAAuB;IACvB,IAAI,EAAE,yBAAyB,CAAC;IAChC,0EAA0E;IAC1E,UAAU,EAAE,KAAK,CAAC;QAChB,SAAS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D;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,EAhKgB,gBAAgB,gCAAhB,gBAAgB,QAgKhC","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, normalizeFullClassName } 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<{\n className: string;\n propertyName: string;\n }>;\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 = PropertyValueRangeGroupingNodeKey | PropertyValueGroupingNodeKey | 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(lhs.instanceKeys[i].imodelKey, rhs.instanceKeys[i].imodelKey);\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(normalizeFullClassName(lhs.className).toLocaleLowerCase(), normalizeFullClassName(rhs.className).toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.properties[i].className).toLocaleLowerCase(),\n normalizeFullClassName(rhs.properties[i].className).toLocaleLowerCase(),\n );\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(lhs.properties[i].propertyName.toLocaleLowerCase(), rhs.properties[i].propertyName.toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.propertyClassName).toLocaleLowerCase(),\n normalizeFullClassName(rhs.propertyClassName).toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.propertyClassName).toLocaleLowerCase(),\n normalizeFullClassName(rhs.propertyClassName).toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());\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/HierarchyNodeKey.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sD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M,yBAAyB,GAAG,IAAA,6BAAc,EAAC,GAAG,CAAC,YAAY,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBAC7H,IAAI,yBAAyB,KAAK,CAAC,EAAE,CAAC;oBACpC,OAAO,yBAAyB,CAAC;gBACnC,CAAC;gBACD,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS,EAAE,CAAC;oBACpC,OAAO,GAAG,CAAC,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;IAjGe,wBAAO,UAiGtB,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,EAhKgB,gBAAgB,gCAAhB,gBAAgB,QAgKhC","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, normalizeFullClassName } from \"@itwin/presentation-shared\";\n\nimport type { EC } 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: EC.FullClassName;\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<{\n className: EC.FullClassName;\n propertyName: string;\n }>;\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: EC.FullClassName;\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: EC.FullClassName;\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 = PropertyValueRangeGroupingNodeKey | PropertyValueGroupingNodeKey | 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(lhs.instanceKeys[i].imodelKey, rhs.instanceKeys[i].imodelKey);\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(normalizeFullClassName(lhs.className).toLocaleLowerCase(), normalizeFullClassName(rhs.className).toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.properties[i].className).toLocaleLowerCase(),\n normalizeFullClassName(rhs.properties[i].className).toLocaleLowerCase(),\n );\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(lhs.properties[i].propertyName.toLocaleLowerCase(), rhs.properties[i].propertyName.toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.propertyClassName).toLocaleLowerCase(),\n normalizeFullClassName(rhs.propertyClassName).toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());\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(\n normalizeFullClassName(lhs.propertyClassName).toLocaleLowerCase(),\n normalizeFullClassName(rhs.propertyClassName).toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());\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,7 +1,7 @@
1
1
  import type { GenericInstanceFilter } from "@itwin/core-common";
2
2
  import type { Event, EventListener, InstanceKey, IPrimitiveValueFormatter, Props, RaisableEvent } from "@itwin/presentation-shared";
3
3
  import type { HierarchyNode, ParentHierarchyNode } from "./HierarchyNode.js";
4
- import type { HierarchySearchPath } from "./HierarchySearch.js";
4
+ import type { HierarchySearchTree } from "./HierarchySearch.js";
5
5
  /**
6
6
  * Props for the `HierarchyProvider.getNodes` call.
7
7
  * @public
@@ -82,8 +82,8 @@ export interface HierarchyProvider {
82
82
  * @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.
83
83
  */
84
84
  setHierarchySearch(props: {
85
- /** A list of node identifiers from root to target node. */
86
- paths: HierarchySearchPath[];
85
+ /** A list of search trees that define paths from root to search target nodes. */
86
+ paths: HierarchySearchTree[];
87
87
  } | undefined): void;
88
88
  }
89
89
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyProv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AE,gBAAgB,EAAE,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAA;CAAE,KAAK,gBAAgB,GACrI,gBAAgB,GAAG,iBAAiB,CAStC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAqJhG,0DAWC;AA9JD,sDAA8C;AA0G9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,uBAAuB,CACrC,cAAsI;IAEtI,MAAM,gBAAgB,GAAqD,IAAI,sBAAO,EAAE,CAAC;IACzF,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QACzB,gBAAgB;QAChB,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,mBAAmB,KAAI,CAAC,EAAE,CAAC;QAC5I,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,YAAY,KAAI,CAAC,EAAE,CAAC;QACzG,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,KAAI,CAAC,EAAE,CAAC;KAClI,CAAC,CAAC;AACL,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 { BeEvent } from \"@itwin/core-bentley\";\n\nimport type { GenericInstanceFilter } from \"@itwin/core-common\";\nimport type { Event, EventListener, InstanceKey, IPrimitiveValueFormatter, Props, RaisableEvent } from \"@itwin/presentation-shared\";\nimport type { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode.js\";\nimport type { HierarchySearchPath } from \"./HierarchySearch.js\";\n\n/**\n * Props for the `HierarchyProvider.getNodes` call.\n * @public\n */\nexport interface GetHierarchyNodesProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: ParentHierarchyNode | undefined;\n\n /** Optional hierarchy level filter. Has no effect if `parentNode` is a `GroupingNode`. */\n instanceFilter?: GenericInstanceFilter;\n\n /**\n * Optional hierarchy level size limit override. This value is passed to `LimitingECSqlQueryExecutor` used\n * by this provider to override query rows limit per hierarchy level. If not provided, defaults to whatever\n * is used by the limiting query executor.\n *\n * Has no effect if `parentNode` is a `GroupingNode`.\n */\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n\n /** When set to `true` ignores the cache and fetches the nodes again. */\n ignoreCache?: boolean;\n}\n\n/**\n * Event arguments for `HierarchyProvider.hierarchyChanged` event.\n * @public\n */\ninterface HierarchyChangedEventArgs {\n /** Set when the hierarchy change was caused by a formatter change. */\n formatterChange?: {\n newFormatter: IPrimitiveValueFormatter | undefined;\n };\n\n /** Set when the hierarchy change was caused by a hierarchy search change. */\n searchChange?: {\n newSearch: Props<HierarchyProvider[\"setHierarchySearch\"]>;\n };\n}\n\n/**\n * An interface for a hierarchy provider that knows how to create child nodes for a given parent node.\n * @public\n */\nexport interface HierarchyProvider {\n /**\n * An event that provider raises due to a hierarchy change that requires a reload.\n *\n * Consumers are expected to subscribe to this event and reload the hierarchy when it's raised.\n * Implementations may provide additional details on what caused the change through the\n * event arguments.\n */\n readonly hierarchyChanged: Event<(args: HierarchyChangedEventArgs) => void>;\n\n /**\n * Gets nodes for the specified parent node. This is **the method to implement**, otherwise\n * the provider doesn't return any nodes.\n */\n getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode>;\n\n /**\n * Gets instance keys for the specified parent node.\n *\n * The result of this method may be used to determine instances whose nodes would be displayed as children\n * of the specified parent node. For such use cases calling this method should be more efficient compared\n * to calling `getNodes`.\n */\n getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey>;\n\n /**\n * Overrides the property value formatter used by the hierarchy provider. Setting to `undefined`\n * resets the formatter, but what that means depends on the provider implementation - it could just\n * use unformatted values, or use some default formatter, e.g. the on created by `createDefaultValueFormatter`\n * from `@itwin/presentation-shared` package.\n *\n * @note Changing formatter is expected to trigger the `hierarchyChanged` event with `formatterChange` arg.\n */\n setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;\n\n /**\n * Sets the hierarchy search used by this hierarchy provider. Setting to `undefined`\n * removes the search.\n *\n * @note There's a difference between `undefined` search and search with empty paths list. The\n * former means no search is applied, while the latter means the search is applied and it filters-out\n * all hierarchy.\n *\n * @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.\n */\n setHierarchySearch(\n props:\n | {\n /** A list of node identifiers from root to target node. */\n paths: HierarchySearchPath[];\n }\n | undefined,\n ): void;\n}\n\n/**\n * An utility to create a `HierarchyProvider` from a partial implementation.\n *\n * Creating a `HierarchyProvider` directly requires implementing all its methods:\n * ```ts\n * {\n * hierarchyChanged: new BeEvent(),\n * async *getNodes({ parentNode }) {\n * // yield nodes...\n * },\n * async *getNodeInstanceKeys() {},\n * setFormatter() {},\n * setHierarchySearch() {},\n * }\n * ```\n *\n * However, in many cases you may only need to implement the `getNodes` method and\n * can rely on default implementations for other methods.\n *\n * With this utility you can implement only part of it, e.g. just the `getNodes` method:\n * ```ts\n * // provide implementation as a javascript object\n * createHierarchyProvider(({ hierarchyChanged }) => ({\n * async *getNodes({ parentNode }) {\n * // yield nodes...\n * },\n * }));\n *\n * // or, provide implementation as a class instance:\n * createHierarchyProvider(\n * ({ hierarchyChanged }) =>\n * new (class implements Pick<HierarchyProvider, \"getNodes\"> {\n * public async *getNodes({ parentNode }): ReturnType<HierarchyProvider[\"getNodes\"]> {\n * // yield nodes...\n * }\n * })(),\n * );\n * ```\n *\n * @public\n */\nexport function createHierarchyProvider<TPartialProvider extends Partial<Omit<HierarchyProvider, \"hierarchyChanged\">> & Pick<HierarchyProvider, \"getNodes\">>(\n partialFactory: (props: { hierarchyChanged: RaisableEvent<EventListener<HierarchyProvider[\"hierarchyChanged\"]>> }) => TPartialProvider,\n): TPartialProvider & HierarchyProvider {\n const hierarchyChanged: Props<typeof partialFactory>[\"hierarchyChanged\"] = new BeEvent();\n const impl = partialFactory({ hierarchyChanged });\n return Object.assign(impl, {\n hierarchyChanged,\n ...(impl.getNodeInstanceKeys ? { getNodeInstanceKeys: impl.getNodeInstanceKeys } : { /* c8 ignore next */ async *getNodeInstanceKeys() {} }),\n ...(impl.setFormatter ? { setFormatter: impl.setFormatter } : { /* c8 ignore next */ setFormatter() {} }),\n ...(impl.setHierarchySearch ? { setHierarchySearch: impl.setHierarchySearch } : { /* c8 ignore next */ setHierarchySearch() {} }),\n });\n}\n"]}
1
+ {"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAqJhG,0DAWC;AA9JD,sDAA8C;AA0G9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,uBAAuB,CACrC,cAAsI;IAEtI,MAAM,gBAAgB,GAAqD,IAAI,sBAAO,EAAE,CAAC;IACzF,MAAM,IAAI,GAAG,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QACzB,gBAAgB;QAChB,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,mBAAmB,KAAI,CAAC,EAAE,CAAC;QAC5I,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,YAAY,KAAI,CAAC,EAAE,CAAC;QACzG,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,KAAI,CAAC,EAAE,CAAC;KAClI,CAAC,CAAC;AACL,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 { BeEvent } from \"@itwin/core-bentley\";\n\nimport type { GenericInstanceFilter } from \"@itwin/core-common\";\nimport type { Event, EventListener, InstanceKey, IPrimitiveValueFormatter, Props, RaisableEvent } from \"@itwin/presentation-shared\";\nimport type { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode.js\";\nimport type { HierarchySearchTree } from \"./HierarchySearch.js\";\n\n/**\n * Props for the `HierarchyProvider.getNodes` call.\n * @public\n */\nexport interface GetHierarchyNodesProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: ParentHierarchyNode | undefined;\n\n /** Optional hierarchy level filter. Has no effect if `parentNode` is a `GroupingNode`. */\n instanceFilter?: GenericInstanceFilter;\n\n /**\n * Optional hierarchy level size limit override. This value is passed to `LimitingECSqlQueryExecutor` used\n * by this provider to override query rows limit per hierarchy level. If not provided, defaults to whatever\n * is used by the limiting query executor.\n *\n * Has no effect if `parentNode` is a `GroupingNode`.\n */\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n\n /** When set to `true` ignores the cache and fetches the nodes again. */\n ignoreCache?: boolean;\n}\n\n/**\n * Event arguments for `HierarchyProvider.hierarchyChanged` event.\n * @public\n */\ninterface HierarchyChangedEventArgs {\n /** Set when the hierarchy change was caused by a formatter change. */\n formatterChange?: {\n newFormatter: IPrimitiveValueFormatter | undefined;\n };\n\n /** Set when the hierarchy change was caused by a hierarchy search change. */\n searchChange?: {\n newSearch: Props<HierarchyProvider[\"setHierarchySearch\"]>;\n };\n}\n\n/**\n * An interface for a hierarchy provider that knows how to create child nodes for a given parent node.\n * @public\n */\nexport interface HierarchyProvider {\n /**\n * An event that provider raises due to a hierarchy change that requires a reload.\n *\n * Consumers are expected to subscribe to this event and reload the hierarchy when it's raised.\n * Implementations may provide additional details on what caused the change through the\n * event arguments.\n */\n readonly hierarchyChanged: Event<(args: HierarchyChangedEventArgs) => void>;\n\n /**\n * Gets nodes for the specified parent node. This is **the method to implement**, otherwise\n * the provider doesn't return any nodes.\n */\n getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode>;\n\n /**\n * Gets instance keys for the specified parent node.\n *\n * The result of this method may be used to determine instances whose nodes would be displayed as children\n * of the specified parent node. For such use cases calling this method should be more efficient compared\n * to calling `getNodes`.\n */\n getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey>;\n\n /**\n * Overrides the property value formatter used by the hierarchy provider. Setting to `undefined`\n * resets the formatter, but what that means depends on the provider implementation - it could just\n * use unformatted values, or use some default formatter, e.g. the on created by `createDefaultValueFormatter`\n * from `@itwin/presentation-shared` package.\n *\n * @note Changing formatter is expected to trigger the `hierarchyChanged` event with `formatterChange` arg.\n */\n setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;\n\n /**\n * Sets the hierarchy search used by this hierarchy provider. Setting to `undefined`\n * removes the search.\n *\n * @note There's a difference between `undefined` search and search with empty paths list. The\n * former means no search is applied, while the latter means the search is applied and it filters-out\n * all hierarchy.\n *\n * @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.\n */\n setHierarchySearch(\n props:\n | {\n /** A list of search trees that define paths from root to search target nodes. */\n paths: HierarchySearchTree[];\n }\n | undefined,\n ): void;\n}\n\n/**\n * An utility to create a `HierarchyProvider` from a partial implementation.\n *\n * Creating a `HierarchyProvider` directly requires implementing all its methods:\n * ```ts\n * {\n * hierarchyChanged: new BeEvent(),\n * async *getNodes({ parentNode }) {\n * // yield nodes...\n * },\n * async *getNodeInstanceKeys() {},\n * setFormatter() {},\n * setHierarchySearch() {},\n * }\n * ```\n *\n * However, in many cases you may only need to implement the `getNodes` method and\n * can rely on default implementations for other methods.\n *\n * With this utility you can implement only part of it, e.g. just the `getNodes` method:\n * ```ts\n * // provide implementation as a javascript object\n * createHierarchyProvider(({ hierarchyChanged }) => ({\n * async *getNodes({ parentNode }) {\n * // yield nodes...\n * },\n * }));\n *\n * // or, provide implementation as a class instance:\n * createHierarchyProvider(\n * ({ hierarchyChanged }) =>\n * new (class implements Pick<HierarchyProvider, \"getNodes\"> {\n * public async *getNodes({ parentNode }): ReturnType<HierarchyProvider[\"getNodes\"]> {\n * // yield nodes...\n * }\n * })(),\n * );\n * ```\n *\n * @public\n */\nexport function createHierarchyProvider<TPartialProvider extends Partial<Omit<HierarchyProvider, \"hierarchyChanged\">> & Pick<HierarchyProvider, \"getNodes\">>(\n partialFactory: (props: { hierarchyChanged: RaisableEvent<EventListener<HierarchyProvider[\"hierarchyChanged\"]>> }) => TPartialProvider,\n): TPartialProvider & HierarchyProvider {\n const hierarchyChanged: Props<typeof partialFactory>[\"hierarchyChanged\"] = new BeEvent();\n const impl = partialFactory({ hierarchyChanged });\n return Object.assign(impl, {\n hierarchyChanged,\n ...(impl.getNodeInstanceKeys ? { getNodeInstanceKeys: impl.getNodeInstanceKeys } : { /* c8 ignore next */ async *getNodeInstanceKeys() {} }),\n ...(impl.setFormatter ? { setFormatter: impl.setFormatter } : { /* c8 ignore next */ setFormatter() {} }),\n ...(impl.setHierarchySearch ? { setHierarchySearch: impl.setHierarchySearch } : { /* c8 ignore next */ setHierarchySearch() {} }),\n });\n}\n"]}
@@ -1,70 +1,52 @@
1
1
  import { HierarchyNodeIdentifier } from "./HierarchyNodeIdentifier.js";
2
- import { HierarchyNodeKey } from "./HierarchyNodeKey.js";
3
2
  import type { NonGroupingHierarchyNode } from "./HierarchyNode.js";
4
3
  import type { HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
5
4
  import type { GenericNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
6
5
  /** @public */
7
- export interface SearchPathRevealDepthInPath {
8
- /**
9
- * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.
10
- *
11
- * Use when you want to expand up to specific instance node and don't care about grouping nodes.
12
- *
13
- * **Use case example:**
14
- *
15
- * All nodes up to `Element1` should be expanded in the following hierarchy:
16
- * - Node1
17
- * - GroupingNode1
18
- * - GroupingNode2
19
- * - Element1
20
- * - Element2
21
- *
22
- * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`
23
- *
24
- * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.
25
- */
26
- depthInPath: number;
27
- }
28
- /** @public */
29
- export interface SearchPathRevealDepthInHierarchy {
30
- /**
31
- * Considering the list of nodes from root to the target node, this is an index in that list, identifying the node that should be revealed in hierarchy by auto-expanding its ancestors.
32
- *
33
- * This should take into account the number of grouping nodes in hierarchy.
34
- *
35
- * **Use case example:**
36
- *
37
- * Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:
38
- * - Node1
39
- * - GroupingNode1
40
- * - GroupingNode2
41
- * - Element1
42
- * - Element2
43
- *
44
- * Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`
45
- *
46
- * To get the correct depth use `HierarchyNode.parentKeys.length`.
47
- *
48
- * **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.
49
- */
50
- depthInHierarchy: number;
51
- }
52
- /** @public */
53
6
  export interface HierarchySearchPathOptions {
54
7
  /**
55
8
  * This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.
56
9
  * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.
57
10
  * - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.
58
- * - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.
59
- * - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.
11
+ * - If it's a object with `groupingLevel` then `groupingLevel` determines the number of grouping levels to expand for
12
+ * the search target.
60
13
  */
61
- reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;
14
+ reveal?: boolean | {
15
+ /**
16
+ * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.
17
+ *
18
+ * Use when you want to expand up to specific instance node and don't care about grouping nodes.
19
+ *
20
+ * **Use case example:**
21
+ *
22
+ * All nodes up to `Element1` should be expanded in the following hierarchy:
23
+ * - Node1
24
+ * - GroupingNode1
25
+ * - GroupingNode2
26
+ * - Element1
27
+ * - Element2
28
+ *
29
+ * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`
30
+ *
31
+ * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.
32
+ */
33
+ depthInPath: number;
34
+ } | {
35
+ /**
36
+ * The number of grouping levels to expand for the search target. For example, if `groupingLevel` is set to `2`, then all grouping nodes up to the second level
37
+ * will have the `autoExpand` flag.
38
+ *
39
+ * **Note:** if search target has less grouping levels than specified by this attribute, then all grouping nodes up to the search target will have
40
+ * the `autoExpand` flag, but the search target itself won't have the `autoExpand` flag.
41
+ */
42
+ groupingLevel: number;
43
+ };
62
44
  /**
63
45
  * This option specifies whether or not search target should be expanded.
64
46
  * - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.
65
47
  * - If it's `true`, search target will have `autoExpand` flag.
66
48
  *
67
- * **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.
49
+ * **Note:** this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.
68
50
  */
69
51
  autoExpand?: boolean;
70
52
  }
@@ -91,20 +73,164 @@ export declare namespace HierarchySearchPath {
91
73
  * - else if only one of the inputs is an object, return it,
92
74
  * - else if both inputs are falsy, return `false` or `undefined`,
93
75
  * - else:
94
- * - if only one of the inputs has `depthInHierarchy` set, return the other one,
95
- * - else return the one with greater `depthInPath` or `depthInHierarchy`.
76
+ * - if only one of the inputs has `groupingLevel` set, return that one,
77
+ * - else compare by matching reveal type (`groupingLevel` or `depthInPath`) and return the deeper one.
96
78
  *
97
79
  * @public
98
80
  */
99
81
  function mergeOptions(lhs: HierarchySearchPathOptions | undefined, rhs: HierarchySearchPathOptions | undefined): HierarchySearchPathOptions | undefined;
100
82
  }
83
+ /**
84
+ * A tree structure representing hierarchy search paths. Each node in the tree corresponds
85
+ * to a hierarchy node identifier and may have children that represent deeper levels in the
86
+ * hierarchy.
87
+ *
88
+ * The `HierarchySearchTree.createBuilder` or `HierarchySearchTree.createFromPathsList` are
89
+ * typically used create this tree from a flat list of search paths.
90
+ *
91
+ * @public
92
+ */
93
+ export interface HierarchySearchTree {
94
+ /** Identifier of the hierarchy node this tree entry represents. */
95
+ identifier: HierarchyNodeIdentifier;
96
+ /**
97
+ * When `true`, indicates that this node is a search target.
98
+ *
99
+ * Note: A `HierarchySearchTree` node is considered a search target if it has no children, even if `isTarget` is not explicitly set to `true`. This
100
+ * is because a node with no children represents the end of a search path.
101
+ */
102
+ isTarget?: boolean;
103
+ /** Provides options for handling this search tree entry, such as auto-expansion behavior. */
104
+ options?: {
105
+ /**
106
+ * - `true` to expand the node and its grouping nodes,
107
+ * - `{ groupingLevel: number }` to expand ancestor grouping nodes, e.g. for the following hierarchy:
108
+ * ```
109
+ * - Grouping node A
110
+ * - Instance node A
111
+ * - Grouping node B1
112
+ * - Grouping node B2
113
+ * - ...
114
+ * - Grouping node Bn
115
+ * - Instance node B
116
+ * ```
117
+ *
118
+ * For "Instance node B" search tree entry:
119
+ * - `{ groupingLevel: 1 }` expands its first grouping node "Grouping node B1",
120
+ * - `{ groupingLevel: 2 }` expands two levels to "Grouping node B2".
121
+ * - `{ groupingLevel: Number.MAX_SAFE_INTEGER }` expands all grouping nodes of that instance node.
122
+ *
123
+ * Note that there's a slight difference between `HierarchySearchTree.options.autoExpand` and
124
+ * `HierarchySearchPath.options.reveal`. The latter option reveals the search target node by expanding its ancestors,
125
+ * while the `HierarchySearchTree.options.autoExpand` also expands the target node itself.
126
+ */
127
+ autoExpand?: boolean | {
128
+ groupingLevel: number;
129
+ };
130
+ };
131
+ /** Child search tree entries representing the next level(s) in the hierarchy search paths. */
132
+ children?: HierarchySearchTree[];
133
+ }
134
+ /** @public */
135
+ export declare namespace HierarchySearchTree {
136
+ /** @public */
137
+ type HierarchySearchTreeBuilderAcceptHandlerTreeEntry<TExtras extends Record<string, unknown>> = Readonly<Pick<HierarchySearchTree, "identifier" | "options"> & {
138
+ extras: TExtras;
139
+ }> & Pick<HierarchySearchTree, "isTarget">;
140
+ /** @public */
141
+ type HierarchySearchTreeBuilderAcceptHandlerTreeInput = Readonly<Pick<HierarchySearchTree, "identifier" | "isTarget" | "options"> & {
142
+ hasChildren: boolean;
143
+ }>;
144
+ /** @public */
145
+ interface HierarchySearchTreeBuilderAcceptHandler<TExtras extends Record<string, unknown>> {
146
+ /**
147
+ * Called when a new entry is added to the tree. Return `true` to accept the entry, `false` to reject it and all its children, if any.
148
+ */
149
+ onNewEntry?: (props: {
150
+ /** The parent entries of the new entry being added, from root to immediate parent. It's allowed to mutate these entries. */
151
+ parentEntries: Array<HierarchySearchTreeBuilderAcceptHandlerTreeEntry<TExtras>>;
152
+ /** The new entry being added to the tree. */
153
+ inputEntry: HierarchySearchTreeBuilderAcceptHandlerTreeInput;
154
+ }) => boolean;
155
+ /**
156
+ * Called when a new entry is added to the tree and accepted (either it's a new entry or it merges with an existing entry). This can be used to perform
157
+ * side effects such as assigning extra information to the tree entry.
158
+ */
159
+ onEntryHandled?: (props: {
160
+ /** The parent entries of the new entry being added, from root to immediate parent. It's allowed to mutate these entries. */
161
+ parentEntries: Array<HierarchySearchTreeBuilderAcceptHandlerTreeEntry<TExtras>>;
162
+ /** The tree entry that has been handled. It's allowed to mutate this entry. */
163
+ treeEntry: HierarchySearchTreeBuilderAcceptHandlerTreeEntry<TExtras>;
164
+ /** The input entry being added to the tree. */
165
+ inputEntry: HierarchySearchTreeBuilderAcceptHandlerTreeInput;
166
+ }) => void;
167
+ }
168
+ /** @public */
169
+ type HierarchySearchTreeBuilderAcceptProps<TAcceptHandlerExtras extends Record<string, unknown>> = ({
170
+ path: HierarchySearchPath;
171
+ } | {
172
+ tree: HierarchySearchTree;
173
+ }) & {
174
+ /** An optional handler for customizing the behavior of the builder when accepting new entries. */
175
+ handler?: HierarchySearchTreeBuilderAcceptHandler<TAcceptHandlerExtras>;
176
+ };
177
+ /**
178
+ * An utility that accepts hierarchy search paths or search trees one by one and builds a `HierarchySearchTree` structure based on them.
179
+ * @public
180
+ */
181
+ interface HierarchySearchTreeBuilder<TAcceptHandlerExtras extends Record<string, unknown>> {
182
+ /**
183
+ * Accepts a hierarchy search path or paths' tree and adds it to the builder's internal tree structure. Use `getTree()` to create
184
+ * a `HierarchySearchTree[]` from the added paths.
185
+ */
186
+ accept(props: HierarchySearchTreeBuilderAcceptProps<TAcceptHandlerExtras>): HierarchySearchTreeBuilder<TAcceptHandlerExtras>;
187
+ /**
188
+ * Create `HierarchySearchTree[]` from currently added search paths.
189
+ */
190
+ getTree(): HierarchySearchTree[];
191
+ }
192
+ /**
193
+ * Create a `HierarchySearchTree` builder utility that accepts hierarchy search paths or search trees one by one and builds
194
+ * a `HierarchySearchTree` structure based on them.
195
+ *
196
+ * Usage example:
197
+ *
198
+ * ```ts
199
+ * const builder = HierarchySearchTree.createBuilder();
200
+ * for (const path of searchPaths) {
201
+ * builder.accept({ path });
202
+ * }
203
+ * const searchTree = builder.getTree();
204
+ * ```
205
+ *
206
+ * @public
207
+ */
208
+ export function createBuilder<TAcceptHandlerExtras extends Record<string, unknown> = Record<string, unknown>>(): HierarchySearchTreeBuilder<TAcceptHandlerExtras>;
209
+ /**
210
+ * Builds a list of `HierarchySearchTree` nodes from an iterable of search paths. Shared
211
+ * path prefixes are merged so that each unique hierarchy node identifier appears only once
212
+ * per level. The resulting trees carry `isTarget`, `options`, and `children` attributes
213
+ * derived from the paths and their options (`autoExpand`, `reveal`).
214
+ *
215
+ * @public
216
+ */
217
+ export function createFromPathsList(paths: Iterable<HierarchySearchPath>): Promise<HierarchySearchTree[]>;
218
+ /**
219
+ * Merges two `HierarchySearchTree` option objects. For the `autoExpand` attribute,
220
+ * `true` takes precedence over `{ groupingLevel }`, and when both sides are
221
+ * `{ groupingLevel }` objects the larger value wins.
222
+ * @public
223
+ */
224
+ export function mergeOptions(lhs: HierarchySearchTree["options"] | undefined, rhs: HierarchySearchTree["options"] | undefined): HierarchySearchTree["options"] | undefined;
225
+ export {};
226
+ }
101
227
  /**
102
228
  * Creates a set of utilities for making it easier to search the given hierarchy
103
229
  * level.
104
230
  *
105
231
  * @public
106
232
  */
107
- export declare function createHierarchySearchHelper(rootLevelSearchProps: HierarchySearchPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "search"> | undefined): {
233
+ export declare function createHierarchySearchHelper(rootLevelSearchProps: HierarchySearchTree[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "search"> | undefined): {
108
234
  /** Returns a flag indicating if the hierarchy level is filtered. */
109
235
  hasSearch: boolean;
110
236
  /**
@@ -129,41 +255,21 @@ export declare function createHierarchySearchHelper(rootLevelSearchProps: Hierar
129
255
  * `nodeKey` prop can be used to check the whole identifier.
130
256
  *
131
257
  * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
132
- * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
133
- * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
134
- * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
258
+ * - `asyncPathMatcher` is provided - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a `Promise`.
259
+ * - `pathMatcher` or only `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
135
260
  */
136
261
  createChildNodeProps: {
137
262
  (props: {
138
- parentKeys?: undefined;
139
- nodeKey: InstancesNodeKey | GenericNodeKey;
140
- }): Pick<NonGroupingHierarchyNode, "search"> | undefined;
141
- (props: {
142
- parentKeys?: undefined;
143
- pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
144
- }): Pick<NonGroupingHierarchyNode, "search"> | undefined;
145
- (props: {
146
- parentKeys?: undefined;
147
- asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
148
- }): Promise<Pick<NonGroupingHierarchyNode, "search"> | undefined> | Pick<NonGroupingHierarchyNode, "search"> | undefined;
149
- (props: {
150
- parentKeys: HierarchyNodeKey[];
151
263
  nodeKey: InstancesNodeKey | GenericNodeKey;
152
264
  }): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
153
265
  (props: {
154
- parentKeys: HierarchyNodeKey[];
266
+ nodeKey: InstancesNodeKey | GenericNodeKey;
155
267
  pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
156
268
  }): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
157
269
  (props: {
158
- parentKeys: HierarchyNodeKey[];
270
+ nodeKey: InstancesNodeKey | GenericNodeKey;
159
271
  asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
160
272
  }): Promise<Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined> | Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
161
273
  };
162
274
  };
163
- /** @internal */
164
- export declare function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }: {
165
- reveal: HierarchySearchPathOptions["reveal"];
166
- nodePositionInPath: number;
167
- nodePositionInHierarchy: number;
168
- }): boolean;
169
275
  //# sourceMappingURL=HierarchySearch.d.ts.map