@itwin/presentation-hierarchies 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (151) hide show
  1. package/CHANGELOG.md +248 -8
  2. package/README.md +4 -22
  3. package/lib/cjs/hierarchies/HierarchyMerge.d.ts +19 -0
  4. package/lib/cjs/hierarchies/HierarchyMerge.d.ts.map +1 -0
  5. package/lib/cjs/hierarchies/HierarchyMerge.js +43 -0
  6. package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -0
  7. package/lib/cjs/hierarchies/HierarchyNode.d.ts +14 -24
  8. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNode.js +1 -21
  10. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  12. package/lib/cjs/hierarchies/HierarchyNodeKey.js +8 -8
  13. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  14. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +11 -29
  15. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  16. package/lib/cjs/hierarchies/HierarchyProvider.js +0 -37
  17. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  18. package/lib/cjs/hierarchies/HierarchySearch.d.ts +167 -0
  19. package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -0
  20. package/lib/cjs/hierarchies/HierarchySearch.js +259 -0
  21. package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -0
  22. package/lib/cjs/hierarchies/imodel/HierarchyCache.js +3 -3
  23. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
  24. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +15 -4
  25. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  26. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +46 -11
  28. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  29. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +192 -65
  30. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  31. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
  32. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  33. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +99 -40
  34. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  35. package/lib/cjs/hierarchies/imodel/{FilteringHierarchyDefinition.d.ts → SearchHierarchyDefinition.d.ts} +13 -14
  36. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
  37. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +285 -0
  38. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
  39. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +4 -6
  40. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  41. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +15 -5
  42. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  43. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  44. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
  45. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  46. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  47. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +6 -5
  48. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  49. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  50. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -3
  51. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  52. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  53. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +21 -16
  54. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  55. package/lib/cjs/hierarchies/internal/Common.d.ts +3 -0
  56. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  57. package/lib/cjs/hierarchies/internal/Common.js +12 -1
  58. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  59. package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  60. package/lib/cjs/hierarchies/internal/EachValueFrom.js +1 -0
  61. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
  62. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts +7 -3
  63. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
  64. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +4 -3
  65. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
  66. package/lib/cjs/presentation-hierarchies.d.ts +5 -4
  67. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  68. package/lib/cjs/presentation-hierarchies.js +7 -7
  69. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  70. package/lib/esm/hierarchies/HierarchyMerge.d.ts +19 -0
  71. package/lib/esm/hierarchies/HierarchyMerge.d.ts.map +1 -0
  72. package/lib/esm/hierarchies/HierarchyMerge.js +40 -0
  73. package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -0
  74. package/lib/esm/hierarchies/HierarchyNode.d.ts +14 -24
  75. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  76. package/lib/esm/hierarchies/HierarchyNode.js +0 -20
  77. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  78. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  79. package/lib/esm/hierarchies/HierarchyNodeKey.js +9 -9
  80. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  81. package/lib/esm/hierarchies/HierarchyProvider.d.ts +11 -29
  82. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  83. package/lib/esm/hierarchies/HierarchyProvider.js +1 -36
  84. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  85. package/lib/esm/hierarchies/HierarchySearch.d.ts +167 -0
  86. package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -0
  87. package/lib/esm/hierarchies/HierarchySearch.js +254 -0
  88. package/lib/esm/hierarchies/HierarchySearch.js.map +1 -0
  89. package/lib/esm/hierarchies/imodel/HierarchyCache.js +3 -3
  90. package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -1
  91. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +15 -4
  92. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  93. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  94. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +46 -11
  95. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  96. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +194 -68
  97. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  98. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
  99. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  100. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +100 -41
  101. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  102. package/lib/esm/hierarchies/imodel/{FilteringHierarchyDefinition.d.ts → SearchHierarchyDefinition.d.ts} +13 -14
  103. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
  104. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +279 -0
  105. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
  106. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts +4 -6
  107. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  108. package/lib/esm/hierarchies/imodel/TreeNodesReader.js +12 -3
  109. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  110. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  111. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
  112. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  113. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  114. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +7 -6
  115. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  116. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  117. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +5 -4
  118. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  119. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  120. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +22 -17
  121. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  122. package/lib/esm/hierarchies/internal/Common.d.ts +3 -0
  123. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  124. package/lib/esm/hierarchies/internal/Common.js +11 -1
  125. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  126. package/lib/esm/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  127. package/lib/esm/hierarchies/internal/EachValueFrom.js +1 -0
  128. package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
  129. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts +7 -3
  130. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
  131. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js +5 -4
  132. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
  133. package/lib/esm/presentation-hierarchies.d.ts +5 -4
  134. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  135. package/lib/esm/presentation-hierarchies.js +3 -3
  136. package/lib/esm/presentation-hierarchies.js.map +1 -1
  137. package/package.json +18 -18
  138. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +0 -110
  139. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  140. package/lib/cjs/hierarchies/HierarchyFiltering.js +0 -215
  141. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +0 -1
  142. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  143. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -274
  144. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
  145. package/lib/esm/hierarchies/HierarchyFiltering.d.ts +0 -110
  146. package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  147. package/lib/esm/hierarchies/HierarchyFiltering.js +0 -210
  148. package/lib/esm/hierarchies/HierarchyFiltering.js.map +0 -1
  149. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  150. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -268
  151. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
