@itwin/presentation-hierarchies 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +4 -3
  3. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +48 -3
  4. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -1
  5. package/lib/cjs/hierarchies/HierarchyFiltering.js +137 -2
  6. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -1
  7. package/lib/cjs/hierarchies/HierarchyNode.d.ts +1 -0
  8. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNode.js +3 -0
  10. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +45 -8
  12. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  13. package/lib/cjs/hierarchies/HierarchyProvider.js +7 -6
  14. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  15. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +3 -6
  16. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
  17. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +134 -181
  18. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
  19. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +2 -0
  20. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  21. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +16 -8
  22. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  23. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  24. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  25. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +1 -1
  26. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +12 -0
  28. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  29. package/lib/cjs/hierarchies/internal/Common.d.ts +14 -0
  30. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  31. package/lib/cjs/hierarchies/internal/Common.js +18 -0
  32. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  33. package/lib/cjs/presentation-hierarchies.d.ts +1 -1
  34. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  35. package/lib/cjs/presentation-hierarchies.js +3 -2
  36. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  37. package/lib/esm/hierarchies/HierarchyFiltering.d.ts +48 -3
  38. package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -1
  39. package/lib/esm/hierarchies/HierarchyFiltering.js +136 -2
  40. package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -1
  41. package/lib/esm/hierarchies/HierarchyNode.d.ts +1 -0
  42. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  43. package/lib/esm/hierarchies/HierarchyNode.js +3 -0
  44. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  45. package/lib/esm/hierarchies/HierarchyProvider.d.ts +45 -8
  46. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  47. package/lib/esm/hierarchies/HierarchyProvider.js +8 -7
  48. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  49. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +3 -6
  50. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
  51. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +132 -180
  52. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
  53. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +2 -0
  54. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  55. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +16 -8
  56. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  57. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  58. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  59. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +1 -1
  60. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  61. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +12 -0
  62. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  63. package/lib/esm/hierarchies/internal/Common.d.ts +14 -0
  64. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  65. package/lib/esm/hierarchies/internal/Common.js +17 -0
  66. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  67. package/lib/esm/presentation-hierarchies.d.ts +1 -1
  68. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  69. package/lib/esm/presentation-hierarchies.js +1 -1
  70. package/lib/esm/presentation-hierarchies.js.map +1 -1
  71. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"PredicateBasedHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/PredicateBasedHierarchyDefinition.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAe,MAAM,4BAA4B,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,yBAAyB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AAG,0CAA0C,GAAG,wCAAwC,CAAC;AAEpI;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;AAE1F;;;GAGG;AACH,UAAU,sCAAsC;IAC9C,gDAAgD;IAChD,uBAAuB,EAAE,yBAAyB,CAAC;IAEnD,kCAAkC;IAClC,SAAS,EAAE;QACT,4DAA4D;QAC5D,SAAS,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAEvF;;;WAGG;QACH,UAAU,EAAE,sCAAsC,EAAE,CAAC;KACtD,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE,sCAAsC,GAAG,mBAAmB,CAE1H"}
1
+ {"version":3,"file":"PredicateBasedHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/PredicateBasedHierarchyDefinition.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAe,MAAM,4BAA4B,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,wBAAwB,EAIzB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,0CAA0C,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,GAAG;IACvG,gCAAgC;IAChC,UAAU,EAAE,IAAI,CAAC,6BAA6B,EAAE,KAAK,CAAC,GAAG;QAAE,GAAG,EAAE,gBAAgB,CAAA;KAAE,CAAC;IAEnF;;;;;;;OAOG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;;;;;;OAOG;IACH,qBAAqB,EAAE,UAAU,EAAE,CAAC;CACrC,CAAC;AAEF;;;;G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EvF;;;WAGG;QACH,UAAU,EAAE,sCAAsC,EAAE,CAAC;KACtD,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE,sCAAsC,GAAG,mBAAmB,CAE1H"}
@@ -19,8 +19,20 @@ function createPredicateBasedHierarchyDefinition(props) {
19
19
  }
