@itwin/presentation-common 5.5.0-dev.2 → 5.5.0-dev.4
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 +8 -1
- package/lib/assets/locales/en/Presentation.json +19 -19
- package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-common/EC.js.map +1 -1
- package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
- package/lib/cjs/presentation-common/Error.js.map +1 -1
- package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
- package/lib/cjs/presentation-common/KeySet.js.map +1 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
- package/lib/cjs/presentation-common/Update.js.map +1 -1
- package/lib/cjs/presentation-common/Utils.js.map +1 -1
- package/lib/cjs/presentation-common/content/Category.js.map +1 -1
- package/lib/cjs/presentation-common/content/Content.js.map +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +2 -2
- package/lib/cjs/presentation-common/content/ContentTraverser.js +2 -2
- package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
- package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
- package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
- package/lib/cjs/presentation-common/content/Item.js.map +1 -1
- package/lib/cjs/presentation-common/content/Property.js.map +1 -1
- package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
- package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
- package/lib/cjs/presentation-common/content/Value.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
- package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
- package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/cjs/presentation-common-internal.js.map +1 -1
- package/lib/cjs/presentation-common.js.map +1 -1
- package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-common/EC.js.map +1 -1
- package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
- package/lib/esm/presentation-common/Error.js.map +1 -1
- package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
- package/lib/esm/presentation-common/KeySet.js.map +1 -1
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
- package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
- package/lib/esm/presentation-common/Update.js.map +1 -1
- package/lib/esm/presentation-common/Utils.js.map +1 -1
- package/lib/esm/presentation-common/content/Category.js.map +1 -1
- package/lib/esm/presentation-common/content/Content.js.map +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.d.ts +2 -2
- package/lib/esm/presentation-common/content/ContentTraverser.js +2 -2
- package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
- package/lib/esm/presentation-common/content/Editor.js.map +1 -1
- package/lib/esm/presentation-common/content/Fields.js.map +1 -1
- package/lib/esm/presentation-common/content/Item.js.map +1 -1
- package/lib/esm/presentation-common/content/Property.js.map +1 -1
- package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
- package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
- package/lib/esm/presentation-common/content/Value.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
- package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
- package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
- package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/esm/presentation-common-internal.js.map +1 -1
- package/lib/esm/presentation-common.js.map +1 -1
- package/lib/public/locales/en/Presentation.json +19 -19
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAA4B,mBAAmB,EAAE,MAAM,8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AC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACvC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;YACnC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,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/** @packageDocumentation\n * @module Core\n */\n\nimport { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Field, PropertiesField } from \"./content/Fields.js\";\nimport { Item } from \"./content/Item.js\";\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription.js\";\nimport { DisplayValue, Value } from \"./content/Value.js\";\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC.js\";\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications.js\";\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification.js\";\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification.js\";\nimport { RelationshipDirection } from \"./rules/RelationshipDirection.js\";\nimport { RuleTypes } from \"./rules/Rule.js\";\nimport { Ruleset } from \"./rules/Ruleset.js\";\n\n/**\n * A factory class that can be used to create presentation rulesets targeted towards\n * specific use cases.\n *\n * @public\n */\nexport class RulesetsFactory {\n private createSimilarInstancesRulesetInfo(field: Field, record: Item) {\n if (!field.isPropertiesField()) {\n throw new Error(\"Can only create 'similar instances' ruleset for properties-based records\");\n }\n if (field.type.valueFormat !== PropertyValueFormat.Primitive) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\n }\n if (field.properties.length === 0) {\n throw new Error(\"Invalid properties' field with no properties\");\n }\n if (record.isFieldMerged(field.name)) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n if (!record.classInfo) {\n throw new Error(\"Can't create 'similar instances' for records based on multiple different ECClass instances\");\n }\n const propertyName = getPropertyName(field);\n const propertyValue = getPropertyValue(record, field);\n const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);\n const relatedClass = relatedInstanceInfo?.class;\n const ruleset: Ruleset = {\n id: `SimilarInstances/${propertyName}/${Guid.createValue()}`,\n rules: [],\n };\n ruleset.rules.push({\n ruleType: RuleTypes.Content,\n specifications: [\n {\n specType: ContentSpecificationTypes.ContentInstancesOfSpecificClasses,\n classes: createMultiClassSpecification(record.classInfo),\n relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],\n instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),\n },\n ],\n });\n return { ruleset, relatedClass, propertyName, propertyValue };\n }\n\n /**\n * Create a ruleset with content rules for getting instances are of the\n * same ECClass and have the same property value as the provided `record`.\n * @param field A field identifying which property of the record we should use\n * @param record A record whose similar instances should be found\n * @param computeDisplayValue Optional callback function to calculate display value that's\n * used in ruleset's description. If not provided, display value from record is used instead.\n */\n public async createSimilarInstancesRuleset(\n field: Field,\n record: Item,\n computeDisplayValue?: ComputeDisplayValueCallback,\n ): Promise<{ ruleset: Ruleset; description: string }> {\n const info = this.createSimilarInstancesRulesetInfo(field, record);\n const description = await createDescriptionAsync(record, info.relatedClass, field, info.propertyValue, computeDisplayValue);\n return { ruleset: info.ruleset, description };\n }\n}\n\n/**\n * Definition of a function for calculating a display value.\n * @public\n */\nexport type ComputeDisplayValueCallback = (type: string, value: PrimitivePropertyValue, displayValue: string) => Promise<string>;\n\ninterface PrimitiveValueDef {\n raw: PrimitivePropertyValue;\n display: string;\n}\n\n/**\n * Value of a primitive property.\n * @public\n */\nexport type PrimitivePropertyValue = string | number | boolean | Point | InstanceKey | undefined;\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype Point = { x: number; y: number; z?: number };\n\nconst toString = (displayValue: string | undefined): string => {\n if (!displayValue) {\n return \"NULL\";\n }\n return displayValue.toString();\n};\n\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\n const classInfo = relatedClass ?? record.classInfo!;\n return `[${classInfo.label}].[${field.label}] = ${value}`;\n};\n\nconst createDescriptionAsync = async (\n record: Item,\n relatedClass: ClassInfo | undefined,\n field: Field,\n value: PrimitiveValueDef,\n computeDisplayValue?: ComputeDisplayValueCallback,\n): Promise<string> => {\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\n return createDescription(record, relatedClass, field, displayValue);\n};\n\nconst getPropertyName = (field: PropertiesField) => {\n let name = field.properties[0].property.name;\n if (field.type.typeName === \"navigation\") {\n name += \".Id\";\n }\n return name;\n};\n\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\n if (Value.isPrimitive(value)) {\n return true;\n }\n\n if (Value.isMap(value)) {\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\n return true;\n }\n\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\n const fieldNamesStack = [];\n let currField: Field | undefined = field;\n while (currField) {\n fieldNamesStack.push(currField.name);\n currField = currField.parent;\n }\n let currFieldName = fieldNamesStack.pop();\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\n let value: Value = record.values[currFieldName!];\n currFieldName = fieldNamesStack.pop();\n while (currFieldName) {\n if (!Value.isNestedContent(value) || value.length === 0) {\n throw new Error(\"Invalid record value\");\n }\n if (value.length > 1) {\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\n }\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n displayValue = value[0].displayValues[currFieldName];\n value = value[0].values[currFieldName];\n currFieldName = fieldNamesStack.pop();\n }\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\n }\n return { raw: value, display: toString(displayValue) };\n};\n\nconst createInstanceFilter = (\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\n propertyType: PrimitiveTypeDescription,\n propertyName: string,\n propertyValue: PrimitivePropertyValue,\n): string => {\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\n};\n\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\n let compareValue = \"\";\n switch (typeof value) {\n case \"undefined\":\n compareValue = \"NULL\";\n break;\n case \"string\":\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\n break;\n case \"boolean\":\n compareValue = value ? \"TRUE\" : \"FALSE\";\n break;\n case \"number\":\n compareValue = value.toString();\n break;\n }\n\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\n // note: this is temporary until we support hex ids in instance filters\n compareValue = hexToDec((value as InstanceKey).id);\n }\n\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\n if (typeof value !== \"object\") {\n throw new Error(\"Expecting point values to be supplied as objects\");\n }\n\n const dimensionType: PrimitiveTypeDescription = {\n valueFormat: PropertyValueFormat.Primitive,\n typeName: \"double\",\n };\n\n const pointValue = value as Point;\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\n }\n\n return comparison;\n }\n\n if (type.typeName === \"double\") {\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\n }\n\n if (type.typeName === \"dateTime\") {\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\n }\n\n return `${name} ${operator} ${compareValue}`;\n};\n\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, classNames: [className], arePolymorphic: true };\n};\n\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, className };\n};\n\nconst createRelatedInstanceSpec = (\n pathFromSelectToPropertyClass: RelationshipPath,\n index: number,\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\n spec: {\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\n relationship: createSingleClassSpecification(step.relationshipInfo),\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\n targetClass: createSingleClassSpecification(step.targetClassInfo),\n })),\n isRequired: true,\n alias: `related_${index}`,\n },\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\n});\n\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\n let currField: Field = field;\n const pathFromPropertyToSelectClass: RelationshipPath = [];\n while (currField.parent) {\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\n currField = currField.parent;\n }\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\n};\n\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\n const path = createPathFromSelectToPropertyClass(field);\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\n};\n\nconst hexToDec = (id: Id64String) => {\n const digits = [0];\n for (let i = 2; i < id.length; ++i) {\n let carry = parseInt(id.charAt(i), 16);\n for (let j = 0; j < digits.length; ++j) {\n digits[j] = digits[j] * 16 + carry;\n carry = (digits[j] / 10) | 0;\n digits[j] %= 10;\n }\n while (carry > 0) {\n digits.push(carry % 10);\n carry = (carry / 10) | 0;\n }\n }\n return digits.reverse().join(\"\");\n};\n"]}
|
|
1
|
+
{"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAA4B,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAgB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAA0B,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAClB,iCAAiC,CAAC,KAAY,EAAE,MAAY;QAClE,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC/B,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AAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Field, PropertiesField } from \"./content/Fields.js\";\r\nimport { Item } from \"./content/Item.js\";\r\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription.js\";\r\nimport { DisplayValue, Value } from \"./content/Value.js\";\r\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC.js\";\r\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications.js\";\r\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification.js\";\r\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification.js\";\r\nimport { RelationshipDirection } from \"./rules/RelationshipDirection.js\";\r\nimport { RuleTypes } from \"./rules/Rule.js\";\r\nimport { Ruleset } from \"./rules/Ruleset.js\";\r\n\r\n/**\r\n * A factory class that can be used to create presentation rulesets targeted towards\r\n * specific use cases.\r\n *\r\n * @public\r\n */\r\nexport class RulesetsFactory {\r\n private createSimilarInstancesRulesetInfo(field: Field, record: Item) {\r\n if (!field.isPropertiesField()) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for properties-based records\");\r\n }\r\n if (field.type.valueFormat !== PropertyValueFormat.Primitive) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\r\n }\r\n if (field.properties.length === 0) {\r\n throw new Error(\"Invalid properties' field with no properties\");\r\n }\r\n if (record.isFieldMerged(field.name)) {\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\r\n }\r\n if (!record.classInfo) {\r\n throw new Error(\"Can't create 'similar instances' for records based on multiple different ECClass instances\");\r\n }\r\n const propertyName = getPropertyName(field);\r\n const propertyValue = getPropertyValue(record, field);\r\n const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);\r\n const relatedClass = relatedInstanceInfo?.class;\r\n const ruleset: Ruleset = {\r\n id: `SimilarInstances/${propertyName}/${Guid.createValue()}`,\r\n rules: [],\r\n };\r\n ruleset.rules.push({\r\n ruleType: RuleTypes.Content,\r\n specifications: [\r\n {\r\n specType: ContentSpecificationTypes.ContentInstancesOfSpecificClasses,\r\n classes: createMultiClassSpecification(record.classInfo),\r\n relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],\r\n instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),\r\n },\r\n ],\r\n });\r\n return { ruleset, relatedClass, propertyName, propertyValue };\r\n }\r\n\r\n /**\r\n * Create a ruleset with content rules for getting instances are of the\r\n * same ECClass and have the same property value as the provided `record`.\r\n * @param field A field identifying which property of the record we should use\r\n * @param record A record whose similar instances should be found\r\n * @param computeDisplayValue Optional callback function to calculate display value that's\r\n * used in ruleset's description. If not provided, display value from record is used instead.\r\n */\r\n public async createSimilarInstancesRuleset(\r\n field: Field,\r\n record: Item,\r\n computeDisplayValue?: ComputeDisplayValueCallback,\r\n ): Promise<{ ruleset: Ruleset; description: string }> {\r\n const info = this.createSimilarInstancesRulesetInfo(field, record);\r\n const description = await createDescriptionAsync(record, info.relatedClass, field, info.propertyValue, computeDisplayValue);\r\n return { ruleset: info.ruleset, description };\r\n }\r\n}\r\n\r\n/**\r\n * Definition of a function for calculating a display value.\r\n * @public\r\n */\r\nexport type ComputeDisplayValueCallback = (type: string, value: PrimitivePropertyValue, displayValue: string) => Promise<string>;\r\n\r\ninterface PrimitiveValueDef {\r\n raw: PrimitivePropertyValue;\r\n display: string;\r\n}\r\n\r\n/**\r\n * Value of a primitive property.\r\n * @public\r\n */\r\nexport type PrimitivePropertyValue = string | number | boolean | Point | InstanceKey | undefined;\r\n\r\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\r\ntype Point = { x: number; y: number; z?: number };\r\n\r\nconst toString = (displayValue: string | undefined): string => {\r\n if (!displayValue) {\r\n return \"NULL\";\r\n }\r\n return displayValue.toString();\r\n};\r\n\r\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\r\n const classInfo = relatedClass ?? record.classInfo!;\r\n return `[${classInfo.label}].[${field.label}] = ${value}`;\r\n};\r\n\r\nconst createDescriptionAsync = async (\r\n record: Item,\r\n relatedClass: ClassInfo | undefined,\r\n field: Field,\r\n value: PrimitiveValueDef,\r\n computeDisplayValue?: ComputeDisplayValueCallback,\r\n): Promise<string> => {\r\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\r\n return createDescription(record, relatedClass, field, displayValue);\r\n};\r\n\r\nconst getPropertyName = (field: PropertiesField) => {\r\n let name = field.properties[0].property.name;\r\n if (field.type.typeName === \"navigation\") {\r\n name += \".Id\";\r\n }\r\n return name;\r\n};\r\n\r\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\r\n if (Value.isPrimitive(value)) {\r\n return true;\r\n }\r\n\r\n if (Value.isMap(value)) {\r\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\r\n return true;\r\n }\r\n\r\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\r\n const fieldNamesStack = [];\r\n let currField: Field | undefined = field;\r\n while (currField) {\r\n fieldNamesStack.push(currField.name);\r\n currField = currField.parent;\r\n }\r\n let currFieldName = fieldNamesStack.pop();\r\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\r\n let value: Value = record.values[currFieldName!];\r\n currFieldName = fieldNamesStack.pop();\r\n while (currFieldName) {\r\n if (!Value.isNestedContent(value) || value.length === 0) {\r\n throw new Error(\"Invalid record value\");\r\n }\r\n if (value.length > 1) {\r\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\r\n }\r\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\r\n }\r\n displayValue = value[0].displayValues[currFieldName];\r\n value = value[0].values[currFieldName];\r\n currFieldName = fieldNamesStack.pop();\r\n }\r\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\r\n }\r\n return { raw: value, display: toString(displayValue) };\r\n};\r\n\r\nconst createInstanceFilter = (\r\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\r\n propertyType: PrimitiveTypeDescription,\r\n propertyName: string,\r\n propertyValue: PrimitivePropertyValue,\r\n): string => {\r\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\r\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\r\n};\r\n\r\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\r\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\r\n let compareValue = \"\";\r\n switch (typeof value) {\r\n case \"undefined\":\r\n compareValue = \"NULL\";\r\n break;\r\n case \"string\":\r\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\r\n break;\r\n case \"boolean\":\r\n compareValue = value ? \"TRUE\" : \"FALSE\";\r\n break;\r\n case \"number\":\r\n compareValue = value.toString();\r\n break;\r\n }\r\n\r\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\r\n // note: this is temporary until we support hex ids in instance filters\r\n compareValue = hexToDec((value as InstanceKey).id);\r\n }\r\n\r\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\r\n if (typeof value !== \"object\") {\r\n throw new Error(\"Expecting point values to be supplied as objects\");\r\n }\r\n\r\n const dimensionType: PrimitiveTypeDescription = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n typeName: \"double\",\r\n };\r\n\r\n const pointValue = value as Point;\r\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\r\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\r\n }\r\n\r\n return comparison;\r\n }\r\n\r\n if (type.typeName === \"double\") {\r\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n if (type.typeName === \"dateTime\") {\r\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n return `${name} ${operator} ${compareValue}`;\r\n};\r\n\r\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, classNames: [className], arePolymorphic: true };\r\n};\r\n\r\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, className };\r\n};\r\n\r\nconst createRelatedInstanceSpec = (\r\n pathFromSelectToPropertyClass: RelationshipPath,\r\n index: number,\r\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\r\n spec: {\r\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\r\n relationship: createSingleClassSpecification(step.relationshipInfo),\r\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\r\n targetClass: createSingleClassSpecification(step.targetClassInfo),\r\n })),\r\n isRequired: true,\r\n alias: `related_${index}`,\r\n },\r\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\r\n});\r\n\r\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\r\n let currField: Field = field;\r\n const pathFromPropertyToSelectClass: RelationshipPath = [];\r\n while (currField.parent) {\r\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\r\n currField = currField.parent;\r\n }\r\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\r\n};\r\n\r\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\r\n const path = createPathFromSelectToPropertyClass(field);\r\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\r\n};\r\n\r\nconst hexToDec = (id: Id64String) => {\r\n const digits = [0];\r\n for (let i = 2; i < id.length; ++i) {\r\n let carry = parseInt(id.charAt(i), 16);\r\n for (let j = 0; j < digits.length; ++j) {\r\n digits[j] = digits[j] * 16 + carry;\r\n carry = (digits[j] / 10) | 0;\r\n digits[j] %= 10;\r\n }\r\n while (carry > 0) {\r\n digits.push(carry % 10);\r\n carry = (carry / 10) | 0;\r\n }\r\n }\r\n return digits.reverse().join(\"\");\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,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/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node, PartialNode } from \"./hierarchy/Node.js\";\n\n/**\n * A constant for indicating that a full update is required.\n * @public\n */\nexport const UPDATE_FULL = \"FULL\";\n\n/**\n * A data structure that describes changes that need to be applied to the hierarchy and\n * content components due to some changes on the backend.\n *\n * @public\n */\nexport interface UpdateInfo {\n [imodel: string]: {\n [rulesetId: string]: {\n /**\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n hierarchy?: HierarchyUpdateInfo;\n content?: ContentUpdateInfo;\n };\n };\n}\n\n/**\n * Information about a required hierarchy update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a required content update.\n * @public\n */\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a hierarchy change: insertion, deletion or node update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\n\n/**\n * Information about node insertion.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeInsertionInfo {\n type: \"Insert\";\n /** Parent node key */\n parent?: NodeKey;\n /** Index of the new node under its parent */\n position: number;\n /** Inserted node */\n node: Node;\n}\n\n/**\n * Information about node deletion.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeDeletionInfo {\n type: \"Delete\";\n /** Parent of the deleted node */\n parent?: NodeKey;\n /** Position of the deleted node among its siblings in the initial, not updated tree */\n position: number;\n}\n\n/**\n * Information about node update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeUpdateInfo {\n type: \"Update\";\n /** Key of the updated node */\n target: NodeKey;\n /** Updated node attributes */\n changes: PartialNode;\n}\n\n/**\n * Information about hierarchy modification / differences.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface HierarchyCompareInfo {\n /** A list of hierarchy changes */\n changes: PartialHierarchyModification[];\n /** Continuation token for requesting more changes. */\n continuationToken?: {\n prevHierarchyNode: string;\n currHierarchyNode: string;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { Node, PartialNode } from \"./hierarchy/Node.js\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n /**\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA8C7C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,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AC1C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAc,CAAC,CAAC;YAClC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC1C,GAAG,CAAC,GAA+B,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAQ,CAAC;YACnF,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAwB,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAU,CAAC;AACpB,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,+BAA+B,CAAC,SAAiB;IAC/D,IAAI,OAAsC,CAAC;IAC3C,IAAI,aAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,aAAa,GAAG,MAAM,CAAC;QACvB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC;QAClB,CAAC;KACF,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/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { KeySet } from \"./KeySet.js\";\n\n/**\n * Create a type with `T` properties excluding properties listed in `K`.\n *\n * Usage example: `Omit<SomeType, \"exclude_prop1\" | \"exclude_prop2\">`\n *\n * @public\n */\nexport type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;\n\n/**\n * Create a type with `T` properties excluding all properties in type `K`.\n *\n * Usage example: `Subtract<SomeType, ExcludePropertiesInThisType>`\n *\n * @public\n */\nexport type Subtract<T, K> = Omit<T, keyof K>;\n\n/**\n * Create a type from given type `T` and make specified properties optional.\n * @public\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * A dictionary data structure.\n * @public\n */\nexport interface ValuesDictionary<T> {\n [key: string]: T;\n}\n\n/**\n * A structure for paged responses\n * @public\n */\nexport interface PagedResponse<T> {\n /** Total number of items */\n total: number;\n /** Items for the requested page */\n items: T[];\n}\n\n/**\n * Get total number of instances included in the supplied key set. The\n * count is calculated by adding all of the following:\n * - `keys.instanceKeysCount`\n * - number of `keys.nodeKeys` which are *ECInstance* keys\n * - for every grouping node key in `keys.nodeKeys`, number of grouped instances\n *\n * E.g. if `keys` contains one instance key, one *ECInstance* node key\n * and one grouping node key which groups 3 instances, the result is 5.\n *\n * @public\n */\nexport const getInstancesCount = (keys: Readonly<KeySet>): number => {\n let count = keys.instanceKeysCount;\n /* eslint-disable @typescript-eslint/no-deprecated */\n keys.nodeKeys.forEach((key: NodeKey) => {\n if (NodeKey.isInstancesNodeKey(key)) {\n count += key.instanceKeys.length;\n } else if (NodeKey.isGroupingNodeKey(key)) {\n count += key.groupedInstancesCount;\n }\n });\n /* eslint-enable @typescript-eslint/no-deprecated */\n return count;\n};\n\n/**\n * Default (recommended) keyset batch size for cases when it needs to be sent\n * over HTTP. Sending keys in batches helps avoid HTTP413 error.\n *\n * @public\n */\nexport const DEFAULT_KEYS_BATCH_SIZE = 5000;\n\n/**\n * Removes all `undefined` properties from given `obj` object and returns\n * the same (mutated) object.\n *\n * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`\n *\n * @internal\n */\nexport function omitUndefined<T extends object>(obj: T): T {\n Object.entries(obj).forEach(([key, value]) => {\n if (value === undefined) {\n delete obj[key as keyof T];\n }\n });\n return obj;\n}\n\n/** @internal */\ntype NullToUndefined<T> = T extends null\n ? undefined\n : T extends Array<infer U>\n ? Array<NullToUndefined<U>>\n : T extends object\n ? { [K in keyof T]: NullToUndefined<T[K]> }\n : T;\n\n/** @internal */\nexport function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T> {\n /* c8 ignore next 3 */\n if (obj === null) {\n return undefined as any;\n }\n /* c8 ignore next 3 */\n if (Array.isArray(obj)) {\n return obj.map(deepReplaceNullsToUndefined) as NullToUndefined<T>;\n }\n if (typeof obj === \"object\") {\n return Object.keys(obj).reduce((acc, key) => {\n const value = obj[key as keyof T];\n if (value !== null && value !== undefined) {\n acc[key as keyof NullToUndefined<T>] = deepReplaceNullsToUndefined(value) as any;\n }\n return acc;\n }, {} as NullToUndefined<T>);\n }\n return obj as any;\n}\n\n/** @internal */\nexport function createCancellableTimeoutPromise(timeoutMs: number) {\n let timeout: ReturnType<typeof setTimeout>;\n let rejectPromise: () => void;\n const promise = new Promise<void>((resolve, reject) => {\n rejectPromise = reject;\n timeout = setTimeout(resolve, timeoutMs);\n });\n return {\n promise,\n cancel: () => {\n clearTimeout(timeout);\n rejectPromise();\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA8C7C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,qDAAqD;IACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAY,EAAE,EAAE;QACrC,IAAI,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QACnC,CAAC;aAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,IAAI,GAAG,CAAC,qBAAqB,CA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AC;AAED,gBAAgB;AAChB,MAAM,UAAU,+BAA+B,CAAC,SAAiB;IAC/D,IAAI,OAAsC,CAAC;IAC3C,IAAI,aAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,aAAa,GAAG,MAAM,CAAC;QACvB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { KeySet } from \"./KeySet.js\";\r\n\r\n/**\r\n * Create a type with `T` properties excluding properties listed in `K`.\r\n *\r\n * Usage example: `Omit<SomeType, \"exclude_prop1\" | \"exclude_prop2\">`\r\n *\r\n * @public\r\n */\r\nexport type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;\r\n\r\n/**\r\n * Create a type with `T` properties excluding all properties in type `K`.\r\n *\r\n * Usage example: `Subtract<SomeType, ExcludePropertiesInThisType>`\r\n *\r\n * @public\r\n */\r\nexport type Subtract<T, K> = Omit<T, keyof K>;\r\n\r\n/**\r\n * Create a type from given type `T` and make specified properties optional.\r\n * @public\r\n */\r\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\n/**\r\n * A dictionary data structure.\r\n * @public\r\n */\r\nexport interface ValuesDictionary<T> {\r\n [key: string]: T;\r\n}\r\n\r\n/**\r\n * A structure for paged responses\r\n * @public\r\n */\r\nexport interface PagedResponse<T> {\r\n /** Total number of items */\r\n total: number;\r\n /** Items for the requested page */\r\n items: T[];\r\n}\r\n\r\n/**\r\n * Get total number of instances included in the supplied key set. The\r\n * count is calculated by adding all of the following:\r\n * - `keys.instanceKeysCount`\r\n * - number of `keys.nodeKeys` which are *ECInstance* keys\r\n * - for every grouping node key in `keys.nodeKeys`, number of grouped instances\r\n *\r\n * E.g. if `keys` contains one instance key, one *ECInstance* node key\r\n * and one grouping node key which groups 3 instances, the result is 5.\r\n *\r\n * @public\r\n */\r\nexport const getInstancesCount = (keys: Readonly<KeySet>): number => {\r\n let count = keys.instanceKeysCount;\r\n /* eslint-disable @typescript-eslint/no-deprecated */\r\n keys.nodeKeys.forEach((key: NodeKey) => {\r\n if (NodeKey.isInstancesNodeKey(key)) {\r\n count += key.instanceKeys.length;\r\n } else if (NodeKey.isGroupingNodeKey(key)) {\r\n count += key.groupedInstancesCount;\r\n }\r\n });\r\n /* eslint-enable @typescript-eslint/no-deprecated */\r\n return count;\r\n};\r\n\r\n/**\r\n * Default (recommended) keyset batch size for cases when it needs to be sent\r\n * over HTTP. Sending keys in batches helps avoid HTTP413 error.\r\n *\r\n * @public\r\n */\r\nexport const DEFAULT_KEYS_BATCH_SIZE = 5000;\r\n\r\n/**\r\n * Removes all `undefined` properties from given `obj` object and returns\r\n * the same (mutated) object.\r\n *\r\n * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`\r\n *\r\n * @internal\r\n */\r\nexport function omitUndefined<T extends object>(obj: T): T {\r\n Object.entries(obj).forEach(([key, value]) => {\r\n if (value === undefined) {\r\n delete obj[key as keyof T];\r\n }\r\n });\r\n return obj;\r\n}\r\n\r\n/** @internal */\r\ntype NullToUndefined<T> = T extends null\r\n ? undefined\r\n : T extends Array<infer U>\r\n ? Array<NullToUndefined<U>>\r\n : T extends object\r\n ? { [K in keyof T]: NullToUndefined<T[K]> }\r\n : T;\r\n\r\n/** @internal */\r\nexport function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T> {\r\n /* c8 ignore next 3 */\r\n if (obj === null) {\r\n return undefined as any;\r\n }\r\n /* c8 ignore next 3 */\r\n if (Array.isArray(obj)) {\r\n return obj.map(deepReplaceNullsToUndefined) as NullToUndefined<T>;\r\n }\r\n if (typeof obj === \"object\") {\r\n return Object.keys(obj).reduce((acc, key) => {\r\n const value = obj[key as keyof T];\r\n if (value !== null && value !== undefined) {\r\n acc[key as keyof NullToUndefined<T>] = deepReplaceNullsToUndefined(value) as any;\r\n }\r\n return acc;\r\n }, {} as NullToUndefined<T>);\r\n }\r\n return obj as any;\r\n}\r\n\r\n/** @internal */\r\nexport function createCancellableTimeoutPromise(timeoutMs: number) {\r\n let timeout: ReturnType<typeof setTimeout>;\r\n let rejectPromise: () => void;\r\n const promise = new Promise<void>((resolve, reject) => {\r\n rejectPromise = reject;\r\n timeout = setTimeout(resolve, timeoutMs);\r\n });\r\n return {\r\n promise,\r\n cancel: () => {\r\n clearTimeout(timeout);\r\n rejectPromise();\r\n },\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAwBH,cAAc;AACd,MAAM,KAAW,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uCAAuC;IACvC,SAAgB,MAAM,CAAC,QAA6B;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACrC,OAAO;YACL,GAAG,IAAI;YACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IANe,0BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,SAAgB,QAAQ,CAAC,IAA6B;QACpD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAJe,4BAAQ,WAIvB,CAAA;IAED,SAAS,yBAAyB,CAAC,IAA6B,EAAE,aAA+C;QAC/G,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,mDAAmD;YACnD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,SAAgB,YAAY,CAAC,IAA+B;QAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5F,CAAC;IAJe,gCAAY,eAI3B,CAAA;AACH,CAAC,EAnCgB,mBAAmB,KAAnB,mBAAmB,QAmCnC","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/** @packageDocumentation\n * @module Content\n */\n\nimport { RendererDescription } from \"./Renderer.js\";\n\n/**\n * A data structure that describes a [[Field]] category.\n * @public\n */\nexport interface CategoryDescription {\n /** Unique name */\n name: string;\n /** Display label */\n label: string;\n /** Extensive description */\n description: string;\n /** Priority. Categories with higher priority should appear higher in the UI */\n priority: number;\n /** Should this category be auto-expanded when it's displayed in the UI */\n expand: boolean;\n /** Parent category description */\n parent?: CategoryDescription;\n /** Custom renderer description */\n renderer?: RendererDescription;\n}\n/** @public */\nexport namespace CategoryDescription {\n /** Serialize given category to JSON */\n export function toJSON(category: CategoryDescription): CategoryDescriptionJSON {\n const { parent, ...rest } = category;\n return {\n ...rest,\n ...(parent ? { parent: parent.name } : undefined),\n };\n }\n\n /**\n * Deserialize [[CategoryDescription]] from JSON. The `parent` is not assigned - use [[CategoryDescription.listFromJSON]]\n * to deserialize the whole categories list and set parents.\n */\n export function fromJSON(json: CategoryDescriptionJSON): CategoryDescription {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { parent, ...rest } = json;\n return rest;\n }\n\n function createCategoriesHierarchy(json: CategoryDescriptionJSON, categoriesMap: Map<string, CategoryDescription>): CategoryDescription {\n const category = categoriesMap.get(json.name)!;\n if (json.parent) {\n // note: mutating categories in the `categoriesMap`\n category.parent = categoriesMap.get(json.parent);\n }\n return category;\n }\n\n /** Deserialize a list of [[CategoryDescription]] from JSON. */\n export function listFromJSON(json: CategoryDescriptionJSON[]): CategoryDescription[] {\n const categoriesMap = new Map<string, CategoryDescription>();\n json.forEach((categoryJson) => categoriesMap.set(categoryJson.name, CategoryDescription.fromJSON(categoryJson)));\n return json.map((categoryJson) => createCategoriesHierarchy(categoryJson, categoriesMap));\n }\n}\n\n/**\n * Serialized [[CategoryDescription]] JSON representation.\n * @public\n */\nexport interface CategoryDescriptionJSON {\n name: string;\n label: string;\n description: string;\n priority: number;\n expand: boolean;\n parent?: string;\n renderer?: RendererDescription;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAwBH,cAAc;AACd,MAAM,KAAW,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uC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AAC,EAnCgB,mBAAmB,KAAnB,mBAAmB,QAmCnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { RendererDescription } from \"./Renderer.js\";\r\n\r\n/**\r\n * A data structure that describes a [[Field]] category.\r\n * @public\r\n */\r\nexport interface CategoryDescription {\r\n /** Unique name */\r\n name: string;\r\n /** Display label */\r\n label: string;\r\n /** Extensive description */\r\n description: string;\r\n /** Priority. Categories with higher priority should appear higher in the UI */\r\n priority: number;\r\n /** Should this category be auto-expanded when it's displayed in the UI */\r\n expand: boolean;\r\n /** Parent category description */\r\n parent?: CategoryDescription;\r\n /** Custom renderer description */\r\n renderer?: RendererDescription;\r\n}\r\n/** @public */\r\nexport namespace CategoryDescription {\r\n /** Serialize given category to JSON */\r\n export function toJSON(category: CategoryDescription): CategoryDescriptionJSON {\r\n const { parent, ...rest } = category;\r\n return {\r\n ...rest,\r\n ...(parent ? { parent: parent.name } : undefined),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize [[CategoryDescription]] from JSON. The `parent` is not assigned - use [[CategoryDescription.listFromJSON]]\r\n * to deserialize the whole categories list and set parents.\r\n */\r\n export function fromJSON(json: CategoryDescriptionJSON): CategoryDescription {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { parent, ...rest } = json;\r\n return rest;\r\n }\r\n\r\n function createCategoriesHierarchy(json: CategoryDescriptionJSON, categoriesMap: Map<string, CategoryDescription>): CategoryDescription {\r\n const category = categoriesMap.get(json.name)!;\r\n if (json.parent) {\r\n // note: mutating categories in the `categoriesMap`\r\n category.parent = categoriesMap.get(json.parent);\r\n }\r\n return category;\r\n }\r\n\r\n /** Deserialize a list of [[CategoryDescription]] from JSON. */\r\n export function listFromJSON(json: CategoryDescriptionJSON[]): CategoryDescription[] {\r\n const categoriesMap = new Map<string, CategoryDescription>();\r\n json.forEach((categoryJson) => categoriesMap.set(categoryJson.name, CategoryDescription.fromJSON(categoryJson)));\r\n return json.map((categoryJson) => createCategoriesHierarchy(categoryJson, categoriesMap));\r\n }\r\n}\r\n\r\n/**\r\n * Serialized [[CategoryDescription]] JSON representation.\r\n * @public\r\n */\r\nexport interface CategoryDescriptionJSON {\r\n name: string;\r\n label: string;\r\n description: string;\r\n priority: number;\r\n expand: boolean;\r\n parent?: string;\r\n renderer?: RendererDescription;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAY,MAAM,WAAW,CAAC;AAW3C;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IAClB,4CAA4C;IAC5B,UAAU,CAAa;IACvC,oBAAoB;IACJ,UAAU,CAAS;IAEnC,wCAAwC;IACxC,YAAmB,UAAsB,EAAE,KAAa;QACtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,oCAAoC;IAC7B,MAAM;QACX,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAsC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAO,CAAC,IAAI,EAAgB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QACvI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,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/** @packageDocumentation\n * @module Content\n */\n\nimport { Descriptor, DescriptorJSON } from \"./Descriptor.js\";\nimport { Item, ItemJSON } from \"./Item.js\";\n\n/**\n * Serialized [[Content]] JSON representation.\n * @public\n */\nexport interface ContentJSON {\n descriptor: DescriptorJSON;\n contentSet: ItemJSON[];\n}\n\n/**\n * A data structure that contains the [[Descriptor]] and a list of [[Item]]\n * objects which are based on that descriptor.\n *\n * @public\n */\nexport class Content {\n /** Descriptor used to create the content */\n public readonly descriptor: Descriptor;\n /** Content items */\n public readonly contentSet: Item[];\n\n /** Create a new [[Content]] instance */\n public constructor(descriptor: Descriptor, items: Item[]) {\n this.descriptor = descriptor;\n this.contentSet = items;\n }\n\n /** Serialize this object to JSON */\n public toJSON(): ContentJSON {\n return {\n descriptor: this.descriptor.toJSON(),\n contentSet: this.contentSet.map((item: Item) => item.toJSON()),\n };\n }\n\n /** Deserialize [[Content]] from JSON */\n public static fromJSON(json: ContentJSON | string | undefined): Content | undefined {\n if (!json) {\n return undefined;\n }\n\n if (typeof json === \"string\") {\n return Content.fromJSON(JSON.parse(json));\n }\n\n const descriptor = Descriptor.fromJSON(json.descriptor);\n if (!descriptor) {\n return undefined;\n }\n\n const contentSet = json.contentSet.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\n return new Content(descriptor, contentSet);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAY,MAAM,WAAW,CAAC;AAW3C;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IAClB,4CAA4C;IAC5B,UAAU,CAAa;IACvC,oBAAoB;IACJ,UAAU,CAAS;IAEnC,wCAAwC;IACxC,YAAmB,UAAsB,EAAE,KAAa;QACtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,oCAAoC;IAC7B,MAAM;QACX,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAsC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAO,CAAC,IAAI,EAAgB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QACvI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { Descriptor, DescriptorJSON } from \"./Descriptor.js\";\r\nimport { Item, ItemJSON } from \"./Item.js\";\r\n\r\n/**\r\n * Serialized [[Content]] JSON representation.\r\n * @public\r\n */\r\nexport interface ContentJSON {\r\n descriptor: DescriptorJSON;\r\n contentSet: ItemJSON[];\r\n}\r\n\r\n/**\r\n * A data structure that contains the [[Descriptor]] and a list of [[Item]]\r\n * objects which are based on that descriptor.\r\n *\r\n * @public\r\n */\r\nexport class Content {\r\n /** Descriptor used to create the content */\r\n public readonly descriptor: Descriptor;\r\n /** Content items */\r\n public readonly contentSet: Item[];\r\n\r\n /** Create a new [[Content]] instance */\r\n public constructor(descriptor: Descriptor, items: Item[]) {\r\n this.descriptor = descriptor;\r\n this.contentSet = items;\r\n }\r\n\r\n /** Serialize this object to JSON */\r\n public toJSON(): ContentJSON {\r\n return {\r\n descriptor: this.descriptor.toJSON(),\r\n contentSet: this.contentSet.map((item: Item) => item.toJSON()),\r\n };\r\n }\r\n\r\n /** Deserialize [[Content]] from JSON */\r\n public static fromJSON(json: ContentJSON | string | undefined): Content | undefined {\r\n if (!json) {\r\n return undefined;\r\n }\r\n\r\n if (typeof json === \"string\") {\r\n return Content.fromJSON(JSON.parse(json));\r\n }\r\n\r\n const descriptor = Descriptor.fromJSON(json.descriptor);\r\n if (!descriptor) {\r\n return undefined;\r\n }\r\n\r\n const contentSet = json.contentSet.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\r\n return new Content(descriptor, contentSet);\r\n }\r\n}\r\n"]}
|
|
@@ -239,13 +239,13 @@ export declare function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h
|
|
|
239
239
|
* An utility to traverse content using provided visitor. Provides means to parse content into different formats,
|
|
240
240
|
* for different components.
|
|
241
241
|
* @public
|
|
242
|
-
* @deprecated in 5.4. Use [[createContentTraverser]] instead.
|
|
242
|
+
* @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.
|
|
243
243
|
*/
|
|
244
244
|
export declare function traverseContent(visitor: IContentVisitor, content: Content): void;
|
|
245
245
|
/**
|
|
246
246
|
* An utility for calling [[traverseContent]] when there's only one content item.
|
|
247
247
|
* @public
|
|
248
|
-
* @deprecated in 5.4. Use [[createContentTraverser]] instead.
|
|
248
|
+
* @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.
|
|
249
249
|
*/
|
|
250
250
|
export declare function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item): void;
|
|
251
251
|
/**
|
|
@@ -77,7 +77,7 @@ export function traverseFieldHierarchy(hierarchy, cb) {
|
|
|
77
77
|
* An utility to traverse content using provided visitor. Provides means to parse content into different formats,
|
|
78
78
|
* for different components.
|
|
79
79
|
* @public
|
|
80
|
-
* @deprecated in 5.4. Use [[createContentTraverser]] instead.
|
|
80
|
+
* @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.
|
|
81
81
|
*/
|
|
82
82
|
export function traverseContent(visitor, content) {
|
|
83
83
|
return createContentTraverser(visitor, content.descriptor)(content.contentSet);
|
|
@@ -85,7 +85,7 @@ export function traverseContent(visitor, content) {
|
|
|
85
85
|
/**
|
|
86
86
|
* An utility for calling [[traverseContent]] when there's only one content item.
|
|
87
87
|
* @public
|
|
88
|
-
* @deprecated in 5.4. Use [[createContentTraverser]] instead.
|
|
88
|
+
* @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.
|
|
89
89
|
*/
|
|
90
90
|
export function traverseContentItem(visitor, descriptor, item) {
|
|
91
91
|
return createContentTraverser(visitor, descriptor)([item]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTraverser.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/ContentTraverser.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAE,KAAK,EAAsB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAmB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,YAAY,EAIZ,KAAK,IAAI,iBAAiB,GAG3B,MAAM,YAAY,CAAC;AAEpB,MAAM,2BAA2B,GAAG,MAAM,EAAE,CAAC;AAyP7C;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAyB,EAAE,EAAkC;IAClG,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;QAClB,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,sBAAsB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IAChG,CAAC;AACH,C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EAAE,SAAS,CAAC,GAAG,EAAE;QACtC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE;QACjD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,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/** @packageDocumentation\n * @module Content\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { LabelDefinition } from \"../LabelDefinition.js\";\nimport { CategoryDescription } from \"./Category.js\";\nimport { Content } from \"./Content.js\";\nimport { Descriptor } from \"./Descriptor.js\";\nimport { Field, NestedContentField } from \"./Fields.js\";\nimport { Item } from \"./Item.js\";\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription.js\";\nimport {\n DisplayValue,\n DisplayValuesArray,\n DisplayValuesMap,\n NestedContentValue,\n Value as PresentationValue,\n ValuesArray as PresentationValuesArray,\n ValuesMap as PresentationValuesMap,\n} from \"./Value.js\";\n\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\n\ntype ValuesMap = PresentationValuesMap & {\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\n};\n\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\n\ntype ValuesArray = Array<Value>;\n\n/**\n * A data structure to define a hierarchy of [[Field]] objects.\n * @public\n */\nexport interface FieldHierarchy {\n /** Parent field. */\n field: Field;\n /** Nested fields. */\n childFields: FieldHierarchy[];\n}\n\n/**\n * Props for the [[IContentVisitor.startContent]] call.\n * @public\n */\nexport interface StartContentProps {\n /** Descriptor of the visited content. */\n descriptor: Descriptor;\n}\n\n/**\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\n * @public\n */\nexport interface ProcessFieldHierarchiesProps {\n /**\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\n * add new fields, etc.\n */\n hierarchies: FieldHierarchy[];\n}\n\n/**\n * Props for the [[IContentVisitor.startItem]] call.\n * @public\n */\nexport interface StartItemProps {\n /** The content item that's about to be visited. */\n item: Item;\n}\n\n/**\n * Props for the [[IContentVisitor.startCategory]] call.\n * @public\n */\nexport interface StartCategoryProps {\n /** The content category that's about to be visited. */\n category: CategoryDescription;\n}\n\n/**\n * Props for the [[IContentVisitor.startField]] call.\n * @public\n */\nexport interface StartFieldProps {\n /** The field that's about to be visited. */\n hierarchy: FieldHierarchy;\n}\n\n/**\n * Props for the [[IContentVisitor.startStruct]] call.\n * @public\n */\nexport interface StartStructProps {\n /** Field that describes the struct. */\n hierarchy: FieldHierarchy;\n /** Type of the struct. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Member raw values. */\n rawValues: PresentationValuesMap;\n /** Member display values. */\n displayValues: DisplayValuesMap;\n /** Label definition of the ECInstance that the struct represents. */\n label?: LabelDefinition;\n}\n\n/**\n * Props for the [[IContentVisitor.startArray]] call.\n * @public\n */\nexport interface StartArrayProps {\n /** Field that describes the array. */\n hierarchy: FieldHierarchy;\n /** Type of the array. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Item raw values. */\n rawValues: PresentationValuesArray;\n /** Item display values. */\n displayValues: DisplayValuesArray;\n}\n\n/**\n * Props for the [[IContentVisitor.processMergedValue]] call.\n * @public\n */\nexport interface ProcessMergedValueProps {\n /** The field whose values are merged. */\n mergedField: Field;\n /**\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\n * process is going to be represented by [[requestedField]].\n */\n requestedField: Field;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n}\n\n/**\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\n * @public\n */\nexport interface ProcessPrimitiveValueProps {\n /** Field whose value is being processed. */\n field: Field;\n /** Type of the value. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Raw value. */\n rawValue: PresentationValue;\n /** Display value. */\n displayValue: DisplayValue;\n}\n\n/**\n * An interface for a visitor that can be passed to the [[traverseContent]] function\n * to be called on each piece of content.\n *\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\n *\n * ```\n * startContent\n * processFieldHierarchies\n * for each content item:\n * startItem\n * for each field in root level:\n * for each category in field's category stack from root to field's category:\n * startCategory\n * startField\n * valueProcessing:\n * if item's value for this field is merged:\n * processMergedValue\n * else if the field is struct:\n * startStruct\n * for each struct member:\n * recurse into the valueProcessing step\n * finishStruct\n * else if the field is array:\n * startArray\n * for each array item:\n * recurse into the valueProcessing step\n * finishArray\n * else if the field is primitive:\n * processPrimitiveValue\n * finishField\n * finishItem\n * finishContent\n * ```\n * @public\n */\nexport interface IContentVisitor {\n /**\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\n * for parsing content.\n *\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\n */\n startContent(props: StartContentProps): boolean;\n /** Called after processing of [[Content]] is complete. */\n finishContent(): void;\n\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\n\n /**\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\n * set up a new row in table.\n *\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\n */\n startItem(props: StartItemProps): boolean;\n /**\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\n * values for one content item have been processed.\n */\n finishItem(): void;\n\n /**\n * Called before processing a content item field ([[startField]] call) for each category in the field's\n * category stack, starting from the root and finishing with the field's category.\n *\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\n */\n startCategory(props: StartCategoryProps): boolean;\n /** Called after processing of field is complete for every category in the field's category stack. */\n finishCategory(): void;\n\n /**\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\n * to skip a field if it doesn't need to be handled.\n *\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\n */\n startField(props: StartFieldProps): boolean;\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\n finishField(): void;\n\n /**\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\n * for struct member values handling.\n *\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\n */\n startStruct(props: StartStructProps): boolean;\n /** Called after processing of struct value is complete. */\n finishStruct(): void;\n\n /**\n * Called before processing an array value. This is a good callback to skip handling the value or set up\n * for array items handling.\n *\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\n */\n startArray(props: StartArrayProps): boolean;\n /** Called after processing of array value is complete. */\n finishArray(): void;\n\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\n processMergedValue(props: ProcessMergedValueProps): void;\n /** Called to process a primitive value. */\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\n}\n\n/**\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\n * @public\n */\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\n if (cb(hierarchy)) {\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\n }\n}\n\n/* c8 ignore start */\n\n/**\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\n * for different components.\n * @public\n * @deprecated in 5.4. Use [[createContentTraverser]] instead.\n */\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\n return createContentTraverser(visitor, content.descriptor)(content.contentSet);\n}\n\n/**\n * An utility for calling [[traverseContent]] when there's only one content item.\n * @public\n * @deprecated in 5.4. Use [[createContentTraverser]] instead.\n */\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\n return createContentTraverser(visitor, descriptor)([item]);\n}\n\n/* c8 ignore end */\n\n/**\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\n * for different components.\n *\n * This overload takes only the visitor and returns a function that takes descriptor and items to traverse, which is\n * more convenient when item sets need to be traversed with different descriptors.\n *\n * @public\n */\nexport function createContentTraverser(visitor: IContentVisitor): (descriptor: Descriptor, items: Item[]) => void;\n/**\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\n * for different components.\n *\n * This overload takes the visitor and descriptor and returns a function that takes items to traverse, which is more convenient\n * when multiple sets of items need to be traversed with the same descriptor.\n *\n * @public\n */\nexport function createContentTraverser(visitor: IContentVisitor, descriptor: Descriptor): (items: Item[]) => void;\n/** @public */\nexport function createContentTraverser(visitor: IContentVisitor, descriptorArg?: Descriptor) {\n let memo: { descriptor: Descriptor; fieldHierarchies: FieldHierarchy[] } | undefined;\n const traverseContentItems = (descriptor: Descriptor, items: Item[]) => {\n if (!visitor.startContent({ descriptor })) {\n return;\n }\n try {\n if (memo?.descriptor !== descriptor) {\n const fieldHierarchies = createFieldHierarchies(descriptor.fields);\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\n memo = { descriptor, fieldHierarchies };\n }\n items.forEach((item) => {\n traverseContentItemFields(visitor, memo!.fieldHierarchies, item);\n });\n } finally {\n visitor.finishContent();\n }\n };\n return descriptorArg ? (items: Item[]) => traverseContentItems(descriptorArg, items) : traverseContentItems;\n}\n\nclass VisitedCategories implements Disposable {\n private _visitedCategories: CategoryDescription[];\n private _didVisitAllHierarchy: boolean;\n constructor(\n private _visitor: IContentVisitor,\n category: CategoryDescription,\n ) {\n const stack: CategoryDescription[] = [];\n let curr: CategoryDescription | undefined = category;\n while (curr) {\n stack.push(curr);\n curr = curr.parent;\n }\n stack.reverse();\n\n this._didVisitAllHierarchy = true;\n this._visitedCategories = [];\n for (curr of stack) {\n if (this._visitor.startCategory({ category: curr })) {\n this._visitedCategories.push(curr);\n } else {\n this._didVisitAllHierarchy = false;\n break;\n }\n }\n }\n public [Symbol.dispose]() {\n while (this._visitedCategories.pop()) {\n this._visitor.finishCategory();\n }\n }\n public get shouldContinue(): boolean {\n return this._didVisitAllHierarchy;\n }\n}\n\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\n if (!visitor.startItem({ item })) {\n return;\n }\n\n try {\n fieldHierarchies.forEach((fieldHierarchy) => {\n using res = new VisitedCategories(visitor, fieldHierarchy.field.category);\n if (res.shouldContinue) {\n traverseContentItemField(visitor, fieldHierarchy, item);\n }\n });\n } finally {\n visitor.finishItem();\n }\n}\n\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\n return;\n }\n\n try {\n const rootToThisField = createFieldPath(fieldHierarchy.field);\n let parentFieldName: string | undefined;\n const pathUpToField = rootToThisField.slice(undefined, -1);\n for (let i = 0; i < pathUpToField.length; ++i) {\n const parentField = pathUpToField[i] as NestedContentField;\n const nextField = rootToThisField[i + 1];\n\n if (item.isFieldMerged(parentField.name)) {\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\n return;\n }\n\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\n if (emptyNestedItem) {\n return;\n }\n\n item = convertedItem;\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\n }\n\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\n return;\n }\n\n if (fieldHierarchy.field.isNestedContentField()) {\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\n if (emptyNestedItem) {\n return;\n }\n item = convertedItem;\n } else if (pathUpToField.length > 0) {\n fieldHierarchy = {\n ...fieldHierarchy,\n field: (function () {\n const clone = fieldHierarchy.field.clone();\n clone.type = {\n valueFormat: PropertyValueFormat.Array,\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\n memberType: fieldHierarchy.field.type,\n };\n return clone;\n })(),\n };\n }\n\n traverseContentItemFieldValue(\n visitor,\n fieldHierarchy,\n item.mergedFieldNames,\n fieldHierarchy.field.type,\n parentFieldName,\n item.values[fieldHierarchy.field.name],\n item.displayValues[fieldHierarchy.field.name],\n );\n } finally {\n visitor.finishField();\n }\n}\n\nfunction traverseContentItemFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValue: Value,\n displayValue: DisplayValue,\n) {\n if (rawValue !== undefined) {\n if (valueType.valueFormat === PropertyValueFormat.Array) {\n assert(PresentationValue.isArray(rawValue));\n assert(DisplayValue.isArray(displayValue));\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n }\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\n assert(PresentationValue.isMap(rawValue));\n assert(DisplayValue.isMap(displayValue));\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n }\n }\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n}\n\nfunction traverseContentItemArrayFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValues: ValuesArray,\n displayValues: DisplayValuesArray,\n) {\n assert(rawValues.length === displayValues.length);\n assert(valueType.valueFormat === PropertyValueFormat.Array);\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\n return;\n }\n\n try {\n const itemType = valueType.memberType;\n rawValues.forEach((_, i) => {\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\n });\n } finally {\n visitor.finishArray();\n }\n}\n\nfunction traverseContentItemStructFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValues: ValuesMap,\n displayValues: DisplayValuesMap,\n) {\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\n return;\n }\n\n try {\n if (fieldHierarchy.field.isNestedContentField()) {\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\n }\n\n valueType.members.forEach((memberDescription) => {\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\n if (!memberField) {\n // Not finding a member field means we're traversing an ECStruct. If current field is `StructPropertiesField`\n // try looking up member field in there. Otherwise, just create fake field to propagate information.\n const structMemberField =\n fieldHierarchy.field.isPropertiesField() && fieldHierarchy.field.isStructPropertiesField()\n ? fieldHierarchy.field.memberFields.find((mf) => mf.name === memberDescription.name)\n : undefined;\n\n memberField = {\n field:\n structMemberField ??\n new Field({\n category: fieldHierarchy.field.category,\n name: memberDescription.name,\n label: memberDescription.label,\n type: memberDescription.type,\n isReadonly: fieldHierarchy.field.isReadonly,\n priority: 0,\n }),\n childFields: [],\n };\n }\n traverseContentItemFieldValue(\n visitor,\n memberField,\n mergedFieldNames,\n memberDescription.type,\n parentFieldName,\n rawValues[memberDescription.name],\n displayValues[memberDescription.name],\n );\n });\n } finally {\n visitor.finishStruct();\n }\n}\n\nfunction traverseContentItemPrimitiveFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValue: Value,\n displayValue: DisplayValue,\n) {\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\n return;\n }\n\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\n}\n\n/**\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\n *\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\n * without considering categories.\n *\n * @public\n */\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean) {\n const hierarchies = new Array<FieldHierarchy>();\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\n let childFields: FieldHierarchy[] = [];\n if (field.isNestedContentField()) {\n // visit all nested fields\n childFields = visitFields(field.nestedFields, field);\n if (0 === childFields.length) {\n return undefined;\n }\n }\n const fieldHierarchy = { field, childFields };\n if (category === parentField?.category || (ignoreCategories && parentField)) {\n // if categories of this field and its parent field match - return the field hierarchy without\n // including it as a top level field\n return fieldHierarchy;\n }\n addFieldHierarchy(hierarchies, fieldHierarchy);\n return undefined;\n };\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\n const includedFields: FieldHierarchy[] = [];\n visitedFields.forEach((field) => {\n const visitedField = visitField(field.category, field, parentField);\n if (visitedField) {\n includedFields.push(visitedField);\n }\n });\n return includedFields;\n };\n visitFields(fields, undefined);\n return hierarchies;\n}\n\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\n // build a list of parent fields in hierarchy\n const fields: Field[] = [];\n let currField: Field | undefined = hierarchy.field;\n while (currField) {\n fields.push(currField);\n currField = currField.parent;\n }\n\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\n const rootFieldHierarchy = rootFields[rootIndex];\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\n // only interested in fields with the same category\n continue;\n }\n\n let first = true;\n currField = rootFieldHierarchy.field;\n while (currField) {\n const index = fields.findIndex((f) => f.name === currField!.name);\n if (-1 !== index) {\n return {\n existing: {\n field: currField,\n hierarchy: first ? rootFieldHierarchy : undefined,\n index: rootIndex,\n },\n matchingField: fields[index],\n };\n }\n currField = currField.parent;\n first = false;\n }\n }\n\n return undefined;\n}\n\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\n // note: parentField is found by walking up the parentship relationship\n // from hierarchy.field, so we expect to always find it here\n while (hierarchy.field !== parentField) {\n const hierarchyParent = hierarchy.field.parent;\n assert(hierarchyParent !== undefined);\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\n }\n return hierarchy;\n}\n\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\n assert(lhs.field.name === rhs.field.name);\n const result: FieldHierarchy = {\n field: lhs.field.clone(),\n childFields: [...lhs.childFields],\n };\n rhs.childFields.forEach((rhsChildHierarchy) => {\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\n if (indexInResult !== -1) {\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\n } else {\n result.childFields.push(rhsChildHierarchy);\n }\n });\n return result;\n}\n\n/**\n * Adds a field hierarchy into root field hierarchies list.\n * @public\n */\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\n const match = findRelatedFields(rootHierarchies, hierarchy);\n if (!match) {\n rootHierarchies.push(hierarchy);\n return;\n }\n\n const targetHierarchy = rootHierarchies[match.existing.index];\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\n mergedHierarchy.field.category = hierarchy.field.category;\n rootHierarchies[match.existing.index] = mergedHierarchy;\n}\n\nfunction createFieldPath(field: Field): Field[] {\n const path = [field];\n let currField = field;\n while (currField.parent) {\n currField = currField.parent;\n path.push(currField);\n }\n path.reverse();\n return path;\n}\n\n/** @internal */\nexport const FIELD_NAMES_SEPARATOR = \"$\";\n/**\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\n * @public\n */\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\n}\n/**\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\n * @public\n */\nexport function parseCombinedFieldNames(combinedName: string) {\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\n}\n\ninterface NestedItemConversionResult {\n emptyNestedItem: boolean;\n convertedItem: Item;\n}\n\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\n const value = item.values[field.name] ?? [];\n assert(PresentationValue.isNestedContent(value));\n if (value.length === 0) {\n return { emptyNestedItem: true, convertedItem: item };\n }\n\n let nextFieldValues: { raw: PresentationValuesArray | NestedContentValue[]; display: DisplayValuesArray } = { raw: [], display: [] };\n if (nextField.isNestedContentField()) {\n const nextNestedContent: NestedContentValue[] = [];\n value.forEach((ncv) => {\n const nextRawValue = ncv.values[nextField.name];\n if (nextRawValue) {\n assert(PresentationValue.isNestedContent(nextRawValue));\n nextNestedContent.push(...nextRawValue);\n }\n });\n nextFieldValues.raw = nextNestedContent;\n } else {\n const nextValues: { raw: PresentationValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\n value.forEach((ncv) => {\n nextValues.raw.push(ncv.values[nextField.name]);\n nextValues.display.push(ncv.displayValues[nextField.name]);\n });\n nextFieldValues = nextValues;\n }\n const convertedItem = new Item({\n ...item,\n values: { [nextField.name]: nextFieldValues.raw },\n displayValues: { [nextField.name]: nextFieldValues.display },\n });\n return { emptyNestedItem: false, convertedItem };\n}\n\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\n const fieldName = fieldHierarchy.field.name;\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\n if (child.field.isNestedContentField()) {\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\n }\n return child;\n });\n const convertedFieldHierarchy: FieldHierarchy = {\n field: (function () {\n const clone = fieldHierarchy.field.clone();\n clone.type = {\n valueFormat: PropertyValueFormat.Array,\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\n memberType: {\n valueFormat: PropertyValueFormat.Struct,\n typeName: fieldHierarchy.field.type.typeName,\n members: convertedChildFieldHierarchies.map((member) => ({\n name: member.field.name,\n label: member.field.label,\n type: member.field.type,\n })),\n },\n };\n return clone;\n })(),\n childFields: convertedChildFieldHierarchies,\n };\n return convertedFieldHierarchy;\n}\n\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\n const result: {\n raw: ValuesArray;\n display: DisplayValuesArray;\n mergedFieldNames: string[];\n } = { raw: [], display: [], mergedFieldNames: [] };\n\n ncvs.forEach((ncv) => {\n const values: ValuesMap = { ...ncv.values };\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.label ?? ncv.labelDefinition;\n\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\n const childFieldName = childFieldHierarchy.field.name;\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\n return;\n }\n if (childFieldHierarchy.field.isNestedContentField()) {\n const value = values[childFieldName];\n assert(PresentationValue.isNestedContent(value));\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\n values[childFieldName] = convertedValues.raw;\n displayValues[childFieldName] = convertedValues.display;\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\n }\n });\n result.raw.push(values);\n result.display.push(displayValues);\n result.mergedFieldNames.push(...mergedFieldNames);\n });\n return result;\n}\n\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\n const fieldName = fieldHierarchy.field.name;\n const rawValue = item.values[fieldName];\n assert(PresentationValue.isNestedContent(rawValue));\n if (rawValue.length === 0) {\n return { emptyNestedItem: true, convertedItem: item };\n }\n\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\n const convertedItem = new Item({\n ...item,\n values: { [fieldName]: converted.raw },\n displayValues: { [fieldName]: converted.display },\n mergedFieldNames: converted.mergedFieldNames,\n });\n return { emptyNestedItem: false, convertedItem };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ContentTraverser.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/ContentTraverser.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAE,KAAK,EAAsB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAmB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,YAAY,EAIZ,KAAK,IAAI,iBAAiB,GAG3B,MAAM,YAAY,CAAC;AAEpB,MAAM,2BAA2B,GAAG,MAAM,EAAE,CAAC;AAyP7C;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAyB,EAAE,EAAkC;IAClG,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;QAClB,SAAS,CAAC,WAAW,CAAC,OAAO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AC;IACnG,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC;QAC7B,GAAG,IAAI;QACP,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE;QACtC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE;QACjD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Content\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { LabelDefinition } from \"../LabelDefinition.js\";\r\nimport { CategoryDescription } from \"./Category.js\";\r\nimport { Content } from \"./Content.js\";\r\nimport { Descriptor } from \"./Descriptor.js\";\r\nimport { Field, NestedContentField } from \"./Fields.js\";\r\nimport { Item } from \"./Item.js\";\r\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription.js\";\r\nimport {\r\n DisplayValue,\r\n DisplayValuesArray,\r\n DisplayValuesMap,\r\n NestedContentValue,\r\n Value as PresentationValue,\r\n ValuesArray as PresentationValuesArray,\r\n ValuesMap as PresentationValuesMap,\r\n} from \"./Value.js\";\r\n\r\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\r\n\r\ntype ValuesMap = PresentationValuesMap & {\r\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\r\n};\r\n\r\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\r\n\r\ntype ValuesArray = Array<Value>;\r\n\r\n/**\r\n * A data structure to define a hierarchy of [[Field]] objects.\r\n * @public\r\n */\r\nexport interface FieldHierarchy {\r\n /** Parent field. */\r\n field: Field;\r\n /** Nested fields. */\r\n childFields: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startContent]] call.\r\n * @public\r\n */\r\nexport interface StartContentProps {\r\n /** Descriptor of the visited content. */\r\n descriptor: Descriptor;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\r\n * @public\r\n */\r\nexport interface ProcessFieldHierarchiesProps {\r\n /**\r\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\r\n * add new fields, etc.\r\n */\r\n hierarchies: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startItem]] call.\r\n * @public\r\n */\r\nexport interface StartItemProps {\r\n /** The content item that's about to be visited. */\r\n item: Item;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startCategory]] call.\r\n * @public\r\n */\r\nexport interface StartCategoryProps {\r\n /** The content category that's about to be visited. */\r\n category: CategoryDescription;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startField]] call.\r\n * @public\r\n */\r\nexport interface StartFieldProps {\r\n /** The field that's about to be visited. */\r\n hierarchy: FieldHierarchy;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startStruct]] call.\r\n * @public\r\n */\r\nexport interface StartStructProps {\r\n /** Field that describes the struct. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the struct. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Member raw values. */\r\n rawValues: PresentationValuesMap;\r\n /** Member display values. */\r\n displayValues: DisplayValuesMap;\r\n /** Label definition of the ECInstance that the struct represents. */\r\n label?: LabelDefinition;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startArray]] call.\r\n * @public\r\n */\r\nexport interface StartArrayProps {\r\n /** Field that describes the array. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the array. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Item raw values. */\r\n rawValues: PresentationValuesArray;\r\n /** Item display values. */\r\n displayValues: DisplayValuesArray;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processMergedValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessMergedValueProps {\r\n /** The field whose values are merged. */\r\n mergedField: Field;\r\n /**\r\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\r\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\r\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\r\n * process is going to be represented by [[requestedField]].\r\n */\r\n requestedField: Field;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessPrimitiveValueProps {\r\n /** Field whose value is being processed. */\r\n field: Field;\r\n /** Type of the value. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Raw value. */\r\n rawValue: PresentationValue;\r\n /** Display value. */\r\n displayValue: DisplayValue;\r\n}\r\n\r\n/**\r\n * An interface for a visitor that can be passed to the [[traverseContent]] function\r\n * to be called on each piece of content.\r\n *\r\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\r\n *\r\n * ```\r\n * startContent\r\n * processFieldHierarchies\r\n * for each content item:\r\n * startItem\r\n * for each field in root level:\r\n * for each category in field's category stack from root to field's category:\r\n * startCategory\r\n * startField\r\n * valueProcessing:\r\n * if item's value for this field is merged:\r\n * processMergedValue\r\n * else if the field is struct:\r\n * startStruct\r\n * for each struct member:\r\n * recurse into the valueProcessing step\r\n * finishStruct\r\n * else if the field is array:\r\n * startArray\r\n * for each array item:\r\n * recurse into the valueProcessing step\r\n * finishArray\r\n * else if the field is primitive:\r\n * processPrimitiveValue\r\n * finishField\r\n * finishItem\r\n * finishContent\r\n * ```\r\n * @public\r\n */\r\nexport interface IContentVisitor {\r\n /**\r\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\r\n * for parsing content.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\r\n */\r\n startContent(props: StartContentProps): boolean;\r\n /** Called after processing of [[Content]] is complete. */\r\n finishContent(): void;\r\n\r\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\r\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\r\n\r\n /**\r\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\r\n * set up a new row in table.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\r\n */\r\n startItem(props: StartItemProps): boolean;\r\n /**\r\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\r\n * values for one content item have been processed.\r\n */\r\n finishItem(): void;\r\n\r\n /**\r\n * Called before processing a content item field ([[startField]] call) for each category in the field's\r\n * category stack, starting from the root and finishing with the field's category.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\r\n */\r\n startCategory(props: StartCategoryProps): boolean;\r\n /** Called after processing of field is complete for every category in the field's category stack. */\r\n finishCategory(): void;\r\n\r\n /**\r\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\r\n * to skip a field if it doesn't need to be handled.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\r\n */\r\n startField(props: StartFieldProps): boolean;\r\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\r\n finishField(): void;\r\n\r\n /**\r\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\r\n * for struct member values handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\r\n */\r\n startStruct(props: StartStructProps): boolean;\r\n /** Called after processing of struct value is complete. */\r\n finishStruct(): void;\r\n\r\n /**\r\n * Called before processing an array value. This is a good callback to skip handling the value or set up\r\n * for array items handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\r\n */\r\n startArray(props: StartArrayProps): boolean;\r\n /** Called after processing of array value is complete. */\r\n finishArray(): void;\r\n\r\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\r\n processMergedValue(props: ProcessMergedValueProps): void;\r\n /** Called to process a primitive value. */\r\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\r\n}\r\n\r\n/**\r\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\r\n * @public\r\n */\r\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\r\n if (cb(hierarchy)) {\r\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\r\n }\r\n}\r\n\r\n/* c8 ignore start */\r\n\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n * @public\r\n * @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.\r\n */\r\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\r\n return createContentTraverser(visitor, content.descriptor)(content.contentSet);\r\n}\r\n\r\n/**\r\n * An utility for calling [[traverseContent]] when there's only one content item.\r\n * @public\r\n * @deprecated in 5.4 - will not be removed until after 2026-12-02. Use [[createContentTraverser]] instead.\r\n */\r\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\r\n return createContentTraverser(visitor, descriptor)([item]);\r\n}\r\n\r\n/* c8 ignore end */\r\n\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n *\r\n * This overload takes only the visitor and returns a function that takes descriptor and items to traverse, which is\r\n * more convenient when item sets need to be traversed with different descriptors.\r\n *\r\n * @public\r\n */\r\nexport function createContentTraverser(visitor: IContentVisitor): (descriptor: Descriptor, items: Item[]) => void;\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n *\r\n * This overload takes the visitor and descriptor and returns a function that takes items to traverse, which is more convenient\r\n * when multiple sets of items need to be traversed with the same descriptor.\r\n *\r\n * @public\r\n */\r\nexport function createContentTraverser(visitor: IContentVisitor, descriptor: Descriptor): (items: Item[]) => void;\r\n/** @public */\r\nexport function createContentTraverser(visitor: IContentVisitor, descriptorArg?: Descriptor) {\r\n let memo: { descriptor: Descriptor; fieldHierarchies: FieldHierarchy[] } | undefined;\r\n const traverseContentItems = (descriptor: Descriptor, items: Item[]) => {\r\n if (!visitor.startContent({ descriptor })) {\r\n return;\r\n }\r\n try {\r\n if (memo?.descriptor !== descriptor) {\r\n const fieldHierarchies = createFieldHierarchies(descriptor.fields);\r\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\r\n memo = { descriptor, fieldHierarchies };\r\n }\r\n items.forEach((item) => {\r\n traverseContentItemFields(visitor, memo!.fieldHierarchies, item);\r\n });\r\n } finally {\r\n visitor.finishContent();\r\n }\r\n };\r\n return descriptorArg ? (items: Item[]) => traverseContentItems(descriptorArg, items) : traverseContentItems;\r\n}\r\n\r\nclass VisitedCategories implements Disposable {\r\n private _visitedCategories: CategoryDescription[];\r\n private _didVisitAllHierarchy: boolean;\r\n constructor(\r\n private _visitor: IContentVisitor,\r\n category: CategoryDescription,\r\n ) {\r\n const stack: CategoryDescription[] = [];\r\n let curr: CategoryDescription | undefined = category;\r\n while (curr) {\r\n stack.push(curr);\r\n curr = curr.parent;\r\n }\r\n stack.reverse();\r\n\r\n this._didVisitAllHierarchy = true;\r\n this._visitedCategories = [];\r\n for (curr of stack) {\r\n if (this._visitor.startCategory({ category: curr })) {\r\n this._visitedCategories.push(curr);\r\n } else {\r\n this._didVisitAllHierarchy = false;\r\n break;\r\n }\r\n }\r\n }\r\n public [Symbol.dispose]() {\r\n while (this._visitedCategories.pop()) {\r\n this._visitor.finishCategory();\r\n }\r\n }\r\n public get shouldContinue(): boolean {\r\n return this._didVisitAllHierarchy;\r\n }\r\n}\r\n\r\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\r\n if (!visitor.startItem({ item })) {\r\n return;\r\n }\r\n\r\n try {\r\n fieldHierarchies.forEach((fieldHierarchy) => {\r\n using res = new VisitedCategories(visitor, fieldHierarchy.field.category);\r\n if (res.shouldContinue) {\r\n traverseContentItemField(visitor, fieldHierarchy, item);\r\n }\r\n });\r\n } finally {\r\n visitor.finishItem();\r\n }\r\n}\r\n\r\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\r\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\r\n return;\r\n }\r\n\r\n try {\r\n const rootToThisField = createFieldPath(fieldHierarchy.field);\r\n let parentFieldName: string | undefined;\r\n const pathUpToField = rootToThisField.slice(undefined, -1);\r\n for (let i = 0; i < pathUpToField.length; ++i) {\r\n const parentField = pathUpToField[i] as NestedContentField;\r\n const nextField = rootToThisField[i + 1];\r\n\r\n if (item.isFieldMerged(parentField.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\r\n return;\r\n }\r\n\r\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n\r\n item = convertedItem;\r\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\r\n }\r\n\r\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\r\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n item = convertedItem;\r\n } else if (pathUpToField.length > 0) {\r\n fieldHierarchy = {\r\n ...fieldHierarchy,\r\n field: (function () {\r\n const clone = fieldHierarchy.field.clone();\r\n clone.type = {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: fieldHierarchy.field.type,\r\n };\r\n return clone;\r\n })(),\r\n };\r\n }\r\n\r\n traverseContentItemFieldValue(\r\n visitor,\r\n fieldHierarchy,\r\n item.mergedFieldNames,\r\n fieldHierarchy.field.type,\r\n parentFieldName,\r\n item.values[fieldHierarchy.field.name],\r\n item.displayValues[fieldHierarchy.field.name],\r\n );\r\n } finally {\r\n visitor.finishField();\r\n }\r\n}\r\n\r\nfunction traverseContentItemFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (rawValue !== undefined) {\r\n if (valueType.valueFormat === PropertyValueFormat.Array) {\r\n assert(PresentationValue.isArray(rawValue));\r\n assert(DisplayValue.isArray(displayValue));\r\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\r\n assert(PresentationValue.isMap(rawValue));\r\n assert(DisplayValue.isMap(displayValue));\r\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n }\r\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n}\r\n\r\nfunction traverseContentItemArrayFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesArray,\r\n displayValues: DisplayValuesArray,\r\n) {\r\n assert(rawValues.length === displayValues.length);\r\n assert(valueType.valueFormat === PropertyValueFormat.Array);\r\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\r\n return;\r\n }\r\n\r\n try {\r\n const itemType = valueType.memberType;\r\n rawValues.forEach((_, i) => {\r\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\r\n });\r\n } finally {\r\n visitor.finishArray();\r\n }\r\n}\r\n\r\nfunction traverseContentItemStructFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesMap,\r\n displayValues: DisplayValuesMap,\r\n) {\r\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\r\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\r\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\r\n return;\r\n }\r\n\r\n try {\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\r\n }\r\n\r\n valueType.members.forEach((memberDescription) => {\r\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\r\n if (!memberField) {\r\n // Not finding a member field means we're traversing an ECStruct. If current field is `StructPropertiesField`\r\n // try looking up member field in there. Otherwise, just create fake field to propagate information.\r\n const structMemberField =\r\n fieldHierarchy.field.isPropertiesField() && fieldHierarchy.field.isStructPropertiesField()\r\n ? fieldHierarchy.field.memberFields.find((mf) => mf.name === memberDescription.name)\r\n : undefined;\r\n\r\n memberField = {\r\n field:\r\n structMemberField ??\r\n new Field({\r\n category: fieldHierarchy.field.category,\r\n name: memberDescription.name,\r\n label: memberDescription.label,\r\n type: memberDescription.type,\r\n isReadonly: fieldHierarchy.field.isReadonly,\r\n priority: 0,\r\n }),\r\n childFields: [],\r\n };\r\n }\r\n traverseContentItemFieldValue(\r\n visitor,\r\n memberField,\r\n mergedFieldNames,\r\n memberDescription.type,\r\n parentFieldName,\r\n rawValues[memberDescription.name],\r\n displayValues[memberDescription.name],\r\n );\r\n });\r\n } finally {\r\n visitor.finishStruct();\r\n }\r\n}\r\n\r\nfunction traverseContentItemPrimitiveFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\r\n}\r\n\r\n/**\r\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\r\n *\r\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\r\n * without considering categories.\r\n *\r\n * @public\r\n */\r\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean) {\r\n const hierarchies = new Array<FieldHierarchy>();\r\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\r\n let childFields: FieldHierarchy[] = [];\r\n if (field.isNestedContentField()) {\r\n // visit all nested fields\r\n childFields = visitFields(field.nestedFields, field);\r\n if (0 === childFields.length) {\r\n return undefined;\r\n }\r\n }\r\n const fieldHierarchy = { field, childFields };\r\n if (category === parentField?.category || (ignoreCategories && parentField)) {\r\n // if categories of this field and its parent field match - return the field hierarchy without\r\n // including it as a top level field\r\n return fieldHierarchy;\r\n }\r\n addFieldHierarchy(hierarchies, fieldHierarchy);\r\n return undefined;\r\n };\r\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\r\n const includedFields: FieldHierarchy[] = [];\r\n visitedFields.forEach((field) => {\r\n const visitedField = visitField(field.category, field, parentField);\r\n if (visitedField) {\r\n includedFields.push(visitedField);\r\n }\r\n });\r\n return includedFields;\r\n };\r\n visitFields(fields, undefined);\r\n return hierarchies;\r\n}\r\n\r\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\r\n // build a list of parent fields in hierarchy\r\n const fields: Field[] = [];\r\n let currField: Field | undefined = hierarchy.field;\r\n while (currField) {\r\n fields.push(currField);\r\n currField = currField.parent;\r\n }\r\n\r\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\r\n const rootFieldHierarchy = rootFields[rootIndex];\r\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\r\n // only interested in fields with the same category\r\n continue;\r\n }\r\n\r\n let first = true;\r\n currField = rootFieldHierarchy.field;\r\n while (currField) {\r\n const index = fields.findIndex((f) => f.name === currField!.name);\r\n if (-1 !== index) {\r\n return {\r\n existing: {\r\n field: currField,\r\n hierarchy: first ? rootFieldHierarchy : undefined,\r\n index: rootIndex,\r\n },\r\n matchingField: fields[index],\r\n };\r\n }\r\n currField = currField.parent;\r\n first = false;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\r\n // note: parentField is found by walking up the parentship relationship\r\n // from hierarchy.field, so we expect to always find it here\r\n while (hierarchy.field !== parentField) {\r\n const hierarchyParent = hierarchy.field.parent;\r\n assert(hierarchyParent !== undefined);\r\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\r\n }\r\n return hierarchy;\r\n}\r\n\r\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\r\n assert(lhs.field.name === rhs.field.name);\r\n const result: FieldHierarchy = {\r\n field: lhs.field.clone(),\r\n childFields: [...lhs.childFields],\r\n };\r\n rhs.childFields.forEach((rhsChildHierarchy) => {\r\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\r\n if (indexInResult !== -1) {\r\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\r\n } else {\r\n result.childFields.push(rhsChildHierarchy);\r\n }\r\n });\r\n return result;\r\n}\r\n\r\n/**\r\n * Adds a field hierarchy into root field hierarchies list.\r\n * @public\r\n */\r\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\r\n const match = findRelatedFields(rootHierarchies, hierarchy);\r\n if (!match) {\r\n rootHierarchies.push(hierarchy);\r\n return;\r\n }\r\n\r\n const targetHierarchy = rootHierarchies[match.existing.index];\r\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\r\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\r\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\r\n mergedHierarchy.field.category = hierarchy.field.category;\r\n rootHierarchies[match.existing.index] = mergedHierarchy;\r\n}\r\n\r\nfunction createFieldPath(field: Field): Field[] {\r\n const path = [field];\r\n let currField = field;\r\n while (currField.parent) {\r\n currField = currField.parent;\r\n path.push(currField);\r\n }\r\n path.reverse();\r\n return path;\r\n}\r\n\r\n/** @internal */\r\nexport const FIELD_NAMES_SEPARATOR = \"$\";\r\n/**\r\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\r\n * @public\r\n */\r\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\r\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\r\n}\r\n/**\r\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\r\n * @public\r\n */\r\nexport function parseCombinedFieldNames(combinedName: string) {\r\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\r\n}\r\n\r\ninterface NestedItemConversionResult {\r\n emptyNestedItem: boolean;\r\n convertedItem: Item;\r\n}\r\n\r\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\r\n const value = item.values[field.name] ?? [];\r\n assert(PresentationValue.isNestedContent(value));\r\n if (value.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n let nextFieldValues: { raw: PresentationValuesArray | NestedContentValue[]; display: DisplayValuesArray } = { raw: [], display: [] };\r\n if (nextField.isNestedContentField()) {\r\n const nextNestedContent: NestedContentValue[] = [];\r\n value.forEach((ncv) => {\r\n const nextRawValue = ncv.values[nextField.name];\r\n if (nextRawValue) {\r\n assert(PresentationValue.isNestedContent(nextRawValue));\r\n nextNestedContent.push(...nextRawValue);\r\n }\r\n });\r\n nextFieldValues.raw = nextNestedContent;\r\n } else {\r\n const nextValues: { raw: PresentationValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\r\n value.forEach((ncv) => {\r\n nextValues.raw.push(ncv.values[nextField.name]);\r\n nextValues.display.push(ncv.displayValues[nextField.name]);\r\n });\r\n nextFieldValues = nextValues;\r\n }\r\n const convertedItem = new Item({\r\n ...item,\r\n values: { [nextField.name]: nextFieldValues.raw },\r\n displayValues: { [nextField.name]: nextFieldValues.display },\r\n });\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\r\n const fieldName = fieldHierarchy.field.name;\r\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\r\n if (child.field.isNestedContentField()) {\r\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\r\n }\r\n return child;\r\n });\r\n const convertedFieldHierarchy: FieldHierarchy = {\r\n field: (function () {\r\n const clone = fieldHierarchy.field.clone();\r\n clone.type = {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: {\r\n valueFormat: PropertyValueFormat.Struct,\r\n typeName: fieldHierarchy.field.type.typeName,\r\n members: convertedChildFieldHierarchies.map((member) => ({\r\n name: member.field.name,\r\n label: member.field.label,\r\n type: member.field.type,\r\n })),\r\n },\r\n };\r\n return clone;\r\n })(),\r\n childFields: convertedChildFieldHierarchies,\r\n };\r\n return convertedFieldHierarchy;\r\n}\r\n\r\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\r\n const result: {\r\n raw: ValuesArray;\r\n display: DisplayValuesArray;\r\n mergedFieldNames: string[];\r\n } = { raw: [], display: [], mergedFieldNames: [] };\r\n\r\n ncvs.forEach((ncv) => {\r\n const values: ValuesMap = { ...ncv.values };\r\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\r\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.label ?? ncv.labelDefinition;\r\n\r\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\r\n const childFieldName = childFieldHierarchy.field.name;\r\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\r\n return;\r\n }\r\n if (childFieldHierarchy.field.isNestedContentField()) {\r\n const value = values[childFieldName];\r\n assert(PresentationValue.isNestedContent(value));\r\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\r\n values[childFieldName] = convertedValues.raw;\r\n displayValues[childFieldName] = convertedValues.display;\r\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\r\n }\r\n });\r\n result.raw.push(values);\r\n result.display.push(displayValues);\r\n result.mergedFieldNames.push(...mergedFieldNames);\r\n });\r\n return result;\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\r\n const fieldName = fieldHierarchy.field.name;\r\n const rawValue = item.values[fieldName];\r\n assert(PresentationValue.isNestedContent(rawValue));\r\n if (rawValue.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\r\n const convertedItem = new Item({\r\n ...item,\r\n values: { [fieldName]: converted.raw },\r\n displayValues: { [fieldName]: converted.display },\r\n mergedFieldNames: converted.mergedFieldNames,\r\n });\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n"]}
|