@@ -91,7 +91,7 @@ var HierarchyNodeKey;
91
91
  if (instanceKeyCompareResult !== 0) {
92
92
  return instanceKeyCompareResult;
93
93
  }
94
- const imodelKeyCompareResult = (0, core_bentley_1.compareStringsOrUndefined)(lhs.instanceKeys[0].imodelKey, rhs.instanceKeys[0].imodelKey);
94
+ const imodelKeyCompareResult = (0, core_bentley_1.compareStringsOrUndefined)(lhs.instanceKeys[i].imodelKey, rhs.instanceKeys[i].imodelKey);
95
95
  if (imodelKeyCompareResult !== 0) {
96
96
  return imodelKeyCompareResult;
97
97
  }
@@ -100,7 +100,7 @@ var HierarchyNodeKey;
100
100
  }
101
101
  case "class-grouping": {
102
102
  (0, core_bentley_1.assert)(rhs.type === "class-grouping");
103
- return (0, core_bentley_1.compareStrings)(lhs.className, rhs.className);
103
+ return (0, core_bentley_1.compareStrings)((0, presentation_shared_1.normalizeFullClassName)(lhs.className).toLocaleLowerCase(), (0, presentation_shared_1.normalizeFullClassName)(rhs.className).toLocaleLowerCase());
104
104
  }
105
105
  case "label-grouping": {
106
106
  (0, core_bentley_1.assert)(rhs.type === "label-grouping");
@@ -116,11 +116,11 @@ var HierarchyNodeKey;
116
116
  return lhs.properties.length - rhs.properties.length;
117
117
  }
118
118
  for (let i = 0; i < lhs.properties.length; ++i) {
119
- const classCompareResult = (0, core_bentley_1.compareStrings)(lhs.properties[i].className, rhs.properties[i].className);
119
+ const classCompareResult = (0, core_bentley_1.compareStrings)((0, presentation_shared_1.normalizeFullClassName)(lhs.properties[i].className).toLocaleLowerCase(), (0, presentation_shared_1.normalizeFullClassName)(rhs.properties[i].className).toLocaleLowerCase());
120
120
  if (classCompareResult !== 0) {
121
121
  return classCompareResult;
122
122
  }
123
- const nameCompareResult = (0, core_bentley_1.compareStrings)(lhs.properties[i].propertyName, rhs.properties[i].propertyName);
123
+ const nameCompareResult = (0, core_bentley_1.compareStrings)(lhs.properties[i].propertyName.toLocaleLowerCase(), rhs.properties[i].propertyName.toLocaleLowerCase());
124
124
  if (nameCompareResult !== 0) {
125
125
  return nameCompareResult;
126
126
  }
@@ -129,11 +129,11 @@ var HierarchyNodeKey;
129
129
  }
130
130
  case "property-grouping:value": {
131
131
  (0, core_bentley_1.assert)(rhs.type === "property-grouping:value");
132
- const propertyClassNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyClassName, rhs.propertyClassName);
132
+ const propertyClassNameCompareResult = (0, core_bentley_1.compareStrings)((0, presentation_shared_1.normalizeFullClassName)(lhs.propertyClassName).toLocaleLowerCase(), (0, presentation_shared_1.normalizeFullClassName)(rhs.propertyClassName).toLocaleLowerCase());
133
133
  if (propertyClassNameCompareResult !== 0) {
134
134
  return propertyClassNameCompareResult;
135
135
  }