20
20
  class PredicateBasedHierarchyDefinition {
21
21
  _props;
22
+ parseNode;
23
+ preProcessNode;
24
+ postProcessNode;
22
25
  constructor(_props) {
23
26
  this._props = _props;
27
+ if (this._props.parseNode) {
28
+ this.parseNode = this._props.parseNode;
29
+ }
30
+ if (this._props.preProcessNode) {
31
+ this.preProcessNode = this._props.preProcessNode;
32
+ }
33
+ if (this._props.postProcessNode) {
34
+ this.postProcessNode = this._props.postProcessNode;
35
+ }
24
36
  }
25
37
  /**
26
38
  * Create hierarchy level definitions for specific hierarchy level.
@@ -1 +1 @@
1
- {"version":3,"file":"PredicateBasedHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/PredicateBasedHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwJhG,0FAEC;AAxJD,+BAA4F;AAG5F,0DAAoD;AA4IpD;;;;;;GAMG;AACH,SAAgB,uCAAuC,CAAC,KAA6C;IACnG,OAAO,IAAI,iCAAiC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,iCAAiC;IACV;IAA3B,YAA2B,MAA8C;QAA9C,WAAM,GAAN,MAAM,CAAwC;IAAG,CAAC;IAE7E;;;OAGG;IACI,KAAK,CAAC,oBAAoB,CAAC,KAAgC;QAChE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;QAE7B,IAAI,UAAU,IAAI,gCAAa,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;YACtD,OAAO,IAAA,qBAAc,EACnB,IAAA,WAAI,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAA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IAAI,GAAG,EAAwB,CAAC;IAC3D,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC3B,IAAI,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,EAAE,CAAC;YACjB,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,SAAS,0CAA0C,CAAC,GAA2C;IAC7F,OAAO,CAAC,CAAE,GAAgD,CAAC,0BAA0B,CAAC;AACxF,CAAC;AAED,SAAS,4CAA4C,CAAC,GAA2C;IAC/F,OAAO,CAAC,CAAE,GAAkD,CAAC,4BAA4B,CAAC;AAC5F,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concatMap, filter, firstValueFrom, from, mergeAll, mergeMap, toArray } from \"rxjs\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyDefinitionParentNode, HierarchyLevelDefinition } from \"./IModelHierarchyDefinition.js\";\n\n/**\n * Props for defining child hierarchy level for specific parent instance node.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineInstanceNodeChildHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\"> & {\n /** The parent instance node. */\n parentNode: Omit<HierarchyDefinitionParentNode, \"key\"> & { key: InstancesNodeKey };\n\n /**\n * Full name of the parent instance node class.\n *\n * The `parentNode.key` also contains information about the instances the parent node is based on. However,\n * an instance node may be based on instances of multiple classes. In case that happens, parent node's instance\n * keys are grouped by class and a hierarchy level definition is requested for each combination of class and\n * instance IDs (with the same `parentNode`).\n */\n parentNodeClassName: string;\n\n /**\n * ECInstanceIds of the parent instance node.\n *\n * The `parentNode.key` also contains information about the instances the parent node is based on. However,\n * an instance node may be based on instances of multiple classes. In case that happens, parent node's instance\n * keys are grouped by class and a hierarchy level definition is requested for each combination of class and\n * instance IDs (with the same `parentNode`).\n */\n parentNodeInstanceIds: Id64String[];\n};\n\n/**\n * A definition of a hierarchy level that should be used for specific parent instance nodes.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ninterface InstancesNodeChildHierarchyLevelDefinition {\n /**\n * A predicate for matching the parent instances node. This can be either a string or a predicate function:\n *\n * - The string version should specify full name of the parent instance node's class to match against when\n * checking if this hierarchy level should be used for specific parent instance node. The check is polymorphic,\n * so `BisCore.Element` class would match `BisCore.GeometricElement`, `BisCore.Category` and all other element classes.\n *\n * - The function version should return a boolean indicating whether this hierarchy level definition should be used\n * for the given parent node.\n */\n parentInstancesNodePredicate: string | ((parentNodeKey: InstancesNodeKey) => Promise<boolean>);\n\n /**\n * Called to create a hierarchy level definition when the `parentInstancesNodePredicate` predicate passes.\n */\n definitions: (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n\n /**\n * If set to true, and node matches at least one of the previous definitions, this definition will not be applied.\n *\n * For example:\n * ```ts\n * {\n * parentInstancesNodePredicate: \"BisCore.GeometricElement3d\",\n * definitions: () => ...,\n * },\n * // This will apply to all elements, that are not `BisCore.GeometricElement3d`\n * {\n * parentInstancesNodePredicate: \"BisCore.Element\",\n * onlyIfNotHandled: true,\n * definitions: () => ...,\n * }\n * ```\n */\n onlyIfNotHandled?: boolean;\n}\n\n/**\n * Props for defining child hierarchy level for specific generic parent node.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineGenericNodeChildHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\"> & {\n /** The parent generic node. */\n parentNode: Omit<HierarchyDefinitionParentNode, \"key\"> & { key: GenericNodeKey };\n};\n\n/**\n * A definition of a hierarchy level for that should be used for specific generic parent nodes.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ninterface GenericNodeChildHierarchyLevelDefinition {\n /**\n * A function that indicates whether this hierarchy level definition should be used for\n * specific parent generic node.\n */\n parentGenericNodePredicate: (parentNodeKey: GenericNodeKey) => Promise<boolean>;\n\n /**\n * Called to create a hierarchy level definition when the `parentInstancesNodePredicate` predicate passes.\n */\n definitions: (requestProps: DefineGenericNodeChildHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n}\n\n/**\n * A hierarchy level definition associated with specific parent instance or generic node. *\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ntype PredicateBasedHierarchyLevelDefinition = InstancesNodeChildHierarchyLevelDefinition | GenericNodeChildHierarchyLevelDefinition;\n\n/**\n * Props for defining root hierarchy level.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineRootHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\">;\n\n/**\n * Props for `createPredicateBasedHierarchyDefinition`.\n * @public\n */\ninterface PredicateBasedHierarchyDefinitionProps {\n /** Access to ECClass hierarchy in the iModel */\n classHierarchyInspector: ECClassHierarchyInspector;\n\n /** Hierarchy level definitions */\n hierarchy: {\n /** Called to create the root hierarchy level definition. */\n rootNodes: (props: DefineRootHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n\n /**\n * A list of child hierarchy level definitions. The list is first filtered based on\n * the parent node and then is used to create child hierarchy level definitions.\n */\n childNodes: PredicateBasedHierarchyLevelDefinition[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyDefinition` that uses a somewhat declarative approach to define the\n * hierarchy - each hierarchy level is defined by specifying a parent node predicate and child hierarchy\n * level definitions, that are used when the predicate passes.\n *\n * @public\n */\nexport function createPredicateBasedHierarchyDefinition(props: PredicateBasedHierarchyDefinitionProps): HierarchyDefinition {\n return new PredicateBasedHierarchyDefinition(props);\n}\n\nclass PredicateBasedHierarchyDefinition implements HierarchyDefinition {\n public constructor(private _props: PredicateBasedHierarchyDefinitionProps) {}\n\n /**\n * Create hierarchy level definitions for specific hierarchy level.\n * @param parentNode Parent node to create children definitions for.\n */\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const { parentNode } = props;\n\n if (parentNode && HierarchyNode.isGeneric(parentNode)) {\n return firstValueFrom(\n from(this._props.hierarchy.childNodes).pipe(\n filter(isGenericNodeChildHierarchyLevelDefinition),\n mergeMap(async (def) => {\n if (await def.parentGenericNodePredicate(parentNode.key)) {\n return def.definitions({ ...props, parentNode });\n }\n return [];\n }),\n mergeAll(),\n toArray(),\n ),\n );\n }\n\n if (parentNode && HierarchyNode.isInstancesNode(parentNode)) {\n const instancesParentNodeDefs = this._props.hierarchy.childNodes.filter(isInstancesNodeChildHierarchyLevelDefinition);\n return firstValueFrom(\n from(groupInstanceIdsByClass(parentNode.key.instanceKeys).entries()).pipe(\n mergeMap(async ([parentNodeClassName, parentNodeInstanceIds]) =>\n createHierarchyLevelDefinitions(this._props.classHierarchyInspector, instancesParentNodeDefs, {\n ...props,\n parentNodeClassName,\n parentNodeInstanceIds,\n parentNode,\n }),\n ),\n mergeAll(),\n toArray(),\n ),\n );\n }\n\n return this._props.hierarchy.rootNodes(props);\n }\n}\n\nasync function createHierarchyLevelDefinitions(\n classHierarchy: ECClassHierarchyInspector,\n defs: InstancesNodeChildHierarchyLevelDefinition[],\n requestProps: DefineInstanceNodeChildHierarchyLevelProps,\n) {\n return from(defs).pipe(\n mergeMap(async (def, idx) => {\n if (\n typeof def.parentInstancesNodePredicate === \"string\" &&\n (await classHierarchy.classDerivesFrom(requestProps.parentNodeClassName, def.parentInstancesNodePredicate))\n ) {\n return { def, idx };\n }\n if (typeof def.parentInstancesNodePredicate === \"function\" && (await def.parentInstancesNodePredicate(requestProps.parentNode.key))) {\n return { def, idx };\n }\n return undefined;\n }),\n filter((x): x is Exclude<typeof x, undefined> => !!x),\n toArray(),\n concatMap((x) => x.sort((a, b) => a.idx - b.idx).map(({ def }) => def)),\n filter((def, idx) => !def.onlyIfNotHandled || idx === 0),\n mergeMap(async (def) => def.definitions(requestProps)),\n mergeAll(),\n );\n}\n\nfunction groupInstanceIdsByClass(instanceKeys: InstanceKey[]) {\n const instanceIdsByClass = new Map<string, Id64String[]>();\n instanceKeys.forEach((key) => {\n let instanceIds = instanceIdsByClass.get(key.className);\n if (!instanceIds) {\n instanceIds = [];\n instanceIdsByClass.set(key.className, instanceIds);\n }\n instanceIds.push(key.id);\n });\n return instanceIdsByClass;\n}\n\nfunction isGenericNodeChildHierarchyLevelDefinition(def: PredicateBasedHierarchyLevelDefinition): def is GenericNodeChildHierarchyLevelDefinition {\n return !!(def as GenericNodeChildHierarchyLevelDefinition).parentGenericNodePredicate;\n}\n\nfunction isInstancesNodeChildHierarchyLevelDefinition(def: PredicateBasedHierarchyLevelDefinition): def is InstancesNodeChildHierarchyLevelDefinition {\n return !!(def as InstancesNodeChildHierarchyLevelDefinition).parentInstancesNodePredicate;\n}\n"]}
1
+ {"version":3,"file":"PredicateBasedHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/PredicateBasedHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAgKhG,0FAEC;AAhKD,+BAA4F;AAG5F,0DAAoD;AAoJpD;;;;;;GAMG;AACH,SAAgB,uCAAuC,CAAC,KAA6C;IACnG,OAAO,IAAI,iCAAiC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,iCAAiC;IAKV;IAJpB,SAAS,CAAyB;IAClC,cAAc,CAA+B;I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;IAC7F,OAAO,CAAC,CAAE,GAAgD,CAAC,0BAA0B,CAAC;AACxF,CAAC;AAED,SAAS,4CAA4C,CAAC,GAA2C;IAC/F,OAAO,CAAC,CAAE,GAAkD,CAAC,4BAA4B,CAAC;AAC5F,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concatMap, filter, firstValueFrom, from, mergeAll, mergeMap, toArray } from \"rxjs\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport {\n DefineHierarchyLevelProps,\n HierarchyDefinition,\n HierarchyDefinitionParentNode,\n HierarchyLevelDefinition,\n NodeParser,\n NodePostProcessor,\n NodePreProcessor,\n} from \"./IModelHierarchyDefinition.js\";\n\n/**\n * Props for defining child hierarchy level for specific parent instance node.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineInstanceNodeChildHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\"> & {\n /** The parent instance node. */\n parentNode: Omit<HierarchyDefinitionParentNode, \"key\"> & { key: InstancesNodeKey };\n\n /**\n * Full name of the parent instance node class.\n *\n * The `parentNode.key` also contains information about the instances the parent node is based on. However,\n * an instance node may be based on instances of multiple classes. In case that happens, parent node's instance\n * keys are grouped by class and a hierarchy level definition is requested for each combination of class and\n * instance IDs (with the same `parentNode`).\n */\n parentNodeClassName: string;\n\n /**\n * ECInstanceIds of the parent instance node.\n *\n * The `parentNode.key` also contains information about the instances the parent node is based on. However,\n * an instance node may be based on instances of multiple classes. In case that happens, parent node's instance\n * keys are grouped by class and a hierarchy level definition is requested for each combination of class and\n * instance IDs (with the same `parentNode`).\n */\n parentNodeInstanceIds: Id64String[];\n};\n\n/**\n * A definition of a hierarchy level that should be used for specific parent instance nodes.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ninterface InstancesNodeChildHierarchyLevelDefinition {\n /**\n * A predicate for matching the parent instances node. This can be either a string or a predicate function:\n *\n * - The string version should specify full name of the parent instance node's class to match against when\n * checking if this hierarchy level should be used for specific parent instance node. The check is polymorphic,\n * so `BisCore.Element` class would match `BisCore.GeometricElement`, `BisCore.Category` and all other element classes.\n *\n * - The function version should return a boolean indicating whether this hierarchy level definition should be used\n * for the given parent node.\n */\n parentInstancesNodePredicate: string | ((parentNodeKey: InstancesNodeKey) => Promise<boolean>);\n\n /**\n * Called to create a hierarchy level definition when the `parentInstancesNodePredicate` predicate passes.\n */\n definitions: (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n\n /**\n * If set to true, and node matches at least one of the previous definitions, this definition will not be applied.\n *\n * For example:\n * ```ts\n * {\n * parentInstancesNodePredicate: \"BisCore.GeometricElement3d\",\n * definitions: () => ...,\n * },\n * // This will apply to all elements, that are not `BisCore.GeometricElement3d`\n * {\n * parentInstancesNodePredicate: \"BisCore.Element\",\n * onlyIfNotHandled: true,\n * definitions: () => ...,\n * }\n * ```\n */\n onlyIfNotHandled?: boolean;\n}\n\n/**\n * Props for defining child hierarchy level for specific generic parent node.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineGenericNodeChildHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\"> & {\n /** The parent generic node. */\n parentNode: Omit<HierarchyDefinitionParentNode, \"key\"> & { key: GenericNodeKey };\n};\n\n/**\n * A definition of a hierarchy level for that should be used for specific generic parent nodes.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ninterface GenericNodeChildHierarchyLevelDefinition {\n /**\n * A function that indicates whether this hierarchy level definition should be used for\n * specific parent generic node.\n */\n parentGenericNodePredicate: (parentNodeKey: GenericNodeKey) => Promise<boolean>;\n\n /**\n * Called to create a hierarchy level definition when the `parentInstancesNodePredicate` predicate passes.\n */\n definitions: (requestProps: DefineGenericNodeChildHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n}\n\n/**\n * A hierarchy level definition associated with specific parent instance or generic node. *\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\ntype PredicateBasedHierarchyLevelDefinition = InstancesNodeChildHierarchyLevelDefinition | GenericNodeChildHierarchyLevelDefinition;\n\n/**\n * Props for defining root hierarchy level.\n * @see `createPredicateBasedHierarchyDefinition`\n * @public\n */\nexport type DefineRootHierarchyLevelProps = Omit<DefineHierarchyLevelProps, \"parentNode\">;\n\n/**\n * Props for `createPredicateBasedHierarchyDefinition`.\n * @public\n */\ninterface PredicateBasedHierarchyDefinitionProps extends Pick<HierarchyDefinition, \"parseNode\" | \"preProcessNode\" | \"postProcessNode\"> {\n /** Access to ECClass hierarchy in the iModel */\n classHierarchyInspector: ECClassHierarchyInspector;\n\n /** Hierarchy level definitions */\n hierarchy: {\n /** Called to create the root hierarchy level definition. */\n rootNodes: (props: DefineRootHierarchyLevelProps) => Promise<HierarchyLevelDefinition>;\n\n /**\n * A list of child hierarchy level definitions. The list is first filtered based on\n * the parent node and then is used to create child hierarchy level definitions.\n */\n childNodes: PredicateBasedHierarchyLevelDefinition[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyDefinition` that uses a somewhat declarative approach to define the\n * hierarchy - each hierarchy level is defined by specifying a parent node predicate and child hierarchy\n * level definitions, that are used when the predicate passes.\n *\n * @public\n */\nexport function createPredicateBasedHierarchyDefinition(props: PredicateBasedHierarchyDefinitionProps): HierarchyDefinition {\n return new PredicateBasedHierarchyDefinition(props);\n}\n\nclass PredicateBasedHierarchyDefinition implements HierarchyDefinition {\n public parseNode: NodeParser | undefined;\n public preProcessNode: NodePreProcessor | undefined;\n public postProcessNode: NodePostProcessor | undefined;\n\n public constructor(private _props: PredicateBasedHierarchyDefinitionProps) {\n if (this._props.parseNode) {\n this.parseNode = this._props.parseNode;\n }\n if (this._props.preProcessNode) {\n this.preProcessNode = this._props.preProcessNode;\n }\n if (this._props.postProcessNode) {\n this.postProcessNode = this._props.postProcessNode;\n }\n }\n\n /**\n * Create hierarchy level definitions for specific hierarchy level.\n * @param parentNode Parent node to create children definitions for.\n */\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const { parentNode } = props;\n\n if (parentNode && HierarchyNode.isGeneric(parentNode)) {\n return firstValueFrom(\n from(this._props.hierarchy.childNodes).pipe(\n filter(isGenericNodeChildHierarchyLevelDefinition),\n mergeMap(async (def) => {\n if (await def.parentGenericNodePredicate(parentNode.key)) {\n return def.definitions({ ...props, parentNode });\n }\n return [];\n }),\n mergeAll(),\n toArray(),\n ),\n );\n }\n\n if (parentNode && HierarchyNode.isInstancesNode(parentNode)) {\n const instancesParentNodeDefs = this._props.hierarchy.childNodes.filter(isInstancesNodeChildHierarchyLevelDefinition);\n return firstValueFrom(\n from(groupInstanceIdsByClass(parentNode.key.instanceKeys).entries()).pipe(\n mergeMap(async ([parentNodeClassName, parentNodeInstanceIds]) =>\n createHierarchyLevelDefinitions(this._props.classHierarchyInspector, instancesParentNodeDefs, {\n ...props,\n parentNodeClassName,\n parentNodeInstanceIds,\n parentNode,\n }),\n ),\n mergeAll(),\n toArray(),\n ),\n );\n }\n\n return this._props.hierarchy.rootNodes(props);\n }\n}\n\nasync function createHierarchyLevelDefinitions(\n classHierarchy: ECClassHierarchyInspector,\n defs: InstancesNodeChildHierarchyLevelDefinition[],\n requestProps: DefineInstanceNodeChildHierarchyLevelProps,\n) {\n return from(defs).pipe(\n mergeMap(async (def, idx) => {\n if (\n typeof def.parentInstancesNodePredicate === \"string\" &&\n (await classHierarchy.classDerivesFrom(requestProps.parentNodeClassName, def.parentInstancesNodePredicate))\n ) {\n return { def, idx };\n }\n if (typeof def.parentInstancesNodePredicate === \"function\" && (await def.parentInstancesNodePredicate(requestProps.parentNode.key))) {\n return { def, idx };\n }\n return undefined;\n }),\n filter((x): x is Exclude<typeof x, undefined> => !!x),\n toArray(),\n concatMap((x) => x.sort((a, b) => a.idx - b.idx).map(({ def }) => def)),\n filter((def, idx) => !def.onlyIfNotHandled || idx === 0),\n mergeMap(async (def) => def.definitions(requestProps)),\n mergeAll(),\n );\n}\n\nfunction groupInstanceIdsByClass(instanceKeys: InstanceKey[]) {\n const instanceIdsByClass = new Map<string, Id64String[]>();\n instanceKeys.forEach((key) => {\n let instanceIds = instanceIdsByClass.get(key.className);\n if (!instanceIds) {\n instanceIds = [];\n instanceIdsByClass.set(key.className, instanceIds);\n }\n instanceIds.push(key.id);\n });\n return instanceIdsByClass;\n}\n\nfunction isGenericNodeChildHierarchyLevelDefinition(def: PredicateBasedHierarchyLevelDefinition): def is GenericNodeChildHierarchyLevelDefinition {\n return !!(def as GenericNodeChildHierarchyLevelDefinition).parentGenericNodePredicate;\n}\n\nfunction isInstancesNodeChildHierarchyLevelDefinition(def: PredicateBasedHierarchyLevelDefinition): def is InstancesNodeChildHierarchyLevelDefinition {\n return !!(def as InstancesNodeChildHierarchyLevelDefinition).parentInstancesNodePredicate;\n}\n"]}
@@ -40,4 +40,18 @@ export declare function compareNodesByLabel<TLhsNode extends {
40
40
  }, TRhsNode extends {
41
41
  label: string;
42
42
  }>(lhs: TLhsNode, rhs: TRhsNode): number;
