CustomQuantityTypeDefinition Interface

Beta  

CustomQuantityTypeDefinition interface is used to define a Custom quantity type that can be registered with the QuantityFormatter. A custom quantity formatter must be able to generate a FormatterSpec and ParserSpec that will be called to format and parse values. Optionally it can provide specification of custom properties that it will use to define any formatting options. CustomQuantityTypeDefinitions must be registered with the QuantityFormatter using the method IModelApp.quantityFormatter.registerQuantityType.

Extends

Methods

Name Description
isCompatibleFormatProps(formatProps: FormatProps): boolean Return true if the FormatProps have the necessary custom property definition  

Inherited methods

Name Inherited from Description
generateFormatterSpec(formatProps: FormatProps, unitsProvider: UnitsProvider): Promise<FormatterSpec> QuantityTypeDefinition Generate a [FormatterSpec]$(imodeljs-quantity) that will be called to format values.
generateParserSpec(formatProps: FormatProps, unitsProvider: UnitsProvider): Promise<ParserSpec> QuantityTypeDefinition Generate a [ParserSpec]$(imodeljs-quantity) that will be called to parse a string into a quantity value.
getDefaultFormatPropsBySystem(requestedSystem: UnitSystemKey): FormatProps QuantityTypeDefinition  

Properties

Name Type Description
primaryPropEditorSpecs undefined | CustomFormatPropEditorSpec[] An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.  
secondaryPropEditorSpecs undefined | CustomFormatPropEditorSpec[] An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.  

Inherited properties

Name Type Inherited from Description
description string QuantityTypeDefinition Localized description that may be used to provide detailed description for the Quantity type.
key Readonly string QuantityTypeDefinition String used as a key to look up the quantity type.
label string QuantityTypeDefinition Localized label to display in UI
persistenceUnit Readonly UnitProps QuantityTypeDefinition The unit that the magnitude of the quantity is stored ie.
type Readonly QuantityTypeArg QuantityTypeDefinition The type value which can be one of the standard QuantityType enum values or a unique string if defining a custom type.

Defined in

Last Updated: 29 November, 2022