@itwin/presentation-hierarchies 2.0.0-alpha.17 → 2.0.0-alpha.18
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 +107 -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
|
@@ -43,7 +43,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
43
43
|
}
|
|
44
44
|
const currentProperty = byProperties.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];
|
|
45
45
|
const propertyClass = handlerGroupingParams.ecClass;
|
|
46
|
-
const property =
|
|
46
|
+
const property = propertyClass.getProperty(currentProperty.propertyName);
|
|
47
47
|
if (!property?.isNavigation() &&
|
|
48
48
|
(!property?.isPrimitive() || property.primitiveType === "Binary" || property.primitiveType === "IGeometry")) {
|
|
49
49
|
groupings.ungrouped.push(node);
|
|
@@ -55,7 +55,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
55
55
|
assert(primitiveType !== "Binary" && primitiveType !== "IGeometry");
|
|
56
56
|
if (!currentProperty.propertyValue) {
|
|
57
57
|
if (byProperties.createGroupForUnspecifiedValues) {
|
|
58
|
-
addGroupingToMap(groupings.grouped, `${
|
|
58
|
+
addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:Unspecified`, {
|
|
59
59
|
label: localizedStrings.unspecified,
|
|
60
60
|
propertyGroupingNodeKey: {
|
|
61
61
|
type: "property-grouping:value",
|
|
@@ -68,7 +68,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
68
68
|
groupings.ungrouped.push(node);
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
|
-
const koqName =
|
|
71
|
+
const koqName = property.kindOfQuantity?.fullName;
|
|
72
72
|
if (currentProperty.ranges) {
|
|
73
73
|
if (typeof currentProperty.propertyValue === "number") {
|
|
74
74
|
const propValue = currentProperty.propertyValue;
|
|
@@ -88,7 +88,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
88
88
|
};
|
|
89
89
|
const rangeLabel = matchingRange.rangeLabel ??
|
|
90
90
|
`${await valueFormatter(fromValueTypedPrimitive)} - ${await valueFormatter(toValueTypedPrimitive)}`;
|
|
91
|
-
addGroupingToMap(groupings.grouped, `${
|
|
91
|
+
addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:[${matchingRange.fromValue}-${matchingRange.toValue}]${matchingRange.rangeLabel ? `(${matchingRange.rangeLabel})` : ""}`, {
|
|
92
92
|
label: rangeLabel,
|
|
93
93
|
propertyGroupingNodeKey: {
|
|
94
94
|
...propertyIdentifier,
|
|
@@ -107,8 +107,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
107
107
|
className: propertyIdentifier.propertyClassName,
|
|
108
108
|
propertyName: propertyIdentifier.propertyName,
|
|
109
109
|
};
|
|
110
|
-
const hasPropertyIdentifier = groupingNode.key.properties.find((x) => x.className
|
|
111
|
-
x.propertyName.toLocaleLowerCase() === thisPropertyIdentifier.propertyName.toLocaleLowerCase());
|
|
110
|
+
const hasPropertyIdentifier = groupingNode.key.properties.find((x) => x.className === thisPropertyIdentifier.className && x.propertyName === thisPropertyIdentifier.propertyName);
|
|
112
111
|
if (!hasPropertyIdentifier) {
|
|
113
112
|
groupingNode.key.properties.push(thisPropertyIdentifier);
|
|
114
113
|
}
|
|
@@ -123,7 +122,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
|
|
|
123
122
|
const formattedValue = currentProperty.propertyValue instanceof Array
|
|
124
123
|
? await formatConcatenatedValue({ value: currentProperty.propertyValue, valueFormatter })
|
|
125
124
|
: await valueFormatter(TypedPrimitiveValue.create(currentProperty.propertyValue, primitiveType, koqName, extendedTypeName));
|
|
126
|
-
addGroupingToMap(groupings.grouped, `${
|
|
125
|
+
addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:${formattedValue}`, {
|
|
127
126
|
label: formattedValue,
|
|
128
127
|
propertyGroupingNodeKey: {
|
|
129
128
|
...propertyIdentifier,
|
|
@@ -182,15 +181,11 @@ function createNodePropertyGroupPathMatchers(node) {
|
|
|
182
181
|
return propertyGroupingNodeKeys.map((key) => {
|
|
183
182
|
switch (key.type) {
|
|
184
183
|
case "property-grouping:other":
|
|
185
|
-
return (x) => key.properties.some((p) => p.className
|
|
186
|
-
p.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase() &&
|
|
187
|
-
!!x.isRange);
|
|
184
|
+
return (x) => key.properties.some((p) => p.className === x.propertiesClassName && p.propertyName === x.propertyName && !!x.isRange);
|
|
188
185
|
case "property-grouping:range":
|
|
189
|
-
return (x) => key.propertyClassName
|
|
190
|
-
key.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase();
|
|
186
|
+
return (x) => key.propertyClassName === x.propertiesClassName && key.propertyName === x.propertyName;
|
|
191
187
|
case "property-grouping:value":
|
|
192
|
-
return (x) => key.propertyClassName
|
|
193
|
-
key.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase();
|
|
188
|
+
return (x) => key.propertyClassName === x.propertiesClassName && key.propertyName === x.propertyName;
|
|
194
189
|
}
|
|
195
190
|
});
|
|
196
191
|
}
|
|
@@ -199,42 +194,58 @@ export async function getUniquePropertiesGroupInfo(schemaProvider, parentNode, n
|
|
|
199
194
|
const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
|
|
200
195
|
const parentPropertyGroupPath = parentNode ? createNodePropertyGroupPathMatchers(parentNode) : [];
|
|
201
196
|
const uniqueProperties = new Map();
|
|
197
|
+
// `getClass` resolves the same class for every node sharing a `propertiesClassName`, so resolve each class once and
|
|
198
|
+
// reuse it across nodes instead of calling `getClass` (schema lookup + class lookup) on every node.
|
|
199
|
+
const propertiesClassCache = new Map();
|
|
200
|
+
const getPropertiesClass = async (fullClassName) => {
|
|
201
|
+
let ecClass = propertiesClassCache.get(fullClassName);
|
|
202
|
+
if (!ecClass) {
|
|
203
|
+
ecClass = await getClass(schemaProvider, fullClassName);
|
|
204
|
+
propertiesClassCache.set(fullClassName, ecClass);
|
|
205
|
+
}
|
|
206
|
+
return ecClass;
|
|
207
|
+
};
|
|
202
208
|
for (const node of nodes) {
|
|
203
209
|
await releaseMainThread();
|
|
204
210
|
const byProperties = node.processingParams?.grouping?.byProperties;
|
|
205
211
|
if (!byProperties) {
|
|
206
212
|
continue;
|
|
207
213
|
}
|
|
214
|
+
const propertiesClass = await getPropertiesClass(byProperties.propertiesClassName);
|
|
208
215
|
let propertyGroupIndex = 0;
|
|
209
216
|
const previousPropertiesInfo = new Array();
|
|
210
217
|
for (const propertyGroup of byProperties.propertyGroups) {
|
|
218
|
+
const property = propertiesClass.getProperty(propertyGroup.propertyName);
|
|
219
|
+
const propertyName = property?.name ?? propertyGroup.propertyName;
|
|
220
|
+
const propertyClassName = property?.class.fullName ?? propertiesClass.fullName;
|
|
211
221
|
const mapKeyRanges = getRangesAsString(propertyGroup.ranges);
|
|
212
222
|
const lastKey = previousPropertiesInfo.length > 0
|
|
213
223
|
? previousPropertiesInfo[previousPropertiesInfo.length - 1].propertyGroupKey
|
|
214
224
|
: "";
|
|
215
|
-
const propertyGroupKey = `${lastKey}:${
|
|
216
|
-
const mapKey = `${
|
|
225
|
+
const propertyGroupKey = `${lastKey}:${propertyName}(${mapKeyRanges})`;
|
|
226
|
+
const mapKey = `${propertiesClass.fullName}:${propertyGroupKey}`;
|
|
217
227
|
let isAlreadyGrouped = false;
|
|
218
228
|
if (parentPropertyGroupPath.length > 0 && propertyGroupIndex < parentPropertyGroupPath.length) {
|
|
219
229
|
const groupMatcher = parentPropertyGroupPath[propertyGroupIndex];
|
|
220
230
|
isAlreadyGrouped = groupMatcher({
|
|
221
|
-
propertiesClassName:
|
|
222
|
-
propertyName
|
|
231
|
+
propertiesClassName: propertyClassName,
|
|
232
|
+
propertyName,
|
|
223
233
|
isRange: !!propertyGroup.ranges,
|
|
224
234
|
});
|
|
225
235
|
}
|
|
226
236
|
if (!isAlreadyGrouped && !uniqueProperties.get(mapKey)) {
|
|
227
237
|
uniqueProperties.set(mapKey, {
|
|
228
|
-
ecClass:
|
|
229
|
-
propertyGroup: { propertyName
|
|
238
|
+
ecClass: propertiesClass,
|
|
239
|
+
propertyGroup: { propertyName, ranges: propertyGroup.ranges },
|
|
230
240
|
previousPropertiesGroupingInfo: previousPropertiesInfo.map((groupingInfo) => ({
|
|
231
|
-
propertiesClassName:
|
|
241
|
+
propertiesClassName: propertiesClass.getProperty(groupingInfo.propertyGroup.propertyName)?.class.fullName ??
|
|
242
|
+
propertiesClass.fullName,
|
|
232
243
|
propertyName: groupingInfo.propertyGroup.propertyName,
|
|
233
244
|
isRange: !!groupingInfo.propertyGroup.ranges,
|
|
234
245
|
})),
|
|
235
246
|
});
|
|
236
247
|
}
|
|
237
|
-
previousPropertiesInfo.push({ propertyGroup, propertyGroupKey });
|
|
248
|
+
previousPropertiesInfo.push({ propertyGroup: { ...propertyGroup, propertyName }, propertyGroupKey });
|
|
238
249
|
++propertyGroupIndex;
|
|
239
250
|
}
|
|
240
251
|
}
|
|
@@ -250,14 +261,12 @@ function getRangesAsString(ranges) {
|
|
|
250
261
|
: "";
|
|
251
262
|
}
|
|
252
263
|
async function shouldCreatePropertyGroup(handlerGroupingParams, nodePropertyGroupingParams, nodeFullClassName, classHierarchyInspector) {
|
|
253
|
-
if (nodePropertyGroupingParams.propertiesClassName.
|
|
254
|
-
handlerGroupingParams.ecClass.fullName.toLocaleLowerCase() ||
|
|
264
|
+
if (nodePropertyGroupingParams.propertiesClassName !== handlerGroupingParams.ecClass.fullName ||
|
|
255
265
|
nodePropertyGroupingParams.propertyGroups.length < handlerGroupingParams.previousPropertiesGroupingInfo.length + 1) {
|
|
256
266
|
return false;
|
|
257
267
|
}
|
|
258
268
|
const currentProperty = nodePropertyGroupingParams.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];
|
|
259
|
-
if (currentProperty.propertyName.
|
|
260
|
-
handlerGroupingParams.propertyGroup.propertyName.toLocaleLowerCase() ||
|
|
269
|
+
if (currentProperty.propertyName !== handlerGroupingParams.propertyGroup.propertyName ||
|
|
261
270
|
!doRangesMatch(currentProperty.ranges, handlerGroupingParams.propertyGroup.ranges)) {
|
|
262
271
|
return false;
|
|
263
272
|
}
|
|
@@ -269,10 +278,8 @@ async function shouldCreatePropertyGroup(handlerGroupingParams, nodePropertyGrou
|
|
|
269
278
|
/** @internal */
|
|
270
279
|
export function doPreviousPropertiesMatch(previousPropertiesGroupingInfo, nodesProperties) {
|
|
271
280
|
return (previousPropertiesGroupingInfo.length <= nodesProperties.propertyGroups.length &&
|
|
272
|
-
previousPropertiesGroupingInfo.every((groupingInfo, index) => groupingInfo.propertiesClassName.
|
|
273
|
-
nodesProperties.
|
|
274
|
-
groupingInfo.propertyName.toLocaleLowerCase() ===
|
|
275
|
-
nodesProperties.propertyGroups[index].propertyName.toLocaleLowerCase() &&
|
|
281
|
+
previousPropertiesGroupingInfo.every((groupingInfo, index) => groupingInfo.propertiesClassName === nodesProperties.propertiesClassName &&
|
|
282
|
+
groupingInfo.propertyName === nodesProperties.propertyGroups[index].propertyName &&
|
|
276
283
|
!!groupingInfo.isRange === !!nodesProperties.propertyGroups[index].ranges));
|
|
277
284
|
}
|
|
278
285
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertiesGrouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/PropertiesGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,0CAA0C,EAC1C,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAoDhE,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAA8C,EAC9C,mBAA8D,EAC9D,qBAAwC,EACxC,cAAwC,EACxC,gBAAoD,EACpD,uBAAkD;IAElD,IAAI,mBAAgG,CAAC;IACrG,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACpG,IAAI,IAAI,EAAE,CAAC;gBACT,mBAAmB,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AC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;IACL,wGAAwG;IACxG,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzB,OAAO,CAAC,IAAI,CACV,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;QACzC,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;QACrC,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAC9C,CACF;QACD,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzB,OAAO,CAAC,IAAI,CACV,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;YACzC,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;YACrC,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAC9C,CACF,CACF,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,YAA0D,EAC1D,UAA2C,EAC3C,KAAuC,EACvC,cAAwC,EACxC,gBAAoD;IAEpD,MAAM,mBAAmB,GAAG,MAAM,4BAA4B,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAChG,OAAO,mBAAmB,CAAC,GAAG,CAC5B,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,EAAE,CAC5D,oBAAoB,CAClB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,CACb,CACJ,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 { assert } from \"@itwin/core-bentley\";\nimport {\n createMainThreadReleaseOnTimePassedHandler,\n formatConcatenatedValue,\n getClass,\n TypedPrimitiveValue,\n} from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\nimport { HierarchyNodeKey } from \"../../../HierarchyNodeKey.js\";\n\nimport type {\n ArrayElement,\n EC,\n ECClassHierarchyInspector,\n ECSchemaProvider,\n IPrimitiveValueFormatter,\n} from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { PropertyGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type {\n HierarchyNodePropertiesGroupingParams,\n HierarchyNodePropertyGroup,\n HierarchyNodePropertyValueRange,\n ProcessedInstanceHierarchyNode,\n} from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandler, GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from \"../Grouping.js\";\n\ninterface DisplayablePropertyGroupingInfo {\n label: string;\n propertyGroupingNodeKey: PropertyGroupingNodeKey;\n}\n\ninterface PropertyGroupingInformation {\n ungrouped: ProcessedInstanceHierarchyNode[];\n grouped: Map<\n string,\n { displayablePropertyGroupingInfo: DisplayablePropertyGroupingInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }\n >;\n}\n\n/** @internal */\nexport interface PropertiesGroupingLocalizedStrings {\n other: string;\n unspecified: string;\n}\n\n/** @internal */\nexport interface PropertyGroupInfo {\n ecClass: EC.Class;\n previousPropertiesGroupingInfo: PreviousPropertiesGroupingInfo;\n propertyGroup: Omit<HierarchyNodePropertyGroup, \"propertyValue\">;\n}\n\n/** @internal */\nexport type PreviousPropertiesGroupingInfo = Array<{\n propertiesClassName: EC.FullClassNameDotNotation;\n propertyName: string;\n isRange?: boolean;\n}>;\n\n/** @internal */\nexport async function createPropertyGroups(\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n handlerGroupingParams: PropertyGroupInfo,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n classHierarchyInspector: ECClassHierarchyInspector,\n): Promise<GroupingHandlerResult> {\n let otherValuesGrouping: { node: ProcessedInstancesGroupingHierarchyNode; new: boolean } | undefined;\n const getOtherValuesGroupingNode = () => {\n if (!otherValuesGrouping) {\n const node = nodesAlreadyGrouped.find((n) => HierarchyNodeKey.isPropertyOtherValuesGrouping(n.key));\n if (node) {\n otherValuesGrouping = { node, new: false };\n }\n }\n otherValuesGrouping ??= {\n node: {\n key: { type: \"property-grouping:other\" as const, properties: [] },\n parentKeys: [],\n groupedInstanceKeys: [],\n label: localizedStrings.other,\n children: [],\n },\n new: true,\n };\n return otherValuesGrouping.node;\n };\n\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const groupings: PropertyGroupingInformation = { ungrouped: [], grouped: new Map() };\n for (const node of nodesToGroup) {\n await releaseMainThread();\n\n const byProperties = node.processingParams?.grouping?.byProperties;\n if (!byProperties) {\n groupings.ungrouped.push(node);\n continue;\n }\n if (\n !(await shouldCreatePropertyGroup(\n handlerGroupingParams,\n byProperties,\n node.key.instanceKeys[0].className,\n classHierarchyInspector,\n ))\n ) {\n groupings.ungrouped.push(node);\n continue;\n }\n const currentProperty = byProperties.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];\n const propertyClass = handlerGroupingParams.ecClass;\n const property = await propertyClass.getProperty(currentProperty.propertyName);\n\n if (\n !property?.isNavigation() &&\n (!property?.isPrimitive() || property.primitiveType === \"Binary\" || property.primitiveType === \"IGeometry\")\n ) {\n groupings.ungrouped.push(node);\n continue;\n }\n\n const propertyIdentifier = { propertyName: property.name, propertyClassName: property.class.fullName };\n const extendedTypeName = \"extendedTypeName\" in property ? property.extendedTypeName : undefined;\n const primitiveType = \"primitiveType\" in property ? property.primitiveType : \"String\";\n assert(primitiveType !== \"Binary\" && primitiveType !== \"IGeometry\");\n\n if (!currentProperty.propertyValue) {\n if (byProperties.createGroupForUnspecifiedValues) {\n addGroupingToMap(\n groupings.grouped,\n `${currentProperty.propertyName.toLocaleLowerCase()}:Unspecified`,\n {\n label: localizedStrings.unspecified,\n propertyGroupingNodeKey: {\n type: \"property-grouping:value\",\n ...propertyIdentifier,\n formattedPropertyValue: \"\",\n },\n },\n node,\n );\n continue;\n }\n groupings.ungrouped.push(node);\n continue;\n }\n\n const koqName = (await property.kindOfQuantity)?.fullName;\n if (currentProperty.ranges) {\n if (typeof currentProperty.propertyValue === \"number\") {\n const propValue = currentProperty.propertyValue;\n const matchingRange = currentProperty.ranges.find(\n (range) => propValue >= range.fromValue && propValue <= range.toValue,\n );\n\n if (matchingRange) {\n const fromValueTypedPrimitive: TypedPrimitiveValue = {\n type: Number.isInteger(matchingRange.fromValue) ? \"Integer\" : \"Double\",\n extendedType: extendedTypeName,\n koqName,\n value: matchingRange.fromValue,\n };\n const toValueTypedPrimitive: TypedPrimitiveValue = {\n type: Number.isInteger(matchingRange.toValue) ? \"Integer\" : \"Double\",\n extendedType: extendedTypeName,\n koqName,\n value: matchingRange.toValue,\n };\n\n const rangeLabel =\n matchingRange.rangeLabel ??\n `${await valueFormatter(fromValueTypedPrimitive)} - ${await valueFormatter(toValueTypedPrimitive)}`;\n addGroupingToMap(\n groupings.grouped,\n `${currentProperty.propertyName.toLocaleLowerCase()}:[${matchingRange.fromValue}-${matchingRange.toValue}]${matchingRange.rangeLabel ? `(${matchingRange.rangeLabel})` : \"\"}`,\n {\n label: rangeLabel,\n propertyGroupingNodeKey: {\n ...propertyIdentifier,\n type: \"property-grouping:range\",\n fromValue: matchingRange.fromValue,\n toValue: matchingRange.toValue,\n },\n },\n node,\n );\n continue;\n }\n }\n if (byProperties.createGroupForOutOfRangeValues) {\n const groupingNode = getOtherValuesGroupingNode();\n assert(HierarchyNodeKey.isPropertyOtherValuesGrouping(groupingNode.key));\n const thisPropertyIdentifier = {\n className: propertyIdentifier.propertyClassName,\n propertyName: propertyIdentifier.propertyName,\n };\n const hasPropertyIdentifier = groupingNode.key.properties.find(\n (x) =>\n x.className.toLocaleLowerCase() === thisPropertyIdentifier.className.toLocaleLowerCase() &&\n x.propertyName.toLocaleLowerCase() === thisPropertyIdentifier.propertyName.toLocaleLowerCase(),\n );\n if (!hasPropertyIdentifier) {\n groupingNode.key.properties.push(thisPropertyIdentifier);\n }\n node.key.instanceKeys.forEach((k) => groupingNode.groupedInstanceKeys.push(k));\n groupingNode.parentKeys = node.parentKeys;\n groupingNode.children.push(Object.assign(node, { parentKeys: [...node.parentKeys, groupingNode.key] }));\n continue;\n }\n groupings.ungrouped.push(node);\n continue;\n }\n\n const formattedValue =\n currentProperty.propertyValue instanceof Array\n ? await formatConcatenatedValue({ value: currentProperty.propertyValue, valueFormatter })\n : await valueFormatter(\n TypedPrimitiveValue.create(currentProperty.propertyValue, primitiveType, koqName, extendedTypeName),\n );\n\n addGroupingToMap(\n groupings.grouped,\n `${currentProperty.propertyName.toLocaleLowerCase()}:${formattedValue}`,\n {\n label: formattedValue,\n propertyGroupingNodeKey: {\n ...propertyIdentifier,\n type: \"property-grouping:value\",\n formattedPropertyValue: formattedValue,\n },\n },\n node,\n );\n }\n return createGroupingNodes(groupings, otherValuesGrouping?.new ? otherValuesGrouping.node : undefined);\n}\n\nfunction addGroupingToMap(\n groupingMap: Map<\n string,\n { displayablePropertyGroupingInfo: DisplayablePropertyGroupingInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }\n >,\n mapKey: string,\n propertyToAdd: DisplayablePropertyGroupingInfo,\n node: ProcessedInstanceHierarchyNode,\n): void {\n let groupingInfo = groupingMap.get(mapKey);\n if (!groupingInfo) {\n groupingInfo = { displayablePropertyGroupingInfo: propertyToAdd, groupedNodes: [node] };\n groupingMap.set(mapKey, groupingInfo);\n return;\n }\n groupingInfo.groupedNodes.push(node);\n}\n\nfunction createGroupingNodes(\n groupings: PropertyGroupingInformation,\n otherValuesGroupingNode: ProcessedInstancesGroupingHierarchyNode | undefined,\n): GroupingHandlerResult {\n const groupedNodes = new Array<ProcessedInstancesGroupingHierarchyNode>();\n groupings.grouped.forEach((entry) => {\n const groupedNodeParentKeys = entry.groupedNodes[0].parentKeys;\n groupedNodes.push({\n label: entry.displayablePropertyGroupingInfo.label,\n key: entry.displayablePropertyGroupingInfo.propertyGroupingNodeKey,\n parentKeys: groupedNodeParentKeys,\n groupedInstanceKeys: entry.groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: entry.groupedNodes.map((gn) => ({\n ...gn,\n parentKeys: [...groupedNodeParentKeys, entry.displayablePropertyGroupingInfo.propertyGroupingNodeKey],\n })),\n });\n });\n if (otherValuesGroupingNode) {\n groupedNodes.push(otherValuesGroupingNode);\n }\n return { grouped: groupedNodes, ungrouped: groupings.ungrouped, groupingType: \"property\" };\n}\n\nfunction createNodePropertyGroupPathMatchers(\n node: ParentHierarchyNode,\n): Array<(x: ArrayElement<PreviousPropertiesGroupingInfo>) => boolean> {\n if (!HierarchyNode.isPropertyGroupingNode(node)) {\n return [];\n }\n\n const keys = [...node.parentKeys, node.key];\n const propertyGroupingNodeKeys: PropertyGroupingNodeKey[] = [];\n for (let i = keys.length - 1; i >= 0; --i) {\n const key = keys[i];\n if (HierarchyNodeKey.isPropertyGrouping(key)) {\n propertyGroupingNodeKeys.push(key);\n } else {\n break;\n }\n }\n propertyGroupingNodeKeys.reverse();\n\n return propertyGroupingNodeKeys.map((key): ((x: ArrayElement<PreviousPropertiesGroupingInfo>) => boolean) => {\n switch (key.type) {\n case \"property-grouping:other\":\n return (x) =>\n key.properties.some(\n (p) =>\n p.className.toLocaleLowerCase() === x.propertiesClassName.toLocaleLowerCase() &&\n p.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase() &&\n !!x.isRange,\n );\n case \"property-grouping:range\":\n return (x) =>\n key.propertyClassName.toLocaleLowerCase() === x.propertiesClassName.toLocaleLowerCase() &&\n key.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase();\n case \"property-grouping:value\":\n return (x) =>\n key.propertyClassName.toLocaleLowerCase() === x.propertiesClassName.toLocaleLowerCase() &&\n key.propertyName.toLocaleLowerCase() === x.propertyName.toLocaleLowerCase();\n }\n });\n}\n\n/** @internal */\nexport async function getUniquePropertiesGroupInfo(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<Array<PropertyGroupInfo>> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const parentPropertyGroupPath = parentNode ? createNodePropertyGroupPathMatchers(parentNode) : [];\n const uniqueProperties = new Map<string, PropertyGroupInfo>();\n for (const node of nodes) {\n await releaseMainThread();\n\n const byProperties = node.processingParams?.grouping?.byProperties;\n if (!byProperties) {\n continue;\n }\n\n let propertyGroupIndex = 0;\n const previousPropertiesInfo = new Array<{ propertyGroup: HierarchyNodePropertyGroup; propertyGroupKey: string }>();\n for (const propertyGroup of byProperties.propertyGroups) {\n const mapKeyRanges = getRangesAsString(propertyGroup.ranges);\n const lastKey =\n previousPropertiesInfo.length > 0\n ? previousPropertiesInfo[previousPropertiesInfo.length - 1].propertyGroupKey\n : \"\";\n const propertyGroupKey = `${lastKey}:${propertyGroup.propertyName}(${mapKeyRanges})`;\n const mapKey = `${byProperties.propertiesClassName}:${propertyGroupKey}`.toLocaleLowerCase();\n\n let isAlreadyGrouped = false;\n if (parentPropertyGroupPath.length > 0 && propertyGroupIndex < parentPropertyGroupPath.length) {\n const groupMatcher = parentPropertyGroupPath[propertyGroupIndex];\n isAlreadyGrouped = groupMatcher({\n propertiesClassName: byProperties.propertiesClassName,\n propertyName: propertyGroup.propertyName,\n isRange: !!propertyGroup.ranges,\n });\n }\n if (!isAlreadyGrouped && !uniqueProperties.get(mapKey)) {\n uniqueProperties.set(mapKey, {\n ecClass: await getClass(schemaProvider, byProperties.propertiesClassName),\n propertyGroup: { propertyName: propertyGroup.propertyName, ranges: propertyGroup.ranges },\n previousPropertiesGroupingInfo: previousPropertiesInfo.map((groupingInfo) => ({\n propertiesClassName: byProperties.propertiesClassName,\n propertyName: groupingInfo.propertyGroup.propertyName,\n isRange: !!groupingInfo.propertyGroup.ranges,\n })),\n });\n }\n\n previousPropertiesInfo.push({ propertyGroup, propertyGroupKey });\n ++propertyGroupIndex;\n }\n }\n // Order might change in uniqueProperties, resorting to make sure that properties with fewer previous properties are returned first.\n return [...uniqueProperties.values()].sort(\n (lhs, rhs) => lhs.previousPropertiesGroupingInfo.length - rhs.previousPropertiesGroupingInfo.length,\n );\n}\n\nfunction getRangesAsString(ranges?: HierarchyNodePropertyValueRange[]): string {\n return ranges\n ? ranges\n .map((range) => `${range.fromValue}-${range.toValue}(${range.rangeLabel ?? \"\"})`)\n .sort()\n .join(\";\")\n : \"\";\n}\n\nasync function shouldCreatePropertyGroup(\n handlerGroupingParams: PropertyGroupInfo,\n nodePropertyGroupingParams: HierarchyNodePropertiesGroupingParams,\n nodeFullClassName: EC.FullClassNameDotNotation,\n classHierarchyInspector: ECClassHierarchyInspector,\n): Promise<boolean> {\n if (\n nodePropertyGroupingParams.propertiesClassName.toLocaleLowerCase() !==\n handlerGroupingParams.ecClass.fullName.toLocaleLowerCase() ||\n nodePropertyGroupingParams.propertyGroups.length < handlerGroupingParams.previousPropertiesGroupingInfo.length + 1\n ) {\n return false;\n }\n const currentProperty =\n nodePropertyGroupingParams.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];\n if (\n currentProperty.propertyName.toLocaleLowerCase() !==\n handlerGroupingParams.propertyGroup.propertyName.toLocaleLowerCase() ||\n !doRangesMatch(currentProperty.ranges, handlerGroupingParams.propertyGroup.ranges)\n ) {\n return false;\n }\n if (!doPreviousPropertiesMatch(handlerGroupingParams.previousPropertiesGroupingInfo, nodePropertyGroupingParams)) {\n return false;\n }\n return classHierarchyInspector.classDerivesFrom(nodeFullClassName, handlerGroupingParams.ecClass.fullName);\n}\n\n/** @internal */\nexport function doPreviousPropertiesMatch(\n previousPropertiesGroupingInfo: PreviousPropertiesGroupingInfo,\n nodesProperties: HierarchyNodePropertiesGroupingParams,\n): boolean {\n return (\n previousPropertiesGroupingInfo.length <= nodesProperties.propertyGroups.length &&\n previousPropertiesGroupingInfo.every(\n (groupingInfo, index) =>\n groupingInfo.propertiesClassName.toLocaleLowerCase() ===\n nodesProperties.propertiesClassName.toLocaleLowerCase() &&\n groupingInfo.propertyName.toLocaleLowerCase() ===\n nodesProperties.propertyGroups[index].propertyName.toLocaleLowerCase() &&\n !!groupingInfo.isRange === !!nodesProperties.propertyGroups[index].ranges,\n )\n );\n}\n\n/** @internal */\nexport function doRangesMatch(\n ranges1: HierarchyNodePropertyValueRange[] | undefined,\n ranges2: HierarchyNodePropertyValueRange[] | undefined,\n): boolean {\n if (typeof ranges1 !== typeof ranges2) {\n return false;\n }\n if (!ranges1) {\n return true;\n }\n assert(Array.isArray(ranges2));\n if (ranges1.length !== ranges2.length) {\n return false;\n }\n return (\n // Check twice, to validate if both ranges have the same elements (elements can be in a different order)\n ranges1.every((lhsRange) =>\n ranges2.some(\n (rhsRange) =>\n lhsRange.fromValue === rhsRange.fromValue &&\n lhsRange.toValue === rhsRange.toValue &&\n lhsRange.rangeLabel === rhsRange.rangeLabel,\n ),\n ) &&\n ranges2.every((lhsRange) =>\n ranges1.some(\n (rhsRange) =>\n lhsRange.fromValue === rhsRange.fromValue &&\n lhsRange.toValue === rhsRange.toValue &&\n lhsRange.rangeLabel === rhsRange.rangeLabel,\n ),\n )\n );\n}\n\n/** @internal */\nexport async function createPropertiesGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Promise<GroupingHandler[]> {\n const propertiesGroupInfo = await getUniquePropertiesGroupInfo(imodelAccess, parentNode, nodes);\n return propertiesGroupInfo.map(\n (propertyInfo) => async (nodesToGroup, nodesAlreadyGrouped) =>\n createPropertyGroups(\n nodesToGroup,\n nodesAlreadyGrouped,\n propertyInfo,\n valueFormatter,\n localizedStrings,\n imodelAccess,\n ),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertiesGrouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/PropertiesGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,0CAA0C,EAC1C,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AA8ChE,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAA8C,EAC9C,mBAA8D,EAC9D,qBAAwC,EACxC,cAAwC,EACxC,gBAAoD,EACpD,uBAAmE;IAEnE,IAAI,mBAAgG,CAAC;IACrG,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACpG,IAAI,IAAI,EAAE,CAAC;gBACT,mBAAmB,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;YAC7C,CAAC;QACH,CAAC;QACD,mBAAmB,KAAK;YACtB,IAAI,EAAE;gBACJ,GAAG,EAAE,EAAE,IAAI,EAAE,yBAAkC,EAAE,UAAU,EAAE,EAAE,EAAE;gBACjE,UAAU,EAAE,EAAE;gBACd,mBAAmB,EAAE,EAAE;gB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,OAAO;IACL,wGAAwG;IACxG,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzB,OAAO,CAAC,IAAI,CACV,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;QACzC,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;QACrC,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAC9C,CACF;QACD,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzB,OAAO,CAAC,IAAI,CACV,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;YACzC,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;YACrC,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,UAAU,CAC9C,CACF,CACF,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,YAA8B,EAC9B,UAA2C,EAC3C,KAAuC,EACvC,cAAwC,EACxC,gBAAoD;IAEpD,MAAM,mBAAmB,GAAG,MAAM,4BAA4B,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAChG,OAAO,mBAAmB,CAAC,GAAG,CAC5B,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,EAAE,CAC5D,oBAAoB,CAClB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,CACb,CACJ,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 { assert } from \"@itwin/core-bentley\";\nimport {\n createMainThreadReleaseOnTimePassedHandler,\n formatConcatenatedValue,\n getClass,\n TypedPrimitiveValue,\n} from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\nimport { HierarchyNodeKey } from \"../../../HierarchyNodeKey.js\";\n\nimport type { ArrayElement, EC, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { PropertyGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type {\n HierarchyNodePropertiesGroupingParams,\n HierarchyNodePropertyGroup,\n HierarchyNodePropertyValueRange,\n ProcessedInstanceHierarchyNode,\n} from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandler, GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from \"../Grouping.js\";\n\ninterface DisplayablePropertyGroupingInfo {\n label: string;\n propertyGroupingNodeKey: PropertyGroupingNodeKey;\n}\n\ninterface PropertyGroupingInformation {\n ungrouped: ProcessedInstanceHierarchyNode[];\n grouped: Map<\n string,\n { displayablePropertyGroupingInfo: DisplayablePropertyGroupingInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }\n >;\n}\n\n/** @internal */\nexport interface PropertiesGroupingLocalizedStrings {\n other: string;\n unspecified: string;\n}\n\n/** @internal */\nexport interface PropertyGroupInfo {\n ecClass: EC.Class;\n previousPropertiesGroupingInfo: PreviousPropertiesGroupingInfo;\n propertyGroup: Omit<HierarchyNodePropertyGroup, \"propertyValue\">;\n}\n\n/** @internal */\nexport type PreviousPropertiesGroupingInfo = Array<{\n propertiesClassName: EC.FullClassNameDotNotation;\n propertyName: string;\n isRange?: boolean;\n}>;\n\n/** @internal */\nexport async function createPropertyGroups(\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n handlerGroupingParams: PropertyGroupInfo,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n classHierarchyInspector: Pick<ECSchemaProvider, \"classDerivesFrom\">,\n): Promise<GroupingHandlerResult> {\n let otherValuesGrouping: { node: ProcessedInstancesGroupingHierarchyNode; new: boolean } | undefined;\n const getOtherValuesGroupingNode = () => {\n if (!otherValuesGrouping) {\n const node = nodesAlreadyGrouped.find((n) => HierarchyNodeKey.isPropertyOtherValuesGrouping(n.key));\n if (node) {\n otherValuesGrouping = { node, new: false };\n }\n }\n otherValuesGrouping ??= {\n node: {\n key: { type: \"property-grouping:other\" as const, properties: [] },\n parentKeys: [],\n groupedInstanceKeys: [],\n label: localizedStrings.other,\n children: [],\n },\n new: true,\n };\n return otherValuesGrouping.node;\n };\n\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const groupings: PropertyGroupingInformation = { ungrouped: [], grouped: new Map() };\n for (const node of nodesToGroup) {\n await releaseMainThread();\n\n const byProperties = node.processingParams?.grouping?.byProperties;\n if (!byProperties) {\n groupings.ungrouped.push(node);\n continue;\n }\n if (\n !(await shouldCreatePropertyGroup(\n handlerGroupingParams,\n byProperties,\n node.key.instanceKeys[0].className,\n classHierarchyInspector,\n ))\n ) {\n groupings.ungrouped.push(node);\n continue;\n }\n const currentProperty = byProperties.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];\n const propertyClass = handlerGroupingParams.ecClass;\n const property = propertyClass.getProperty(currentProperty.propertyName);\n\n if (\n !property?.isNavigation() &&\n (!property?.isPrimitive() || property.primitiveType === \"Binary\" || property.primitiveType === \"IGeometry\")\n ) {\n groupings.ungrouped.push(node);\n continue;\n }\n\n const propertyIdentifier = { propertyName: property.name, propertyClassName: property.class.fullName };\n const extendedTypeName = \"extendedTypeName\" in property ? property.extendedTypeName : undefined;\n const primitiveType = \"primitiveType\" in property ? property.primitiveType : \"String\";\n assert(primitiveType !== \"Binary\" && primitiveType !== \"IGeometry\");\n\n if (!currentProperty.propertyValue) {\n if (byProperties.createGroupForUnspecifiedValues) {\n addGroupingToMap(\n groupings.grouped,\n `${propertyIdentifier.propertyName}:Unspecified`,\n {\n label: localizedStrings.unspecified,\n propertyGroupingNodeKey: {\n type: \"property-grouping:value\",\n ...propertyIdentifier,\n formattedPropertyValue: \"\",\n },\n },\n node,\n );\n continue;\n }\n groupings.ungrouped.push(node);\n continue;\n }\n\n const koqName = property.kindOfQuantity?.fullName;\n if (currentProperty.ranges) {\n if (typeof currentProperty.propertyValue === \"number\") {\n const propValue = currentProperty.propertyValue;\n const matchingRange = currentProperty.ranges.find(\n (range) => propValue >= range.fromValue && propValue <= range.toValue,\n );\n\n if (matchingRange) {\n const fromValueTypedPrimitive: TypedPrimitiveValue = {\n type: Number.isInteger(matchingRange.fromValue) ? \"Integer\" : \"Double\",\n extendedType: extendedTypeName,\n koqName,\n value: matchingRange.fromValue,\n };\n const toValueTypedPrimitive: TypedPrimitiveValue = {\n type: Number.isInteger(matchingRange.toValue) ? \"Integer\" : \"Double\",\n extendedType: extendedTypeName,\n koqName,\n value: matchingRange.toValue,\n };\n\n const rangeLabel =\n matchingRange.rangeLabel ??\n `${await valueFormatter(fromValueTypedPrimitive)} - ${await valueFormatter(toValueTypedPrimitive)}`;\n addGroupingToMap(\n groupings.grouped,\n `${propertyIdentifier.propertyName}:[${matchingRange.fromValue}-${matchingRange.toValue}]${matchingRange.rangeLabel ? `(${matchingRange.rangeLabel})` : \"\"}`,\n {\n label: rangeLabel,\n propertyGroupingNodeKey: {\n ...propertyIdentifier,\n type: \"property-grouping:range\",\n fromValue: matchingRange.fromValue,\n toValue: matchingRange.toValue,\n },\n },\n node,\n );\n continue;\n }\n }\n if (byProperties.createGroupForOutOfRangeValues) {\n const groupingNode = getOtherValuesGroupingNode();\n assert(HierarchyNodeKey.isPropertyOtherValuesGrouping(groupingNode.key));\n const thisPropertyIdentifier = {\n className: propertyIdentifier.propertyClassName,\n propertyName: propertyIdentifier.propertyName,\n };\n const hasPropertyIdentifier = groupingNode.key.properties.find(\n (x) =>\n x.className === thisPropertyIdentifier.className && x.propertyName === thisPropertyIdentifier.propertyName,\n );\n if (!hasPropertyIdentifier) {\n groupingNode.key.properties.push(thisPropertyIdentifier);\n }\n node.key.instanceKeys.forEach((k) => groupingNode.groupedInstanceKeys.push(k));\n groupingNode.parentKeys = node.parentKeys;\n groupingNode.children.push(Object.assign(node, { parentKeys: [...node.parentKeys, groupingNode.key] }));\n continue;\n }\n groupings.ungrouped.push(node);\n continue;\n }\n\n const formattedValue =\n currentProperty.propertyValue instanceof Array\n ? await formatConcatenatedValue({ value: currentProperty.propertyValue, valueFormatter })\n : await valueFormatter(\n TypedPrimitiveValue.create(currentProperty.propertyValue, primitiveType, koqName, extendedTypeName),\n );\n\n addGroupingToMap(\n groupings.grouped,\n `${propertyIdentifier.propertyName}:${formattedValue}`,\n {\n label: formattedValue,\n propertyGroupingNodeKey: {\n ...propertyIdentifier,\n type: \"property-grouping:value\",\n formattedPropertyValue: formattedValue,\n },\n },\n node,\n );\n }\n return createGroupingNodes(groupings, otherValuesGrouping?.new ? otherValuesGrouping.node : undefined);\n}\n\nfunction addGroupingToMap(\n groupingMap: Map<\n string,\n { displayablePropertyGroupingInfo: DisplayablePropertyGroupingInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }\n >,\n mapKey: string,\n propertyToAdd: DisplayablePropertyGroupingInfo,\n node: ProcessedInstanceHierarchyNode,\n): void {\n let groupingInfo = groupingMap.get(mapKey);\n if (!groupingInfo) {\n groupingInfo = { displayablePropertyGroupingInfo: propertyToAdd, groupedNodes: [node] };\n groupingMap.set(mapKey, groupingInfo);\n return;\n }\n groupingInfo.groupedNodes.push(node);\n}\n\nfunction createGroupingNodes(\n groupings: PropertyGroupingInformation,\n otherValuesGroupingNode: ProcessedInstancesGroupingHierarchyNode | undefined,\n): GroupingHandlerResult {\n const groupedNodes = new Array<ProcessedInstancesGroupingHierarchyNode>();\n groupings.grouped.forEach((entry) => {\n const groupedNodeParentKeys = entry.groupedNodes[0].parentKeys;\n groupedNodes.push({\n label: entry.displayablePropertyGroupingInfo.label,\n key: entry.displayablePropertyGroupingInfo.propertyGroupingNodeKey,\n parentKeys: groupedNodeParentKeys,\n groupedInstanceKeys: entry.groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: entry.groupedNodes.map((gn) => ({\n ...gn,\n parentKeys: [...groupedNodeParentKeys, entry.displayablePropertyGroupingInfo.propertyGroupingNodeKey],\n })),\n });\n });\n if (otherValuesGroupingNode) {\n groupedNodes.push(otherValuesGroupingNode);\n }\n return { grouped: groupedNodes, ungrouped: groupings.ungrouped, groupingType: \"property\" };\n}\n\nfunction createNodePropertyGroupPathMatchers(\n node: ParentHierarchyNode,\n): Array<(x: ArrayElement<PreviousPropertiesGroupingInfo>) => boolean> {\n if (!HierarchyNode.isPropertyGroupingNode(node)) {\n return [];\n }\n\n const keys = [...node.parentKeys, node.key];\n const propertyGroupingNodeKeys: PropertyGroupingNodeKey[] = [];\n for (let i = keys.length - 1; i >= 0; --i) {\n const key = keys[i];\n if (HierarchyNodeKey.isPropertyGrouping(key)) {\n propertyGroupingNodeKeys.push(key);\n } else {\n break;\n }\n }\n propertyGroupingNodeKeys.reverse();\n\n return propertyGroupingNodeKeys.map((key): ((x: ArrayElement<PreviousPropertiesGroupingInfo>) => boolean) => {\n switch (key.type) {\n case \"property-grouping:other\":\n return (x) =>\n key.properties.some(\n (p) => p.className === x.propertiesClassName && p.propertyName === x.propertyName && !!x.isRange,\n );\n case \"property-grouping:range\":\n return (x) => key.propertyClassName === x.propertiesClassName && key.propertyName === x.propertyName;\n case \"property-grouping:value\":\n return (x) => key.propertyClassName === x.propertiesClassName && key.propertyName === x.propertyName;\n }\n });\n}\n\n/** @internal */\nexport async function getUniquePropertiesGroupInfo(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<Array<PropertyGroupInfo>> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const parentPropertyGroupPath = parentNode ? createNodePropertyGroupPathMatchers(parentNode) : [];\n const uniqueProperties = new Map<string, PropertyGroupInfo>();\n // `getClass` resolves the same class for every node sharing a `propertiesClassName`, so resolve each class once and\n // reuse it across nodes instead of calling `getClass` (schema lookup + class lookup) on every node.\n const propertiesClassCache = new Map<EC.FullClassNameDotNotation, EC.Class>();\n const getPropertiesClass = async (fullClassName: EC.FullClassNameDotNotation): Promise<EC.Class> => {\n let ecClass = propertiesClassCache.get(fullClassName);\n if (!ecClass) {\n ecClass = await getClass(schemaProvider, fullClassName);\n propertiesClassCache.set(fullClassName, ecClass);\n }\n return ecClass;\n };\n for (const node of nodes) {\n await releaseMainThread();\n\n const byProperties = node.processingParams?.grouping?.byProperties;\n if (!byProperties) {\n continue;\n }\n\n const propertiesClass = await getPropertiesClass(byProperties.propertiesClassName);\n let propertyGroupIndex = 0;\n const previousPropertiesInfo = new Array<{ propertyGroup: HierarchyNodePropertyGroup; propertyGroupKey: string }>();\n for (const propertyGroup of byProperties.propertyGroups) {\n const property = propertiesClass.getProperty(propertyGroup.propertyName);\n const propertyName = property?.name ?? propertyGroup.propertyName;\n const propertyClassName = property?.class.fullName ?? propertiesClass.fullName;\n const mapKeyRanges = getRangesAsString(propertyGroup.ranges);\n const lastKey =\n previousPropertiesInfo.length > 0\n ? previousPropertiesInfo[previousPropertiesInfo.length - 1].propertyGroupKey\n : \"\";\n const propertyGroupKey = `${lastKey}:${propertyName}(${mapKeyRanges})`;\n const mapKey = `${propertiesClass.fullName}:${propertyGroupKey}`;\n\n let isAlreadyGrouped = false;\n if (parentPropertyGroupPath.length > 0 && propertyGroupIndex < parentPropertyGroupPath.length) {\n const groupMatcher = parentPropertyGroupPath[propertyGroupIndex];\n isAlreadyGrouped = groupMatcher({\n propertiesClassName: propertyClassName,\n propertyName,\n isRange: !!propertyGroup.ranges,\n });\n }\n if (!isAlreadyGrouped && !uniqueProperties.get(mapKey)) {\n uniqueProperties.set(mapKey, {\n ecClass: propertiesClass,\n propertyGroup: { propertyName, ranges: propertyGroup.ranges },\n previousPropertiesGroupingInfo: previousPropertiesInfo.map((groupingInfo) => ({\n propertiesClassName:\n propertiesClass.getProperty(groupingInfo.propertyGroup.propertyName)?.class.fullName ??\n propertiesClass.fullName,\n propertyName: groupingInfo.propertyGroup.propertyName,\n isRange: !!groupingInfo.propertyGroup.ranges,\n })),\n });\n }\n\n previousPropertiesInfo.push({ propertyGroup: { ...propertyGroup, propertyName }, propertyGroupKey });\n ++propertyGroupIndex;\n }\n }\n // Order might change in uniqueProperties, resorting to make sure that properties with fewer previous properties are returned first.\n return [...uniqueProperties.values()].sort(\n (lhs, rhs) => lhs.previousPropertiesGroupingInfo.length - rhs.previousPropertiesGroupingInfo.length,\n );\n}\n\nfunction getRangesAsString(ranges?: HierarchyNodePropertyValueRange[]): string {\n return ranges\n ? ranges\n .map((range) => `${range.fromValue}-${range.toValue}(${range.rangeLabel ?? \"\"})`)\n .sort()\n .join(\";\")\n : \"\";\n}\n\nasync function shouldCreatePropertyGroup(\n handlerGroupingParams: PropertyGroupInfo,\n nodePropertyGroupingParams: HierarchyNodePropertiesGroupingParams,\n nodeFullClassName: EC.FullClassNameDotNotation,\n classHierarchyInspector: Pick<ECSchemaProvider, \"classDerivesFrom\">,\n): Promise<boolean> {\n if (\n nodePropertyGroupingParams.propertiesClassName !== handlerGroupingParams.ecClass.fullName ||\n nodePropertyGroupingParams.propertyGroups.length < handlerGroupingParams.previousPropertiesGroupingInfo.length + 1\n ) {\n return false;\n }\n const currentProperty =\n nodePropertyGroupingParams.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];\n if (\n currentProperty.propertyName !== handlerGroupingParams.propertyGroup.propertyName ||\n !doRangesMatch(currentProperty.ranges, handlerGroupingParams.propertyGroup.ranges)\n ) {\n return false;\n }\n if (!doPreviousPropertiesMatch(handlerGroupingParams.previousPropertiesGroupingInfo, nodePropertyGroupingParams)) {\n return false;\n }\n return classHierarchyInspector.classDerivesFrom(nodeFullClassName, handlerGroupingParams.ecClass.fullName);\n}\n\n/** @internal */\nexport function doPreviousPropertiesMatch(\n previousPropertiesGroupingInfo: PreviousPropertiesGroupingInfo,\n nodesProperties: HierarchyNodePropertiesGroupingParams,\n): boolean {\n return (\n previousPropertiesGroupingInfo.length <= nodesProperties.propertyGroups.length &&\n previousPropertiesGroupingInfo.every(\n (groupingInfo, index) =>\n groupingInfo.propertiesClassName === nodesProperties.propertiesClassName &&\n groupingInfo.propertyName === nodesProperties.propertyGroups[index].propertyName &&\n !!groupingInfo.isRange === !!nodesProperties.propertyGroups[index].ranges,\n )\n );\n}\n\n/** @internal */\nexport function doRangesMatch(\n ranges1: HierarchyNodePropertyValueRange[] | undefined,\n ranges2: HierarchyNodePropertyValueRange[] | undefined,\n): boolean {\n if (typeof ranges1 !== typeof ranges2) {\n return false;\n }\n if (!ranges1) {\n return true;\n }\n assert(Array.isArray(ranges2));\n if (ranges1.length !== ranges2.length) {\n return false;\n }\n return (\n // Check twice, to validate if both ranges have the same elements (elements can be in a different order)\n ranges1.every((lhsRange) =>\n ranges2.some(\n (rhsRange) =>\n lhsRange.fromValue === rhsRange.fromValue &&\n lhsRange.toValue === rhsRange.toValue &&\n lhsRange.rangeLabel === rhsRange.rangeLabel,\n ),\n ) &&\n ranges2.every((lhsRange) =>\n ranges1.some(\n (rhsRange) =>\n lhsRange.fromValue === rhsRange.fromValue &&\n lhsRange.toValue === rhsRange.toValue &&\n lhsRange.rangeLabel === rhsRange.rangeLabel,\n ),\n )\n );\n}\n\n/** @internal */\nexport async function createPropertiesGroupingHandlers(\n imodelAccess: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Promise<GroupingHandler[]> {\n const propertiesGroupInfo = await getUniquePropertiesGroupInfo(imodelAccess, parentNode, nodes);\n return propertiesGroupInfo.map(\n (propertyInfo) => async (nodesToGroup, nodesAlreadyGrouped) =>\n createPropertyGroups(\n nodesToGroup,\n nodesAlreadyGrouped,\n propertyInfo,\n valueFormatter,\n localizedStrings,\n imodelAccess,\n ),\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sorting.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"Sorting.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAYrH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAkC,KAAwB;IAChG,OAAO,KAAK,CAAC,IAAI,CACf,MAAM,
|
|
1
|
+
{"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAkC,KAAwB;IAChG,OAAO,KAAK,CAAC,IAAI,CACf,MAAM,CACJ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,IAAI,WAAW,CAAQ,mBAAmB,EAAE,eAAe,CAAC,KAAK,CAAC,CACnE,EACD,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,EAChD,SAAS,EAAE,CACZ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concatAll, map, reduce } from \"rxjs\";\nimport { DuplicatePolicy, SortedArray } from \"@itwin/core-bentley\";\nimport { compareNodesByLabel } from \"../Common.js\";\n\nimport type { Observable } from \"rxjs\";\n\n/**\n * This should accept sorting params in some form:\n * - is sorting disabled?\n * - are we sorting by label or some property value, in case of the latter - how do we get the value?\n *\n * @note Nodes with same labels are returned in undefined order.\n * @internal\n */\nexport function sortNodesByLabelOperator<TNode extends { label: string }>(nodes: Observable<TNode>): Observable<TNode> {\n return nodes.pipe(\n reduce(\n (sorted, node) => {\n sorted.insert(node);\n return sorted;\n },\n new SortedArray<TNode>(compareNodesByLabel, DuplicatePolicy.Allow),\n ),\n map((sortedArray) => sortedArray.extractArray()),\n concatAll(),\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-hierarchies",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.18",
|
|
4
4
|
"description": "A package for creating hierarchies based on data in iTwin.js iModels.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,25 +31,25 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@itwin/core-bentley": "^5.
|
|
35
|
-
"@itwin/core-common": "^5.
|
|
36
|
-
"@itwin/core-geometry": "^5.
|
|
37
|
-
"natural-compare-lite": "^1.4.
|
|
34
|
+
"@itwin/core-bentley": "^5.13.1",
|
|
35
|
+
"@itwin/core-common": "^5.13.1",
|
|
36
|
+
"@itwin/core-geometry": "^5.13.1",
|
|
37
|
+
"natural-compare-lite": "^1.4.1",
|
|
38
38
|
"rxjs": "^7.8.2",
|
|
39
|
-
"@itwin/presentation-shared": "2.0.0-alpha.
|
|
39
|
+
"@itwin/presentation-shared": "2.0.0-alpha.13"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@itwin/build-tools": "^5.
|
|
42
|
+
"@itwin/build-tools": "^5.13.1",
|
|
43
43
|
"@itwin/eslint-plugin": "^6.1.0",
|
|
44
44
|
"@types/natural-compare-lite": "^1.4.2",
|
|
45
|
-
"@types/node": "^24.13.
|
|
46
|
-
"@
|
|
45
|
+
"@types/node": "^24.13.4",
|
|
46
|
+
"@typescript/native": "npm:typescript@~7.0.2",
|
|
47
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
47
48
|
"cpx2": "^7.0.2",
|
|
48
49
|
"eslint": "^9.39.5",
|
|
49
50
|
"rimraf": "^6.1.3",
|
|
50
|
-
"@typescript/native": "npm:typescript@~7.0.2",
|
|
51
51
|
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
52
|
-
"vitest": "^4.1.
|
|
52
|
+
"vitest": "^4.1.11",
|
|
53
53
|
"presentation-test-utilities": "0.0.1"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Observable } from "rxjs";
|
|
2
|
-
/**
|
|
3
|
-
* This is pretty much a combination of:
|
|
4
|
-
* - https://github.com/benlesh/rxjs-for-await/blob/94f9cf9cb015ac3700dfd1850eb81d36962eb70f/src/index.ts#L33,
|
|
5
|
-
* - https://github.com/ReactiveX/rxjs/blob/2587ee852eb43eeb0883a7787bac2944d823392b/packages/observable/src/observable.ts#L922.
|
|
6
|
-
*
|
|
7
|
-
* Our implementation uses a linked list rather than an array to store values, which is more efficient.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare function eachValueFrom<T>(source: Observable<T>): AsyncIterableIterator<T>;
|
|
12
|
-
//# sourceMappingURL=EachValueFrom.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EachValueFrom.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/internal/EachValueFrom.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC;;;;;;;;GAQG;AACH,wBAAuB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAwDvF"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
// cspell:words deferreds
|
|
6
|
-
/**
|
|
7
|
-
* This is pretty much a combination of:
|
|
8
|
-
* - https://github.com/benlesh/rxjs-for-await/blob/94f9cf9cb015ac3700dfd1850eb81d36962eb70f/src/index.ts#L33,
|
|
9
|
-
* - https://github.com/ReactiveX/rxjs/blob/2587ee852eb43eeb0883a7787bac2944d823392b/packages/observable/src/observable.ts#L922.
|
|
10
|
-
*
|
|
11
|
-
* Our implementation uses a linked list rather than an array to store values, which is more efficient.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export async function* eachValueFrom(source) {
|
|
16
|
-
const deferreds = new Queue();
|
|
17
|
-
const values = new Queue();
|
|
18
|
-
let error;
|
|
19
|
-
let completed = false;
|
|
20
|
-
const subs = source.subscribe({
|
|
21
|
-
next: (value) => {
|
|
22
|
-
const deferred = deferreds.pop();
|
|
23
|
-
if (deferred) {
|
|
24
|
-
deferred.resolve({ value, done: false });
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
values.push(value);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
error: (err) => {
|
|
31
|
-
error = err;
|
|
32
|
-
for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {
|
|
33
|
-
deferred.reject(err);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
complete: () => {
|
|
37
|
-
completed = true;
|
|
38
|
-
for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {
|
|
39
|
-
deferred.resolve({ value: undefined, done: true });
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
try {
|
|
44
|
-
while (true) {
|
|
45
|
-
const value = values.pop();
|
|
46
|
-
if (value !== undefined) {
|
|
47
|
-
yield value;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
51
|
-
if (completed) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
55
|
-
if (error) {
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
const result = await new Promise((resolve, reject) => {
|
|
60
|
-
deferreds.push({ resolve, reject });
|
|
61
|
-
});
|
|
62
|
-
if (result.done) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
yield result.value;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
throw err;
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
subs.unsubscribe();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
class QueueEntry {
|
|
76
|
-
value;
|
|
77
|
-
next;
|
|
78
|
-
constructor(value, next) {
|
|
79
|
-
this.value = value;
|
|
80
|
-
this.next = next;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
class Queue {
|
|
84
|
-
_front;
|
|
85
|
-
_back;
|
|
86
|
-
push(item) {
|
|
87
|
-
const entry = new QueueEntry(item);
|
|
88
|
-
if (this._back) {
|
|
89
|
-
this._back.next = entry;
|
|
90
|
-
}
|
|
91
|
-
this._back = entry;
|
|
92
|
-
if (!this._front) {
|
|
93
|
-
this._front = entry;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
pop() {
|
|
97
|
-
if (!this._front) {
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
const value = this._front.value;
|
|
101
|
-
this._front = this._front.next;
|
|
102
|
-
if (!this._front) {
|
|
103
|
-
this._back = undefined;
|
|
104
|
-
}
|
|
105
|
-
return value;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=EachValueFrom.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EachValueFrom.js","sourceRoot":"","sources":["../../../src/hierarchies/internal/EachValueFrom.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,yBAAyB;AAEzB;;;;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AM,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAEM,GAAG;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACzB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,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 type { Observable } from \"rxjs\";\n\n// cspell:words deferreds\n\n/**\n * This is pretty much a combination of:\n * - https://github.com/benlesh/rxjs-for-await/blob/94f9cf9cb015ac3700dfd1850eb81d36962eb70f/src/index.ts#L33,\n * - https://github.com/ReactiveX/rxjs/blob/2587ee852eb43eeb0883a7787bac2944d823392b/packages/observable/src/observable.ts#L922.\n *\n * Our implementation uses a linked list rather than an array to store values, which is more efficient.\n *\n * @internal\n */\nexport async function* eachValueFrom<T>(source: Observable<T>): AsyncIterableIterator<T> {\n const deferreds = new Queue<{ resolve: (value: IteratorResult<T>) => void; reject: (reason: unknown) => void }>();\n const values = new Queue<T>();\n let error;\n let completed = false;\n const subs = source.subscribe({\n next: (value) => {\n const deferred = deferreds.pop();\n if (deferred) {\n deferred.resolve({ value, done: false });\n } else {\n values.push(value);\n }\n },\n error: (err) => {\n error = err;\n for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {\n deferred.reject(err);\n }\n },\n complete: () => {\n completed = true;\n for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {\n deferred.resolve({ value: undefined, done: true });\n }\n },\n });\n try {\n while (true) {\n const value = values.pop();\n if (value !== undefined) {\n yield value;\n continue;\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (completed) {\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (error) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw error;\n }\n const result = await new Promise<IteratorResult<T>>((resolve, reject) => {\n deferreds.push({ resolve, reject });\n });\n if (result.done) {\n return;\n }\n yield result.value;\n }\n } catch (err) {\n throw err;\n } finally {\n subs.unsubscribe();\n }\n}\n\nclass QueueEntry<T> {\n constructor(\n public readonly value: T,\n public next?: QueueEntry<T>,\n ) {}\n}\n\nclass Queue<T> {\n private _front?: QueueEntry<T>;\n private _back?: QueueEntry<T>;\n\n public push(item: T) {\n const entry = new QueueEntry<T>(item);\n if (this._back) {\n this._back.next = entry;\n }\n this._back = entry;\n if (!this._front) {\n this._front = entry;\n }\n }\n\n public pop(): T | undefined {\n if (!this._front) {\n return undefined;\n }\n const value = this._front.value;\n this._front = this._front.next;\n if (!this._front) {\n this._back = undefined;\n }\n return value;\n }\n}\n"]}
|