43
+ /**
44
+ * A helper that disposes the given object, if it's disposable.
45
+ *
46
+ * The first option is to dispose using the deprecated `dispose` method if it exists on the object.
47
+ * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is
48
+ * considered as non-disposable and nothing is done with it.
49
+ *
50
+ * @internal
51
+ */
52
+ export declare function safeDispose(disposable: {} | {
53
+ [Symbol.dispose]: () => void;
54
+ } | {
55
+ dispose: () => void;
56
+ }): void;
43
57
  //# sourceMappingURL=Common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.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atorLoggingNamespace = createOperatorLoggingNamespace;
12
12
  exports.createNodeIdentifierForLogging = createNodeIdentifierForLogging;
13
13
  exports.hasChildren = hasChildren;
14
14
  exports.compareNodesByLabel = compareNodesByLabel;
15
+ exports.safeDispose = safeDispose;
15
16
  const natural_compare_lite_1 = __importDefault(require("natural-compare-lite"));
16
17
  /**
17
18
  * This is a logging namespace for public log messages that may be interesting to consumers.
@@ -58,4 +59,21 @@ function hasChildren(node) {
58
59
  function compareNodesByLabel(lhs, rhs) {
59
60
  return (0, natural_compare_lite_1.default)(lhs.label.toLocaleLowerCase(), rhs.label.toLocaleLowerCase());
60
61
  }
62
+ /**
63
+ * A helper that disposes the given object, if it's disposable.
64
+ *
65
+ * The first option is to dispose using the deprecated `dispose` method if it exists on the object.
66
+ * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is
67
+ * considered as non-disposable and nothing is done with it.
68
+ *
69
+ * @internal
70
+ */
71
+ function safeDispose(disposable) {
72
+ if ("dispose" in disposable) {
73
+ disposable.dispose();
74
+ }
75
+ else if (Symbol.dispose in disposable) {
76
+ disposable[Symbol.dispose]();
77
+ }
78
+ }
61
79
  //# sourceMappingURL=Common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;AAiChG,wEASC;AAID,wEASC;AAID,kCAEC;AAGD,kDAEC;AAhED,gFAAkD;AAIlD;;;GAGG;AACU,QAAA,iBAAiB,GAAG,0BAA0B,CAAC;AAE5D;;;GAGG;AACU,QAAA,6BAA6B,GAAG,GAAG,yBAAiB,cAAc,CAAC;AAEhF;;;;GAIG;AACU,QAAA,0BAA0B,GAAG,kCAAkC,CAAC;AAE7E;;;;GAIG;AACU,QAAA,sCAAsC,GAAG,GAAG,kCAA0B,cAAc,CAAC;AAElG,gBAAgB;AAChB,SAAgB,8BAA8B,CAC5C,YAAoB,EACpB,YAIiD;IAEjD,OAAO,GAAG,YAAY,cAAc,YAAY,EAAE,CAAC;AACrD,CAAC;AAED,gBAAgB;AAChB,qBAAqB;AACrB,SAAgB,8BAA8B,CAC5C,IAA+G;IAE/G,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;IACxE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;AACpD,CAAC;AACD,mBAAmB;AAEnB,gBAAgB;AAChB,SAAgB,WAAW,CAAwD,IAAW;IAC5F,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,gBAAgB;AAChB,SAAgB,mBAAmB,CAAyE,GAAa,EAAE,GAAa;IACtI,OAAO,IAAA,8BAAc,EAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtF,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 naturalCompare from \"natural-compare-lite\";\nimport { ConcatenatedValue } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * This is a logging namespace for public log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE = \"Presentation.Hierarchies\";\n\n/**\n * This is a logging namespace for public performance-related log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE = `${LOGGING_NAMESPACE}.Performance`;\n\n/**\n * This is a logging namespace for internal log messages that are only interesting to package contributors,\n * but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_INTERNAL = \"Presentation.HierarchiesInternal\";\n\n/**\n * This is a logging namespace for internal performance-related log messages that are only interesting\n * to package contributors, but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = `${LOGGING_NAMESPACE_INTERNAL}.Performance`;\n\n/** @internal */\nexport function createOperatorLoggingNamespace(\n operatorName: string,\n baseCategory:\n | typeof LOGGING_NAMESPACE\n | typeof LOGGING_NAMESPACE_PERFORMANCE\n | typeof LOGGING_NAMESPACE_INTERNAL\n | typeof LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n) {\n return `${baseCategory}.Operators.${operatorName}`;\n}\n\n/** @internal */\n/* c8 ignore start */\nexport function createNodeIdentifierForLogging(\n node: { label: string | ConcatenatedValue; key: HierarchyNodeKey; parentKeys?: HierarchyNodeKey[] } | undefined,\n) {\n if (!node) {\n return \"<root>\";\n }\n const { label, key } = node;\n const parentKeys = \"parentKeys\" in node ? node.parentKeys : \"<unknown>\";\n return JSON.stringify({ label, key, parentKeys });\n}\n/* c8 ignore end */\n\n/** @internal */\nexport function hasChildren<TNode extends { children?: boolean | Array<unknown> }>(node: TNode) {\n return node.children === true || (Array.isArray(node.children) && node.children.length > 0);\n}\n\n/** @internal */\nexport function compareNodesByLabel<TLhsNode extends { label: string }, TRhsNode extends { label: string }>(lhs: TLhsNode, rhs: TRhsNode): number {\n return naturalCompare(lhs.label.toLocaleLowerCase(), rhs.label.toLocaleLowerCase());\n}\n"]}
