Format Class

Beta  

A class used to define the specifications for formatting quantity values. This class is typically loaded by reading FormatProps.

Extends

Methods

Name Description
constructor(name: string): Format Constructor  
clone(options?: CloneOptions): Format Clone Format  
fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> Populates this Format with the values from the provided.  
toJSON(): FormatProps Returns a JSON object that contain the specification for this Format.  
createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<Format> Static Create a Format from FormatProps  
isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits): boolean Static    

Inherited methods

Name Inherited from Description
hasFormatTraitSet(formatTrait: FormatTraits): boolean BaseFormat This method returns true if the formatTrait is set in this Format object.
loadFormatProperties(formatProps: FormatProps): void BaseFormat  
parseFormatTraits(formatTraitsFromJson: string | string[]): void BaseFormat This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType.

Properties

Name Type Description
_customProps Protected undefined | any    
_units Protected undefined | [UnitProps, undefined | string][]    
customProps Accessor ReadOnly any    
hasUnits Accessor ReadOnly boolean    
units Accessor ReadOnly undefined | [UnitProps, undefined | string][]    

Inherited properties

Name Type Inherited from Description
_decimalSeparator Protected string BaseFormat  
_formatTraits Protected FormatTraits BaseFormat  
_includeZero Protected boolean BaseFormat  
_minWidth Protected undefined | number BaseFormat  
_precision Protected number BaseFormat  
_roundFactor Protected number BaseFormat  
_scientificType Protected undefined | ScientificType BaseFormat  
_showSignOption Protected ShowSignOption BaseFormat  
_spacer Protected string BaseFormat  
_stationOffsetSize Protected undefined | number BaseFormat  
_stationSeparator Protected string BaseFormat  
_thousandSeparator Protected string BaseFormat  
_type Protected FormatType BaseFormat  
_uomSeparator Protected string BaseFormat  
decimalSeparator Accessor string BaseFormat  
formatTraits Accessor FormatTraits BaseFormat  
includeZero Accessor undefined | boolean BaseFormat  
minWidth Accessor undefined | number BaseFormat  
name Accessor ReadOnly string BaseFormat  
precision Accessor DecimalPrecision | FractionalPrecision BaseFormat  
roundFactor Accessor number BaseFormat  
scientificType Accessor undefined | ScientificType BaseFormat  
showSignOption Accessor ShowSignOption BaseFormat  
spacer Accessor undefined | string BaseFormat  
stationOffsetSize Accessor undefined | number BaseFormat  
stationSeparator Accessor string BaseFormat  
thousandSeparator Accessor string BaseFormat  
type Accessor FormatType BaseFormat  
uomSeparator Accessor string BaseFormat  

Defined in

Last Updated: 30 November, 2023