@itwin/presentation-hierarchies 2.0.0-alpha.17 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/README.md +4 -6
- package/lib/hierarchies/HierarchyMerge.js +1 -1
- package/lib/hierarchies/HierarchyMerge.js.map +1 -1
- package/lib/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/hierarchies/HierarchyNodeKey.js +7 -7
- package/lib/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/hierarchies/imodel/IModelHierarchyDefinition.d.ts +2 -2
- package/lib/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/hierarchies/imodel/IModelHierarchyProvider.d.ts +2 -4
- package/lib/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/hierarchies/imodel/IModelHierarchyProvider.js +15 -12
- package/lib/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/hierarchies/imodel/NodeSelectQueryFactory.d.ts +6 -2
- package/lib/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
- package/lib/hierarchies/imodel/NodeSelectQueryFactory.js +77 -40
- package/lib/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +2 -2
- package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
- package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +1 -1
- package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
- package/lib/hierarchies/imodel/SearchHierarchyDefinition.d.ts +2 -2
- package/lib/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
- package/lib/hierarchies/imodel/SearchHierarchyDefinition.js +3 -3
- package/lib/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
- package/lib/hierarchies/imodel/operators/Grouping.d.ts +2 -2
- package/lib/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
- package/lib/hierarchies/imodel/operators/Grouping.js.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +3 -3
- package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +8 -9
- package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.js +3 -5
- package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +3 -3
- package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
- package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +37 -30
- package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
- package/lib/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/package.json +11 -11
- package/lib/hierarchies/internal/EachValueFrom.d.ts +0 -12
- package/lib/hierarchies/internal/EachValueFrom.d.ts.map +0 -1
- package/lib/hierarchies/internal/EachValueFrom.js +0 -108
- package/lib/hierarchies/internal/EachValueFrom.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# @itwin/presentation-hierarchies
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @itwin/presentation-shared@2.0.0-alpha.14
|
|
9
|
+
|
|
10
|
+
## 2.0.0-alpha.18
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [#1503](https://github.com/iTwin/presentation/pull/1503): Full class and property names are now compared case-sensitively. Provide names using the casing defined by their EC schemas.
|
|
15
|
+
- [#1491](https://github.com/iTwin/presentation/pull/1491): `ECSchemaProvider`: Added a `classDerivesFrom` method for checking whether one ECClass is the same as, or derives from, another. `createECSchemaProvider` (in `@itwin/presentation-core-interop`) implements it using the class hierarchy information it already loads, so the answer is returned synchronously once the hierarchy has been loaded and no additional round-trips to the iModel are needed.
|
|
16
|
+
|
|
17
|
+
Also, `ECClassHierarchyInspector` and `createCachingECClassHierarchyInspector` have been deprecated. Because `ECSchemaProvider` now exposes `classDerivesFrom` directly, a separate class hierarchy inspector is no longer needed when setting up iModel access:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// Before:
|
|
21
|
+
import { createCachingECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
22
|
+
import {
|
|
23
|
+
createECSchemaProvider,
|
|
24
|
+
createECSqlQueryExecutor,
|
|
25
|
+
} from "@itwin/presentation-core-interop";
|
|
26
|
+
|
|
27
|
+
const schemaProvider = createECSchemaProvider(imodel);
|
|
28
|
+
const imodelAccess = {
|
|
29
|
+
...schemaProvider,
|
|
30
|
+
...createCachingECClassHierarchyInspector({ schemaProvider }),
|
|
31
|
+
...createECSqlQueryExecutor(imodel),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// After:
|
|
35
|
+
import {
|
|
36
|
+
createECSchemaProvider,
|
|
37
|
+
createECSqlQueryExecutor,
|
|
38
|
+
} from "@itwin/presentation-core-interop";
|
|
39
|
+
|
|
40
|
+
const imodelAccess = {
|
|
41
|
+
...createECSchemaProvider(imodel), // now also provides `classDerivesFrom`
|
|
42
|
+
...createECSqlQueryExecutor(imodel),
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Breaking changes:**
|
|
47
|
+
|
|
48
|
+
- `ECSchemaProvider` now requires a `classDerivesFrom` method. Objects created via `createECSchemaProvider` get it automatically, so most consumers don't need to change anything. Only custom, hand-written `ECSchemaProvider` implementations need to add the method.
|
|
49
|
+
|
|
50
|
+
- Renamed the `classHierarchyInspector` prop to `imodelAccess` on `createClassBasedInstanceLabelSelectClauseFactory`, `createBisInstanceLabelSelectClauseFactory` (both in `@itwin/presentation-shared`) and `createPredicateBasedHierarchyDefinition` (in `@itwin/presentation-hierarchies`). The prop's type is unchanged, so the value passed to it doesn't need to change - only the prop name:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// Before:
|
|
54
|
+
const classHierarchyInspector = createCachingECClassHierarchyInspector({
|
|
55
|
+
schemaProvider: createECSchemaProvider(imodel),
|
|
56
|
+
});
|
|
57
|
+
createPredicateBasedHierarchyDefinition({
|
|
58
|
+
classHierarchyInspector,
|
|
59
|
+
hierarchy,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// After:
|
|
63
|
+
const imodelAccess = createECSchemaProvider(imodel);
|
|
64
|
+
createPredicateBasedHierarchyDefinition({ imodelAccess, hierarchy });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- [#1394](https://github.com/iTwin/presentation/pull/1394): `EC` namespace interfaces in `@itwin/presentation-shared` no longer use `Promise` wrappers — once a schema is loaded via the still-async `ECSchemaProvider.getSchema`, all further navigation (`baseClass`, `is()`, `getProperty()`, `getProperties()`, `kindOfQuantity`, `relationshipClass`, `enumeration`, `abstractConstraint`) is synchronous.
|
|
68
|
+
|
|
69
|
+
Additional changes:
|
|
70
|
+
|
|
71
|
+
- The `EC.Class.getDerivedClasses()` method was replaced with `getDerivedClassNames(props?: { onlyDirect?: boolean })`. `ECSchemaProvider` can be used to load the derived classes by name, if needed.
|
|
72
|
+
- The `getCustomAttributes()` method has been removed from `EC.Schema`, `EC.Class`, and `EC.Property` and replaced with an `isHidden: boolean` property. `EC.CustomAttributeSet` and `EC.CustomAttribute` types have been removed.
|
|
73
|
+
- Added an `EC.Class.getOwnProperties()` method that returns only the properties defined on the class itself, without inherited properties.
|
|
74
|
+
- Added an `EC.EntityClass.getMixins()` method that returns all mixins applied to the entity class.
|
|
75
|
+
- Added an optional `EC.Property.category` attribute.
|
|
76
|
+
- Added a required `EC.RelationshipConstraint.constraintClasses` attribute.
|
|
77
|
+
- Added missing optional `description` attributes to `EC.Schema` and `EC.Property`.
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- [#1495](https://github.com/iTwin/presentation/pull/1495): Fix nested property grouping for inherited properties by consistently using their declaring class.
|
|
82
|
+
- [#1518](https://github.com/iTwin/presentation/pull/1518): Improved hierarchy load performance by memoizing the hidden-classes tree per selected class, avoiding repeated traversal of large derived-class hierarchies (notably improving the models tree).
|
|
83
|
+
|
|
84
|
+
The memoization persists for the lifetime of the hierarchy provider's query factories. When iModel schemas may have changed, `createIModelHierarchyProvider` now re-creates its per-iModel factories in response to the `imodelChanged` event.
|
|
85
|
+
|
|
86
|
+
- [#1511](https://github.com/iTwin/presentation/pull/1511): Fixed a performance regression that made property grouping of large hierarchies dramatically slower.
|
|
87
|
+
|
|
88
|
+
`createECSchemaProvider` now caches resolved schemas and the `EC.Class` objects built from them, so repeated `getSchema`/`getClass` calls and `EC.Property.class` accesses no longer trigger a new native schema view request or rebuild the class each time. Cached schemas are reused until the underlying schema view becomes outdated, at which point they are refreshed on next access. In addition, property grouping now resolves each properties class once instead of once per grouped node.
|
|
89
|
+
|
|
90
|
+
- Updated dependencies:
|
|
91
|
+
- @itwin/presentation-shared@2.0.0-alpha.13
|
|
92
|
+
|
|
3
93
|
## 2.0.0-alpha.17
|
|
4
94
|
|
|
5
95
|
### Major Changes
|
|
@@ -621,6 +711,30 @@
|
|
|
621
711
|
- Updated dependencies:
|
|
622
712
|
- @itwin/presentation-shared@2.0.0-alpha.0
|
|
623
713
|
|
|
714
|
+
## 1.7.21
|
|
715
|
+
|
|
716
|
+
### Patch Changes
|
|
717
|
+
|
|
718
|
+
- [#1543](https://github.com/iTwin/presentation/pull/1543): Update iTwin.js core dependencies to `^5.13.1` and refresh related tooling/test dependencies.
|
|
719
|
+
- Updated dependencies:
|
|
720
|
+
- @itwin/presentation-shared@1.2.22
|
|
721
|
+
|
|
722
|
+
## 1.7.20
|
|
723
|
+
|
|
724
|
+
### Patch Changes
|
|
725
|
+
|
|
726
|
+
- [#1500](https://github.com/iTwin/presentation/pull/1500): Update iTwin.js core dependencies to ^5.12.4 and refresh related tooling/test dependencies.
|
|
727
|
+
- Updated dependencies:
|
|
728
|
+
- @itwin/presentation-shared@1.2.20
|
|
729
|
+
|
|
730
|
+
## 1.7.19
|
|
731
|
+
|
|
732
|
+
### Patch Changes
|
|
733
|
+
|
|
734
|
+
- [#1473](https://github.com/iTwin/presentation/pull/1473): Bump dependencies.
|
|
735
|
+
- Updated dependencies:
|
|
736
|
+
- @itwin/presentation-shared@1.2.19
|
|
737
|
+
|
|
624
738
|
## 1.7.18
|
|
625
739
|
|
|
626
740
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Here's a simple example of how to create a hierarchy provider and build a hierar
|
|
|
77
77
|
import { IModelConnection } from "@itwin/core-frontend";
|
|
78
78
|
import { createECSchemaProvider, createECSqlQueryExecutor, createIModelKey } from "@itwin/presentation-core-interop";
|
|
79
79
|
import { createLimitingECSqlQueryExecutor, HierarchyLevelDefinition } from "@itwin/presentation-hierarchies";
|
|
80
|
-
import {
|
|
80
|
+
import { Props } from "@itwin/presentation-shared";
|
|
81
81
|
|
|
82
82
|
import {
|
|
83
83
|
createIModelHierarchyProvider,
|
|
@@ -89,14 +89,12 @@ import {
|
|
|
89
89
|
import { ECSqlBinding } from "@itwin/presentation-shared";
|
|
90
90
|
|
|
91
91
|
function createIModelAccess(imodel: IModelConnection) {
|
|
92
|
-
const schemaProvider = createECSchemaProvider(imodel
|
|
92
|
+
const schemaProvider = createECSchemaProvider(imodel);
|
|
93
93
|
return {
|
|
94
94
|
// The key of the iModel we're accessing
|
|
95
95
|
imodelKey: createIModelKey(imodel),
|
|
96
|
-
// Schema provider provides access to EC information (metadata)
|
|
96
|
+
// Schema provider provides access to EC information (metadata) and class hierarchy inspection
|
|
97
97
|
...schemaProvider,
|
|
98
|
-
// While caching for hierarchy inspector is not mandatory, it's recommended to use it to improve performance
|
|
99
|
-
...createCachingECClassHierarchyInspector({ schemaProvider, cacheSize: 100 }),
|
|
100
98
|
// The second argument is the maximum number of rows the executor will return - this allows us to
|
|
101
99
|
// avoid creating hierarchy levels of insane size (expensive to us and useless to users)
|
|
102
100
|
...createLimitingECSqlQueryExecutor(createECSqlQueryExecutor(imodel), 1000),
|
|
@@ -106,7 +104,7 @@ function createIModelAccess(imodel: IModelConnection) {
|
|
|
106
104
|
function createProvider(imodelAccess: Props<typeof createIModelHierarchyProvider>["imodelAccess"]): HierarchyProvider {
|
|
107
105
|
// Define the hierarchy
|
|
108
106
|
const hierarchyDefinition = createPredicateBasedHierarchyDefinition({
|
|
109
|
-
|
|
107
|
+
imodelAccess,
|
|
110
108
|
hierarchy: {
|
|
111
109
|
// For root nodes, select all BisCore.GeometricModel3d instances
|
|
112
110
|
rootNodes: async ({ createSelectClause }) => [
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import "./internal/DisposePolyfill.js";
|
|
6
6
|
import { filter, first, from, map, mergeMap, of } from "rxjs";
|
|
7
7
|
import { BeEvent } from "@itwin/core-bentley";
|
|
8
|
+
import { eachValueFrom } from "@itwin/presentation-shared";
|
|
8
9
|
import { safeDispose } from "./internal/Common.js";
|
|
9
|
-
import { eachValueFrom } from "./internal/EachValueFrom.js";
|
|
10
10
|
import { sortNodesByLabelOperator } from "./internal/operators/Sorting.js";
|
|
11
11
|
/**
|
|
12
12
|
* Creates a single, merged, hierarchy provider from multiple given providers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyMerge.js","sourceRoot":"","sources":["../../src/hierarchies/HierarchyMerge.ts"],"names":[],"mappings":"AAAA;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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;KAC1B,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\";\n\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { eachValueFrom } from \"@itwin/presentation-shared\";\nimport { safeDispose } from \"./internal/Common.js\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting.js\";\n\nimport type { EventArgs } from \"@itwin/presentation-shared\";\nimport type { HierarchyProvider } from \"./HierarchyProvider.js\";\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({\n providers,\n}: MergeHierarchyProvidersProps): HierarchyProvider & { [Symbol.dispose]: () => void } {\n const hierarchyChanged = new BeEvent<(args: EventArgs<HierarchyProvider[\"hierarchyChanged\"]>) => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener((args) => hierarchyChanged.raiseEvent(args));\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 ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n setHierarchySearch: (props) => providers.forEach((p) => p.setHierarchySearch(props)),\n [Symbol.dispose]: dispose,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyNodeKey.d.ts","sourceRoot":"","sources":["../../src/hierarchies/HierarchyNodeKey.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAC;IAElB;;;OAGG;IACH,YAAY,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,IAAI,EAAE,gBAAgB,CAAC;IAEvB,uEAAuE;IACvE,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,IAAI,EAAE,gBAAg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CAElF;IAED,mFAAmF;IACnF,SAAgB,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,IAAI,kCAAkC,CAE9G;IAED,kFAAkF;IAClF,SAAgB,4BAA4B,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,IAAI,iCAAiC,CAE5G;IAED,6EAA6E;IAC7E,SAAgB,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,IAAI,4BAA4B,CAElG;IAED,wEAAwE;IACxE,SAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,IAAI,uBAAuB,CAExF;IAED;;;;;OAKG;IACH,SAAgB,OAAO,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,GAAG,MAAM,CA2F5E;IAED,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAE5E;CACF"}
|
|
@@ -97,7 +97,7 @@ export var HierarchyNodeKey;
|
|
|
97
97
|
}
|
|
98
98
|
case "class-grouping": {
|
|
99
99
|
assert(rhs.type === "class-grouping");
|
|
100
|
-
return compareStrings(lhs.className
|
|
100
|
+
return compareStrings(lhs.className, rhs.className);
|
|
101
101
|
}
|
|
102
102
|
case "label-grouping": {
|
|
103
103
|
assert(rhs.type === "label-grouping");
|
|
@@ -113,11 +113,11 @@ export var HierarchyNodeKey;
|
|
|
113
113
|
return lhs.properties.length - rhs.properties.length;
|
|
114
114
|
}
|
|
115
115
|
for (let i = 0; i < lhs.properties.length; ++i) {
|
|
116
|
-
const classCompareResult = compareStrings(lhs.properties[i].className
|
|
116
|
+
const classCompareResult = compareStrings(lhs.properties[i].className, rhs.properties[i].className);
|
|
117
117
|
if (classCompareResult !== 0) {
|
|
118
118
|
return classCompareResult;
|
|
119
119
|
}
|
|
120
|
-
const nameCompareResult = compareStrings(lhs.properties[i].propertyName
|
|
120
|
+
const nameCompareResult = compareStrings(lhs.properties[i].propertyName, rhs.properties[i].propertyName);
|
|
121
121
|
if (nameCompareResult !== 0) {
|
|
122
122
|
return nameCompareResult;
|
|
123
123
|
}
|
|
@@ -126,11 +126,11 @@ export var HierarchyNodeKey;
|
|
|
126
126
|
}
|
|
127
127
|
case "property-grouping:value": {
|
|
128
128
|
assert(rhs.type === "property-grouping:value");
|
|
129
|
-
const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName
|
|
129
|
+
const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);
|
|
130
130
|
if (propertyClassNameCompareResult !== 0) {
|
|
131
131
|
return propertyClassNameCompareResult;
|
|
132
132
|
}
|
|
133
|
-
const propertyNameCompareResult = compareStrings(lhs.propertyName
|
|
133
|
+
const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);
|
|
134
134
|
if (propertyNameCompareResult !== 0) {
|
|
135
135
|
return propertyNameCompareResult;
|
|
136
136
|
}
|
|
@@ -138,11 +138,11 @@ export var HierarchyNodeKey;
|
|
|
138
138
|
}
|
|
139
139
|
case "property-grouping:range": {
|
|
140
140
|
assert(rhs.type === "property-grouping:range");
|
|
141
|
-
const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName
|
|
141
|
+
const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);
|
|
142
142
|
if (propertyClassNameCompareResult !== 0) {
|
|
143
143
|
return propertyClassNameCompareResult;
|
|
144
144
|
}
|
|
145
|
-
const propertyNameCompareResult = compareStrings(lhs.propertyName
|
|
145
|
+
const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);
|
|
146
146
|
if (propertyNameCompareResult !== 0) {
|
|
147
147
|
return propertyNameCompareResult;
|
|
148
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyNodeKey.js","sourceRoot":"","sources":["../../src/hierarchies/HierarchyNodeKey.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG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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;IA7Ge,iBAAA,OAAO,UA6GtB,CAAA;IAED,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAqB,EAAE,GAAqB;QACjE,OAAO,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAFe,iBAAA,MAAM,SAErB,CAAA;AACH,CAAC,EA5KgB,gBAAgB,KAAhB,gBAAgB,QA4KhC","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\nimport type { EC } from \"@itwin/presentation-shared\";\n\n/**\n * An instance key that may be associated with specific iModel.\n * @public\n */\nexport interface IModelInstanceKey extends InstanceKey {\n imodelKey?: string;\n}\n\n/**\n * A key for a generic node.\n * @public\n */\nexport interface GenericNodeKey {\n /** Type of the node */\n type: \"generic\";\n\n /**\n * Node key identifier, which uniquely identifies the node within the hierarchy level the node is used.\n * The format of the identifier is not specified and is up to the data source.\n */\n id: string;\n\n /**\n * Optional data source identifier. Useful when a hierarchy is built using multiple hierarchy providers - in that\n * case each provider can assign a unique source identifier to its nodes.\n */\n source?: string;\n}\n\n/**\n * A key for a node that represents one or more ECInstances.\n * @public\n */\nexport interface InstancesNodeKey {\n /** Type of the node */\n type: \"instances\";\n\n /**\n * Keys of ECInstances that are represented by the node. Generally, one node represents a single\n * ECInstance, but in some cases (e.g. node merging) there could be more.\n */\n instanceKeys: IModelInstanceKey[];\n}\n\n/**\n * A key for a class-grouping node.\n * @public\n */\nexport interface ClassGroupingNodeKey {\n /** Type of the node */\n type: \"class-grouping\";\n\n /** Full name of the ECClass that this grouping node is grouping by. */\n className: EC.FullClassNameDotNotation;\n}\n\n/**\n * A key for a label-grouping node.\n * @public\n */\nexport interface LabelGroupingNodeKey {\n /** Type of the node */\n type: \"label-grouping\";\n\n /** Node label that this grouping node is grouping by. */\n label: string;\n\n /**\n * Optional group identifier that is assigned to the node key when multiple nodes\n * with the same label shouldn't be grouped together.\n */\n groupId?: string;\n}\n\n/**\n * A key property grouping node that groups nodes whose values don't fall into any other\n * property group in the hierarchy level.\n * @public\n */\nexport interface PropertyOtherValuesGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:other\";\n /** Identifiers of properties whose values are grouped under this node. */\n properties: Array<{ className: EC.FullClassNameDotNotation; propertyName: string }>;\n}\n\n/**\n * A key for a property grouping node that groups nodes by formatted property value.\n * @public\n */\nexport interface PropertyValueGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:value\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: EC.FullClassNameDotNotation;\n\n /** Formatted property value that this node is grouping by. */\n formattedPropertyValue: string;\n}\n\n/**\n * A key for a property grouping node that groups nodes by a range of property values.\n * @public\n */\nexport interface PropertyValueRangeGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:range\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: EC.FullClassNameDotNotation;\n\n /** Defines the start of the values' range that this node is grouping by. */\n fromValue: number;\n\n /** Defines the end of the values' range that this node is grouping by. */\n toValue: number;\n}\n\n/**\n * A key for a property grouping node.\n * @public\n */\nexport type PropertyGroupingNodeKey =\n | PropertyValueRangeGroupingNodeKey\n | PropertyValueGroupingNodeKey\n | PropertyOtherValuesGroupingNodeKey;\n\n/**\n * A key for one of the instance grouping nodes.\n * @public\n */\nexport type GroupingNodeKey = ClassGroupingNodeKey | LabelGroupingNodeKey | PropertyGroupingNodeKey;\n\n/**\n * A key for either an instance node or one of the instance grouping nodes.\n * @public\n */\nexport type IModelHierarchyNodeKey = InstancesNodeKey | GroupingNodeKey;\n\n/**\n * A key that uniquely identifies a node in a hierarchy level.\n * @public\n */\nexport type HierarchyNodeKey = IModelHierarchyNodeKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeKey {\n /** Checks whether the given node key is a generic node key. */\n export function isGeneric(key: HierarchyNodeKey): key is GenericNodeKey {\n return key.type === \"generic\";\n }\n\n /** Checks whether the given node key is a `StandardHierarchyNodeKey`. */\n export function isIModelNodeKey(key: HierarchyNodeKey): key is IModelHierarchyNodeKey {\n return !isGeneric(key);\n }\n\n /** Checks whether the given node key is an `InstancesNodeKey`. */\n export function isInstances(key: HierarchyNodeKey): key is InstancesNodeKey {\n return key.type === \"instances\";\n }\n\n /** Checks whether the given node key is a `GroupingNodeKey`. */\n export function isGrouping(key: HierarchyNodeKey): key is GroupingNodeKey {\n return !isGeneric(key) && !isInstances(key);\n }\n\n /** Checks whether the given node key is a `ClassGroupingNodeKey`. */\n export function isClassGrouping(key: HierarchyNodeKey): key is ClassGroupingNodeKey {\n return key.type === \"class-grouping\";\n }\n\n /** Checks whether the given node key is a `LabelGroupingNodeKey`. */\n export function isLabelGrouping(key: HierarchyNodeKey): key is LabelGroupingNodeKey {\n return key.type === \"label-grouping\";\n }\n\n /** Checks whether the given node key is a `PropertyOtherValuesGroupingNodeKey`. */\n export function isPropertyOtherValuesGrouping(key: HierarchyNodeKey): key is PropertyOtherValuesGroupingNodeKey {\n return key.type === \"property-grouping:other\";\n }\n\n /** Checks whether the given node key is a `PropertyValueRangeGroupingNodeKey`. */\n export function isPropertyValueRangeGrouping(key: HierarchyNodeKey): key is PropertyValueRangeGroupingNodeKey {\n return key.type === \"property-grouping:range\";\n }\n\n /** Checks whether the given node key is a `PropertyValueGroupingNodeKey`. */\n export function isPropertyValueGrouping(key: HierarchyNodeKey): key is PropertyValueGroupingNodeKey {\n return key.type === \"property-grouping:value\";\n }\n\n /** Checks whether the given node key is a `PropertyGroupingNodeKey`. */\n export function isPropertyGrouping(key: HierarchyNodeKey): key is PropertyGroupingNodeKey {\n return isPropertyOtherValuesGrouping(key) || isPropertyValueRangeGrouping(key) || isPropertyValueGrouping(key);\n }\n\n /**\n * Compares two given keys. Returns:\n * - `0` if they are equal,\n * - `negative value` if lhs key is less than rhs key,\n * - `positive value` if lhs key is more than rhs key.\n */\n export function compare(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): number {\n const typeCompareResult = compareStrings(lhs.type, rhs.type);\n if (typeCompareResult !== 0) {\n return typeCompareResult;\n }\n switch (lhs.type) {\n case \"generic\": {\n assert(rhs.type === \"generic\");\n const idCompareResult = compareStrings(lhs.id, rhs.id);\n if (idCompareResult !== 0) {\n return idCompareResult;\n }\n return compareStringsOrUndefined(lhs.source, rhs.source);\n }\n case \"instances\": {\n assert(rhs.type === \"instances\");\n if (lhs.instanceKeys.length !== rhs.instanceKeys.length) {\n return lhs.instanceKeys.length > rhs.instanceKeys.length ? 1 : -1;\n }\n for (let i = 0; i < lhs.instanceKeys.length; ++i) {\n const instanceKeyCompareResult = InstanceKey.compare(lhs.instanceKeys[i], rhs.instanceKeys[i]);\n if (instanceKeyCompareResult !== 0) {\n return instanceKeyCompareResult;\n }\n const imodelKeyCompareResult = compareStringsOrUndefined(\n lhs.instanceKeys[i].imodelKey,\n rhs.instanceKeys[i].imodelKey,\n );\n if (imodelKeyCompareResult !== 0) {\n return imodelKeyCompareResult;\n }\n }\n return 0;\n }\n case \"class-grouping\": {\n assert(rhs.type === \"class-grouping\");\n return compareStrings(lhs.className.toLocaleLowerCase(), 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 lhs.properties[i].className.toLocaleLowerCase(),\n rhs.properties[i].className.toLocaleLowerCase(),\n );\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(\n lhs.properties[i].propertyName.toLocaleLowerCase(),\n rhs.properties[i].propertyName.toLocaleLowerCase(),\n );\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 lhs.propertyClassName.toLocaleLowerCase(),\n rhs.propertyClassName.toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(\n lhs.propertyName.toLocaleLowerCase(),\n rhs.propertyName.toLocaleLowerCase(),\n );\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 lhs.propertyClassName.toLocaleLowerCase(),\n rhs.propertyClassName.toLocaleLowerCase(),\n );\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(\n lhs.propertyName.toLocaleLowerCase(),\n rhs.propertyName.toLocaleLowerCase(),\n );\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,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AA4JzD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,gBAAgB,CA0JhC;AA1JD,WAAiB,gBAAgB;IAC/B,+DAA+D;IAC/D,SAAgB,SAAS,CAAC,GAAqB;QAC7C,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;IAChC,CAAC;IAFe,iBAAA,SAAS,YAExB,CAAA;IAED,yEAAyE;IACzE,SAAgB,eAAe,CAAC,GAAqB;QACnD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAFe,iBAAA,eAAe,kBAE9B,CAAA;IAED,kEAAkE;IAClE,SAAgB,WAAW,CAAC,GAAqB;QAC/C,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;IAClC,CAAC;IAFe,iBAAA,WAAW,cAE1B,CAAA;IAED,gEAAgE;IAChE,SAAgB,UAAU,CAAC,GAAqB;QAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,C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C;gBACxC,CAAC;gBACD,MAAM,yBAAyB,GAAG,cAAc,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;gBACrF,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;IA3Fe,iBAAA,OAAO,UA2FtB,CAAA;IAED,mDAAmD;IACnD,SAAgB,MAAM,CAAC,GAAqB,EAAE,GAAqB;QACjE,OAAO,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAFe,iBAAA,MAAM,SAErB,CAAA;AACH,CAAC,EA1JgB,gBAAgB,KAAhB,gBAAgB,QA0JhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { assert, compareStrings, compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\n\nimport type { EC } from \"@itwin/presentation-shared\";\n\n/**\n * An instance key that may be associated with specific iModel.\n * @public\n */\nexport interface IModelInstanceKey extends InstanceKey {\n imodelKey?: string;\n}\n\n/**\n * A key for a generic node.\n * @public\n */\nexport interface GenericNodeKey {\n /** Type of the node */\n type: \"generic\";\n\n /**\n * Node key identifier, which uniquely identifies the node within the hierarchy level the node is used.\n * The format of the identifier is not specified and is up to the data source.\n */\n id: string;\n\n /**\n * Optional data source identifier. Useful when a hierarchy is built using multiple hierarchy providers - in that\n * case each provider can assign a unique source identifier to its nodes.\n */\n source?: string;\n}\n\n/**\n * A key for a node that represents one or more ECInstances.\n * @public\n */\nexport interface InstancesNodeKey {\n /** Type of the node */\n type: \"instances\";\n\n /**\n * Keys of ECInstances that are represented by the node. Generally, one node represents a single\n * ECInstance, but in some cases (e.g. node merging) there could be more.\n */\n instanceKeys: IModelInstanceKey[];\n}\n\n/**\n * A key for a class-grouping node.\n * @public\n */\nexport interface ClassGroupingNodeKey {\n /** Type of the node */\n type: \"class-grouping\";\n\n /** Full name of the ECClass that this grouping node is grouping by. */\n className: EC.FullClassNameDotNotation;\n}\n\n/**\n * A key for a label-grouping node.\n * @public\n */\nexport interface LabelGroupingNodeKey {\n /** Type of the node */\n type: \"label-grouping\";\n\n /** Node label that this grouping node is grouping by. */\n label: string;\n\n /**\n * Optional group identifier that is assigned to the node key when multiple nodes\n * with the same label shouldn't be grouped together.\n */\n groupId?: string;\n}\n\n/**\n * A key property grouping node that groups nodes whose values don't fall into any other\n * property group in the hierarchy level.\n * @public\n */\nexport interface PropertyOtherValuesGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:other\";\n /** Identifiers of properties whose values are grouped under this node. */\n properties: Array<{ className: EC.FullClassNameDotNotation; propertyName: string }>;\n}\n\n/**\n * A key for a property grouping node that groups nodes by formatted property value.\n * @public\n */\nexport interface PropertyValueGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:value\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: EC.FullClassNameDotNotation;\n\n /** Formatted property value that this node is grouping by. */\n formattedPropertyValue: string;\n}\n\n/**\n * A key for a property grouping node that groups nodes by a range of property values.\n * @public\n */\nexport interface PropertyValueRangeGroupingNodeKey {\n /** Type of the node */\n type: \"property-grouping:range\";\n\n /** Name of the property that is used for grouping nodes. */\n propertyName: string;\n\n /** Full name of the ECClass containing the property. */\n propertyClassName: EC.FullClassNameDotNotation;\n\n /** Defines the start of the values' range that this node is grouping by. */\n fromValue: number;\n\n /** Defines the end of the values' range that this node is grouping by. */\n toValue: number;\n}\n\n/**\n * A key for a property grouping node.\n * @public\n */\nexport type PropertyGroupingNodeKey =\n | PropertyValueRangeGroupingNodeKey\n | PropertyValueGroupingNodeKey\n | PropertyOtherValuesGroupingNodeKey;\n\n/**\n * A key for one of the instance grouping nodes.\n * @public\n */\nexport type GroupingNodeKey = ClassGroupingNodeKey | LabelGroupingNodeKey | PropertyGroupingNodeKey;\n\n/**\n * A key for either an instance node or one of the instance grouping nodes.\n * @public\n */\nexport type IModelHierarchyNodeKey = InstancesNodeKey | GroupingNodeKey;\n\n/**\n * A key that uniquely identifies a node in a hierarchy level.\n * @public\n */\nexport type HierarchyNodeKey = IModelHierarchyNodeKey | GenericNodeKey;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeKey {\n /** Checks whether the given node key is a generic node key. */\n export function isGeneric(key: HierarchyNodeKey): key is GenericNodeKey {\n return key.type === \"generic\";\n }\n\n /** Checks whether the given node key is a `StandardHierarchyNodeKey`. */\n export function isIModelNodeKey(key: HierarchyNodeKey): key is IModelHierarchyNodeKey {\n return !isGeneric(key);\n }\n\n /** Checks whether the given node key is an `InstancesNodeKey`. */\n export function isInstances(key: HierarchyNodeKey): key is InstancesNodeKey {\n return key.type === \"instances\";\n }\n\n /** Checks whether the given node key is a `GroupingNodeKey`. */\n export function isGrouping(key: HierarchyNodeKey): key is GroupingNodeKey {\n return !isGeneric(key) && !isInstances(key);\n }\n\n /** Checks whether the given node key is a `ClassGroupingNodeKey`. */\n export function isClassGrouping(key: HierarchyNodeKey): key is ClassGroupingNodeKey {\n return key.type === \"class-grouping\";\n }\n\n /** Checks whether the given node key is a `LabelGroupingNodeKey`. */\n export function isLabelGrouping(key: HierarchyNodeKey): key is LabelGroupingNodeKey {\n return key.type === \"label-grouping\";\n }\n\n /** Checks whether the given node key is a `PropertyOtherValuesGroupingNodeKey`. */\n export function isPropertyOtherValuesGrouping(key: HierarchyNodeKey): key is PropertyOtherValuesGroupingNodeKey {\n return key.type === \"property-grouping:other\";\n }\n\n /** Checks whether the given node key is a `PropertyValueRangeGroupingNodeKey`. */\n export function isPropertyValueRangeGrouping(key: HierarchyNodeKey): key is PropertyValueRangeGroupingNodeKey {\n return key.type === \"property-grouping:range\";\n }\n\n /** Checks whether the given node key is a `PropertyValueGroupingNodeKey`. */\n export function isPropertyValueGrouping(key: HierarchyNodeKey): key is PropertyValueGroupingNodeKey {\n return key.type === \"property-grouping:value\";\n }\n\n /** Checks whether the given node key is a `PropertyGroupingNodeKey`. */\n export function isPropertyGrouping(key: HierarchyNodeKey): key is PropertyGroupingNodeKey {\n return isPropertyOtherValuesGrouping(key) || isPropertyValueRangeGrouping(key) || isPropertyValueGrouping(key);\n }\n\n /**\n * Compares two given keys. Returns:\n * - `0` if they are equal,\n * - `negative value` if lhs key is less than rhs key,\n * - `positive value` if lhs key is more than rhs key.\n */\n export function compare(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): number {\n const typeCompareResult = compareStrings(lhs.type, rhs.type);\n if (typeCompareResult !== 0) {\n return typeCompareResult;\n }\n switch (lhs.type) {\n case \"generic\": {\n assert(rhs.type === \"generic\");\n const idCompareResult = compareStrings(lhs.id, rhs.id);\n if (idCompareResult !== 0) {\n return idCompareResult;\n }\n return compareStringsOrUndefined(lhs.source, rhs.source);\n }\n case \"instances\": {\n assert(rhs.type === \"instances\");\n if (lhs.instanceKeys.length !== rhs.instanceKeys.length) {\n return lhs.instanceKeys.length > rhs.instanceKeys.length ? 1 : -1;\n }\n for (let i = 0; i < lhs.instanceKeys.length; ++i) {\n const instanceKeyCompareResult = InstanceKey.compare(lhs.instanceKeys[i], rhs.instanceKeys[i]);\n if (instanceKeyCompareResult !== 0) {\n return instanceKeyCompareResult;\n }\n const imodelKeyCompareResult = compareStringsOrUndefined(\n lhs.instanceKeys[i].imodelKey,\n rhs.instanceKeys[i].imodelKey,\n );\n if (imodelKeyCompareResult !== 0) {\n return imodelKeyCompareResult;\n }\n }\n return 0;\n }\n case \"class-grouping\": {\n assert(rhs.type === \"class-grouping\");\n return compareStrings(lhs.className, rhs.className);\n }\n case \"label-grouping\": {\n assert(rhs.type === \"label-grouping\");\n const labelCompareResult = compareStrings(lhs.label, rhs.label);\n if (labelCompareResult !== 0) {\n return labelCompareResult;\n }\n return compareStringsOrUndefined(lhs.groupId, rhs.groupId);\n }\n case \"property-grouping:other\": {\n assert(rhs.type === \"property-grouping:other\");\n if (lhs.properties.length !== rhs.properties.length) {\n return lhs.properties.length - rhs.properties.length;\n }\n for (let i = 0; i < lhs.properties.length; ++i) {\n const classCompareResult = compareStrings(lhs.properties[i].className, rhs.properties[i].className);\n if (classCompareResult !== 0) {\n return classCompareResult;\n }\n const nameCompareResult = compareStrings(lhs.properties[i].propertyName, rhs.properties[i].propertyName);\n if (nameCompareResult !== 0) {\n return nameCompareResult;\n }\n }\n return 0;\n }\n case \"property-grouping:value\": {\n assert(rhs.type === \"property-grouping:value\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n return compareStrings(lhs.formattedPropertyValue, rhs.formattedPropertyValue);\n }\n case \"property-grouping:range\": {\n assert(rhs.type === \"property-grouping:range\");\n const propertyClassNameCompareResult = compareStrings(lhs.propertyClassName, rhs.propertyClassName);\n if (propertyClassNameCompareResult !== 0) {\n return propertyClassNameCompareResult;\n }\n const propertyNameCompareResult = compareStrings(lhs.propertyName, rhs.propertyName);\n if (propertyNameCompareResult !== 0) {\n return propertyNameCompareResult;\n }\n if (lhs.fromValue !== rhs.fromValue) {\n return lhs.fromValue > rhs.fromValue ? 1 : -1;\n }\n return lhs.toValue > rhs.toValue ? 1 : lhs.toValue < rhs.toValue ? -1 : 0;\n }\n }\n }\n\n /** Checks whether the two given keys are equal. */\n export function equals(lhs: HierarchyNodeKey, rhs: HierarchyNodeKey): boolean {\n return compare(lhs, rhs) === 0;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GenericInstanceFilter } from "@itwin/core-common";
|
|
2
|
-
import type { EC,
|
|
2
|
+
import type { EC, ECSchemaProvider, ECSqlQueryDef } from "@itwin/presentation-shared";
|
|
3
3
|
import type { NonGroupingHierarchyNode, ParentHierarchyNode } from "../HierarchyNode.js";
|
|
4
4
|
import type { ProcessedGenericHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from "./IModelHierarchyNode.js";
|
|
5
5
|
import type { LimitingECSqlQueryExecutor } from "./LimitingECSqlQueryExecutor.js";
|
|
@@ -97,7 +97,7 @@ export type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, "chil
|
|
|
97
97
|
*/
|
|
98
98
|
export interface DefineHierarchyLevelProps extends Pick<NodesQueryClauseFactory, "createSelectClause" | "createFilterClauses"> {
|
|
99
99
|
/** The iModel for which the hierarchy definition is being requested for. */
|
|
100
|
-
imodelAccess: LimitingECSqlQueryExecutor & ECSchemaProvider &
|
|
100
|
+
imodelAccess: LimitingECSqlQueryExecutor & ECSchemaProvider & {
|
|
101
101
|
imodelKey: string;
|
|
102
102
|
};
|
|
103
103
|
/** Parent node to get children for. Pass `undefined` to get root nodes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,oDAAoD;IACpD,IAAI,EAAE,0BAA0B,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,aAAa,EAAE,EAAE,CAAC,wBAAwB,CAAC;IAC3C;;;OAGG;IACH,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,GAAG,4BAA4B,CAAC;AACrG,cAAc;AAEd,yBAAiB,wBAAwB,CAAC;IACxC,SAAgB,aAAa,CAAC,GAAG,EAAE,wBAAwB,GAAG,GAAG,IAAI,8BAA8B,CAElG;IACD,SAAgB,oBAAoB,CAAC,GAAG,EAAE,wBAAwB,GAAG,GAAG,IAAI,4BAA4B,CAEvG;CACF;AAED;;;GAGG;A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,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC,+EAA+E;IAC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AA+ChG,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,yBAAA,aAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,yBAAA,oBAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,KAAxB,wBAAwB,QAOxC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { GenericInstanceFilter } from \"@itwin/core-common\";\nimport type { EC,
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AA+ChG,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,yBAAA,aAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,yBAAA,oBAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,KAAxB,wBAAwB,QAOxC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { GenericInstanceFilter } from \"@itwin/core-common\";\nimport type { EC, ECSchemaProvider, ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport type { NonGroupingHierarchyNode, ParentHierarchyNode } from \"../HierarchyNode.js\";\nimport type {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\nimport type { LimitingECSqlQueryExecutor } from \"./LimitingECSqlQueryExecutor.js\";\nimport type { NodesQueryClauseFactory } from \"./NodeSelectQueryFactory.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @public\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: EC.FullClassNameDotNotation;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (props: {\n /** The ECSQL row object to parse. Keys & value types depend on the executed query. */\n row: { [columnName: string]: any };\n\n /** The parent node whose child node is being parsed. */\n parentNode?: HierarchyDefinitionParentNode;\n\n /** The key of iModel which is used to run the query. */\n imodelKey: string;\n}) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(props: {\n /** Node to be pre-processed. */\n node: TNode;\n\n /** The parent node whose child node is being pre-processed. */\n parentNode?: ParentHierarchyNode;\n}) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @public\n */\nexport type NodePostProcessor = (props: {\n /** Node to be post-processed. */\n node: ProcessedHierarchyNode;\n\n /** The parent node whose child node is being post-processed. */\n parentNode?: ParentHierarchyNode;\n}) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\n */\nexport interface DefineHierarchyLevelProps extends Pick<\n NodesQueryClauseFactory,\n \"createSelectClause\" | \"createFilterClauses\"\n> {\n /** The iModel for which the hierarchy definition is being requested for. */\n imodelAccess: LimitingECSqlQueryExecutor & ECSchemaProvider & { imodelKey: string };\n\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: HierarchyDefinitionParentNode | undefined;\n\n /** Optional hierarchy level filter. */\n instanceFilter?: GenericInstanceFilter;\n}\n\n/**\n * An interface for a factory that knows how define a hierarchy based on a given parent node.\n * @public\n */\nexport interface HierarchyDefinition {\n /**\n * An optional function for parsing ECInstance node from ECSQL row.\n *\n * Should be used in situations when the `HierarchyDefinition` implementation\n * introduces additional ECSQL columns into the select clause and wants to assign additional\n * data to the nodes it produces.\n *\n * Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT\n * clause is created using `NodeSelectQueryFactory.createSelectClause`.\n */\n parseNode?: NodeParser;\n\n /**\n * An optional function for pre-processing nodes.\n *\n * Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`\n * returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.\n * The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.\n */\n preProcessNode?: NodePreProcessor;\n\n /**\n * An optional function for post-processing nodes.\n *\n * Post-processing happens after the loaded nodes go through all the merging, hiding and grouping\n * steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data\n * to nodes after they're processed. This is especially true for grouping nodes as they're only created during\n * processing.\n */\n postProcessNode?: NodePostProcessor;\n\n /** A function to create a hierarchy level definition for given parent node. */\n defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../internal/DisposePolyfill.js";
|
|
2
2
|
import { HierarchySearchTree } from "../HierarchySearch.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ECSchemaProvider, Event, IInstanceLabelSelectClauseFactory, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
|
|
4
4
|
import type { HierarchyProvider } from "../HierarchyProvider.js";
|
|
5
5
|
import type { HierarchyDefinition } from "./IModelHierarchyDefinition.js";
|
|
6
6
|
import type { LimitingECSqlQueryExecutor } from "./LimitingECSqlQueryExecutor.js";
|
|
@@ -21,7 +21,7 @@ interface IModelHierarchyProviderLocalizedStrings {
|
|
|
21
21
|
other: string;
|
|
22
22
|
}
|
|
23
23
|
/** @public */
|
|
24
|
-
type IModelAccess = ECSchemaProvider & LimitingECSqlQueryExecutor &
|
|
24
|
+
type IModelAccess = ECSchemaProvider & LimitingECSqlQueryExecutor & {
|
|
25
25
|
imodelKey: string;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
@@ -34,7 +34,6 @@ interface IModelHierarchyProviderProps {
|
|
|
34
34
|
*
|
|
35
35
|
* @see `ECSchemaProvider`
|
|
36
36
|
* @see `LimitingECSqlQueryExecutor`
|
|
37
|
-
* @see `ECClassHierarchyInspector`
|
|
38
37
|
*/
|
|
39
38
|
imodelAccess: IModelAccess;
|
|
40
39
|
/**
|
|
@@ -106,7 +105,6 @@ interface MergedIModelHierarchyProviderProps extends Omit<IModelHierarchyProvide
|
|
|
106
105
|
*
|
|
107
106
|
* @see `ECSchemaProvider`
|
|
108
107
|
* @see `LimitingECSqlQueryExecutor`
|
|
109
|
-
* @see `ECClassHierarchyInspector`
|
|
110
108
|
*/
|
|
111
109
|
imodelAccess: IModelAccess;
|
|
112
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;AAmCxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA4B5D,OAAO,KAAK,EAEV,gBAAgB,EAEhB,KAAK,EAEL,iCAAiC,EACjC,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAA0B,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,OAAO,KAAK,EAGV,mBAAmB,EAEpB,MAAM,gCAAgC,CAAC;AAOxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAUlF;;;GAGG;AACH,UAAU,uCAAuC;IAC/C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,cAAc;AACd,KAAK,YAAY,GAAG,gBAAgB,GAAG,0BAA0B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1F;;;GAGG;AACH,UAAU,4BAA4B;IACpC;;;;;OAKG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;IAEzC,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAC,uCAAuC,CAAC,CAAC;IAEpE;;;;OAIG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAC;IAErC;;;;;OAKG;IACH,MAAM,CAAC,EAAE;QACP,iFAAiF;QACjF,KAAK,EAAE,mBAAmB,EAAE,CAAC;KAC9B,CAAC;IAEF;;;;;;;OAOG;IACH,gCAAgC,CAAC,EAAE,iCAAiC,CAAC;CACtE;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,4BAA4B,GAAG,iBAAiB,GAAG,UAAU,CAMjH;AAED;;;GAGG;AACH,UAAU,kCAAmC,SAAQ,IAAI,CACvD,4BAA4B,EAC5B,cAAc,GAAG,eAAe,GAAG,kCAAkC,CACtE;IACC;;;;;OAKG;IACH,OAAO,EAAE,KAAK,CAAC;QACb;;;;;WAKG;QACH,YAAY,EAAE,YAAY,CAAC;QAE3B;;;WAGG;QACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;QAElC;;;;;;;WAOG;QACH,gCAAgC,CAAC,EAAE,iCAAiC,CAAC;KACtE,CAAC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,kCAAkC,GACxC,iBAAiB,GAAG,UAAU,CAEhC"}
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import "../internal/DisposePolyfill.js";
|
|
6
6
|
import { catchError, concat, defaultIfEmpty, EMPTY, filter, finalize, from, fromEventPattern, identity, map, merge, mergeAll, mergeMap, of, reduce, Subject, take, takeUntil, tap, } from "rxjs";
|
|
7
7
|
import { assert, BeEvent, Guid, StopWatch } from "@itwin/core-bentley";
|
|
8
|
-
import { createDefaultValueFormatter, createIModelInstanceLabelSelectClauseFactory, formatConcatenatedValue, InstanceKey, normalizeFullClassName, } from "@itwin/presentation-shared";
|
|
8
|
+
import { createDefaultValueFormatter, createIModelInstanceLabelSelectClauseFactory, eachValueFrom, formatConcatenatedValue, InstanceKey, normalizeFullClassName, } from "@itwin/presentation-shared";
|
|
9
9
|
import { RowsLimitExceededError } from "../HierarchyErrors.js";
|
|
10
10
|
import { HierarchyNode } from "../HierarchyNode.js";
|
|
11
11
|
import { HierarchyNodeKey } from "../HierarchyNodeKey.js";
|
|
12
12
|
import { HierarchySearchTree } from "../HierarchySearch.js";
|
|
13
13
|
import { LOGGING_NAMESPACE as BASE_LOGGING_NAMESPACE, LOGGING_NAMESPACE_INTERNAL as BASE_LOGGING_NAMESPACE_INTERNAL, LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE, createNodeIdentifierForLogging, hasChildren, } from "../internal/Common.js";
|
|
14
|
-
import { eachValueFrom } from "../internal/EachValueFrom.js";
|
|
15
14
|
import { doLog, log } from "../internal/LoggingUtils.js";
|
|
16
15
|
import { partition } from "../internal/operators/Partition.js";
|
|
17
16
|
import { reduceToMergeMapList } from "../internal/operators/ReduceToMergeMap.js";
|
|
@@ -59,6 +58,7 @@ export function createMergedIModelHierarchyProvider(props) {
|
|
|
59
58
|
return new IModelHierarchyProviderImpl(props);
|
|
60
59
|
}
|
|
61
60
|
class IModelHierarchyProviderImpl {
|
|
61
|
+
_imodelProps;
|
|
62
62
|
_imodels;
|
|
63
63
|
_hierarchyChanged;
|
|
64
64
|
_valuesFormatter;
|
|
@@ -80,13 +80,8 @@ class IModelHierarchyProviderImpl {
|
|
|
80
80
|
this.#componentId = Guid.createValue();
|
|
81
81
|
this.#componentName = "IModelHierarchyProviderImpl";
|
|
82
82
|
this.#sourceName = props.sourceName ?? `${this.#componentName}:${this.#componentId}`;
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
instanceLabelSelectClauseFactory = createIModelInstanceLabelSelectClauseFactory({ imodelAccess });
|
|
86
|
-
}
|
|
87
|
-
const nodeSelectClauseFactory = createNodesQueryClauseFactory({ imodelAccess, instanceLabelSelectClauseFactory });
|
|
88
|
-
return { imodelAccess, imodelChanged, nodeSelectClauseFactory };
|
|
89
|
-
});
|
|
83
|
+
this._imodelProps = props.imodels;
|
|
84
|
+
this._imodels = props.imodels.map((imodelProps) => this.#createIModelState(imodelProps));
|
|
90
85
|
this._hierarchyChanged = new BeEvent();
|
|
91
86
|
this._activeHierarchyDefinition = this._sourceHierarchyDefinition = getRxjsHierarchyDefinition(props.hierarchyDefinition);
|
|
92
87
|
this._valuesFormatter = props.formatter ?? createDefaultValueFormatter();
|
|
@@ -103,18 +98,26 @@ class IModelHierarchyProviderImpl {
|
|
|
103
98
|
});
|
|
104
99
|
}
|
|
105
100
|
const imodelChangeSubscription = from(this._imodels)
|
|
106
|
-
.pipe(mergeMap(({ imodelAccess, imodelChanged }) => imodelChanged
|
|
107
|
-
? fromEventPattern((handler) => imodelChanged.addListener(handler), (handler) => imodelChanged.removeListener(handler), () => imodelAccess)
|
|
101
|
+
.pipe(mergeMap(({ imodelAccess, imodelChanged }, index) => imodelChanged
|
|
102
|
+
? fromEventPattern((handler) => imodelChanged.addListener(handler), (handler) => imodelChanged.removeListener(handler), () => ({ imodelKey: imodelAccess.imodelKey, index }))
|
|
108
103
|
: EMPTY))
|
|
109
|
-
.subscribe(({ imodelKey }) => {
|
|
104
|
+
.subscribe(({ imodelKey, index }) => {
|
|
110
105
|
this.invalidateHierarchyCache(`Data source changed: "${imodelKey}"`);
|
|
111
106
|
this._dispose.next();
|
|
107
|
+
// The iModel's schemas may have changed, so re-create the query factories to drop their schema-derived caches.
|
|
108
|
+
this._imodels[index] = this.#createIModelState(this._imodelProps[index]);
|
|
112
109
|
this._hierarchyChanged.raiseEvent({});
|
|
113
110
|
});
|
|
114
111
|
this._unsubscribe = () => {
|
|
115
112
|
imodelChangeSubscription.unsubscribe();
|
|
116
113
|
};
|
|
117
114
|
}
|
|
115
|
+
#createIModelState(imodelProps) {
|
|
116
|
+
const { imodelAccess, imodelChanged } = imodelProps;
|
|
117
|
+
const instanceLabelSelectClauseFactory = imodelProps.instanceLabelSelectClauseFactory ?? createIModelInstanceLabelSelectClauseFactory({ imodelAccess });
|
|
118
|
+
const nodeSelectClauseFactory = createNodesQueryClauseFactory({ imodelAccess, instanceLabelSelectClauseFactory });
|
|
119
|
+
return { imodelAccess, imodelChanged, nodeSelectClauseFactory };
|
|
120
|
+
}
|
|
118
121
|
[Symbol.dispose]() {
|
|
119
122
|
this._dispose.next();
|
|
120
123
|
this._unsubscribe?.();
|