1
+ {"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;AAiChG,wEASC;AAID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KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAC,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,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 naturalCompare from \"natural-compare-lite\";\nimport { ConcatenatedValue } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * This is a logging namespace for public log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE = \"Presentation.Hierarchies\";\n\n/**\n * This is a logging namespace for public performance-related log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE = `${LOGGING_NAMESPACE}.Performance`;\n\n/**\n * This is a logging namespace for internal log messages that are only interesting to package contributors,\n * but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_INTERNAL = \"Presentation.HierarchiesInternal\";\n\n/**\n * This is a logging namespace for internal performance-related log messages that are only interesting\n * to package contributors, but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = `${LOGGING_NAMESPACE_INTERNAL}.Performance`;\n\n/** @internal */\nexport function createOperatorLoggingNamespace(\n operatorName: string,\n baseCategory:\n | typeof LOGGING_NAMESPACE\n | typeof LOGGING_NAMESPACE_PERFORMANCE\n | typeof LOGGING_NAMESPACE_INTERNAL\n | typeof LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n) {\n return `${baseCategory}.Operators.${operatorName}`;\n}\n\n/** @internal */\n/* c8 ignore start */\nexport function createNodeIdentifierForLogging(\n node: { label: string | ConcatenatedValue; key: HierarchyNodeKey; parentKeys?: HierarchyNodeKey[] } | undefined,\n) {\n if (!node) {\n return \"<root>\";\n }\n const { label, key } = node;\n const parentKeys = \"parentKeys\" in node ? node.parentKeys : \"<unknown>\";\n return JSON.stringify({ label, key, parentKeys });\n}\n/* c8 ignore end */\n\n/** @internal */\nexport function hasChildren<TNode extends { children?: boolean | Array<unknown> }>(node: TNode) {\n return node.children === true || (Array.isArray(node.children) && node.children.length > 0);\n}\n\n/** @internal */\nexport function compareNodesByLabel<TLhsNode extends { label: string }, TRhsNode extends { label: string }>(lhs: TLhsNode, rhs: TRhsNode): number {\n return naturalCompare(lhs.label.toLocaleLowerCase(), rhs.label.toLocaleLowerCase());\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
@@ -10,6 +10,6 @@ export { GroupingHierarchyNode, HierarchyNode, NonGroupingHierarchyNode } from "
10
10
  export { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from "./hierarchies/HierarchyNodeIdentifier.js";
11
11
  export { GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, InstancesNodeKey, ClassGroupingNodeKey, LabelGroupingNodeKey, PropertyGroupingNodeKey, PropertyOtherValuesGroupingNodeKey, PropertyValueGroupingNodeKey, PropertyValueRangeGroupingNodeKey, IModelHierarchyNodeKey, } from "./hierarchies/HierarchyNodeKey.js";
12
12
  export { GetHierarchyNodesProps, HierarchyProvider, mergeProviders } from "./hierarchies/HierarchyProvider.js";
13
- export { HierarchyFilteringPath, extractFilteringProps } from "./hierarchies/HierarchyFiltering.js";
13
+ export { createHierarchyFilteringHelper, extractFilteringProps, HierarchyFilteringPath, HierarchyFilteringPathOptions, } from "./hierarchies/HierarchyFiltering.js";
14
14
  export { getLogger, setLogger } from "./hierarchies/Logging.js";
15
15
  //# sourceMappingURL=presentation-hierarchies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-hierarchies.d.ts","sourceRoot":"","sources":["../../src/presentation-hierarchies.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,yCAAyC,EACzC,0CAA0C,EAC1C,6BAA6B,EAC7B,uCAAuC,GACxC,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AAClI,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AACrJ,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACjH,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"presentation-hierarchies.d.ts","sourceRoot":"","sources":["../../src/presentation-hierarchies.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,yCAAyC,EACzC,0CAA0C,EAC1C,6BAA6B,EAC7B,uCAAuC,GACxC,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AAClI,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AACrJ,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACjH,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC/G,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
@@ -4,7 +4,7 @@
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.setLogger = exports.getLogger = exports.extractFilteringProps = exports.HierarchyFilteringPath = exports.mergeProviders = exports.HierarchyNodeKey = exports.HierarchyNodeIdentifier = exports.HierarchyNode = exports.RowsLimitExceededError = exports.ProcessedHierarchyNode = exports.createIModelHierarchyProvider = exports.createNodesQueryClauseFactory = exports.NodeSelectClauseColumnNames = exports.createLimitingECSqlQueryExecutor = exports.createPredicateBasedHierarchyDefinition = exports.HierarchyNodesDefinition = exports.GenericInstanceFilter = void 0;
7
+ exports.setLogger = exports.getLogger = exports.HierarchyFilteringPath = exports.extractFilteringProps = exports.createHierarchyFilteringHelper = exports.mergeProviders = exports.HierarchyNodeKey = exports.HierarchyNodeIdentifier = exports.HierarchyNode = exports.RowsLimitExceededError = exports.ProcessedHierarchyNode = exports.createIModelHierarchyProvider = exports.createNodesQueryClauseFactory = exports.NodeSelectClauseColumnNames = exports.createLimitingECSqlQueryExecutor = exports.createPredicateBasedHierarchyDefinition = exports.HierarchyNodesDefinition = exports.GenericInstanceFilter = void 0;
8
8
  var core_common_1 = require("@itwin/core-common");
9
9
  Object.defineProperty(exports, "GenericInstanceFilter", { enumerable: true, get: function () { return core_common_1.GenericInstanceFilter; } });
10
10
  var IModelHierarchyDefinition_js_1 = require("./hierarchies/imodel/IModelHierarchyDefinition.js");
@@ -31,8 +31,9 @@ Object.defineProperty(exports, "HierarchyNodeKey", { enumerable: true, get: func
31
31
  var HierarchyProvider_js_1 = require("./hierarchies/HierarchyProvider.js");
32
32
  Object.defineProperty(exports, "mergeProviders", { enumerable: true, get: function () { return HierarchyProvider_js_1.mergeProviders; } });
33
33
  var HierarchyFiltering_js_1 = require("./hierarchies/HierarchyFiltering.js");
34
- Object.defineProperty(exports, "HierarchyFilteringPath", { enumerable: true, get: function () { return HierarchyFiltering_js_1.HierarchyFilteringPath; } });
34
+ Object.defineProperty(exports, "createHierarchyFilteringHelper", { enumerable: true, get: function () { return HierarchyFiltering_js_1.createHierarchyFilteringHelper; } });
35
35
  Object.defineProperty(exports, "extractFilteringProps", { enumerable: true, get: function () { return HierarchyFiltering_js_1.extractFilteringProps; } });
36
+ Object.defineProperty(exports, "HierarchyFilteringPath", { enumerable: true, get: function () { return HierarchyFiltering_js_1.HierarchyFilteringPath; } });
36
37
  var Logging_js_1 = require("./hierarchies/Logging.js");
37
38
  Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return Logging_js_1.getLogger; } });
38
39
  Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return Logging_js_1.setLogger; } });
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-hierarchies.js","sourceRoot":"","sources":["../../src/presentation-hierarchies.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,kDAA2D;AAAlD,oHAAA,qBAAqB,OAAA;AAE9B,kGAQ2D;AAJzD,wIAAA,wBAAwB,OAAA;AAK1B,kHAKmE;AADjE,+JAAA,uCAAuC,OAAA;AAEzC,oGAAkI;AAA7F,iJAAA,gCAAgC,OAAA;AACrE,4FAAqJ;AAA5I,wIAAA,2BAA2B,OAAA;AAA2B,0IAAA,6BAA6B,OAAA;AAC5F,8FAAgG;AAAvF,2IAAA,6BAA6B,OAAA;AACtC,sFAA0G;AAA5E,gIAAA,sBAAsB,OAAA;AAEpD,uEAA0E;AAAjE,4HAAA,sBAAsB,OAAA;AAC/B,mEAAgH;AAAhF,iHAAA,aAAa,OAAA;AAC7C,uFAAiH;AAAxG,qIAAA,uBAAuB,OAAA;AAChC,yEAY2C;AATzC,uHAAA,gBAAgB,OAAA;AAUlB,2EAA+G;AAA3D,sHAAA,cAAc,OAAA;AAClE,6EAAoG;AAA3F,+HAAA,sBAAsB,OAAA;AAAE,8HAAA,qBAAqB,OAAA;AACtD,uDAAgE;AAAvD,uGAAA,SAAS,OAAA;AAAE,uGAAA,SAAS,OAAA","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\nexport { GenericInstanceFilter } from \"@itwin/core-common\";\n\nexport {\n DefineHierarchyLevelProps,\n HierarchyLevelDefinition,\n HierarchyDefinition,\n HierarchyNodesDefinition,\n NodeParser,\n NodePostProcessor,\n NodePreProcessor,\n} from \"./hierarchies/imodel/IModelHierarchyDefinition.js\";\nexport {\n DefineGenericNodeChildHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n createPredicateBasedHierarchyDefinition,\n} from \"./hierarchies/imodel/PredicateBasedHierarchyDefinition.js\";\nexport { LimitingECSqlQueryExecutor, createLimitingECSqlQueryExecutor } from \"./hierarchies/imodel/LimitingECSqlQueryExecutor.js\";\nexport { NodeSelectClauseColumnNames, NodesQueryClauseFactory, createNodesQueryClauseFactory } from \"./hierarchies/imodel/NodeSelectQueryFactory.js\";\nexport { createIModelHierarchyProvider } from \"./hierarchies/imodel/IModelHierarchyProvider.js\";\nexport { SourceHierarchyNode, ProcessedHierarchyNode } from \"./hierarchies/imodel/IModelHierarchyNode.js\";\n\nexport { RowsLimitExceededError } from \"./hierarchies/HierarchyErrors.js\";\nexport { GroupingHierarchyNode, HierarchyNode, NonGroupingHierarchyNode } from \"./hierarchies/HierarchyNode.js\";\nexport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./hierarchies/HierarchyNodeIdentifier.js\";\nexport {\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n InstancesNodeKey,\n ClassGroupingNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n IModelHierarchyNodeKey,\n} from \"./hierarchies/HierarchyNodeKey.js\";\nexport { GetHierarchyNodesProps, HierarchyProvider, mergeProviders } from \"./hierarchies/HierarchyProvider.js\";\nexport { HierarchyFilteringPath, extractFilteringProps } from \"./hierarchies/HierarchyFiltering.js\";\nexport { getLogger, setLogger } from \"./hierarchies/Logging.js\";\n"]}
1
+ {"version":3,"file":"presentation-hierarchies.js","sourceRoot":"","sources":["../../src/presentation-hierarchies.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,kDAA2D;AAAlD,oHAAA,qBAAqB,OAAA;AAE9B,kGAQ2D;AAJzD,wIAAA,wBAAwB,OAAA;AAK1B,kHAKmE;AADjE,+JAAA,uCAAuC,OAAA;AAEzC,oGAAkI;AAA7F,iJAAA,gCAAgC,OAAA;AACrE,4FAAqJ;AAA5I,wIAAA,2BAA2B,OAAA;AAA2B,0IAAA,6BAA6B,OAAA;AAC5F,8FAAgG;AAAvF,2IAAA,6BAA6B,OAAA;AACtC,sFAA0G;AAA5E,gIAAA,sBAAsB,OAAA;AAEpD,uEAA0E;AAAjE,4HAAA,sBAAsB,OAAA;AAC/B,mEAAgH;AAAhF,iHAAA,aAAa,OAAA;AAC7C,uFAAiH;AAAxG,qIAAA,uBAAuB,OAAA;AAChC,yEAY2C;AATzC,uHAAA,gBAAgB,OAAA;AAUlB,2EAA+G;AAA3D,sHAAA,cAAc,OAAA;AAClE,6EAK6C;AAJ3C,uIAAA,8BAA8B,OAAA;AAC9B,8HAAA,qBAAqB,OAAA;AACrB,+HAAA,sBAAsB,OAAA;AAGxB,uDAAgE;AAAvD,uGAAA,SAAS,OAAA;AAAE,uGAAA,SAAS,OAAA","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\nexport { GenericInstanceFilter } from \"@itwin/core-common\";\n\nexport {\n DefineHierarchyLevelProps,\n HierarchyLevelDefinition,\n HierarchyDefinition,\n HierarchyNodesDefinition,\n NodeParser,\n NodePostProcessor,\n NodePreProcessor,\n} from \"./hierarchies/imodel/IModelHierarchyDefinition.js\";\nexport {\n DefineGenericNodeChildHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n createPredicateBasedHierarchyDefinition,\n} from \"./hierarchies/imodel/PredicateBasedHierarchyDefinition.js\";\nexport { LimitingECSqlQueryExecutor, createLimitingECSqlQueryExecutor } from \"./hierarchies/imodel/LimitingECSqlQueryExecutor.js\";\nexport { NodeSelectClauseColumnNames, NodesQueryClauseFactory, createNodesQueryClauseFactory } from \"./hierarchies/imodel/NodeSelectQueryFactory.js\";\nexport { createIModelHierarchyProvider } from \"./hierarchies/imodel/IModelHierarchyProvider.js\";\nexport { SourceHierarchyNode, ProcessedHierarchyNode } from \"./hierarchies/imodel/IModelHierarchyNode.js\";\n\nexport { RowsLimitExceededError } from \"./hierarchies/HierarchyErrors.js\";\nexport { GroupingHierarchyNode, HierarchyNode, NonGroupingHierarchyNode } from \"./hierarchies/HierarchyNode.js\";\nexport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./hierarchies/HierarchyNodeIdentifier.js\";\nexport {\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n InstancesNodeKey,\n ClassGroupingNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n IModelHierarchyNodeKey,\n} from \"./hierarchies/HierarchyNodeKey.js\";\nexport { GetHierarchyNodesProps, HierarchyProvider, mergeProviders } from \"./hierarchies/HierarchyProvider.js\";\nexport {\n createHierarchyFilteringHelper,\n extractFilteringProps,\n HierarchyFilteringPath,\n HierarchyFilteringPathOptions,\n} from \"./hierarchies/HierarchyFiltering.js\";\nexport { getLogger, setLogger } from \"./hierarchies/Logging.js\";\n"]}
@@ -1,6 +1,6 @@
1
- import { NonGroupingHierarchyNode } from "./HierarchyNode.js";
2
- import { HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
3
- import { GroupingNodeKey } from "./HierarchyNodeKey.js";
1
+ import { HierarchyNode, NonGroupingHierarchyNode } from "./HierarchyNode.js";
2
+ import { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
3
+ import { GenericNodeKey, GroupingNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
4
4
  /** @public */
5
5
  export interface FilterTargetGroupingNodeInfo {
6
6
  /** Key of the grouping node. */
@@ -57,9 +57,54 @@ export declare namespace HierarchyFilteringPath {
57
57
  * An utility that extracts filtering properties from given root level filtering props or
58
58
  * the parent node. Returns `undefined` if filtering props are not present.
59
59
  * @public
60
+ * @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.
60
61
  */
61
62
  export declare function extractFilteringProps(rootLevelFilteringProps: HierarchyFilteringPath[], parentNode: Pick<NonGroupingHierarchyNode, "filtering"> | undefined): {
62
63
  filteredNodePaths: HierarchyFilteringPath[];
63
64
  hasFilterTargetAncestor: boolean;
64
65
  } | undefined;
66
+ /**
67
+ * Creates a set of utilities for making it easier to filter the given hierarchy
68
+ * level.
69
+ *
70
+ * @public
71
+ */
72
+ export declare function createHierarchyFilteringHelper(rootLevelFilteringProps: HierarchyFilteringPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "filtering"> | undefined): {
73
+ /**
74
+ * Returns a flag indicating if the hierarchy level is filtered.
75
+ */
76
+ hasFilter: boolean;
77
+ /**
78
+ * Returns a flag indicating whether this hierarchy level has an ancestor node
79
+ * that is a filter target. That generally means that this and all downstream hierarchy
80
+ * levels should be displayed without filter being applied to them, even if filter paths
81
+ * say otherwise.
82
+ */
83
+ hasFilterTargetAncestor: boolean;
84
+ /**
85
+ * Returns a list of hierarchy node identifiers that apply specifically for this
86
+ * hierarchy level. Returns `undefined` if filtering is not applied to this level.
87
+ */
88
+ getChildNodeFilteringIdentifiers: () => HierarchyNodeIdentifier[] | undefined;
89
+ /**
90
+ * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `filtering`
91
+ * and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates
92
+ * these props for a child node based on its key or path matcher.
93
+ *
94
+ * When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
95
+ * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
96
+ * `nodeKey` prop can be used to check the whole identifier.
97
+ */
98
+ createChildNodeProps: (props: {
99
+ nodeKey: InstancesNodeKey | GenericNodeKey;
100
+ } | {
101
+ pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
102
+ }) => Pick<HierarchyNode, "filtering" | "autoExpand"> | undefined;
103
+ /**
104
+ * Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.
105
+ */
106
+ createChildNodePropsAsync: (props: {
107
+ pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
108
+ }) => Promise<Pick<HierarchyNode, "filtering" | "autoExpand"> | undefined>;
109
+ };
65
110
  //# sourceMappingURL=HierarchyFiltering.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyFiltering.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,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OAEG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;IAWH;;;;;;;;OAQG;kCAGG;QACE,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAAC;KAC5C,GACD;QACE,WAAW,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,OAAO,CAAC;KAC/D,KACJ,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,YAAY,CAAC,GAAG,SAAS;IAoB9D;;OAEG;uCACsC;QACvC,WAAW,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KAClF,KAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC;EA2B3E"}
@@ -2,6 +2,8 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ import { HierarchyNodeIdentifier } from "./HierarchyNodeIdentifier.js";
6
+ import { HierarchyNodeKey } from "./HierarchyNodeKey.js";
5
7
  /** @public */
6
8
  // eslint-disable-next-line @typescript-eslint/no-redeclare
7
9
  export var HierarchyFilteringPath;
@@ -12,7 +14,7 @@ export var HierarchyFilteringPath;
12
14
  */
13
15
  function normalize(source) {
14
16
  if (Array.isArray(source)) {
15
- return { path: source, options: undefined };
17
+ return { path: source };
16
18
  }
17
19
  return source;
18
20
  }
@@ -56,10 +58,16 @@ export var HierarchyFilteringPath;
56
58
  * An utility that extracts filtering properties from given root level filtering props or
57
59
  * the parent node. Returns `undefined` if filtering props are not present.
58
60
  * @public
61
+ * @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.
59
62
  */
63
+ /* c8 ignore start */
60
64
  export function extractFilteringProps(rootLevelFilteringProps, parentNode) {
65
+ return extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);
66
+ }
67
+ /* c8 ignore end */
68
+ function extractFilteringPropsInternal(rootLevelFilteringProps, parentNode) {
61
69
  if (!parentNode) {
62
- return { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false };
70
+ return rootLevelFilteringProps ? { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false } : undefined;
63
71
  }
64
72
  return parentNode.filtering?.filteredChildrenIdentifierPaths
65
73
  ? {
@@ -68,4 +76,130 @@ export function extractFilteringProps(rootLevelFilteringProps, parentNode) {
68
76
  }
69
77
  : undefined;
70
78
  }
79
+ /**
80
+ * Creates a set of utilities for making it easier to filter the given hierarchy
81
+ * level.
82
+ *
83
+ * @public
84
+ */
85
+ export function createHierarchyFilteringHelper(rootLevelFilteringProps, parentNode) {
86
+ const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);
87
+ const hasFilter = !!filteringProps;
88
+ return {
89
+ /**
90
+ * Returns a flag indicating if the hierarchy level is filtered.
91
+ */
92
+ hasFilter,
93
+ /**
94
+ * Returns a flag indicating whether this hierarchy level has an ancestor node
95
+ * that is a filter target. That generally means that this and all downstream hierarchy
96
+ * levels should be displayed without filter being applied to them, even if filter paths
97
+ * say otherwise.
98
+ */
99
+ hasFilterTargetAncestor: filteringProps?.hasFilterTargetAncestor ?? false,
100
+ /**
101
+ * Returns a list of hierarchy node identifiers that apply specifically for this
102
+ * hierarchy level. Returns `undefined` if filtering is not applied to this level.
103
+ */
104
+ getChildNodeFilteringIdentifiers: () => {
105
+ if (!hasFilter) {
106
+ return undefined;
107
+ }
108
+ return filteringProps.filteredNodePaths
109
+ .map(HierarchyFilteringPath.normalize)
110
+ .filter(({ path }) => path.length > 0)
111
+ .map(({ path }) => path[0]);
112
+ },
113
+ /**
114
+ * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `filtering`
115
+ * and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates
116
+ * these props for a child node based on its key or path matcher.
117
+ *
118
+ * When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
119
+ * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
120
+ * `nodeKey` prop can be used to check the whole identifier.
121
+ */
122
+ createChildNodeProps: (props) => {
123
+ if (!hasFilter) {
124
+ return undefined;
125
+ }
126
+ const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);
127
+ filteringProps.filteredNodePaths.forEach((filteredPath) => {
128
+ const normalizedPath = HierarchyFilteringPath.normalize(filteredPath);
129
+ if ("nodeKey" in props &&
130
+ ((HierarchyNodeKey.isGeneric(props.nodeKey) && HierarchyNodeIdentifier.equal(normalizedPath.path[0], props.nodeKey)) ||
131
+ (HierarchyNodeKey.isInstances(props.nodeKey) && props.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik))))) {
132
+ reducer.accept(normalizedPath);
133
+ }
134
+ else if ("pathMatcher" in props && props.pathMatcher(normalizedPath.path[0])) {
135
+ reducer.accept(normalizedPath);
136
+ }
137
+ });
138
+ return reducer.getNodeProps();
139
+ },
140
+ /**
141
+ * Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.
142
+ */
143
+ createChildNodePropsAsync: async (props) => {
144
+ if (!hasFilter) {
145
+ return undefined;
146
+ }
147
+ const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);
148
+ for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {
149
+ const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);
150
+ /* c8 ignore next 3 */
151
+ if (normalizedPath.path.length === 0) {
152
+ continue;
153
+ }
154
+ const matchesPossiblyPromise = props.pathMatcher(normalizedPath.path[0]);
155
+ if (matchesPossiblyPromise instanceof Promise) {
156
+ if (!(await matchesPossiblyPromise)) {
157
+ continue;
158
+ }
159
+ }
160
+ if (!matchesPossiblyPromise) {
161
+ continue;
162
+ }
163
+ reducer.accept(normalizedPath);
164
+ }
165
+ return reducer.getNodeProps();
166
+ },
167
+ };
168
+ }
169
+ class MatchingFilteringPathsReducer {
170
+ _hasFilterTargetAncestor;
171
+ _filteredChildrenIdentifierPaths = new Array();
172
+ _isFilterTarget = false;
173
+ _filterTargetOptions = undefined;
174
+ _needsAutoExpand = false;
175
+ constructor(_hasFilterTargetAncestor) {
176
+ this._hasFilterTargetAncestor = _hasFilterTargetAncestor;
177
+ }
178
+ accept({ path, options }) {
179
+ if (path.length === 1) {
180
+ this._isFilterTarget = true;
181
+ this._filterTargetOptions = HierarchyFilteringPath.mergeOptions(this._filterTargetOptions, options);
182
+ }
183
+ else if (path.length > 1) {
184
+ this._filteredChildrenIdentifierPaths.push({ path: path.slice(1), options });
185
+ if (options?.autoExpand) {
186
+ this._needsAutoExpand = true;
187
+ }
188
+ }
189
+ }
190
+ getNodeProps() {
191
+ return {
192
+ ...(this._hasFilterTargetAncestor || this._isFilterTarget || this._filteredChildrenIdentifierPaths.length > 0
193
+ ? {
194
+ filtering: {
195
+ ...(this._hasFilterTargetAncestor ? { hasFilterTargetAncestor: true } : undefined),
196
+ ...(this._isFilterTarget ? { isFilterTarget: true, filterTargetOptions: this._filterTargetOptions } : undefined),
197
+ ...(this._filteredChildrenIdentifierPaths.length > 0 ? { filteredChildrenIdentifierPaths: this._filteredChildrenIdentifierPaths } : undefined),
198
+ },
199
+ }
200
+ : undefined),
201
+ ...(this._needsAutoExpand ? { autoExpand: true } : undefined),
202
+ };
203
+ }
204
+ }
71
205
  //# sourceMappingURL=HierarchyFiltering.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyFiltering.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAmChG,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,sBAAsB,CAiDtC;AAjDD,WAAiB,sBAAsB;IACrC;;;OAGG;IACH,SAAgB,SAAS,CAAC,MAA8B;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CA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B,EAAE,UAAU,CAAC,SAAS,CAAC,+BAA+B;YACvE,uBAAuB,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,uBAAuB,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc;SACjH;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,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 { NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GroupingNodeKey } from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport interface FilterTargetGroupingNodeInfo {\n /** Key of the grouping node. */\n key: GroupingNodeKey;\n\n /**\n * Depth of the grouping node in the hierarchy.\n * Generally, it can be retrieved from `parentKeys.length`.\n */\n depth: number;\n}\n\n/** @public */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n */\n autoExpand?: boolean | FilterTargetGroupingNodeInfo;\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @public\n */\nexport type HierarchyFilteringPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchyFilteringPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyFilteringPath {\n /**\n * Normalizes the hierarchy filtering path to the object form.\n * @public\n */\n export function normalize(source: HierarchyFilteringPath): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source, options: undefined };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchyFilteringPathOptions` objects.\n * - if both inputs are `undefined`, `undefined` is returned,\n * - else if one of the inputs is `undefined`, the other one is returned.\n * - else, merge each option individually.\n *\n * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if both inputs are objects, return the one with the greater `depth` attribute.\n * - else if one input is an object, return it.\n * - else, return `false` or `undefined`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchyFilteringPathOptions | undefined,\n rhs: HierarchyFilteringPathOptions | undefined,\n ): HierarchyFilteringPathOptions | undefined {\n if (!lhs || !rhs) {\n return lhs ?? rhs;\n }\n\n return {\n autoExpand: ((): HierarchyFilteringPathOptions[\"autoExpand\"] => {\n if (rhs.autoExpand === true || lhs.autoExpand === true) {\n return true;\n }\n if (typeof lhs.autoExpand === \"object\") {\n if (typeof rhs.autoExpand === \"object\" && rhs.autoExpand.depth > lhs.autoExpand.depth) {\n return rhs.autoExpand;\n }\n return lhs.autoExpand;\n }\n return rhs.autoExpand;\n })(),\n };\n }\n}\n\n/**\n * An utility that extracts filtering properties from given root level filtering props or\n * the parent node. Returns `undefined` if filtering props are not present.\n * @public\n */\nexport function extractFilteringProps(\n rootLevelFilteringProps: HierarchyFilteringPath[],\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n):\n | {\n filteredNodePaths: HierarchyFilteringPath[];\n hasFilterTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false };\n }\n return parentNode.filtering?.filteredChildrenIdentifierPaths\n ? {\n filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,\n hasFilterTargetAncestor: !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,\n }\n : undefined;\n}\n"]}