136
- const propertyNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyName, rhs.propertyName);
136
+ const propertyNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());
137
137
  if (propertyNameCompareResult !== 0) {
138
138
  return propertyNameCompareResult;
139
139
  }
@@ -141,11 +141,11 @@ var HierarchyNodeKey;
141
141
  }
142
142
  case "property-grouping:range": {
143
143
  (0, core_bentley_1.assert)(rhs.type === "property-grouping:range");
144
- const propertyClassNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyClassName, rhs.propertyClassName);
144
+ const propertyClassNameCompareResult = (0, core_bentley_1.compareStrings)((0, presentation_shared_1.normalizeFullClassName)(lhs.propertyClassName).toLocaleLowerCase(), (0, presentation_shared_1.normalizeFullClassName)(rhs.propertyClassName).toLocaleLowerCase());
145
145
  if (propertyClassNameCompareResult !== 0) {
146
146
  return propertyClassNameCompareResult;
147
147
  }
148
- const propertyNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyName, rhs.propertyName);
148
+ const propertyNameCompareResult = (0, core_bentley_1.compareStrings)(lhs.propertyName.toLocaleLowerCase(), rhs.propertyName.toLocaleLowerCase());
149
149
  if (propertyNameCompareResult !== 0) {
150
150
  return propertyNameCompareResult;
151
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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;IAxFe,wBAAO,UAwFtB,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,EAvJgB,gBAAgB,gCAAhB,gBAAgB,QAuJhC","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<{\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[0].imodelKey, rhs.instanceKeys[0].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(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/HierarchyNodeKey.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAA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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\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,8 +1,7 @@
1
- import "./internal/DisposePolyfill.js";
2
1
  import { GenericInstanceFilter } from "@itwin/core-common";
3
2
  import { Event, InstanceKey, IPrimitiveValueFormatter, Props } from "@itwin/presentation-shared";
4
- import { HierarchyFilteringPath } from "./HierarchyFiltering.js";
5
3
  import { HierarchyNode, ParentHierarchyNode } from "./HierarchyNode.js";
4
+ import { HierarchySearchPath } from "./HierarchySearch.js";
6
5
  /**
7
6
  * Props for the `HierarchyProvider.getNodes` call.
8
7
  * @public
@@ -32,9 +31,9 @@ interface HierarchyChangedEventArgs {
32
31
  formatterChange?: {
33
32
  newFormatter: IPrimitiveValueFormatter | undefined;
34
33
  };
35
- /** Set when the hierarchy change was caused by a hierarchy filter change. */
36
- filterChange?: {
37
- newFilter: Props<HierarchyProvider["setHierarchyFilter"]>;
34
+ /** Set when the hierarchy change was caused by a hierarchy search change. */
35
+ searchChange?: {
36
+ newSearch: Props<HierarchyProvider["setHierarchySearch"]>;
38
37
  };
39
38
  }
40
39
  /**
@@ -74,36 +73,19 @@ export interface HierarchyProvider {
74
73
  */
75
74
  setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;
76
75
  /**
77
- * Sets the hierarchy filter used by this hierarchy provider. Setting to `undefined`
78
- * removes the filter.
76
+ * Sets the hierarchy search used by this hierarchy provider. Setting to `undefined`
77
+ * removes the search.
79
78
  *
80
- * @note There's a difference between `undefined` filter and filter with empty paths list. The
81
- * former means no filter is applied, while the latter means the filter is applied and it filters-out
79
+ * @note There's a difference between `undefined` search and search with empty paths list. The
80
+ * former means no search is applied, while the latter means the search is applied and it filters-out
82
81
  * all hierarchy.
83
82
  *
84
- * @note Changing filter is expected to trigger the `hierarchyChanged` event with `filterChange` arg.
83
+ * @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.
85
84
  */
86
- setHierarchyFilter(props: {
85
+ setHierarchySearch(props: {
87
86
  /** A list of node identifiers from root to target node. */
88
- paths: HierarchyFilteringPath[];
87
+ paths: HierarchySearchPath[];
89
88
  } | undefined): void;
90
89
  }
91
- /**
92
- * Props for `mergeProviders` function.
93
- * @public
94
- */
95
- interface MergeHierarchyProvidersProps {
96
- /** List of providers to merge. */
97
- providers: HierarchyProvider[];
98
- }
99
- /**
100
- * Creates a single, merged, hierarchy provider from multiple given providers.
101
- * @public
102
- */
103
- export declare function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {
104
- /** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */
105
- dispose: () => void;
106
- [Symbol.dispose]: () => void;
107
- };
108
90
  export {};
109
91
  //# sourceMappingURL=HierarchyProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyProvider.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,+BAA+B,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;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;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAAC,CAAC;IAE7E;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,sBAAsB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAE9E;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAE5G;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,wBAAwB,GAAG,SAAS,GAAG,IAAI,CAAC;IAEpE;;;;;;;;;OASG;IACH,kBAAkB,CAChB,KAAK,EACD;QACE,2DAA2D;QAC3D,KAAK,EAAE,mBAAmB,EAAE,CAAC;KAC9B,GACD,SAAS,GACZ,IAAI,CAAC;CACT"}
@@ -4,41 +4,4 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.mergeProviders = mergeProviders;
8
- require("./internal/DisposePolyfill.js");
9
- const rxjs_1 = require("rxjs");
10
- const core_bentley_1 = require("@itwin/core-bentley");
11
- const Common_js_1 = require("./internal/Common.js");
12
- const EachValueFrom_js_1 = require("./internal/EachValueFrom.js");
13
- const Sorting_js_1 = require("./internal/operators/Sorting.js");
14
- /**
15
- * Creates a single, merged, hierarchy provider from multiple given providers.
16
- * @public
17
- */
18
- function mergeProviders({ providers }) {
19
- const hierarchyChanged = new core_bentley_1.BeEvent();
20
- providers.forEach((p) => {
21
- p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());
22
- });
23
- const dispose = () => {
24
- hierarchyChanged.clear();
25
- providers.forEach((p) => (0, Common_js_1.safeDispose)(p));
26
- };
27
- return {
28
- hierarchyChanged,
29
- getNodes: (props) => (0, EachValueFrom_js_1.eachValueFrom)((0, rxjs_1.from)(providers).pipe((0, rxjs_1.mergeMap)((provider) => (0, rxjs_1.from)(provider.getNodes(props)).pipe((0, rxjs_1.mergeMap)((node) => {
30
- if (node.children) {
31
- return (0, rxjs_1.of)(node);
32
- }
33
- // each provider only considers its own data when determining node's children - in case it says
34
- // the node has no children, we have to check against the other providers too
35
- return (0, rxjs_1.from)(providers).pipe((0, rxjs_1.filter)((p) => p !== provider), (0, rxjs_1.mergeMap)((p) => p.getNodes({ parentNode: node })), (0, rxjs_1.map)(() => true), (0, rxjs_1.first)(undefined, false), (0, rxjs_1.map)((hasChildren) => ({ ...node, children: hasChildren })));
36
- }))), Sorting_js_1.sortNodesByLabelOperator)),
37
- getNodeInstanceKeys: (props) => (0, EachValueFrom_js_1.eachValueFrom)((0, rxjs_1.from)(providers).pipe((0, rxjs_1.mergeMap)((p) => p.getNodeInstanceKeys(props)))),
38
- setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),
39
- setHierarchyFilter: (props) => providers.forEach((p) => p.setHierarchyFilter(props)),
40
- [Symbol.dispose]: dispose,
41
- dispose,
42
- };
43
- }
44
7
  //# sourceMappingURL=HierarchyProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AA8HhG,wCA+CC;AA3KD,yCAAuC;AACvC,+BAA8D;AAC9D,sDAA8C;AAK9C,oDAAmD;AACnD,kEAA4D;AAC5D,gEAA2E;AA+G3E;;;GAGG;AACH,SAAgB,cAAc,CAAC,EAAE,SAAS,EAAgC;IAKxE,MAAM,gBAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAA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EACD,qCAAwB,CAEzB,CACF;QACH,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,gCAAa,EAAC,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClH,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpF,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;QACzB,OAAO;KACR,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 \"./internal/DisposePolyfill.js\";\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { Event, InstanceKey, IPrimitiveValueFormatter, Props } from \"@itwin/presentation-shared\";\nimport { HierarchyFilteringPath } from \"./HierarchyFiltering.js\";\nimport { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode.js\";\nimport { safeDispose } from \"./internal/Common.js\";\nimport { eachValueFrom } from \"./internal/EachValueFrom.js\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting.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 filter change. */\n filterChange?: {\n newFilter: Props<HierarchyProvider[\"setHierarchyFilter\"]>;\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. Provider may\n * set additional event arguments to provide extra information about what caused the change.\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 optional\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 filter used by this hierarchy provider. Setting to `undefined`\n * removes the filter.\n *\n * @note There's a difference between `undefined` filter and filter with empty paths list. The\n * former means no filter is applied, while the latter means the filter is applied and it filters-out\n * all hierarchy.\n *\n * @note Changing filter is expected to trigger the `hierarchyChanged` event with `filterChange` arg.\n */\n setHierarchyFilter(\n props:\n | {\n /** A list of node identifiers from root to target node. */\n paths: HierarchyFilteringPath[];\n }\n | undefined,\n ): void;\n}\n\n/**\n * Props for `mergeProviders` function.\n * @public\n */\ninterface MergeHierarchyProvidersProps {\n /** List of providers to merge. */\n providers: HierarchyProvider[];\n}\n\n/**\n * Creates a single, merged, hierarchy provider from multiple given providers.\n * @public\n */\nexport function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {\n /** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */\n dispose: () => void;\n [Symbol.dispose]: () => void;\n} {\n const hierarchyChanged = new BeEvent<() => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());\n });\n const dispose = () => {\n hierarchyChanged.clear();\n providers.forEach((p) => safeDispose(p));\n };\n\n return {\n hierarchyChanged,\n getNodes: (props) =>\n eachValueFrom(\n from(providers).pipe(\n mergeMap((provider) =>\n from(provider.getNodes(props)).pipe(\n mergeMap((node) => {\n if (node.children) {\n return of(node);\n }\n // each provider only considers its own data when determining node's children - in case it says\n // the node has no children, we have to check against the other providers too\n return from(providers).pipe(\n filter((p) => p !== provider),\n mergeMap((p) => p.getNodes({ parentNode: node })),\n map(() => true),\n first(undefined, false),\n map((hasChildren) => ({ ...node, children: hasChildren })),\n );\n }),\n ),\n ),\n sortNodesByLabelOperator,\n // TODO: consider merging similar nodes\n ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n setHierarchyFilter: (props) => providers.forEach((p) => p.setHierarchyFilter(props)),\n [Symbol.dispose]: dispose,\n dispose,\n };\n}\n"]}
1
+ {"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","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 { Event, InstanceKey, IPrimitiveValueFormatter, Props } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode.js\";\nimport { 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. Provider may\n * set additional event arguments to provide extra information about what caused the change.\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 optional\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"]}
@@ -0,0 +1,167 @@
1
+ import { NonGroupingHierarchyNode } from "./HierarchyNode.js";
2
+ import { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
3
+ import { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
4
+ /** @public */
5
+ export interface SearchPathRevealDepthInPath {
6
+ /**
7
+ * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.
8
+ *
9
+ * Use when you want to expand up to specific instance node and don't care about grouping nodes.
10
+ *
11
+ * **Use case example:**
12
+ *
13
+ * All nodes up to `Element1` should be expanded in the following hierarchy:
14
+ * - Node1
15
+ * - GroupingNode1
16
+ * - GroupingNode2
17
+ * - Element1
18
+ * - Element2
19
+ *
20
+ * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`
21
+ *
22
+ * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.
23
+ */
24
+ depthInPath: number;
25
+ }
26
+ /** @public */
27
+ export interface SearchPathRevealDepthInHierarchy {
28
+ /**
29
+ * 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.
30
+ *
31
+ * This should take into account the number of grouping nodes in hierarchy.
32
+ *
33
+ * **Use case example:**
34
+ *
35
+ * Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:
36
+ * - Node1
37
+ * - GroupingNode1
38
+ * - GroupingNode2
39
+ * - Element1
40
+ * - Element2
41
+ *
42
+ * Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`
43
+ *
44
+ * To get the correct depth use `HierarchyNode.parentKeys.length`.
45
+ *
46
+ * **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.
47
+ */
48
+ depthInHierarchy: number;
49
+ }
50
+ /** @public */
51
+ export interface HierarchySearchPathOptions {
52
+ /**
53
+ * This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.
54
+ * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.
55
+ * - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.
56
+ * - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.
57
+ * - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.
58
+ */
59
+ reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;
60
+ /**
61
+ * This option specifies whether or not search target should be expanded.
62
+ * - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.
63
+ * - If it's `true`, search target will have `autoExpand` flag.
64
+ *
65
+ * **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.
66
+ */
67
+ autoExpand?: boolean;
68
+ }
69
+ /**
70
+ * A path of hierarchy node identifiers for search the hierarchy with additional options.
71
+ * @public
72
+ */
73
+ export type HierarchySearchPath = HierarchyNodeIdentifiersPath | {
74
+ path: HierarchyNodeIdentifiersPath;
75
+ options?: HierarchySearchPathOptions;
76
+ };
77
+ /** @public */
78
+ export declare namespace HierarchySearchPath {
79
+ /**
80
+ * Normalizes the hierarchy search path to the object form.
81
+ * @public
82
+ */
83
+ function normalize(source: HierarchySearchPath): Exclude<HierarchySearchPath, HierarchyNodeIdentifiersPath>;
84
+ /**
85
+ * Merges two given `HierarchySearchPathOptions` objects.
86
+ *
87
+ * For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:
88
+ * - if any one of the inputs is `true`, return `true`,
89
+ * - else if only one of the inputs is an object, return it,
90
+ * - else if both inputs are falsy, return `false` or `undefined`,
91
+ * - else:
92
+ * - if only one of the inputs has `depthInHierarchy` set, return the other one,
93
+ * - else return the one with greater `depthInPath` or `depthInHierarchy`.
94
+ *
95
+ * @public
96
+ */
97
+ function mergeOptions(lhs: HierarchySearchPathOptions | undefined, rhs: HierarchySearchPathOptions | undefined): HierarchySearchPathOptions | undefined;
98
+ }
99
+ /**
100
+ * Creates a set of utilities for making it easier to search the given hierarchy
101
+ * level.
102
+ *
103
+ * @public
104
+ */
105
+ export declare function createHierarchySearchHelper(rootLevelSearchProps: HierarchySearchPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "search"> | undefined): {
106
+ /** Returns a flag indicating if the hierarchy level is filtered. */
107
+ hasSearch: boolean;
108
+ /**
109
+ * Returns a flag indicating whether this hierarchy level has an ancestor node
110
+ * that is a search target. That generally means that this and all downstream hierarchy
111
+ * levels should be displayed without search being applied to them, even if search paths
112
+ * say otherwise.
113
+ */
114
+ hasSearchTargetAncestor: boolean;
115
+ /**
116
+ * Returns a list of hierarchy node identifiers that apply specifically for this
117
+ * hierarchy level. Returns `undefined` if search is not applied to this level.
118
+ */
119
+ getChildNodeSearchIdentifiers: () => HierarchyNodeIdentifier[] | undefined;
120
+ /**
121
+ * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`
122
+ * and `autoExpand`) to be set based on the search paths and search options. This function calculates
123
+ * these props for a child node based on its key or path matcher.
124
+ *
125
+ * When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
126
+ * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
127
+ * `nodeKey` prop can be used to check the whole identifier.
128
+ *
129
+ * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
130
+ * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
131
+ * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
132
+ * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
133
+ */
134
+ createChildNodeProps: {
135
+ (props: {
136
+ parentKeys?: undefined;
137
+ nodeKey: InstancesNodeKey | GenericNodeKey;
138
+ }): Pick<NonGroupingHierarchyNode, "search"> | undefined;
139
+ (props: {
140
+ parentKeys?: undefined;
141
+ pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
142
+ }): Pick<NonGroupingHierarchyNode, "search"> | undefined;
143
+ (props: {
144
+ parentKeys?: undefined;
145
+ asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
146
+ }): Promise<Pick<NonGroupingHierarchyNode, "search"> | undefined> | Pick<NonGroupingHierarchyNode, "search"> | undefined;
147
+ (props: {
148
+ parentKeys: HierarchyNodeKey[];
149
+ nodeKey: InstancesNodeKey | GenericNodeKey;
150
+ }): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
151
+ (props: {
152
+ parentKeys: HierarchyNodeKey[];
153
+ pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
154
+ }): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
155
+ (props: {
156
+ parentKeys: HierarchyNodeKey[];
157
+ asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
158
+ }): Promise<Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined> | Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
159
+ };
160
+ };
161
+ /** @internal */
162
+ export declare function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }: {
163
+ reveal: HierarchySearchPathOptions["reveal"];
164
+ nodePositionInPath: number;
165
+ nodePositionInHierarchy: number;
166
+ }): boolean;
167
+ //# sourceMappingURL=HierarchySearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchySearch.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA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