@itwin/presentation-common 5.2.0-dev.3 → 5.2.0-dev.30
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 +53 -1
- package/Ruleset.schema.json +18 -0
- 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.d.ts +22 -7
- package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
- package/lib/cjs/presentation-common/KeySet.js +28 -37
- package/lib/cjs/presentation-common/KeySet.js.map +1 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.d.ts +5 -3
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js +2 -2
- 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.d.ts +1 -1
- package/lib/cjs/presentation-common/LocalizationHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-common/LocalizationHelper.js +9 -7
- 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.d.ts +10 -0
- package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
- package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +8 -0
- package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.js +1 -2
- 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.d.ts.map +1 -1
- package/lib/cjs/presentation-common/RpcRequestsHandler.js +2 -16
- 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.d.ts +16 -0
- package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
- package/lib/cjs/presentation-common/Update.js +1 -0
- package/lib/cjs/presentation-common/Update.js.map +1 -1
- package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-common/Utils.js +2 -0
- 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.map +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.js +14 -10
- 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.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +6 -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.d.ts +2 -0
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +1 -0
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.d.ts +23 -1
- package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.js +8 -1
- package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.d.ts +4 -0
- package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.js +1 -0
- package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +4 -0
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +1 -0
- 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.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/Rule.js +1 -0
- 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.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js +1 -0
- 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.d.ts +18 -0
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +5 -0
- 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.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +8 -0
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -0
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +12 -0
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -0
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts +4 -0
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js +1 -0
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js +1 -0
- 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.d.ts +22 -7
- package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
- package/lib/esm/presentation-common/KeySet.js +29 -38
- package/lib/esm/presentation-common/KeySet.js.map +1 -1
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.d.ts +5 -3
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.js +2 -2
- 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.d.ts +1 -1
- package/lib/esm/presentation-common/LocalizationHelper.d.ts.map +1 -1
- package/lib/esm/presentation-common/LocalizationHelper.js +9 -7
- 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.d.ts +10 -0
- package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
- package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +8 -0
- package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.js +1 -2
- 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.d.ts.map +1 -1
- package/lib/esm/presentation-common/RpcRequestsHandler.js +2 -16
- 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.d.ts +16 -0
- package/lib/esm/presentation-common/Update.d.ts.map +1 -1
- package/lib/esm/presentation-common/Update.js +1 -0
- package/lib/esm/presentation-common/Update.js.map +1 -1
- package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
- package/lib/esm/presentation-common/Utils.js +2 -0
- 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.map +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.js +14 -10
- 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.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/PropertyValueFormatter.js +6 -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.d.ts +2 -0
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +1 -0
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.d.ts +23 -1
- package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.js +8 -1
- package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.d.ts +4 -0
- package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.js +1 -0
- package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +4 -0
- package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.js +1 -0
- 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.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/Rule.js +1 -0
- 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.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.js +1 -0
- 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.d.ts +18 -0
- package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js +5 -0
- 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.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +8 -0
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -0
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +12 -0
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -0
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts +4 -0
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js +1 -0
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js +1 -0
- 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
|
@@ -12,12 +12,17 @@ import { NodeKey } from "./hierarchy/Key.js";
|
|
|
12
12
|
export type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;
|
|
13
13
|
/** @public */
|
|
14
14
|
export declare namespace Key {
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Check if the supplied key is a `NodeKey`
|
|
17
|
+
*
|
|
18
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
19
|
+
* package for creating hierarchies.
|
|
20
|
+
*/
|
|
21
|
+
function isNodeKey(key: Key): key is Extract<Key, Readonly<NodeKey>>;
|
|
17
22
|
/** Check if the supplied key is an `InstanceKey` */
|
|
18
|
-
function isInstanceKey(key: Key): key is InstanceKey
|
|
23
|
+
function isInstanceKey(key: Key): key is Extract<Key, Readonly<InstanceKey>>;
|
|
19
24
|
/** Check if the supplied key is an `EntityProps` */
|
|
20
|
-
function isEntityProps(key: Key): key is EntityProps
|
|
25
|
+
function isEntityProps(key: Key): key is Extract<Key, Readonly<EntityProps>>;
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
23
28
|
* A type for multiple keys that identify something in iModel.js application
|
|
@@ -31,7 +36,12 @@ export type Keys = ReadonlyArray<Key> | Readonly<KeySet>;
|
|
|
31
36
|
export interface KeySetJSON {
|
|
32
37
|
/** JSON representation of a list of instance keys */
|
|
33
38
|
instanceKeys: Array<[string, string]>;
|
|
34
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* An array of serialized node keys
|
|
41
|
+
*
|
|
42
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
43
|
+
* package for creating hierarchies.
|
|
44
|
+
*/
|
|
35
45
|
nodeKeys: NodeKey[];
|
|
36
46
|
}
|
|
37
47
|
/**
|
|
@@ -71,12 +81,17 @@ export declare class KeySet {
|
|
|
71
81
|
/**
|
|
72
82
|
* Get a set of node keys stored in this KeySet
|
|
73
83
|
*
|
|
74
|
-
* **Warning**: getting node keys might be expensive for
|
|
75
|
-
*
|
|
84
|
+
* **Warning**: getting node keys might be expensive for large KeySets.
|
|
85
|
+
*
|
|
86
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
87
|
+
* package for creating hierarchies.
|
|
76
88
|
*/
|
|
77
89
|
get nodeKeys(): Set<NodeKey>;
|
|
78
90
|
/**
|
|
79
91
|
* Get node keys count
|
|
92
|
+
*
|
|
93
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
94
|
+
* package for creating hierarchies.
|
|
80
95
|
*/
|
|
81
96
|
get nodeKeysCount(): number;
|
|
82
97
|
private isKeySet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeySet.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"KeySet.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAmC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,GAAG,EAAE,WAAW,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;IAW5E,sDAAsD;IAC/C,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;IAqBvF;;;OAGG;IACI,MAAM,IAAI,UAAU;IAoB3B;;;OAGG;WACW,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CAKjD"}
|
|
@@ -9,13 +9,19 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.KeySet = exports.Key = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const Error_js_1 = require("./Error.js");
|
|
13
12
|
/** @public */
|
|
14
13
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
15
14
|
var Key;
|
|
16
15
|
(function (Key) {
|
|
17
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Check if the supplied key is a `NodeKey`
|
|
18
|
+
*
|
|
19
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
20
|
+
* package for creating hierarchies.
|
|
21
|
+
*/
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
18
23
|
function isNodeKey(key) {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
19
25
|
return !!key.type;
|
|
20
26
|
}
|
|
21
27
|
Key.isNodeKey = isNodeKey;
|
|
@@ -91,10 +97,13 @@ class KeySet {
|
|
|
91
97
|
/**
|
|
92
98
|
* Get a set of node keys stored in this KeySet
|
|
93
99
|
*
|
|
94
|
-
* **Warning**: getting node keys might be expensive for
|
|
95
|
-
*
|
|
100
|
+
* **Warning**: getting node keys might be expensive for large KeySets.
|
|
101
|
+
*
|
|
102
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
103
|
+
* package for creating hierarchies.
|
|
96
104
|
*/
|
|
97
105
|
get nodeKeys() {
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
98
107
|
const set = new Set();
|
|
99
108
|
for (const serialized of this._nodeKeys) {
|
|
100
109
|
set.add(JSON.parse(serialized));
|
|
@@ -103,6 +112,9 @@ class KeySet {
|
|
|
103
112
|
}
|
|
104
113
|
/**
|
|
105
114
|
* Get node keys count
|
|
115
|
+
*
|
|
116
|
+
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
117
|
+
* package for creating hierarchies.
|
|
106
118
|
*/
|
|
107
119
|
get nodeKeysCount() {
|
|
108
120
|
return this._nodeKeys.size;
|
|
@@ -149,6 +161,7 @@ class KeySet {
|
|
|
149
161
|
}
|
|
150
162
|
}
|
|
151
163
|
addKeySetJSON(keyset) {
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
152
165
|
for (const key of keyset.nodeKeys) {
|
|
153
166
|
this._nodeKeys.add(JSON.stringify(key));
|
|
154
167
|
}
|
|
@@ -168,9 +181,6 @@ class KeySet {
|
|
|
168
181
|
* @returns itself
|
|
169
182
|
*/
|
|
170
183
|
add(value, pred) {
|
|
171
|
-
if (!value) {
|
|
172
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
|
|
173
|
-
}
|
|
174
184
|
const sizeBefore = this.size;
|
|
175
185
|
if (this.isKeySet(value)) {
|
|
176
186
|
this.addKeySet(value, pred);
|
|
@@ -190,13 +200,11 @@ class KeySet {
|
|
|
190
200
|
}
|
|
191
201
|
this._lowerCaseMap.set(lcClassName, normalizedClassName);
|
|
192
202
|
this._instanceKeys.get(lcClassName).add(value.id);
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
193
204
|
}
|
|
194
205
|
else if (Key.isNodeKey(value)) {
|
|
195
206
|
this._nodeKeys.add(JSON.stringify(value));
|
|
196
207
|
}
|
|
197
|
-
else {
|
|
198
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
|
|
199
|
-
}
|
|
200
208
|
}
|
|
201
209
|
if (this.size !== sizeBefore) {
|
|
202
210
|
this.recalculateGuid();
|
|
@@ -222,9 +230,6 @@ class KeySet {
|
|
|
222
230
|
* @returns itself
|
|
223
231
|
*/
|
|
224
232
|
delete(value) {
|
|
225
|
-
if (!value) {
|
|
226
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
|
|
227
|
-
}
|
|
228
233
|
const sizeBefore = this.size;
|
|
229
234
|
if (this.isKeySet(value)) {
|
|
230
235
|
this.deleteKeySet(value);
|
|
@@ -243,13 +248,11 @@ class KeySet {
|
|
|
243
248
|
if (set) {
|
|
244
249
|
set.delete(value.id);
|
|
245
250
|
}
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
246
252
|
}
|
|
247
253
|
else if (Key.isNodeKey(value)) {
|
|
248
254
|
this._nodeKeys.delete(JSON.stringify(value));
|
|
249
255
|
}
|
|
250
|
-
else {
|
|
251
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
|
|
252
|
-
}
|
|
253
256
|
if (this.size !== sizeBefore) {
|
|
254
257
|
this.recalculateGuid();
|
|
255
258
|
}
|
|
@@ -260,9 +263,6 @@ class KeySet {
|
|
|
260
263
|
* @param value The key to check.
|
|
261
264
|
*/
|
|
262
265
|
has(value) {
|
|
263
|
-
if (!value) {
|
|
264
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
|
|
265
|
-
}
|
|
266
266
|
if (Key.isEntityProps(value)) {
|
|
267
267
|
return this.has({ className: value.classFullName, id: value.id });
|
|
268
268
|
}
|
|
@@ -271,10 +271,9 @@ class KeySet {
|
|
|
271
271
|
const set = this._instanceKeys.get(normalizedClassName.toLowerCase());
|
|
272
272
|
return !!(set && set.has(value.id));
|
|
273
273
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
|
|
274
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
275
|
+
(0, core_bentley_1.assert)(Key.isNodeKey(value));
|
|
276
|
+
return this._nodeKeys.has(JSON.stringify(value));
|
|
278
277
|
}
|
|
279
278
|
hasKeySet(readonlyKeys, checkType) {
|
|
280
279
|
// note: cast-away read-onlyness to access private members...
|
|
@@ -334,32 +333,22 @@ class KeySet {
|
|
|
334
333
|
* @param keys The keys to check.
|
|
335
334
|
*/
|
|
336
335
|
hasAll(keys) {
|
|
337
|
-
if (!keys) {
|
|
338
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);
|
|
339
|
-
}
|
|
340
336
|
if (this.isKeySet(keys)) {
|
|
341
337
|
return this.hasKeySet(keys, "all");
|
|
342
338
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);
|
|
339
|
+
(0, core_bentley_1.assert)(this.isKeysArray(keys));
|
|
340
|
+
return this.hasKeysArray(keys, "all");
|
|
347
341
|
}
|
|
348
342
|
/**
|
|
349
343
|
* Check if this KeySet contains any of the specified keys.
|
|
350
344
|
* @param keys The keys to check.
|
|
351
345
|
*/
|
|
352
346
|
hasAny(keys) {
|
|
353
|
-
if (!keys) {
|
|
354
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);
|
|
355
|
-
}
|
|
356
347
|
if (this.isKeySet(keys)) {
|
|
357
348
|
return this.hasKeySet(keys, "any");
|
|
358
349
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);
|
|
350
|
+
(0, core_bentley_1.assert)(this.isKeysArray(keys));
|
|
351
|
+
return this.hasKeysArray(keys, "any");
|
|
363
352
|
}
|
|
364
353
|
/**
|
|
365
354
|
* Get the number of keys stored in this KeySet.
|
|
@@ -389,6 +378,7 @@ class KeySet {
|
|
|
389
378
|
return some(this._nodeKeys, (serializedKey) => callback(JSON.parse(serializedKey)));
|
|
390
379
|
}
|
|
391
380
|
/** Iterate over all keys in this keyset. */
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
392
382
|
forEach(callback) {
|
|
393
383
|
let index = 0;
|
|
394
384
|
this._instanceKeys.forEach((ids, className) => {
|
|
@@ -433,6 +423,7 @@ class KeySet {
|
|
|
433
423
|
instanceKeys.push([className, compressedIds.length > 0 ? compressedIds : core_bentley_1.Id64.invalid]);
|
|
434
424
|
}
|
|
435
425
|
}
|
|
426
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
436
427
|
const nodeKeys = [];
|
|
437
428
|
for (const serializedKey of this._nodeKeys.values()) {
|
|
438
429
|
nodeKeys.push(JSON.parse(serializedKey));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeySet.js","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA4F;AAG5F,yCAAmE;AASnE,cAAc;AACd,2DAA2D;AAC3D,IAAiB,GAAG,CAenB;AAfD,WAAiB,GAAG;IAClB,+CAA+C;IAC/C,SAAgB,S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AAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;QACD,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YACpD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO;YACL,YAAY;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArbD,wBAqbC;AAED,SAAS,kBAAkB,CAAC,SAAiB;IAC3C,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,IAAI,GAAG,CAAQ,GAAe,EAAE,EAA4B,EAAE,EAAE;IACpE,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { CompressedId64Set, Guid, GuidString, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { EntityProps } from \"@itwin/core-common\";\nimport { InstanceId, InstanceKey } from \"./EC.js\";\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\n\n/**\n * A single key that identifies something in an iTwin.js application\n * @public\n */\nexport type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace Key {\n /** Check if the supplied key is a `NodeKey` */\n export function isNodeKey(key: Key): key is NodeKey {\n return !!(key as NodeKey).type;\n }\n\n /** Check if the supplied key is an `InstanceKey` */\n export function isInstanceKey(key: Key): key is InstanceKey {\n return !!(key as InstanceKey).className && !!(key as InstanceKey).id;\n }\n\n /** Check if the supplied key is an `EntityProps` */\n export function isEntityProps(key: Key): key is EntityProps {\n return !!(key as EntityProps).classFullName && !!(key as EntityProps).id;\n }\n}\n\n/**\n * A type for multiple keys that identify something in iModel.js application\n * @public\n */\nexport type Keys = ReadonlyArray<Key> | Readonly<KeySet>;\n\n/**\n * A data structure of serialized [[KeySet]]\n * @public\n */\nexport interface KeySetJSON {\n /** JSON representation of a list of instance keys */\n instanceKeys: Array<[string, string]>;\n /** An array of serialized node keys */\n nodeKeys: NodeKey[];\n}\n\n/**\n * A class that holds multiple [[Key]] objects. It's basically\n * used as a container that holds multiple keys of different types.\n *\n * @public\n */\nexport class KeySet {\n // note: all keys are stored as strings because we need ability to find them by value\n private _instanceKeys: Map<string, Set<string>>; // lower case class name => instance ids\n private _lowerCaseMap: Map<string, string>; // lower case class name => most recent class name\n private _nodeKeys: Set<string>;\n private _guid!: GuidString;\n\n /**\n * Creates an instance of KeySet.\n * @param source Optional source to initialize from.\n */\n constructor(source?: Keys) {\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n if (source) {\n this.add(source);\n }\n }\n\n private recalculateGuid() {\n // empty keyset should have empty guid, otherwise use a random guid value\n this._guid = this.isEmpty ? Guid.empty : Guid.createValue();\n }\n\n /**\n * Get a GUID that identifies changes in this keyset. The value\n * does not uniquely identify contents of the keyset, but it can be\n * used to check whether keyset has changed.\n */\n public get guid(): GuidString {\n return this._guid;\n }\n\n /**\n * Get a map of instance keys stored in this KeySet\n *\n * **Warning**: getting instance keys might be expensive for\n * large KeySets.\n */\n public get instanceKeys(): Map<string, Set<InstanceId>> {\n const map = new Map<string, Set<InstanceId>>();\n for (const entry of this._instanceKeys) {\n map.set(this._lowerCaseMap.get(entry[\"0\"])!, new Set([...entry[\"1\"]].map((key: string) => Id64.fromJSON(key))));\n }\n return map;\n }\n\n /**\n * Get instance keys count\n */\n public get instanceKeysCount(): number {\n let count = 0;\n this._instanceKeys.forEach((set: Set<string>) => (count += set.size));\n return count;\n }\n\n /**\n * Get a set of node keys stored in this KeySet\n *\n * **Warning**: getting node keys might be expensive for\n * large KeySets.\n */\n public get nodeKeys(): Set<NodeKey> {\n const set = new Set<NodeKey>();\n for (const serialized of this._nodeKeys) {\n set.add(JSON.parse(serialized));\n }\n return set;\n }\n\n /**\n * Get node keys count\n */\n public get nodeKeysCount(): number {\n return this._nodeKeys.size;\n }\n\n private isKeySet(set: Keys | Key): set is Readonly<KeySet> {\n return !!(set as KeySet)._nodeKeys && !!(set as KeySet)._instanceKeys;\n }\n\n private isKeysArray(keys: Keys | Key): keys is ReadonlyArray<Key> {\n return Array.isArray(keys);\n }\n\n /**\n * Clear this KeySet.\n * @returns itself\n */\n public clear(): KeySet {\n if (this.isEmpty) {\n return this;\n }\n\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n return this;\n }\n\n private addKeySet(keyset: Readonly<KeySet>, pred?: (key: Key) => boolean): void {\n for (const key of (keyset as any)._nodeKeys) {\n if (!pred || pred(JSON.parse(key))) {\n this._nodeKeys.add(key);\n }\n }\n for (const entry of (keyset as any)._instanceKeys) {\n let set = this._instanceKeys.get(entry[\"0\"]);\n const className = (keyset as KeySet)._lowerCaseMap.get(entry[\"0\"])!;\n if (!set) {\n set = new Set();\n this._instanceKeys.set(entry[\"0\"], set);\n this._lowerCaseMap.set(entry[\"0\"], className);\n }\n entry[\"1\"].forEach((id: Id64String) => {\n if (!pred || pred({ className, id })) {\n set.add(id);\n }\n });\n }\n }\n\n private addKeySetJSON(keyset: Readonly<KeySetJSON>): void {\n for (const key of keyset.nodeKeys) {\n this._nodeKeys.add(JSON.stringify(key));\n }\n for (const entry of keyset.instanceKeys) {\n const normalizedClassName = normalizeClassName(entry[\"0\"]);\n const lcClassName = normalizedClassName.toLowerCase();\n const idsJson: string | Id64String[] = entry[\"1\"];\n const ids: Set<Id64String> =\n typeof idsJson === \"string\" ? (idsJson === Id64.invalid ? new Set([Id64.invalid]) : CompressedId64Set.decompressSet(idsJson)) : new Set(idsJson);\n this._instanceKeys.set(lcClassName, ids);\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n }\n }\n\n /**\n * Add a key or keys to this KeySet.\n * @param value A key or keys to add.\n * @param pred An optional predicate function that indicates whether a key should be added\n * @returns itself\n */\n public add(value: Keys | Key, pred?: (key: Key) => boolean): KeySet {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.addKeySet(value, pred);\n } else if (this.isKeysArray(value)) {\n value.forEach((key) => this.add(key, pred));\n } else if (!pred || pred(value)) {\n if (Key.isEntityProps(value)) {\n this.add({ className: value.classFullName, id: Id64.fromJSON(value.id) } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const lcClassName = normalizedClassName.toLowerCase();\n if (!this._instanceKeys.has(lcClassName)) {\n this._instanceKeys.set(lcClassName, new Set());\n }\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n this._instanceKeys.get(lcClassName)!.add(value.id);\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.add(JSON.stringify(value));\n } else {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n private deleteKeySet(keyset: Readonly<KeySet>): void {\n for (const key of (keyset as any)._nodeKeys) {\n this._nodeKeys.delete(key);\n }\n for (const entry of (keyset as any)._instanceKeys) {\n const set = this._instanceKeys.get(entry[\"0\"]);\n if (set) {\n entry[\"1\"].forEach((key: string) => {\n set.delete(key);\n });\n }\n }\n }\n\n /**\n * Deletes a key or keys from this KeySet.\n * @param value A key or keys to delete.\n * @returns itself\n */\n public delete(value: Keys | Key): KeySet {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.deleteKeySet(value);\n } else if (this.isKeysArray(value)) {\n for (const key of value) {\n this.delete(key);\n }\n } else if (Key.isEntityProps(value)) {\n this.delete({ className: value.classFullName, id: value.id! } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n if (set) {\n set.delete(value.id);\n }\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.delete(JSON.stringify(value));\n } else {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n /**\n * Check if this KeySet contains the specified key.\n * @param value The key to check.\n */\n public has(value: Key): boolean {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n if (Key.isEntityProps(value)) {\n return this.has({ className: value.classFullName, id: value.id! } as InstanceKey);\n }\n if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n return !!(set && set.has(value.id));\n }\n if (Key.isNodeKey(value)) {\n return this._nodeKeys.has(JSON.stringify(value));\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n\n private hasKeySet(readonlyKeys: Readonly<KeySet>, checkType: \"all\" | \"any\"): boolean {\n // note: cast-away read-onlyness to access private members...\n const keys = readonlyKeys as KeySet;\n\n if (checkType === \"all\") {\n if (this._nodeKeys.size < keys._nodeKeys.size || this._instanceKeys.size < keys._instanceKeys.size) {\n return false;\n }\n if ([...keys._nodeKeys].some((key) => !this._nodeKeys.has(key))) {\n return false;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (!thisEntryKeys || thisEntryKeys.size < otherEntry[\"1\"].size) {\n return false;\n }\n if ([...otherEntry[\"1\"]].some((key) => !thisEntryKeys.has(key))) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n if ([...keys._nodeKeys].some((key) => this._nodeKeys.has(key))) {\n return true;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (thisEntryKeys && [...otherEntry[\"1\"]].some((key) => thisEntryKeys.has(key))) {\n return true;\n }\n }\n return false;\n }\n\n private hasKeysArray(keys: ReadonlyArray<Key>, checkType: \"all\" | \"any\"): boolean {\n if (checkType === \"all\") {\n if (this.size < keys.length) {\n return false;\n }\n for (const key of keys) {\n if (!this.has(key)) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n for (const key of keys) {\n if (this.has(key)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Check if this KeySet contains all the specified keys.\n * @param keys The keys to check.\n */\n public hasAll(keys: Keys): boolean {\n if (!keys) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);\n }\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"all\");\n }\n if (this.isKeysArray(keys)) {\n return this.hasKeysArray(keys, \"all\");\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);\n }\n\n /**\n * Check if this KeySet contains any of the specified keys.\n * @param keys The keys to check.\n */\n public hasAny(keys: Keys): boolean {\n if (!keys) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);\n }\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"any\");\n }\n if (this.isKeysArray(keys)) {\n return this.hasKeysArray(keys, \"any\");\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);\n }\n\n /**\n * Get the number of keys stored in this KeySet.\n */\n public get size(): number {\n const nodeKeysCount = this._nodeKeys.size;\n let instanceIdsCount = 0;\n for (const set of this._instanceKeys.values()) {\n instanceIdsCount += set.size;\n }\n return nodeKeysCount + instanceIdsCount;\n }\n\n /**\n * Is this KeySet currently empty.\n */\n public get isEmpty(): boolean {\n return 0 === this.size;\n }\n\n /** Iterate over all keys in this keyset. */\n public some(callback: (key: Key) => boolean) {\n for (const entry of this._instanceKeys) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase())!;\n if (some(entry[1], (id: Id64String) => callback({ className, id }))) {\n return true;\n }\n }\n return some(this._nodeKeys, (serializedKey: string) => callback(JSON.parse(serializedKey)));\n }\n\n /** Iterate over all keys in this keyset. */\n public forEach(callback: (key: InstanceKey | NodeKey, index: number) => void) {\n let index = 0;\n this._instanceKeys.forEach((ids: Set<Id64String>, className: string) => {\n const recentClassName = this._lowerCaseMap.get(className.toLowerCase())!;\n ids.forEach((id: Id64String) => callback({ className: recentClassName, id }, index++));\n });\n this._nodeKeys.forEach((serializedKey: string) => {\n callback(JSON.parse(serializedKey), index++);\n });\n }\n\n /** Iterate over all keys in this keyset in batches */\n public forEachBatch(batchSize: number, callback: (batch: KeySet, index: number) => void) {\n const size = this.size;\n const count = Math.ceil(size / batchSize);\n if (1 === count) {\n callback(this, 0);\n return;\n }\n let batch = new KeySet();\n let batchIndex = 0;\n let currBatchSize = 0;\n this.forEach((key, index) => {\n batch.add(key);\n ++currBatchSize;\n if (currBatchSize === batchSize || index === size - 1) {\n callback(batch, batchIndex++);\n batch = new KeySet();\n currBatchSize = 0;\n }\n });\n }\n\n /**\n * Serializes this KeySet to JSON\n * @public\n */\n public toJSON(): KeySetJSON {\n const instanceKeys: [string, string][] = [];\n for (const entry of this._instanceKeys.entries()) {\n if (entry[\"1\"].size > 0) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase());\n const compressedIds = CompressedId64Set.sortAndCompress(entry[\"1\"]);\n instanceKeys.push([className!, compressedIds.length > 0 ? compressedIds : Id64.invalid]);\n }\n }\n const nodeKeys: NodeKey[] = [];\n for (const serializedKey of this._nodeKeys.values()) {\n nodeKeys.push(JSON.parse(serializedKey));\n }\n return {\n instanceKeys,\n nodeKeys,\n };\n }\n\n /**\n * Creates a KeySet from JSON\n * @public\n */\n public static fromJSON(json: KeySetJSON): KeySet {\n const keyset = new KeySet();\n keyset.addKeySetJSON(json);\n return keyset;\n }\n}\n\nfunction normalizeClassName(className: string) {\n return className.replace(\".\", \":\");\n}\n\nconst some = <TItem>(set: Set<TItem>, cb: (item: TItem) => boolean) => {\n for (const item of set) {\n if (cb(item)) {\n return true;\n }\n }\n return false;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"KeySet.js","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAoG;AAYpG,cAAc;AACd,2DAA2D;AAC3D,IAAiB,GAAG,CAsBnB;AAtBD,WAAiB,GAAG;IAClB;;;;;OAKG;IACH,4DAA4D;IAC5D,SAAgB,SAAS,CAAC,GAAQ;QAChC,4DAA4D;QAC5D,OAAO,CAAC,CAAE,GAAe,CAAC,IAAI,CAAC;IACjC,CAAC;IAHe,aAAS,YAGxB,CAAA;IAED,oDAAoD;IACpD,SAAgB,aAAa,CAAC,GAAQ;QACpC,OAAO,CAAC,CAAE,GAAmB,CAAC,SAAS,IAAI,CAA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5D,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YACpD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO;YACL,YAAY;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxaD,wBAwaC;AAED,SAAS,kBAAkB,CAAC,SAAiB;IAC3C,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,IAAI,GAAG,CAAQ,GAAe,EAAE,EAA4B,EAAE,EAAE;IACpE,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { assert, CompressedId64Set, Guid, GuidString, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { EntityProps } from \"@itwin/core-common\";\r\nimport { InstanceId, InstanceKey } from \"./EC.js\";\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\n\r\n/**\r\n * A single key that identifies something in an iTwin.js application\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nexport type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace Key {\r\n /**\r\n * Check if the supplied key is a `NodeKey`\r\n *\r\n * @deprecated in 5.2. 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 // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function isNodeKey(key: Key): key is Extract<Key, Readonly<NodeKey>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return !!(key as NodeKey).type;\r\n }\r\n\r\n /** Check if the supplied key is an `InstanceKey` */\r\n export function isInstanceKey(key: Key): key is Extract<Key, Readonly<InstanceKey>> {\r\n return !!(key as InstanceKey).className && !!(key as InstanceKey).id;\r\n }\r\n\r\n /** Check if the supplied key is an `EntityProps` */\r\n export function isEntityProps(key: Key): key is Extract<Key, Readonly<EntityProps>> {\r\n return !!(key as EntityProps).classFullName && !!(key as EntityProps).id;\r\n }\r\n}\r\n\r\n/**\r\n * A type for multiple keys that identify something in iModel.js application\r\n * @public\r\n */\r\nexport type Keys = ReadonlyArray<Key> | Readonly<KeySet>;\r\n\r\n/**\r\n * A data structure of serialized [[KeySet]]\r\n * @public\r\n */\r\nexport interface KeySetJSON {\r\n /** JSON representation of a list of instance keys */\r\n instanceKeys: Array<[string, string]>;\r\n /**\r\n * An array of serialized node keys\r\n *\r\n * @deprecated in 5.2. 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 // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n nodeKeys: NodeKey[];\r\n}\r\n\r\n/**\r\n * A class that holds multiple [[Key]] objects. It's basically\r\n * used as a container that holds multiple keys of different types.\r\n *\r\n * @public\r\n */\r\nexport class KeySet {\r\n // note: all keys are stored as strings because we need ability to find them by value\r\n private _instanceKeys: Map<string, Set<string>>; // lower case class name => instance ids\r\n private _lowerCaseMap: Map<string, string>; // lower case class name => most recent class name\r\n private _nodeKeys: Set<string>;\r\n private _guid!: GuidString;\r\n\r\n /**\r\n * Creates an instance of KeySet.\r\n * @param source Optional source to initialize from.\r\n */\r\n constructor(source?: Keys) {\r\n this._instanceKeys = new Map();\r\n this._lowerCaseMap = new Map();\r\n this._nodeKeys = new Set();\r\n this.recalculateGuid();\r\n if (source) {\r\n this.add(source);\r\n }\r\n }\r\n\r\n private recalculateGuid() {\r\n // empty keyset should have empty guid, otherwise use a random guid value\r\n this._guid = this.isEmpty ? Guid.empty : Guid.createValue();\r\n }\r\n\r\n /**\r\n * Get a GUID that identifies changes in this keyset. The value\r\n * does not uniquely identify contents of the keyset, but it can be\r\n * used to check whether keyset has changed.\r\n */\r\n public get guid(): GuidString {\r\n return this._guid;\r\n }\r\n\r\n /**\r\n * Get a map of instance keys stored in this KeySet\r\n *\r\n * **Warning**: getting instance keys might be expensive for\r\n * large KeySets.\r\n */\r\n public get instanceKeys(): Map<string, Set<InstanceId>> {\r\n const map = new Map<string, Set<InstanceId>>();\r\n for (const entry of this._instanceKeys) {\r\n map.set(this._lowerCaseMap.get(entry[\"0\"])!, new Set([...entry[\"1\"]].map((key: string) => Id64.fromJSON(key))));\r\n }\r\n return map;\r\n }\r\n\r\n /**\r\n * Get instance keys count\r\n */\r\n public get instanceKeysCount(): number {\r\n let count = 0;\r\n this._instanceKeys.forEach((set: Set<string>) => (count += set.size));\r\n return count;\r\n }\r\n\r\n /**\r\n * Get a set of node keys stored in this KeySet\r\n *\r\n * **Warning**: getting node keys might be expensive for large KeySets.\r\n *\r\n * @deprecated in 5.2. 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 public get nodeKeys() {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const set = new Set<NodeKey>();\r\n for (const serialized of this._nodeKeys) {\r\n set.add(JSON.parse(serialized));\r\n }\r\n return set;\r\n }\r\n\r\n /**\r\n * Get node keys count\r\n *\r\n * @deprecated in 5.2. 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 public get nodeKeysCount(): number {\r\n return this._nodeKeys.size;\r\n }\r\n\r\n private isKeySet(set: Keys | Key): set is Readonly<KeySet> {\r\n return !!(set as KeySet)._nodeKeys && !!(set as KeySet)._instanceKeys;\r\n }\r\n\r\n private isKeysArray(keys: Keys | Key): keys is ReadonlyArray<Key> {\r\n return Array.isArray(keys);\r\n }\r\n\r\n /**\r\n * Clear this KeySet.\r\n * @returns itself\r\n */\r\n public clear(): KeySet {\r\n if (this.isEmpty) {\r\n return this;\r\n }\r\n\r\n this._instanceKeys = new Map();\r\n this._lowerCaseMap = new Map();\r\n this._nodeKeys = new Set();\r\n this.recalculateGuid();\r\n return this;\r\n }\r\n\r\n private addKeySet(keyset: Readonly<KeySet>, pred?: (key: Key) => boolean): void {\r\n for (const key of (keyset as any)._nodeKeys) {\r\n if (!pred || pred(JSON.parse(key))) {\r\n this._nodeKeys.add(key);\r\n }\r\n }\r\n for (const entry of (keyset as any)._instanceKeys) {\r\n let set = this._instanceKeys.get(entry[\"0\"]);\r\n const className = (keyset as KeySet)._lowerCaseMap.get(entry[\"0\"])!;\r\n if (!set) {\r\n set = new Set();\r\n this._instanceKeys.set(entry[\"0\"], set);\r\n this._lowerCaseMap.set(entry[\"0\"], className);\r\n }\r\n entry[\"1\"].forEach((id: Id64String) => {\r\n if (!pred || pred({ className, id })) {\r\n set.add(id);\r\n }\r\n });\r\n }\r\n }\r\n\r\n private addKeySetJSON(keyset: Readonly<KeySetJSON>): void {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n for (const key of keyset.nodeKeys) {\r\n this._nodeKeys.add(JSON.stringify(key));\r\n }\r\n for (const entry of keyset.instanceKeys) {\r\n const normalizedClassName = normalizeClassName(entry[\"0\"]);\r\n const lcClassName = normalizedClassName.toLowerCase();\r\n const idsJson: string | Id64String[] = entry[\"1\"];\r\n const ids: Set<Id64String> =\r\n typeof idsJson === \"string\" ? (idsJson === Id64.invalid ? new Set([Id64.invalid]) : CompressedId64Set.decompressSet(idsJson)) : new Set(idsJson);\r\n this._instanceKeys.set(lcClassName, ids);\r\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\r\n }\r\n }\r\n\r\n /**\r\n * Add a key or keys to this KeySet.\r\n * @param value A key or keys to add.\r\n * @param pred An optional predicate function that indicates whether a key should be added\r\n * @returns itself\r\n */\r\n public add(value: Keys | Key, pred?: (key: Key) => boolean): KeySet {\r\n const sizeBefore = this.size;\r\n if (this.isKeySet(value)) {\r\n this.addKeySet(value, pred);\r\n } else if (this.isKeysArray(value)) {\r\n value.forEach((key) => this.add(key, pred));\r\n } else if (!pred || pred(value)) {\r\n if (Key.isEntityProps(value)) {\r\n this.add({ className: value.classFullName, id: Id64.fromJSON(value.id) } as InstanceKey);\r\n } else if (Key.isInstanceKey(value)) {\r\n const normalizedClassName = normalizeClassName(value.className);\r\n const lcClassName = normalizedClassName.toLowerCase();\r\n if (!this._instanceKeys.has(lcClassName)) {\r\n this._instanceKeys.set(lcClassName, new Set());\r\n }\r\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\r\n this._instanceKeys.get(lcClassName)!.add(value.id);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n } else if (Key.isNodeKey(value)) {\r\n this._nodeKeys.add(JSON.stringify(value));\r\n }\r\n }\r\n if (this.size !== sizeBefore) {\r\n this.recalculateGuid();\r\n }\r\n return this;\r\n }\r\n\r\n private deleteKeySet(keyset: Readonly<KeySet>): void {\r\n for (const key of (keyset as any)._nodeKeys) {\r\n this._nodeKeys.delete(key);\r\n }\r\n for (const entry of (keyset as any)._instanceKeys) {\r\n const set = this._instanceKeys.get(entry[\"0\"]);\r\n if (set) {\r\n entry[\"1\"].forEach((key: string) => {\r\n set.delete(key);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a key or keys from this KeySet.\r\n * @param value A key or keys to delete.\r\n * @returns itself\r\n */\r\n public delete(value: Keys | Key): KeySet {\r\n const sizeBefore = this.size;\r\n if (this.isKeySet(value)) {\r\n this.deleteKeySet(value);\r\n } else if (this.isKeysArray(value)) {\r\n for (const key of value) {\r\n this.delete(key);\r\n }\r\n } else if (Key.isEntityProps(value)) {\r\n this.delete({ className: value.classFullName, id: value.id! } as InstanceKey);\r\n } else if (Key.isInstanceKey(value)) {\r\n const normalizedClassName = normalizeClassName(value.className);\r\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\r\n if (set) {\r\n set.delete(value.id);\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n } else if (Key.isNodeKey(value)) {\r\n this._nodeKeys.delete(JSON.stringify(value));\r\n }\r\n if (this.size !== sizeBefore) {\r\n this.recalculateGuid();\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Check if this KeySet contains the specified key.\r\n * @param value The key to check.\r\n */\r\n public has(value: Key): boolean {\r\n if (Key.isEntityProps(value)) {\r\n return this.has({ className: value.classFullName, id: value.id! } as InstanceKey);\r\n }\r\n if (Key.isInstanceKey(value)) {\r\n const normalizedClassName = normalizeClassName(value.className);\r\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\r\n return !!(set && set.has(value.id));\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n assert(Key.isNodeKey(value));\r\n return this._nodeKeys.has(JSON.stringify(value));\r\n }\r\n\r\n private hasKeySet(readonlyKeys: Readonly<KeySet>, checkType: \"all\" | \"any\"): boolean {\r\n // note: cast-away read-onlyness to access private members...\r\n const keys = readonlyKeys as KeySet;\r\n\r\n if (checkType === \"all\") {\r\n if (this._nodeKeys.size < keys._nodeKeys.size || this._instanceKeys.size < keys._instanceKeys.size) {\r\n return false;\r\n }\r\n if ([...keys._nodeKeys].some((key) => !this._nodeKeys.has(key))) {\r\n return false;\r\n }\r\n for (const otherEntry of keys._instanceKeys) {\r\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\r\n if (!thisEntryKeys || thisEntryKeys.size < otherEntry[\"1\"].size) {\r\n return false;\r\n }\r\n if ([...otherEntry[\"1\"]].some((key) => !thisEntryKeys.has(key))) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n // \"any\" check type\r\n if ([...keys._nodeKeys].some((key) => this._nodeKeys.has(key))) {\r\n return true;\r\n }\r\n for (const otherEntry of keys._instanceKeys) {\r\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\r\n if (thisEntryKeys && [...otherEntry[\"1\"]].some((key) => thisEntryKeys.has(key))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private hasKeysArray(keys: ReadonlyArray<Key>, checkType: \"all\" | \"any\"): boolean {\r\n if (checkType === \"all\") {\r\n if (this.size < keys.length) {\r\n return false;\r\n }\r\n for (const key of keys) {\r\n if (!this.has(key)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n // \"any\" check type\r\n for (const key of keys) {\r\n if (this.has(key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Check if this KeySet contains all the specified keys.\r\n * @param keys The keys to check.\r\n */\r\n public hasAll(keys: Keys): boolean {\r\n if (this.isKeySet(keys)) {\r\n return this.hasKeySet(keys, \"all\");\r\n }\r\n assert(this.isKeysArray(keys));\r\n return this.hasKeysArray(keys, \"all\");\r\n }\r\n\r\n /**\r\n * Check if this KeySet contains any of the specified keys.\r\n * @param keys The keys to check.\r\n */\r\n public hasAny(keys: Keys): boolean {\r\n if (this.isKeySet(keys)) {\r\n return this.hasKeySet(keys, \"any\");\r\n }\r\n assert(this.isKeysArray(keys));\r\n return this.hasKeysArray(keys, \"any\");\r\n }\r\n\r\n /**\r\n * Get the number of keys stored in this KeySet.\r\n */\r\n public get size(): number {\r\n const nodeKeysCount = this._nodeKeys.size;\r\n let instanceIdsCount = 0;\r\n for (const set of this._instanceKeys.values()) {\r\n instanceIdsCount += set.size;\r\n }\r\n return nodeKeysCount + instanceIdsCount;\r\n }\r\n\r\n /**\r\n * Is this KeySet currently empty.\r\n */\r\n public get isEmpty(): boolean {\r\n return 0 === this.size;\r\n }\r\n\r\n /** Iterate over all keys in this keyset. */\r\n public some(callback: (key: Key) => boolean) {\r\n for (const entry of this._instanceKeys) {\r\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase())!;\r\n if (some(entry[1], (id: Id64String) => callback({ className, id }))) {\r\n return true;\r\n }\r\n }\r\n return some(this._nodeKeys, (serializedKey: string) => callback(JSON.parse(serializedKey)));\r\n }\r\n\r\n /** Iterate over all keys in this keyset. */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public forEach(callback: (key: InstanceKey | NodeKey, index: number) => void) {\r\n let index = 0;\r\n this._instanceKeys.forEach((ids: Set<Id64String>, className: string) => {\r\n const recentClassName = this._lowerCaseMap.get(className.toLowerCase())!;\r\n ids.forEach((id: Id64String) => callback({ className: recentClassName, id }, index++));\r\n });\r\n this._nodeKeys.forEach((serializedKey: string) => {\r\n callback(JSON.parse(serializedKey), index++);\r\n });\r\n }\r\n\r\n /** Iterate over all keys in this keyset in batches */\r\n public forEachBatch(batchSize: number, callback: (batch: KeySet, index: number) => void) {\r\n const size = this.size;\r\n const count = Math.ceil(size / batchSize);\r\n if (1 === count) {\r\n callback(this, 0);\r\n return;\r\n }\r\n let batch = new KeySet();\r\n let batchIndex = 0;\r\n let currBatchSize = 0;\r\n this.forEach((key, index) => {\r\n batch.add(key);\r\n ++currBatchSize;\r\n if (currBatchSize === batchSize || index === size - 1) {\r\n callback(batch, batchIndex++);\r\n batch = new KeySet();\r\n currBatchSize = 0;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Serializes this KeySet to JSON\r\n * @public\r\n */\r\n public toJSON(): KeySetJSON {\r\n const instanceKeys: [string, string][] = [];\r\n for (const entry of this._instanceKeys.entries()) {\r\n if (entry[\"1\"].size > 0) {\r\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase());\r\n const compressedIds = CompressedId64Set.sortAndCompress(entry[\"1\"]);\r\n instanceKeys.push([className!, compressedIds.length > 0 ? compressedIds : Id64.invalid]);\r\n }\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const nodeKeys: NodeKey[] = [];\r\n for (const serializedKey of this._nodeKeys.values()) {\r\n nodeKeys.push(JSON.parse(serializedKey));\r\n }\r\n return {\r\n instanceKeys,\r\n nodeKeys,\r\n };\r\n }\r\n\r\n /**\r\n * Creates a KeySet from JSON\r\n * @public\r\n */\r\n public static fromJSON(json: KeySetJSON): KeySet {\r\n const keyset = new KeySet();\r\n keyset.addKeySetJSON(json);\r\n return keyset;\r\n }\r\n}\r\n\r\nfunction normalizeClassName(className: string) {\r\n return className.replace(\".\", \":\");\r\n}\r\n\r\nconst some = <TItem>(set: Set<TItem>, cb: (item: TItem) => boolean) => {\r\n for (const item of set) {\r\n if (cb(item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n"]}
|
|
@@ -9,7 +9,7 @@ import { SchemaContext } from "@itwin/ecschema-metadata";
|
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
*
|
|
12
|
-
* @deprecated in 5.1. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).
|
|
12
|
+
* @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).
|
|
13
13
|
*/
|
|
14
14
|
export interface UnitSystemFormat {
|
|
15
15
|
unitSystems: UnitSystemKey[];
|
|
@@ -36,7 +36,7 @@ export interface UnitSystemFormat {
|
|
|
36
36
|
*
|
|
37
37
|
* @public
|
|
38
38
|
*
|
|
39
|
-
* @deprecated in 5.1. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).
|
|
39
|
+
* @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).
|
|
40
40
|
*/
|
|
41
41
|
export interface FormatsMap {
|
|
42
42
|
[phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];
|
|
@@ -50,6 +50,8 @@ export interface FormatOptions {
|
|
|
50
50
|
koqName: string;
|
|
51
51
|
/** Unit system to use for formatting. */
|
|
52
52
|
unitSystem?: UnitSystemKey;
|
|
53
|
+
/** Optional overrides for the format used to parse or format values. */
|
|
54
|
+
formatOverride?: Partial<Omit<FormatProps, "type">>;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Props for creating [[KoqPropertyValueFormatter]].
|
|
@@ -71,7 +73,7 @@ export declare class KoqPropertyValueFormatter {
|
|
|
71
73
|
private _unitsProvider;
|
|
72
74
|
private _formatsProvider?;
|
|
73
75
|
private _defaultFormats?;
|
|
74
|
-
/** @deprecated in 5.1. Use the overload that takes a props object. */
|
|
76
|
+
/** @deprecated in 5.1 - will not be removed until after 2026-08-08. Use the overload that takes a props object. */
|
|
75
77
|
constructor(schemaContext: SchemaContext, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider);
|
|
76
78
|
constructor(props: KoqPropertyValueFormatterProps);
|
|
77
79
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KoqPropertyValueFormatter.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAiB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAgC,aAAa,EAAyE,MAAM,0BAA0B,CAAC;AAE9J;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,UAAU;IAEzB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"KoqPropertyValueFormatter.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAiB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAgC,aAAa,EAAyE,MAAM,0BAA0B,CAAC;AAE9J;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,UAAU;IAEzB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,UAAU,8BAA8B;IACtC,mIAAmI;IACnI,aAAa,EAAE,aAAa,CAAC;IAC7B,uIAAuI;IACvI,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,yBAAyB;;IACpC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,gBAAgB,CAAC,CAAkB;IAE3C,OAAO,CAAC,eAAe,CAAC,CAAa;IAErC,mHAAmH;gBAEvG,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,eAAe;gBAC5F,KAAK,EAAE,8BAA8B;IAejD,gBAAgB;IAEhB,IAAW,cAAc,IAAI,UAAU,GAAG,SAAS,CAElD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAItD;IAGY,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAQ5C,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAWvC,aAAa,CAAC,OAAO,EAAE,aAAa;CA+ClD"}
|
|
@@ -61,7 +61,7 @@ class KoqPropertyValueFormatter {
|
|
|
61
61
|
}
|
|
62
62
|
const { formatProps, persistenceUnitName } = formattingProps;
|
|
63
63
|
const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);
|
|
64
|
-
const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, formatProps);
|
|
64
|
+
const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, { ...formatProps, ...options.formatOverride });
|
|
65
65
|
return core_quantity_1.FormatterSpec.create("", format, this._unitsProvider, persistenceUnit);
|
|
66
66
|
}
|
|
67
67
|
async getParserSpec(options) {
|
|
@@ -71,7 +71,7 @@ class KoqPropertyValueFormatter {
|
|
|
71
71
|
}
|
|
72
72
|
const { formatProps, persistenceUnitName } = formattingProps;
|
|
73
73
|
const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);
|
|
74
|
-
const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, formatProps);
|
|
74
|
+
const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, { ...formatProps, ...options.formatOverride });
|
|
75
75
|
return core_quantity_1.ParserSpec.create(format, this._unitsProvider, persistenceUnit);
|
|
76
76
|
}
|
|
77
77
|
async #getFormattingProps(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6C;AAC7C,wDAAqI;AACrI,gEAA8J;AAiE9J;;;GAGG;AACH,MAAa,yBAAyB;IAC5B,cAAc,CAAgB;IAC9B,cAAc,CAAgB;IAC9B,gBAAgB,CAAmB;IAC3C,4DAA4D;IACpD,eAAe,CAAc;IAMrC,4DAA4D;IAC5D,YAAY,oBAAoE,EAAE,cAA2B,EAAE,eAAiC;QAC9I,IAAI,oBAAoB,YAAY,iCAAa,EAAE,CAAC;YAClD,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC;YAC3C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;YACxC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,aAAa,CAAC;YACzD,IAAI,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,eAAe,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,sCAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,CAAC;IAED,qBAAqB;IACrB,gBAAgB;IAChB,4DAA4D;IAC5D,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,4DAA4D;IAC5D,IAAW,cAAc,CAAC,KAA6B;QACrD,IAAI,CAAC,eAAe,GAAG,KAAK;YAC1B,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,C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B,CAAC,EAAE,CAAC;YAC/B,IAAI,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7D,OAAO,uBAAuB,CAAC,MAAM,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,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 { assert } from \"@itwin/core-bentley\";\nimport { Format, FormatProps, FormatsProvider, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\nimport { InvertedUnit, KindOfQuantity, SchemaContext, SchemaFormatsProvider, SchemaKey, SchemaMatchType, SchemaUnitProvider } from \"@itwin/ecschema-metadata\";\n\n/**\n * A data structure that associates unit systems with property value formatting props. The associations are used for\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\n *\n * @public\n *\n * @deprecated in 5.1. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\n */\nexport interface UnitSystemFormat {\n unitSystems: UnitSystemKey[];\n format: FormatProps;\n}\n\n/**\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\n *\n * Example:\n * ```json\n * {\n * length: [{\n * unitSystems: [\"metric\"],\n * format: formatForCentimeters,\n * }, {\n * unitSystems: [\"imperial\", \"usCustomary\"],\n * format: formatForInches,\n * }, {\n * unitSystems: [\"usSurvey\"],\n * format: formatForUsSurveyInches,\n * }]\n * }\n * ```\n *\n * @public\n *\n * @deprecated in 5.1. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\n */\nexport interface FormatsMap {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\n}\n\n/**\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\n * @public\n */\nexport interface FormatOptions {\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\n koqName: string;\n /** Unit system to use for formatting. */\n unitSystem?: UnitSystemKey;\n}\n\n/**\n * Props for creating [[KoqPropertyValueFormatter]].\n * @public\n */\ninterface KoqPropertyValueFormatterProps {\n /** Schema context to use for locating units, formats, etc. Generally retrieved through the `schemaContext` getter on an iModel. */\n schemaContext: SchemaContext;\n /** Formats provider to use for finding formatting props. Defaults to [SchemaFormatsProvider]($ecschema-metadata) when not supplied. */\n formatsProvider?: FormatsProvider;\n}\n\n/**\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\n * @public\n */\nexport class KoqPropertyValueFormatter {\n private _schemaContext: SchemaContext;\n private _unitsProvider: UnitsProvider;\n private _formatsProvider?: FormatsProvider;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private _defaultFormats?: FormatsMap;\n\n /** @deprecated in 5.1. Use the overload that takes a props object. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(schemaContext: SchemaContext, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider);\n constructor(props: KoqPropertyValueFormatterProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(schemaContextOrProps: SchemaContext | KoqPropertyValueFormatterProps, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider) {\n if (schemaContextOrProps instanceof SchemaContext) {\n this._schemaContext = schemaContextOrProps;\n this._formatsProvider = formatsProvider;\n this.defaultFormats = defaultFormats;\n } else {\n this._schemaContext = schemaContextOrProps.schemaContext;\n this._formatsProvider = schemaContextOrProps.formatsProvider;\n }\n this._unitsProvider = new SchemaUnitProvider(this._schemaContext);\n }\n\n /* c8 ignore start */\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public get defaultFormats(): FormatsMap | undefined {\n return this._defaultFormats;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public set defaultFormats(value: FormatsMap | undefined) {\n this._defaultFormats = value\n ? Object.entries(value).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\n : undefined;\n }\n /* c8 ignore end */\n\n public async format(value: number, options: FormatOptions) {\n const formatterSpec = await this.getFormatterSpec(options);\n if (!formatterSpec) {\n return undefined;\n }\n return formatterSpec.applyFormatting(value);\n }\n\n public async getFormatterSpec(options: FormatOptions) {\n const formattingProps = await this.#getFormattingProps(options);\n if (!formattingProps) {\n return undefined;\n }\n const { formatProps, persistenceUnitName } = formattingProps;\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\n }\n\n public async getParserSpec(options: FormatOptions) {\n const formattingProps = await this.#getFormattingProps(options);\n if (!formattingProps) {\n return undefined;\n }\n const { formatProps, persistenceUnitName } = formattingProps;\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\n }\n\n async #getFormattingProps(options: FormatOptions): Promise<FormattingProps | undefined> {\n const { koqName } = options;\n const koq = await getKoq(this._schemaContext, koqName);\n if (!koq) {\n return undefined;\n }\n const persistenceUnit = await koq.persistenceUnit;\n assert(!!persistenceUnit);\n\n // default to metric as it's the persistence unit system\n const unitSystem = options.unitSystem ?? \"metric\";\n\n const formatsProvider = this._formatsProvider ?? new SchemaFormatsProvider(this._schemaContext, unitSystem);\n const formatProps = await formatsProvider.getFormat(koqName);\n\n // `SchemaFormatsProvider` will fall back to default presentation format, but we want to fall back\n // to default formats' map first, and only then to the default presentation format. All of this can\n // be removed with the removal of default formats map.\n if (this._defaultFormats && (!formatProps || (await getUnitSystemKey(this._unitsProvider, formatProps)) !== unitSystem)) {\n const defaultFormatProps = await getFormatPropsFromDefaultFormats({\n schemaContext: this._schemaContext,\n formatsMap: this._defaultFormats,\n unitSystem,\n koqName,\n });\n if (defaultFormatProps) {\n return { formatProps: defaultFormatProps, persistenceUnitName: persistenceUnit.fullName };\n }\n }\n\n if (formatProps) {\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\n }\n\n return undefined;\n }\n}\n\ninterface FormattingProps {\n formatProps: FormatProps;\n persistenceUnitName: string;\n}\n\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\n const [schemaName, propKoqName] = fullName.split(\":\");\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\n if (!schema) {\n return undefined;\n }\n return schema.getItem(propKoqName, KindOfQuantity);\n}\n\nasync function getUnitSystemKey(unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<UnitSystemKey | undefined> {\n const unitName = formatProps.composite?.units[0].name;\n assert(!!unitName);\n const unit = await unitsProvider.findUnitByName(unitName);\n assert(!!unit);\n const [_, unitSystemName] = unit.system.split(/[\\.:]/);\n switch (unitSystemName.toUpperCase()) {\n case \"METRIC\":\n return \"metric\";\n case \"IMPERIAL\":\n return \"imperial\";\n case \"USCUSTOM\":\n return \"usCustomary\";\n case \"USSURVEY\":\n return \"usSurvey\";\n /* c8 ignore next 2 */\n default:\n return undefined;\n }\n}\n\nasync function getFormatPropsFromDefaultFormats({\n schemaContext,\n formatsMap,\n unitSystem,\n koqName,\n}: {\n schemaContext: SchemaContext;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n formatsMap: FormatsMap;\n unitSystem: UnitSystemKey;\n koqName: string;\n}): Promise<FormatProps | undefined> {\n const koq = await getKoq(schemaContext, koqName);\n /* c8 ignore next 3 */\n if (!koq) {\n return undefined;\n }\n\n const persistenceUnit = await koq.persistenceUnit;\n /* c8 ignore next 3 */\n if (!persistenceUnit) {\n return undefined;\n }\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* c8 ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\n const phenomenon = await actualPersistenceUnit?.phenomenon;\n if (phenomenon && formatsMap[phenomenon.name.toUpperCase()]) {\n const defaultPhenomenonFormats = formatsMap[phenomenon.name.toUpperCase()];\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\n ? /* c8 ignore next */ defaultPhenomenonFormats\n : [defaultPhenomenonFormats]) {\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\n return defaultUnitSystemFormat.format;\n }\n }\n }\n return undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6C;AAC7C,wDAAqI;AACrI,gEAA8J;AAmE9J;;;GAGG;AACH,MAAa,yBAAyB;IAC5B,cAAc,CAAgB;IAC9B,cAAc,CAAgB;IAC9B,gBAAgB,CAAmB;IAC3C,4DAA4D;IACpD,eAAe,CAAc;IAMrC,4DAA4D;IAC5D,YAAY,oBAAoE,EAAE,cAA2B,EAAE,eAAiC;QAC9I,IAAI,oBAAoB,YAAY,iCAAa,EAAE,CAAC;YAClD,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC;YAC3C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;YACxC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,aAAa,CAAC;YACzD,IAAI,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,eAAe,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,sCAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,CAAC;IAED,qBAAqB;IACrB,gBAAgB;IAChB,4DAA4D;IAC5D,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,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C,EAAE,CAAC;QAC5D,MAAM,wBAAwB,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3E,KAAK,MAAM,uBAAuB,IAAI,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;YAC3E,CAAC,CAAC,oBAAoB,CAAC,wBAAwB;YAC/C,CAAC,CAAC,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAC/B,IAAI,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7D,OAAO,uBAAuB,CAAC,MAAM,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,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 { assert } from \"@itwin/core-bentley\";\r\nimport { Format, FormatProps, FormatsProvider, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { InvertedUnit, KindOfQuantity, SchemaContext, SchemaFormatsProvider, SchemaKey, SchemaMatchType, SchemaUnitProvider } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * A data structure that associates unit systems with property value formatting props. The associations are used for\r\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\r\n *\r\n * @public\r\n *\r\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * length: [{\r\n * unitSystems: [\"metric\"],\r\n * format: formatForCentimeters,\r\n * }, {\r\n * unitSystems: [\"imperial\", \"usCustomary\"],\r\n * format: formatForInches,\r\n * }, {\r\n * unitSystems: [\"usSurvey\"],\r\n * format: formatForUsSurveyInches,\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @public\r\n *\r\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\r\n */\r\nexport interface FormatsMap {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\r\n}\r\n\r\n/**\r\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\nexport interface FormatOptions {\r\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\r\n koqName: string;\r\n /** Unit system to use for formatting. */\r\n unitSystem?: UnitSystemKey;\r\n /** Optional overrides for the format used to parse or format values. */\r\n formatOverride?: Partial<Omit<FormatProps, \"type\">>;\r\n}\r\n\r\n/**\r\n * Props for creating [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\ninterface KoqPropertyValueFormatterProps {\r\n /** Schema context to use for locating units, formats, etc. Generally retrieved through the `schemaContext` getter on an iModel. */\r\n schemaContext: SchemaContext;\r\n /** Formats provider to use for finding formatting props. Defaults to [SchemaFormatsProvider]($ecschema-metadata) when not supplied. */\r\n formatsProvider?: FormatsProvider;\r\n}\r\n\r\n/**\r\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\r\n * @public\r\n */\r\nexport class KoqPropertyValueFormatter {\r\n private _schemaContext: SchemaContext;\r\n private _unitsProvider: UnitsProvider;\r\n private _formatsProvider?: FormatsProvider;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n private _defaultFormats?: FormatsMap;\r\n\r\n /** @deprecated in 5.1 - will not be removed until after 2026-08-08. Use the overload that takes a props object. */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n constructor(schemaContext: SchemaContext, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider);\r\n constructor(props: KoqPropertyValueFormatterProps);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n constructor(schemaContextOrProps: SchemaContext | KoqPropertyValueFormatterProps, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider) {\r\n if (schemaContextOrProps instanceof SchemaContext) {\r\n this._schemaContext = schemaContextOrProps;\r\n this._formatsProvider = formatsProvider;\r\n this.defaultFormats = defaultFormats;\r\n } else {\r\n this._schemaContext = schemaContextOrProps.schemaContext;\r\n this._formatsProvider = schemaContextOrProps.formatsProvider;\r\n }\r\n this._unitsProvider = new SchemaUnitProvider(this._schemaContext);\r\n }\r\n\r\n /* c8 ignore start */\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public get defaultFormats(): FormatsMap | undefined {\r\n return this._defaultFormats;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public set defaultFormats(value: FormatsMap | undefined) {\r\n this._defaultFormats = value\r\n ? Object.entries(value).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\r\n : undefined;\r\n }\r\n /* c8 ignore end */\r\n\r\n public async format(value: number, options: FormatOptions) {\r\n const formatterSpec = await this.getFormatterSpec(options);\r\n if (!formatterSpec) {\r\n return undefined;\r\n }\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n\r\n public async getFormatterSpec(options: FormatOptions) {\r\n const formattingProps = await this.#getFormattingProps(options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\r\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n public async getParserSpec(options: FormatOptions) {\r\n const formattingProps = await this.#getFormattingProps(options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n async #getFormattingProps(options: FormatOptions): Promise<FormattingProps | undefined> {\r\n const { koqName } = options;\r\n const koq = await getKoq(this._schemaContext, koqName);\r\n if (!koq) {\r\n return undefined;\r\n }\r\n const persistenceUnit = await koq.persistenceUnit;\r\n assert(!!persistenceUnit);\r\n\r\n // default to metric as it's the persistence unit system\r\n const unitSystem = options.unitSystem ?? \"metric\";\r\n\r\n const formatsProvider = this._formatsProvider ?? new SchemaFormatsProvider(this._schemaContext, unitSystem);\r\n const formatProps = await formatsProvider.getFormat(koqName);\r\n\r\n // `SchemaFormatsProvider` will fall back to default presentation format, but we want to fall back\r\n // to default formats' map first, and only then to the default presentation format. All of this can\r\n // be removed with the removal of default formats map.\r\n if (this._defaultFormats && (!formatProps || (await getUnitSystemKey(this._unitsProvider, formatProps)) !== unitSystem)) {\r\n const defaultFormatProps = await getFormatPropsFromDefaultFormats({\r\n schemaContext: this._schemaContext,\r\n formatsMap: this._defaultFormats,\r\n unitSystem,\r\n koqName,\r\n });\r\n if (defaultFormatProps) {\r\n return { formatProps: defaultFormatProps, persistenceUnitName: persistenceUnit.fullName };\r\n }\r\n }\r\n\r\n if (formatProps) {\r\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\ninterface FormattingProps {\r\n formatProps: FormatProps;\r\n persistenceUnitName: string;\r\n}\r\n\r\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\r\n const [schemaName, propKoqName] = fullName.split(\":\");\r\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\r\n if (!schema) {\r\n return undefined;\r\n }\r\n return schema.getItem(propKoqName, KindOfQuantity);\r\n}\r\n\r\nasync function getUnitSystemKey(unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<UnitSystemKey | undefined> {\r\n const unitName = formatProps.composite?.units[0].name;\r\n assert(!!unitName);\r\n const unit = await unitsProvider.findUnitByName(unitName);\r\n assert(!!unit);\r\n const [_, unitSystemName] = unit.system.split(/[\\.:]/);\r\n switch (unitSystemName.toUpperCase()) {\r\n case \"METRIC\":\r\n return \"metric\";\r\n case \"IMPERIAL\":\r\n return \"imperial\";\r\n case \"USCUSTOM\":\r\n return \"usCustomary\";\r\n case \"USSURVEY\":\r\n return \"usSurvey\";\r\n /* c8 ignore next 2 */\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\nasync function getFormatPropsFromDefaultFormats({\r\n schemaContext,\r\n formatsMap,\r\n unitSystem,\r\n koqName,\r\n}: {\r\n schemaContext: SchemaContext;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n formatsMap: FormatsMap;\r\n unitSystem: UnitSystemKey;\r\n koqName: string;\r\n}): Promise<FormatProps | undefined> {\r\n const koq = await getKoq(schemaContext, koqName);\r\n /* c8 ignore next 3 */\r\n if (!koq) {\r\n return undefined;\r\n }\r\n\r\n const persistenceUnit = await koq.persistenceUnit;\r\n /* c8 ignore next 3 */\r\n if (!persistenceUnit) {\r\n return undefined;\r\n }\r\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* c8 ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\r\n const phenomenon = await actualPersistenceUnit?.phenomenon;\r\n if (phenomenon && formatsMap[phenomenon.name.toUpperCase()]) {\r\n const defaultPhenomenonFormats = formatsMap[phenomenon.name.toUpperCase()];\r\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\r\n ? /* c8 ignore next */ defaultPhenomenonFormats\r\n : [defaultPhenomenonFormats]) {\r\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\r\n return defaultUnitSystemFormat.format;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA8BH,gBAAgB;AACH,QAAA,mCAAmC,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,IAAiB,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,2CAAmC,CAAC;IAC9D,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EApBgB,eAAe,+BAAf,eAAe,QAoB/B","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 Hierarchies\n */\n\n/**\n * Data structure that describes raw composite label value.\n * @public\n */\nexport interface LabelCompositeValue {\n separator: string;\n values: LabelDefinition[];\n}\n\n/**\n * Type definition of label raw value.\n * @public\n */\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\n\n/**\n * Data structure that describes label definition.\n * @public\n */\nexport interface LabelDefinition {\n /** Display value of label */\n displayValue: string;\n /** Raw value of label */\n rawValue: LabelRawValue;\n /** Type name of raw value */\n typeName: string;\n}\n\n/** @internal */\nexport const COMPOSITE_LABEL_DEFINITION_TYPENAME = \"composite\";\n\n/** @public */\nexport namespace LabelDefinition {\n /**\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\n * @public\n */\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\n return def.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME;\n }\n\n /**\n * Creates [[LabelDefinition]] from string value.\n * @public\n */\n export function fromLabelString(label: string): LabelDefinition {\n return {\n displayValue: label,\n rawValue: label,\n typeName: \"string\",\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA8BH,gBAAgB;AACH,QAAA,mCAAmC,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,IAAiB,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,2CAAmC,CAAC;IAC9D,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EApBgB,eAAe,+BAAf,eAAe,QAoB/B","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 Hierarchies\r\n */\r\n\r\n/**\r\n * Data structure that describes raw composite label value.\r\n * @public\r\n */\r\nexport interface LabelCompositeValue {\r\n separator: string;\r\n values: LabelDefinition[];\r\n}\r\n\r\n/**\r\n * Type definition of label raw value.\r\n * @public\r\n */\r\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\r\n\r\n/**\r\n * Data structure that describes label definition.\r\n * @public\r\n */\r\nexport interface LabelDefinition {\r\n /** Display value of label */\r\n displayValue: string;\r\n /** Raw value of label */\r\n rawValue: LabelRawValue;\r\n /** Type name of raw value */\r\n typeName: string;\r\n}\r\n\r\n/** @internal */\r\nexport const COMPOSITE_LABEL_DEFINITION_TYPENAME = \"composite\";\r\n\r\n/** @public */\r\nexport namespace LabelDefinition {\r\n /**\r\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\r\n * @public\r\n */\r\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\r\n return def.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME;\r\n }\r\n\r\n /**\r\n * Creates [[LabelDefinition]] from string value.\r\n * @public\r\n */\r\n export function fromLabelString(label: string): LabelDefinition {\r\n return {\r\n displayValue: label,\r\n rawValue: label,\r\n typeName: \"string\",\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -18,6 +18,7 @@ export declare class LocalizationHelper {
|
|
|
18
18
|
constructor(props: LocalizationHelperProps);
|
|
19
19
|
getLocalizedString(text: string): string;
|
|
20
20
|
getLocalizedNodes(nodes: Node[]): Node[];
|
|
21
|
+
getLocalizedNode(node: Node): Node;
|
|
21
22
|
getLocalizedNodePathElement(npe: NodePathElement): NodePathElement;
|
|
22
23
|
getLocalizedDisplayValueGroup(group: DisplayValueGroup): DisplayValueGroup;
|
|
23
24
|
getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition;
|
|
@@ -30,7 +31,6 @@ export declare class LocalizationHelper {
|
|
|
30
31
|
private getLocalizedRawValue;
|
|
31
32
|
private getLocalizedContentField;
|
|
32
33
|
private getLocalizedCategoryDescription;
|
|
33
|
-
getLocalizedNode(node: Node): Node;
|
|
34
34
|
private getLocalizedDisplayValue;
|
|
35
35
|
}
|
|
36
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAgB,iBAAiB,EAAS,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAA4D,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIjH,UAAU,uBAAuB;IAC/B,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C;AAED,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,mBAAmB,CAA0B;gBAEzC,KAAK,EAAE,uBAAuB;IAInC,kBAAkB,CAAC,IAAI,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAgB,iBAAiB,EAAS,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAA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