1
+ {"version":3,"file":"HierarchyFiltering.js","sourceRoot":"","s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,SAAS,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC9D,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { HierarchyNode, NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport interface FilterTargetGroupingNodeInfo {\n /** Key of the grouping node. */\n key: GroupingNodeKey;\n\n /**\n * Depth of the grouping node in the hierarchy.\n * Generally, it can be retrieved from `parentKeys.length`.\n */\n depth: number;\n}\n\n/** @public */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n */\n autoExpand?: boolean | FilterTargetGroupingNodeInfo;\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @public\n */\nexport type HierarchyFilteringPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchyFilteringPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyFilteringPath {\n /**\n * Normalizes the hierarchy filtering path to the object form.\n * @public\n */\n export function normalize(source: HierarchyFilteringPath): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchyFilteringPathOptions` objects.\n * - if both inputs are `undefined`, `undefined` is returned,\n * - else if one of the inputs is `undefined`, the other one is returned.\n * - else, merge each option individually.\n *\n * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if both inputs are objects, return the one with the greater `depth` attribute.\n * - else if one input is an object, return it.\n * - else, return `false` or `undefined`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchyFilteringPathOptions | undefined,\n rhs: HierarchyFilteringPathOptions | undefined,\n ): HierarchyFilteringPathOptions | undefined {\n if (!lhs || !rhs) {\n return lhs ?? rhs;\n }\n\n return {\n autoExpand: ((): HierarchyFilteringPathOptions[\"autoExpand\"] => {\n if (rhs.autoExpand === true || lhs.autoExpand === true) {\n return true;\n }\n if (typeof lhs.autoExpand === \"object\") {\n if (typeof rhs.autoExpand === \"object\" && rhs.autoExpand.depth > lhs.autoExpand.depth) {\n return rhs.autoExpand;\n }\n return lhs.autoExpand;\n }\n return rhs.autoExpand;\n })(),\n };\n }\n}\n\n/**\n * An utility that extracts filtering properties from given root level filtering props or\n * the parent node. Returns `undefined` if filtering props are not present.\n * @public\n * @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.\n */\n/* c8 ignore start */\nexport function extractFilteringProps(\n rootLevelFilteringProps: HierarchyFilteringPath[],\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n):\n | {\n filteredNodePaths: HierarchyFilteringPath[];\n hasFilterTargetAncestor: boolean;\n }\n | undefined {\n return extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n}\n/* c8 ignore end */\n\nfunction extractFilteringPropsInternal(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n):\n | {\n filteredNodePaths: HierarchyFilteringPath[];\n hasFilterTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return rootLevelFilteringProps ? { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false } : undefined;\n }\n return parentNode.filtering?.filteredChildrenIdentifierPaths\n ? {\n filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,\n hasFilterTargetAncestor: !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,\n }\n : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to filter the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchyFilteringHelper(\n rootLevelFilteringProps: HierarchyFilteringPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n) {\n const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);\n const hasFilter = !!filteringProps;\n return {\n /**\n * Returns a flag indicating if the hierarchy level is filtered.\n */\n hasFilter,\n\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a filter target. That generally means that this and all downstream hierarchy\n * levels should be displayed without filter being applied to them, even if filter paths\n * say otherwise.\n */\n hasFilterTargetAncestor: filteringProps?.hasFilterTargetAncestor ?? false,\n\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if filtering is not applied to this level.\n */\n getChildNodeFilteringIdentifiers: () => {\n if (!hasFilter) {\n return undefined;\n }\n return filteringProps.filteredNodePaths\n .map(HierarchyFilteringPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `filtering`\n * and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n */\n createChildNodeProps: (\n props:\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n },\n ): Pick<HierarchyNode, \"filtering\" | \"autoExpand\"> | undefined => {\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n filteringProps.filteredNodePaths.forEach((filteredPath) => {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredPath);\n if (\n \"nodeKey\" in props &&\n ((HierarchyNodeKey.isGeneric(props.nodeKey) && HierarchyNodeIdentifier.equal(normalizedPath.path[0], props.nodeKey)) ||\n (HierarchyNodeKey.isInstances(props.nodeKey) && props.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik))))\n ) {\n reducer.accept(normalizedPath);\n } else if (\"pathMatcher\" in props && props.pathMatcher(normalizedPath.path[0])) {\n reducer.accept(normalizedPath);\n }\n });\n return reducer.getNodeProps();\n },\n\n /**\n * Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.\n */\n createChildNodePropsAsync: async (props: {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<HierarchyNode, \"filtering\" | \"autoExpand\"> | undefined> => {\n if (!hasFilter) {\n return undefined;\n }\n const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);\n for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {\n const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);\n /* c8 ignore next 3 */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n\n const matchesPossiblyPromise = props.pathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n if (!(await matchesPossiblyPromise)) {\n continue;\n }\n }\n if (!matchesPossiblyPromise) {\n continue;\n }\n\n reducer.accept(normalizedPath);\n }\n return reducer.getNodeProps();\n },\n };\n}\n\ntype NormalizedFilteringPath = ReturnType<(typeof HierarchyFilteringPath)[\"normalize\"]>;\nclass MatchingFilteringPathsReducer {\n private _filteredChildrenIdentifierPaths = new Array<NormalizedFilteringPath>();\n private _isFilterTarget = false;\n private _filterTargetOptions = undefined as HierarchyFilteringPathOptions | undefined;\n private _needsAutoExpand = false;\n\n public constructor(private _hasFilterTargetAncestor: boolean) {}\n\n public accept({ path, options }: NormalizedFilteringPath) {\n if (path.length === 1) {\n this._isFilterTarget = true;\n this._filterTargetOptions = HierarchyFilteringPath.mergeOptions(this._filterTargetOptions, options);\n } else if (path.length > 1) {\n this._filteredChildrenIdentifierPaths.push({ path: path.slice(1), options });\n if (options?.autoExpand) {\n this._needsAutoExpand = true;\n }\n }\n }\n public getNodeProps(): Pick<HierarchyNode, \"filtering\" | \"autoExpand\"> {\n return {\n ...(this._hasFilterTargetAncestor || this._isFilterTarget || this._filteredChildrenIdentifierPaths.length > 0\n ? {\n filtering: {\n ...(this._hasFilterTargetAncestor ? { hasFilterTargetAncestor: true } : undefined),\n ...(this._isFilterTarget ? { isFilterTarget: true, filterTargetOptions: this._filterTargetOptions } : undefined),\n ...(this._filteredChildrenIdentifierPaths.length > 0 ? { filteredChildrenIdentifierPaths: this._filteredChildrenIdentifierPaths } : undefined),\n },\n }\n : undefined),\n ...(this._needsAutoExpand ? { autoExpand: true } : undefined),\n };\n }\n}\n"]}
@@ -18,6 +18,7 @@ export type HierarchyNodeFilteringProps = {
18
18
  });
19
19
  /** @public */
20
20
  export declare namespace HierarchyNodeFilteringProps {
21
+ /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
21
22
  function create(props: {
22
23
  hasFilterTargetAncestor?: boolean;
23
24
  filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNode.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAA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FilteringProps;
9
9
  (function (HierarchyNodeFilteringProps) {
10
+ /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
11
+ /* c8 ignore start */
10
12
  function create(props) {
11
13
  const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;
12
14
  if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {
@@ -19,6 +21,7 @@ export var HierarchyNodeFilteringProps;
19
21
  return undefined;
20
22
  }
21
23
  HierarchyNodeFilteringProps.create = create;
24
+ /* c8 ignore end */
22
25
  })(HierarchyNodeFilteringProps || (HierarchyNodeFilteringProps = {}));
23
26
  /** @public */
24
27
  // eslint-disable-next-line @typescript-eslint/no-redeclare