@itwin/core-quantity 3.0.0-dev.76 → 3.0.0-dev.80
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/lib/{Constants.d.ts → cjs/Constants.d.ts} +0 -0
- package/lib/cjs/Constants.d.ts.map +1 -0
- package/lib/{Constants.js → cjs/Constants.js} +0 -0
- package/lib/cjs/Constants.js.map +1 -0
- package/lib/{Exception.d.ts → cjs/Exception.d.ts} +0 -0
- package/lib/cjs/Exception.d.ts.map +1 -0
- package/lib/{Exception.js → cjs/Exception.js} +0 -0
- package/lib/cjs/Exception.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Format.d.ts +0 -0
- package/lib/cjs/Formatter/Format.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Format.js +0 -0
- package/lib/cjs/Formatter/Format.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatEnums.d.ts +0 -0
- package/lib/cjs/Formatter/FormatEnums.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatEnums.js +0 -0
- package/lib/cjs/Formatter/FormatEnums.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Formatter.d.ts +0 -0
- package/lib/cjs/Formatter/Formatter.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Formatter.js +0 -0
- package/lib/cjs/Formatter/Formatter.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatterSpec.d.ts +0 -0
- package/lib/cjs/Formatter/FormatterSpec.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatterSpec.js +0 -0
- package/lib/cjs/Formatter/FormatterSpec.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Interfaces.d.ts +0 -0
- package/lib/cjs/Formatter/Interfaces.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Interfaces.js +0 -0
- package/lib/cjs/Formatter/Interfaces.js.map +1 -0
- package/lib/{Interfaces.d.ts → cjs/Interfaces.d.ts} +0 -0
- package/lib/cjs/Interfaces.d.ts.map +1 -0
- package/lib/{Interfaces.js → cjs/Interfaces.js} +0 -0
- package/lib/cjs/Interfaces.js.map +1 -0
- package/lib/{Parser.d.ts → cjs/Parser.d.ts} +0 -0
- package/lib/cjs/Parser.d.ts.map +1 -0
- package/lib/{Parser.js → cjs/Parser.js} +0 -0
- package/lib/cjs/Parser.js.map +1 -0
- package/lib/{ParserSpec.d.ts → cjs/ParserSpec.d.ts} +0 -0
- package/lib/cjs/ParserSpec.d.ts.map +1 -0
- package/lib/{ParserSpec.js → cjs/ParserSpec.js} +0 -0
- package/lib/cjs/ParserSpec.js.map +1 -0
- package/lib/{Quantity.d.ts → cjs/Quantity.d.ts} +0 -0
- package/lib/cjs/Quantity.d.ts.map +1 -0
- package/lib/{Quantity.js → cjs/Quantity.js} +0 -0
- package/lib/cjs/Quantity.js.map +1 -0
- package/lib/{Unit.d.ts → cjs/Unit.d.ts} +0 -0
- package/lib/cjs/Unit.d.ts.map +1 -0
- package/lib/{Unit.js → cjs/Unit.js} +0 -0
- package/lib/cjs/Unit.js.map +1 -0
- package/lib/{core-quantity.d.ts → cjs/core-quantity.d.ts} +0 -0
- package/lib/cjs/core-quantity.d.ts.map +1 -0
- package/lib/{core-quantity.js → cjs/core-quantity.js} +0 -0
- package/lib/cjs/core-quantity.js.map +1 -0
- package/lib/esm/Constants.d.ts +28 -0
- package/lib/esm/Constants.d.ts.map +1 -0
- package/lib/esm/Constants.js +49 -0
- package/lib/esm/Constants.js.map +1 -0
- package/lib/esm/Exception.d.ts +27 -0
- package/lib/esm/Exception.d.ts.map +1 -0
- package/lib/esm/Exception.js +34 -0
- package/lib/esm/Exception.js.map +1 -0
- package/lib/esm/Formatter/Format.d.ts +96 -0
- package/lib/esm/Formatter/Format.d.ts.map +1 -0
- package/lib/esm/Formatter/Format.js +550 -0
- package/lib/esm/Formatter/Format.js.map +1 -0
- package/lib/esm/Formatter/FormatEnums.d.ts +89 -0
- package/lib/esm/Formatter/FormatEnums.d.ts.map +1 -0
- package/lib/esm/Formatter/FormatEnums.js +99 -0
- package/lib/esm/Formatter/FormatEnums.js.map +1 -0
- package/lib/esm/Formatter/Formatter.d.ts +45 -0
- package/lib/esm/Formatter/Formatter.d.ts.map +1 -0
- package/lib/esm/Formatter/Formatter.js +368 -0
- package/lib/esm/Formatter/Formatter.js.map +1 -0
- package/lib/esm/Formatter/FormatterSpec.d.ts +40 -0
- package/lib/esm/Formatter/FormatterSpec.d.ts.map +1 -0
- package/lib/esm/Formatter/FormatterSpec.js +98 -0
- package/lib/esm/Formatter/FormatterSpec.js.map +1 -0
- package/lib/esm/Formatter/Interfaces.d.ts +63 -0
- package/lib/esm/Formatter/Interfaces.d.ts.map +1 -0
- package/lib/esm/Formatter/Interfaces.js +14 -0
- package/lib/esm/Formatter/Interfaces.js.map +1 -0
- package/lib/esm/Interfaces.d.ts +75 -0
- package/lib/esm/Interfaces.d.ts.map +1 -0
- package/lib/esm/Interfaces.js +9 -0
- package/lib/esm/Interfaces.js.map +1 -0
- package/lib/esm/Parser.d.ts +94 -0
- package/lib/esm/Parser.d.ts.map +1 -0
- package/lib/esm/Parser.js +584 -0
- package/lib/esm/Parser.js.map +1 -0
- package/lib/esm/ParserSpec.d.ts +35 -0
- package/lib/esm/ParserSpec.d.ts.map +1 -0
- package/lib/esm/ParserSpec.js +44 -0
- package/lib/esm/ParserSpec.js.map +1 -0
- package/lib/esm/Quantity.d.ts +28 -0
- package/lib/esm/Quantity.d.ts.map +1 -0
- package/lib/esm/Quantity.js +43 -0
- package/lib/esm/Quantity.js.map +1 -0
- package/lib/esm/Unit.d.ts +27 -0
- package/lib/esm/Unit.d.ts.map +1 -0
- package/lib/esm/Unit.js +41 -0
- package/lib/esm/Unit.js.map +1 -0
- package/lib/esm/core-quantity.d.ts +20 -0
- package/lib/esm/core-quantity.d.ts.map +1 -0
- package/lib/esm/core-quantity.js +24 -0
- package/lib/esm/core-quantity.js.map +1 -0
- package/package.json +11 -8
- package/lib/Constants.d.ts.map +0 -1
- package/lib/Constants.js.map +0 -1
- package/lib/Exception.d.ts.map +0 -1
- package/lib/Exception.js.map +0 -1
- package/lib/Formatter/Format.d.ts.map +0 -1
- package/lib/Formatter/Format.js.map +0 -1
- package/lib/Formatter/FormatEnums.d.ts.map +0 -1
- package/lib/Formatter/FormatEnums.js.map +0 -1
- package/lib/Formatter/Formatter.d.ts.map +0 -1
- package/lib/Formatter/Formatter.js.map +0 -1
- package/lib/Formatter/FormatterSpec.d.ts.map +0 -1
- package/lib/Formatter/FormatterSpec.js.map +0 -1
- package/lib/Formatter/Interfaces.d.ts.map +0 -1
- package/lib/Formatter/Interfaces.js.map +0 -1
- package/lib/Interfaces.d.ts.map +0 -1
- package/lib/Interfaces.js.map +0 -1
- package/lib/Parser.d.ts.map +0 -1
- package/lib/Parser.js.map +0 -1
- package/lib/ParserSpec.d.ts.map +0 -1
- package/lib/ParserSpec.js.map +0 -1
- package/lib/Quantity.d.ts.map +0 -1
- package/lib/Quantity.js.map +0 -1
- package/lib/Unit.d.ts.map +0 -1
- package/lib/Unit.js.map +0 -1
- package/lib/core-quantity.d.ts.map +0 -1
- package/lib/core-quantity.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../src/Formatter/Format.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,EAAgD,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEjG,sFAAsF;AACtF,6JAA6J;AAE7J;;GAEG;AACH,MAAM,OAAO,MAAM;I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iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,SAAS;SACV,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityConstants } from \"../Constants\";\nimport { QuantityError, QuantityStatus } from \"../Exception\";\nimport { UnitProps, UnitsProvider } from \"../Interfaces\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"./FormatEnums\";\nimport { CloneOptions, CustomFormatProps, FormatProps, isCustomFormatProps } from \"./Interfaces\";\n\n// cSpell:ignore ZERONORMALIZED, nosign, onlynegative, signalways, negativeparentheses\n// cSpell:ignore trailzeroes, keepsinglezero, zeroempty, keepdecimalpoint, applyrounding, fractiondash, showunitlabel, prependunitlabel, exponentonlynegative\n\n/** A class used to define the specifications for formatting quantity values. This class is typically loaded by reading [[FormatProps]].\n * @beta\n */\nexport class Format {\n private _name = \"\";\n protected _roundFactor: number = 0.0;\n protected _type: FormatType = FormatType.Decimal; // required; options are decimal, fractional, scientific, station\n protected _precision: number = DecimalPrecision.Six; // required\n protected _minWidth?: number; // optional; positive int\n protected _scientificType?: ScientificType; // required if type is scientific; options: normalized, zeroNormalized\n protected _showSignOption: ShowSignOption = ShowSignOption.OnlyNegative; // options: noSign, onlyNegative, signAlways, negativeParentheses\n protected _decimalSeparator: string = QuantityConstants.LocaleSpecificDecimalSeparator;\n protected _thousandSeparator: string = QuantityConstants.LocaleSpecificThousandSeparator;\n protected _uomSeparator = \" \"; // optional; default is \" \"; defined separator between magnitude and the unit\n protected _stationSeparator = \"+\"; // optional; default is \"+\"\n protected _stationOffsetSize?: number; // required when type is station; positive integer > 0\n protected _formatTraits: FormatTraits = 0x0;\n protected _spacer: string = \" \"; // optional; default is \" \"\n protected _includeZero: boolean = true; // optional; default is true\n protected _units?: Array<[UnitProps, string | undefined]>;\n protected _customProps?: any; // used by custom formatters and parsers\n\n /** Constructor\n * @param name The name of a format specification. TODO: make optional or remove\n */\n constructor(name: string) {\n this._name = name;\n }\n\n public get name(): string { return this._name; }\n public get roundFactor(): number { return this._roundFactor; }\n public get type(): FormatType { return this._type; }\n public get precision(): DecimalPrecision | FractionalPrecision { return this._precision; }\n public get minWidth(): number | undefined { return this._minWidth; }\n public get scientificType(): ScientificType | undefined { return this._scientificType; }\n public get showSignOption(): ShowSignOption { return this._showSignOption; }\n public get decimalSeparator(): string { return this._decimalSeparator; }\n public get thousandSeparator(): string { return this._thousandSeparator; }\n public get uomSeparator(): string { return this._uomSeparator; }\n public get stationSeparator(): string { return this._stationSeparator; }\n public get stationOffsetSize(): number | undefined { return this._stationOffsetSize; }\n public get formatTraits(): FormatTraits { return this._formatTraits; }\n public get spacer(): string { return this._spacer; }\n public get includeZero(): boolean { return this._includeZero; }\n public get units(): Array<[UnitProps, string | undefined]> | undefined { return this._units; }\n public get hasUnits(): boolean { return this._units !== undefined && this._units.length > 0; }\n public get customProps(): any { return this._customProps; }\n\n // parse and toString methods\n public static scientificTypeToString(scientificType: ScientificType): string {\n if (scientificType === ScientificType.Normalized)\n return \"Normalized\";\n else\n return \"ZeroNormalized\";\n }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid ScientificType. Throws exception if not valid. */\n public static parseScientificType(scientificType: string, formatName: string): ScientificType {\n switch (scientificType.toLowerCase()) {\n case \"normalized\":\n return ScientificType.Normalized;\n case \"zeronormalized\":\n return ScientificType.ZeroNormalized;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'SCIENTIFIC_TYPE' attribute.`);\n }\n }\n\n /** Method used when generating a JSON object that represents this Format. */\n public static showSignOptionToString(showSign: ShowSignOption): string {\n switch (showSign) {\n case ShowSignOption.NegativeParentheses:\n return \"NegativeParentheses\";\n case ShowSignOption.NoSign:\n return \"NoSign\";\n case ShowSignOption.OnlyNegative:\n return \"OnlyNegative\";\n case ShowSignOption.SignAlways:\n return \"SignAlways\";\n }\n }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid ShowSignOption. Throws exception if not valid. */\n public static parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption {\n switch (showSignOption.toLowerCase()) {\n case \"nosign\":\n return ShowSignOption.NoSign;\n case \"onlynegative\":\n return ShowSignOption.OnlyNegative;\n case \"signalways\":\n return ShowSignOption.SignAlways;\n case \"negativeparentheses\":\n return ShowSignOption.NegativeParentheses;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'showSignOption' attribute.`);\n }\n }\n\n public static isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits) {\n if (!formatProps.formatTraits)\n return false;\n const formatTraits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : formatProps.formatTraits.split(/,|;|\\|/);\n const traitStr = Format.getTraitString(trait);\n return formatTraits.find((traitEntry) => traitStr === traitEntry) ? true : false;\n }\n\n /** Get string used in FormatProps */\n public static getTraitString(trait: FormatTraits) {\n switch (trait) {\n case FormatTraits.TrailZeroes:\n return \"trailZeroes\";\n case FormatTraits.KeepSingleZero:\n return \"keepSingleZero\";\n case FormatTraits.ZeroEmpty:\n return \"zeroEmpty\";\n case FormatTraits.KeepDecimalPoint:\n return \"keepDecimalPoint\";\n case FormatTraits.ApplyRounding:\n return \"applyRounding\";\n case FormatTraits.FractionDash:\n return \"fractionDash\";\n case FormatTraits.ShowUnitLabel:\n return \"showUnitLabel\";\n case FormatTraits.PrependUnitLabel:\n return \"prependUnitLabel\";\n case FormatTraits.Use1000Separator:\n return \"use1000Separator\";\n case FormatTraits.ExponentOnlyNegative:\n default:\n return \"exponentOnlyNegative\";\n }\n }\n\n /** Method used when generating a JSON object that represents this Format. */\n public static formatTraitsToArray(currentFormatTrait: FormatTraits): string[] {\n const formatTraitsArr = Array<string>();\n if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes) formatTraitsArr.push(Format.getTraitString(FormatTraits.TrailZeroes));\n if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero) formatTraitsArr.push(Format.getTraitString(FormatTraits.KeepSingleZero));\n if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty) formatTraitsArr.push(Format.getTraitString(FormatTraits.ZeroEmpty));\n if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint) formatTraitsArr.push(Format.getTraitString(FormatTraits.KeepDecimalPoint));\n if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding) formatTraitsArr.push(Format.getTraitString(FormatTraits.ApplyRounding));\n if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash) formatTraitsArr.push(Format.getTraitString(FormatTraits.FractionDash));\n if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel) formatTraitsArr.push(Format.getTraitString(FormatTraits.ShowUnitLabel));\n if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel) formatTraitsArr.push(Format.getTraitString(FormatTraits.PrependUnitLabel));\n if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator) formatTraitsArr.push(Format.getTraitString(FormatTraits.Use1000Separator));\n // NOTE: the formatter does not current use trait ExponentOnlyNegative\n if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative) formatTraitsArr.push(Format.getTraitString(FormatTraits.ExponentOnlyNegative));\n\n return formatTraitsArr;\n }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatTrait. Throws exception if not valid. */\n public static parseFormatTrait(stringToCheck: string, currentFormatTrait: number): FormatTraits {\n switch (stringToCheck.toLowerCase()) {\n case \"trailzeroes\":\n return currentFormatTrait | FormatTraits.TrailZeroes;\n case \"keepsinglezero\":\n return currentFormatTrait | FormatTraits.KeepSingleZero; // keep single when format type is Decimal\n case \"zeroempty\":\n return currentFormatTrait | FormatTraits.ZeroEmpty;\n case \"keepdecimalpoint\":\n return currentFormatTrait | FormatTraits.KeepDecimalPoint; // add decimal point when no fractional part and format type is Decimal\n case \"applyrounding\":\n return currentFormatTrait | FormatTraits.ApplyRounding;\n case \"fractiondash\":\n return currentFormatTrait | FormatTraits.FractionDash;\n case \"showunitlabel\":\n return currentFormatTrait | FormatTraits.ShowUnitLabel;\n case \"prependunitlabel\":\n return currentFormatTrait | FormatTraits.PrependUnitLabel;\n case \"use1000separator\":\n return currentFormatTrait | FormatTraits.Use1000Separator;\n case \"exponentonlynegative\":\n return currentFormatTrait | FormatTraits.ExponentOnlyNegative;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `Format has an invalid 'formatTraits' option.`);\n }\n }\n\n /** Get FormatTrait from entry in FormatProps */\n public static parseFormatTraits(formatTraitsFromJson: string | string[] | undefined) {\n if (!formatTraitsFromJson)\n return undefined;\n\n const formatTraits = Array.isArray(formatTraitsFromJson) ? formatTraitsFromJson : formatTraitsFromJson.split(/,|;|\\|/);\n let traits = 0;\n for (const traitStr of formatTraits) {\n traits = Format.parseFormatTrait(traitStr, traits);\n }\n if (0 === traits)\n return undefined;\n\n return traits as FormatTraits;\n }\n\n /** Method used when generating a JSON object that represents this Format. */\n public static formatTypeToString(type: FormatType): string {\n switch (type) {\n case FormatType.Decimal:\n return \"Decimal\";\n case FormatType.Scientific:\n return \"Scientific\";\n case FormatType.Station:\n return \"Station\";\n case FormatType.Fractional:\n return \"Fractional\";\n }\n }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType. Throws exception if not valid. */\n public static parseFormatType(jsonObjType: string, formatName: string): FormatType {\n switch (jsonObjType.toLowerCase()) {\n case \"decimal\":\n return FormatType.Decimal;\n case \"scientific\":\n return FormatType.Scientific;\n case \"station\":\n return FormatType.Station;\n case \"fractional\":\n return FormatType.Fractional;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'type' attribute.`);\n }\n }\n\n /** This method validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision. Throws exception if not valid. */\n public static parseDecimalPrecision(jsonObjPrecision: number): DecimalPrecision {\n switch (jsonObjPrecision) {\n case 0:\n return DecimalPrecision.Zero;\n case 1:\n return DecimalPrecision.One;\n case 2:\n return DecimalPrecision.Two;\n case 3:\n return DecimalPrecision.Three;\n case 4:\n return DecimalPrecision.Four;\n case 5:\n return DecimalPrecision.Five;\n case 6:\n return DecimalPrecision.Six;\n case 7:\n return DecimalPrecision.Seven;\n case 8:\n return DecimalPrecision.Eight;\n case 9:\n return DecimalPrecision.Nine;\n case 10:\n return DecimalPrecision.Ten;\n case 11:\n return DecimalPrecision.Eleven;\n case 12:\n return DecimalPrecision.Twelve;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The 'precision' attribute must be an integer in the range 0-12.`);\n }\n }\n\n /** This method validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision. Throws exception if not valid. */\n public static parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision {\n switch (jsonObjPrecision) {\n case 1:\n return FractionalPrecision.One;\n case 2:\n return FractionalPrecision.Two;\n case 4:\n return FractionalPrecision.Four;\n case 8:\n return FractionalPrecision.Eight;\n case 16:\n return FractionalPrecision.Sixteen;\n case 32:\n return FractionalPrecision.ThirtyTwo;\n case 64:\n return FractionalPrecision.SixtyFour;\n case 128:\n return FractionalPrecision.OneHundredTwentyEight;\n case 256:\n return FractionalPrecision.TwoHundredFiftySix;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n }\n\n /** This method validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. Throws exception if not valid. */\n public static parsePrecision(precision: number, formatName: string, type: FormatType): DecimalPrecision | FractionalPrecision {\n switch (type) { // type must be decimal, fractional, scientific, or station\n case FormatType.Decimal:\n case FormatType.Scientific:\n case FormatType.Station:\n return Format.parseDecimalPrecision(precision);\n case FormatType.Fractional:\n return Format.parseFractionalPrecision(precision, formatName);\n }\n }\n\n private verifyFormatTraitsOptions(formatTraitsFromJson: string | string[]) {\n const formatTraits = (Array.isArray(formatTraitsFromJson)) ? formatTraitsFromJson : formatTraitsFromJson.split(/,|;|\\|/);\n formatTraits.forEach((formatTraitsString: string) => { // for each element in the string array\n this._formatTraits = Format.parseFormatTrait(formatTraitsString, this.formatTraits);\n });\n }\n\n /** This method returns true if the formatTrait is set in this Format object. */\n public hasFormatTraitSet(formatTrait: FormatTraits): boolean {\n return (this._formatTraits & formatTrait) === formatTrait;\n }\n\n private async createUnit(unitsProvider: UnitsProvider, name: string, label?: string): Promise<void> {\n if (name === undefined || typeof (name) !== \"string\" || (label !== undefined && typeof (label) !== \"string\")) // throws if name is undefined or name isn't a string or if label is defined and isn't a string\n throw new QuantityError(QuantityStatus.InvalidJson, `This Composite has a unit with an invalid 'name' or 'label' attribute.`);\n for (const unit of this.units!) {\n const unitObj = unit[0].name;\n if (unitObj.toLowerCase() === name.toLowerCase()) // duplicate names are not allowed\n throw new QuantityError(QuantityStatus.InvalidJson, `The unit ${unitObj} has a duplicate name.`);\n }\n const newUnit: UnitProps = await unitsProvider.findUnitByName(name);\n if (!newUnit || !newUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${name}'.`);\n this.units!.push([newUnit, label]);\n }\n\n /**\n * Clone Format\n */\n public clone(options?: CloneOptions): Format {\n const newFormat = new Format(this.name);\n newFormat._roundFactor = this._roundFactor;\n newFormat._type = this._type;\n newFormat._precision = this._precision;\n newFormat._minWidth = this._minWidth;\n newFormat._scientificType = this._scientificType;\n newFormat._showSignOption = this._showSignOption;\n newFormat._decimalSeparator = this._decimalSeparator;\n newFormat._thousandSeparator = this._thousandSeparator;\n newFormat._uomSeparator = this._uomSeparator;\n newFormat._stationSeparator = this._stationSeparator;\n newFormat._stationOffsetSize = this._stationOffsetSize;\n newFormat._formatTraits = this._formatTraits;\n newFormat._spacer = this._spacer;\n newFormat._includeZero = this._includeZero;\n newFormat._customProps = this._customProps;\n this._units && (newFormat._units = [...this._units]);\n\n if (newFormat._units) {\n if (options?.showOnlyPrimaryUnit) {\n if (newFormat._units.length > 1)\n newFormat._units.length = 1;\n }\n }\n\n if (undefined !== options?.traits)\n newFormat._formatTraits = options?.traits;\n\n if (undefined !== options?.type)\n newFormat._type = options.type;\n\n if (undefined !== options?.precision) {\n // ensure specified precision is valid\n const precision = Format.parsePrecision(options?.precision, \"clone\", newFormat._type);\n newFormat._precision = precision;\n }\n\n if (undefined !== options?.primaryUnit) {\n if (options.primaryUnit.unit) {\n const newUnits = new Array<[UnitProps, string | undefined]>();\n newUnits.push([options.primaryUnit.unit, options.primaryUnit.label]);\n newFormat._units = newUnits;\n } else if (options.primaryUnit.label && newFormat._units?.length) {\n // update label only\n newFormat._units[0][1] = options.primaryUnit.label;\n }\n }\n return newFormat;\n }\n\n private loadFormatProperties(jsonObj: FormatProps) {\n if (isCustomFormatProps(jsonObj))\n this._customProps = jsonObj.custom;\n\n if (undefined === jsonObj.type) // type is required\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} does not have the required 'type' attribute.`);\n if (typeof (jsonObj.type) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'type' attribute. It should be of type 'string'.`);\n this._type = Format.parseFormatType(jsonObj.type, this.name);\n\n if (undefined === jsonObj.precision) // precision is required\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} does not have the required 'precision' attribute.`);\n else if (typeof (jsonObj.precision) !== \"number\") // must be a number\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'precision' attribute. It should be of type 'number'.`);\n else if (!Number.isInteger(jsonObj.precision)) // must be an integer\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'precision' attribute. It should be an integer.`);\n this._precision = Format.parsePrecision(jsonObj.precision, this.name, this._type);\n\n if (this.type === FormatType.Scientific) {\n if (undefined === jsonObj.scientificType) // if format type is scientific and scientific type is undefined, throw\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has type 'Scientific' therefore attribute 'scientificType' is required.`);\n if (typeof (jsonObj.scientificType) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'scientificType' attribute. It should be of type 'string'.`);\n this._scientificType = Format.parseScientificType(jsonObj.scientificType.toLowerCase(), this.name);\n }\n\n if (this.type === FormatType.Station) {\n if (undefined === jsonObj.stationOffsetSize)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has type 'Station' therefore attribute 'stationOffsetSize' is required.`);\n if (typeof (jsonObj.stationOffsetSize) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationOffsetSize' attribute. It should be of type 'number'.`);\n if (!Number.isInteger(jsonObj.stationOffsetSize) || jsonObj.stationOffsetSize <= 0) // must be a positive int > 0\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationOffsetSize' attribute. It should be a positive integer.`);\n this._stationOffsetSize = jsonObj.stationOffsetSize;\n }\n\n if (undefined !== jsonObj.roundFactor) { // optional; default is 0.0\n if (typeof (jsonObj.roundFactor) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'roundFactor' attribute. It should be of type 'number'.`);\n if (jsonObj.roundFactor !== this.roundFactor) // if roundFactor isn't default value of 0.0, reassign roundFactor variable\n this._roundFactor = jsonObj.roundFactor;\n }\n\n if (undefined !== jsonObj.minWidth) { // optional\n if (typeof (jsonObj.minWidth) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'minWidth' attribute. It should be of type 'number'.`);\n if (!Number.isInteger(jsonObj.minWidth) || jsonObj.minWidth < 0) // must be a positive int\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'minWidth' attribute. It should be a positive integer.`);\n this._minWidth = jsonObj.minWidth;\n }\n\n if (undefined !== jsonObj.showSignOption) { // optional; default is \"onlyNegative\"\n if (typeof (jsonObj.showSignOption) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'showSignOption' attribute. It should be of type 'string'.`);\n this._showSignOption = Format.parseShowSignOption(jsonObj.showSignOption, this.name);\n }\n\n if (undefined !== jsonObj.formatTraits && jsonObj.formatTraits.length !== 0) { // FormatTraits is optional\n if (!Array.isArray(jsonObj.formatTraits) && typeof (jsonObj.formatTraits) !== \"string\") // must be either an array of strings or a string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'formatTraits' attribute. It should be of type 'string' or 'string[]'.`);\n this.verifyFormatTraitsOptions(jsonObj.formatTraits); // check that all of the options for formatTraits are valid. If now, throw\n }\n\n if (undefined !== jsonObj.decimalSeparator) { // optional\n if (typeof (jsonObj.decimalSeparator) !== \"string\") // not a string or not a one character string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It should be of type 'string'.`);\n if (jsonObj.decimalSeparator.length !== 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It must be a one character string.`);\n this._decimalSeparator = jsonObj.decimalSeparator;\n }\n\n if (undefined !== jsonObj.thousandSeparator) { // optional\n if (typeof (jsonObj.thousandSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It should be of type 'string'.`);\n if (jsonObj.thousandSeparator.length !== 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It must be a one character string.`);\n this._thousandSeparator = jsonObj.thousandSeparator;\n }\n\n if (undefined !== jsonObj.uomSeparator) { // optional; default is \" \"\n if (typeof (jsonObj.uomSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It should be of type 'string'.`);\n if (jsonObj.uomSeparator.length < 0 || jsonObj.uomSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It must be empty or a string with a single character.`);\n this._uomSeparator = jsonObj.uomSeparator;\n }\n\n if (undefined !== jsonObj.stationSeparator) { // optional; default is \"+\"\n if (typeof (jsonObj.stationSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It should be of type 'string'.`);\n if (jsonObj.stationSeparator.length !== 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It must be a one character string.`);\n this._stationSeparator = jsonObj.stationSeparator;\n }\n }\n\n /**\n * Populates this Format with the values from the provided.\n */\n public async fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> {\n this.loadFormatProperties(jsonObj);\n\n if (undefined !== jsonObj.composite) { // optional\n this._units = new Array<[UnitProps, string | undefined]>();\n if (jsonObj.composite.includeZero !== undefined) {\n if (typeof (jsonObj.composite.includeZero) !== \"boolean\") // includeZero must be a boolean IF it is defined\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'includeZero' attribute. It should be of type 'boolean'.`);\n this._includeZero = jsonObj.composite.includeZero;\n }\n if (jsonObj.composite.spacer !== undefined) { // spacer must be a string IF it is defined\n if (typeof (jsonObj.composite.spacer) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It must be of type 'string'.`);\n if (jsonObj.composite.spacer.length < 0 || jsonObj.composite.spacer.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It must be empty or a string with a single character.`);\n this._spacer = jsonObj.composite.spacer;\n }\n if (jsonObj.composite.units !== undefined) { // if composite is defined, it must be an array with 1-4 units\n if (!Array.isArray(jsonObj.composite.units)) { // must be an array\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'units' attribute. It must be of type 'array'`);\n }\n if (jsonObj.composite.units.length > 0 && jsonObj.composite.units.length <= 4) { // Composite requires 1-4 units\n try {\n const createUnitPromises: Array<Promise<void>> = [];\n for (const unit of jsonObj.composite.units) {\n createUnitPromises.push(this.createUnit(unitsProvider, unit.name, unit.label));\n }\n\n await Promise.all(createUnitPromises);\n } catch (e) {\n throw e;\n }\n }\n }\n if (undefined === this.units || this.units.length === 0)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with no valid 'units'`);\n }\n }\n\n /** Create a Format from FormatProps */\n public static async createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps) {\n const actualFormat = new Format(name);\n await actualFormat.fromJSON(unitsProvider, formatProps);\n return actualFormat;\n }\n\n /**\n * Returns a JSON object that contain the specification for this Format.\n */\n public toJSON(): FormatProps {\n let composite;\n if (this.units) {\n const units = this.units.map((value) => {\n if (undefined !== value[1])\n return { name: value[0].name, label: value[1] };\n else\n return { name: value[0].name };\n });\n\n composite = {\n spacer: this.spacer,\n includeZero: this.includeZero,\n units,\n };\n }\n\n if (this.customProps)\n return {\n type: Format.formatTypeToString(this.type),\n precision: this.precision,\n roundFactor: this.roundFactor,\n minWidth: this.minWidth,\n showSignOption: Format.showSignOptionToString(this.showSignOption),\n formatTraits: Format.formatTraitsToArray(this.formatTraits),\n decimalSeparator: this.decimalSeparator,\n thousandSeparator: this.thousandSeparator,\n uomSeparator: this.uomSeparator,\n scientificType: this.scientificType ? Format.scientificTypeToString(this.scientificType) : undefined,\n stationOffsetSize: this.stationOffsetSize,\n stationSeparator: this.stationSeparator,\n composite,\n custom: this.customProps,\n } as CustomFormatProps;\n\n return {\n type: Format.formatTypeToString(this.type),\n precision: this.precision,\n roundFactor: this.roundFactor,\n minWidth: this.minWidth,\n showSignOption: Format.showSignOptionToString(this.showSignOption),\n formatTraits: Format.formatTraitsToArray(this.formatTraits),\n decimalSeparator: this.decimalSeparator,\n thousandSeparator: this.thousandSeparator,\n uomSeparator: this.uomSeparator,\n scientificType: this.scientificType ? Format.scientificTypeToString(this.scientificType) : undefined,\n stationOffsetSize: this.stationOffsetSize,\n stationSeparator: this.stationSeparator,\n composite,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Quantity
|
|
3
|
+
*/
|
|
4
|
+
/** @beta */
|
|
5
|
+
export declare enum FormatTraits {
|
|
6
|
+
/** Show trailing zeroes to requested precision */
|
|
7
|
+
TrailZeroes = 1,
|
|
8
|
+
/** Indicates that the fractional part of the number is required when the fraction is zero */
|
|
9
|
+
KeepSingleZero = 2,
|
|
10
|
+
/** Zero magnitude returns blank display value */
|
|
11
|
+
ZeroEmpty = 4,
|
|
12
|
+
/** Show decimal point when value to right of decimal is empty */
|
|
13
|
+
KeepDecimalPoint = 8,
|
|
14
|
+
/** Use the rounding factor. Not yet supported */
|
|
15
|
+
ApplyRounding = 16,
|
|
16
|
+
/** Show a dash between whole value and fractional value */
|
|
17
|
+
FractionDash = 32,
|
|
18
|
+
/** Append the quantity's unit label */
|
|
19
|
+
ShowUnitLabel = 64,
|
|
20
|
+
/** Prepend unit label. Not yet supported */
|
|
21
|
+
PrependUnitLabel = 128,
|
|
22
|
+
/** show a grouping in each group of 1000. */
|
|
23
|
+
Use1000Separator = 256,
|
|
24
|
+
/** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */
|
|
25
|
+
ExponentOnlyNegative = 512
|
|
26
|
+
}
|
|
27
|
+
/** Precision for Fractional formatted value types. Range from Whole (1/1) through 1/256.
|
|
28
|
+
* @beta */
|
|
29
|
+
export declare enum FractionalPrecision {
|
|
30
|
+
One = 1,
|
|
31
|
+
Two = 2,
|
|
32
|
+
Four = 4,
|
|
33
|
+
Eight = 8,
|
|
34
|
+
Sixteen = 16,
|
|
35
|
+
ThirtyTwo = 32,
|
|
36
|
+
SixtyFour = 64,
|
|
37
|
+
OneHundredTwentyEight = 128,
|
|
38
|
+
TwoHundredFiftySix = 256
|
|
39
|
+
}
|
|
40
|
+
/** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12).
|
|
41
|
+
* @beta */
|
|
42
|
+
export declare enum DecimalPrecision {
|
|
43
|
+
Zero = 0,
|
|
44
|
+
One = 1,
|
|
45
|
+
Two = 2,
|
|
46
|
+
Three = 3,
|
|
47
|
+
Four = 4,
|
|
48
|
+
Five = 5,
|
|
49
|
+
Six = 6,
|
|
50
|
+
Seven = 7,
|
|
51
|
+
Eight = 8,
|
|
52
|
+
Nine = 9,
|
|
53
|
+
Ten = 10,
|
|
54
|
+
Eleven = 11,
|
|
55
|
+
Twelve = 12
|
|
56
|
+
}
|
|
57
|
+
/** Supported format types
|
|
58
|
+
* @beta */
|
|
59
|
+
export declare enum FormatType {
|
|
60
|
+
/** Decimal display (ie 2.125) */
|
|
61
|
+
Decimal = 0,
|
|
62
|
+
/** Fractional display (ie 2-1/8) */
|
|
63
|
+
Fractional = 1,
|
|
64
|
+
/** Scientific Notation (ie 1.04e3) */
|
|
65
|
+
Scientific = 2,
|
|
66
|
+
/** Civil Engineering Stationing (ie 1+00). */
|
|
67
|
+
Station = 3
|
|
68
|
+
}
|
|
69
|
+
/** required if type is scientific
|
|
70
|
+
* @beta */
|
|
71
|
+
export declare enum ScientificType {
|
|
72
|
+
/** Non-zero value left of decimal point (ie 1.2345e3) */
|
|
73
|
+
Normalized = 0,
|
|
74
|
+
/** Zero value left of decimal point (ie 0.12345e4) */
|
|
75
|
+
ZeroNormalized = 1
|
|
76
|
+
}
|
|
77
|
+
/** Determines how the sign of values are displayed
|
|
78
|
+
* @beta */
|
|
79
|
+
export declare enum ShowSignOption {
|
|
80
|
+
/** Never show a sign even if the value is negative. */
|
|
81
|
+
NoSign = 0,
|
|
82
|
+
/** Only show a sign when the value is negative. */
|
|
83
|
+
OnlyNegative = 1,
|
|
84
|
+
/** Always show a sign whether the value is positive or negative. */
|
|
85
|
+
SignAlways = 2,
|
|
86
|
+
/** Only show a sign when the value is negative but use parentheses instead of a negative sign. For example, -10 is formatted as `(10)`. */
|
|
87
|
+
NegativeParentheses = 3
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=FormatEnums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatEnums.d.ts","sourceRoot":"","sources":["../../../src/Formatter/FormatEnums.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,YAAY;AACZ,oBAAY,YAAY;IACtB,kDAAkD;IAClD,WAAW,IAAM;IACjB,6FAA6F;IAC7F,cAAc,IAAM;IACpB,iDAAiD;IACjD,SAAS,IAAM;IACf,iEAAiE;IACjE,gBAAgB,IAAM;IACtB,kDAAkD;IAClD,aAAa,KAAO;IACpB,2DAA2D;IAC3D,YAAY,KAAO;IACnB,uCAAuC;IACvC,aAAa,KAAO;IACpB,4CAA4C;IAC5C,gBAAgB,MAAO;IACvB,6CAA6C;IAC7C,gBAAgB,MAAQ;IACxB,8IAA8I;IAC9I,oBAAoB,MAAQ;CAC7B;AAED;WACW;AACX,oBAAY,mBAAmB;IAC7B,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,KAAK,IAAI;IACT,OAAO,KAAK;IACZ,SAAS,KAAK;IACd,SAAS,KAAK;IACd,qBAAqB,MAAM;IAC3B,kBAAkB,MAAM;CACzB;AAED;WACW;AACX,oBAAY,gBAAgB;IAC1B,IAAI,IAAI;IACR,GAAG,IAAI;IACP,GAAG,IAAI;IACP,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,GAAG,IAAI;IACP,KAAK,IAAI;IACT,KAAK,IAAI;IACT,IAAI,IAAI;IACR,GAAG,KAAK;IACR,MAAM,KAAK;IACX,MAAM,KAAK;CACZ;AAED;YACY;AACZ,oBAAY,UAAU;IACpB,iCAAiC;IACjC,OAAO,IAAA;IACP,oCAAoC;IACpC,UAAU,IAAA;IACV,sCAAsC;IACtC,UAAU,IAAA;IACV,8CAA8C;IAC9C,OAAO,IAAA;CACR;AAED;WACW;AACX,oBAAY,cAAc;IACxB,yDAAyD;IACzD,UAAU,IAAA;IACV,sDAAsD;IACtD,cAAc,IAAA;CACf;AAED;WACW;AACX,oBAAY,cAAc;IACxB,uDAAuD;IACvD,MAAM,IAAA;IACN,mDAAmD;IACnD,YAAY,IAAA;IACZ,oEAAoE;IACpE,UAAU,IAAA;IACV,2IAA2I;IAC3I,mBAAmB,IAAA;CACpB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Quantity
|
|
7
|
+
*/
|
|
8
|
+
/** @beta */
|
|
9
|
+
export var FormatTraits;
|
|
10
|
+
(function (FormatTraits) {
|
|
11
|
+
/** Show trailing zeroes to requested precision */
|
|
12
|
+
FormatTraits[FormatTraits["TrailZeroes"] = 1] = "TrailZeroes";
|
|
13
|
+
/** Indicates that the fractional part of the number is required when the fraction is zero */
|
|
14
|
+
FormatTraits[FormatTraits["KeepSingleZero"] = 2] = "KeepSingleZero";
|
|
15
|
+
/** Zero magnitude returns blank display value */
|
|
16
|
+
FormatTraits[FormatTraits["ZeroEmpty"] = 4] = "ZeroEmpty";
|
|
17
|
+
/** Show decimal point when value to right of decimal is empty */
|
|
18
|
+
FormatTraits[FormatTraits["KeepDecimalPoint"] = 8] = "KeepDecimalPoint";
|
|
19
|
+
/** Use the rounding factor. Not yet supported */
|
|
20
|
+
FormatTraits[FormatTraits["ApplyRounding"] = 16] = "ApplyRounding";
|
|
21
|
+
/** Show a dash between whole value and fractional value */
|
|
22
|
+
FormatTraits[FormatTraits["FractionDash"] = 32] = "FractionDash";
|
|
23
|
+
/** Append the quantity's unit label */
|
|
24
|
+
FormatTraits[FormatTraits["ShowUnitLabel"] = 64] = "ShowUnitLabel";
|
|
25
|
+
/** Prepend unit label. Not yet supported */
|
|
26
|
+
FormatTraits[FormatTraits["PrependUnitLabel"] = 128] = "PrependUnitLabel";
|
|
27
|
+
/** show a grouping in each group of 1000. */
|
|
28
|
+
FormatTraits[FormatTraits["Use1000Separator"] = 256] = "Use1000Separator";
|
|
29
|
+
/** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */
|
|
30
|
+
FormatTraits[FormatTraits["ExponentOnlyNegative"] = 512] = "ExponentOnlyNegative";
|
|
31
|
+
})(FormatTraits || (FormatTraits = {}));
|
|
32
|
+
/** Precision for Fractional formatted value types. Range from Whole (1/1) through 1/256.
|
|
33
|
+
* @beta */
|
|
34
|
+
export var FractionalPrecision;
|
|
35
|
+
(function (FractionalPrecision) {
|
|
36
|
+
FractionalPrecision[FractionalPrecision["One"] = 1] = "One";
|
|
37
|
+
FractionalPrecision[FractionalPrecision["Two"] = 2] = "Two";
|
|
38
|
+
FractionalPrecision[FractionalPrecision["Four"] = 4] = "Four";
|
|
39
|
+
FractionalPrecision[FractionalPrecision["Eight"] = 8] = "Eight";
|
|
40
|
+
FractionalPrecision[FractionalPrecision["Sixteen"] = 16] = "Sixteen";
|
|
41
|
+
FractionalPrecision[FractionalPrecision["ThirtyTwo"] = 32] = "ThirtyTwo";
|
|
42
|
+
FractionalPrecision[FractionalPrecision["SixtyFour"] = 64] = "SixtyFour";
|
|
43
|
+
FractionalPrecision[FractionalPrecision["OneHundredTwentyEight"] = 128] = "OneHundredTwentyEight";
|
|
44
|
+
FractionalPrecision[FractionalPrecision["TwoHundredFiftySix"] = 256] = "TwoHundredFiftySix";
|
|
45
|
+
})(FractionalPrecision || (FractionalPrecision = {}));
|
|
46
|
+
/** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12).
|
|
47
|
+
* @beta */
|
|
48
|
+
export var DecimalPrecision;
|
|
49
|
+
(function (DecimalPrecision) {
|
|
50
|
+
DecimalPrecision[DecimalPrecision["Zero"] = 0] = "Zero";
|
|
51
|
+
DecimalPrecision[DecimalPrecision["One"] = 1] = "One";
|
|
52
|
+
DecimalPrecision[DecimalPrecision["Two"] = 2] = "Two";
|
|
53
|
+
DecimalPrecision[DecimalPrecision["Three"] = 3] = "Three";
|
|
54
|
+
DecimalPrecision[DecimalPrecision["Four"] = 4] = "Four";
|
|
55
|
+
DecimalPrecision[DecimalPrecision["Five"] = 5] = "Five";
|
|
56
|
+
DecimalPrecision[DecimalPrecision["Six"] = 6] = "Six";
|
|
57
|
+
DecimalPrecision[DecimalPrecision["Seven"] = 7] = "Seven";
|
|
58
|
+
DecimalPrecision[DecimalPrecision["Eight"] = 8] = "Eight";
|
|
59
|
+
DecimalPrecision[DecimalPrecision["Nine"] = 9] = "Nine";
|
|
60
|
+
DecimalPrecision[DecimalPrecision["Ten"] = 10] = "Ten";
|
|
61
|
+
DecimalPrecision[DecimalPrecision["Eleven"] = 11] = "Eleven";
|
|
62
|
+
DecimalPrecision[DecimalPrecision["Twelve"] = 12] = "Twelve";
|
|
63
|
+
})(DecimalPrecision || (DecimalPrecision = {}));
|
|
64
|
+
/** Supported format types
|
|
65
|
+
* @beta */
|
|
66
|
+
export var FormatType;
|
|
67
|
+
(function (FormatType) {
|
|
68
|
+
/** Decimal display (ie 2.125) */
|
|
69
|
+
FormatType[FormatType["Decimal"] = 0] = "Decimal";
|
|
70
|
+
/** Fractional display (ie 2-1/8) */
|
|
71
|
+
FormatType[FormatType["Fractional"] = 1] = "Fractional";
|
|
72
|
+
/** Scientific Notation (ie 1.04e3) */
|
|
73
|
+
FormatType[FormatType["Scientific"] = 2] = "Scientific";
|
|
74
|
+
/** Civil Engineering Stationing (ie 1+00). */
|
|
75
|
+
FormatType[FormatType["Station"] = 3] = "Station";
|
|
76
|
+
})(FormatType || (FormatType = {}));
|
|
77
|
+
/** required if type is scientific
|
|
78
|
+
* @beta */
|
|
79
|
+
export var ScientificType;
|
|
80
|
+
(function (ScientificType) {
|
|
81
|
+
/** Non-zero value left of decimal point (ie 1.2345e3) */
|
|
82
|
+
ScientificType[ScientificType["Normalized"] = 0] = "Normalized";
|
|
83
|
+
/** Zero value left of decimal point (ie 0.12345e4) */
|
|
84
|
+
ScientificType[ScientificType["ZeroNormalized"] = 1] = "ZeroNormalized";
|
|
85
|
+
})(ScientificType || (ScientificType = {}));
|
|
86
|
+
/** Determines how the sign of values are displayed
|
|
87
|
+
* @beta */
|
|
88
|
+
export var ShowSignOption;
|
|
89
|
+
(function (ShowSignOption) {
|
|
90
|
+
/** Never show a sign even if the value is negative. */
|
|
91
|
+
ShowSignOption[ShowSignOption["NoSign"] = 0] = "NoSign";
|
|
92
|
+
/** Only show a sign when the value is negative. */
|
|
93
|
+
ShowSignOption[ShowSignOption["OnlyNegative"] = 1] = "OnlyNegative";
|
|
94
|
+
/** Always show a sign whether the value is positive or negative. */
|
|
95
|
+
ShowSignOption[ShowSignOption["SignAlways"] = 2] = "SignAlways";
|
|
96
|
+
/** Only show a sign when the value is negative but use parentheses instead of a negative sign. For example, -10 is formatted as `(10)`. */
|
|
97
|
+
ShowSignOption[ShowSignOption["NegativeParentheses"] = 3] = "NegativeParentheses";
|
|
98
|
+
})(ShowSignOption || (ShowSignOption = {}));
|
|
99
|
+
//# sourceMappingURL=FormatEnums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatEnums.js","sourceRo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pB,iCAAiC;IACjC,iDAAO,CAAA;IACP,oCAAoC;IACpC,uDAAU,CAAA;IACV,sCAAsC;IACtC,uDAAU,CAAA;IACV,8CAA8C;IAC9C,iDAAO,CAAA;AACT,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAED;WACW;AACX,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,yDAAyD;IACzD,+DAAU,CAAA;IACV,sDAAsD;IACtD,uEAAc,CAAA;AAChB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED;WACW;AACX,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB,uDAAuD;IACvD,uDAAM,CAAA;IACN,mDAAmD;IACnD,mEAAY,CAAA;IACZ,oEAAoE;IACpE,+DAAU,CAAA;IACV,2IAA2I;IAC3I,iFAAmB,CAAA;AACrB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB","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 Quantity\n */\n\n/** @beta */\nexport enum FormatTraits {\n /** Show trailing zeroes to requested precision */\n TrailZeroes = 0x1,\n /** Indicates that the fractional part of the number is required when the fraction is zero */\n KeepSingleZero = 0x2,\n /** Zero magnitude returns blank display value */\n ZeroEmpty = 0x4,\n /** Show decimal point when value to right of decimal is empty */\n KeepDecimalPoint = 0x8,\n /** Use the rounding factor. Not yet supported */\n ApplyRounding = 0x10,\n /** Show a dash between whole value and fractional value */\n FractionDash = 0x20,\n /** Append the quantity's unit label */\n ShowUnitLabel = 0x40,\n /** Prepend unit label. Not yet supported */\n PrependUnitLabel = 0x80,\n /** show a grouping in each group of 1000. */\n Use1000Separator = 0x100,\n /** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */\n ExponentOnlyNegative = 0x200,\n}\n\n/** Precision for Fractional formatted value types. Range from Whole (1/1) through 1/256.\n * @beta */\nexport enum FractionalPrecision {\n One = 1,\n Two = 2,\n Four = 4,\n Eight = 8,\n Sixteen = 16,\n ThirtyTwo = 32,\n SixtyFour = 64,\n OneHundredTwentyEight = 128,\n TwoHundredFiftySix = 256,\n}\n\n/** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12).\n * @beta */\nexport enum DecimalPrecision {\n Zero = 0,\n One = 1,\n Two = 2,\n Three = 3,\n Four = 4,\n Five = 5,\n Six = 6,\n Seven = 7,\n Eight = 8,\n Nine = 9,\n Ten = 10,\n Eleven = 11,\n Twelve = 12,\n}\n\n/** Supported format types\n * @beta */\nexport enum FormatType {\n /** Decimal display (ie 2.125) */\n Decimal,\n /** Fractional display (ie 2-1/8) */\n Fractional,\n /** Scientific Notation (ie 1.04e3) */\n Scientific,\n /** Civil Engineering Stationing (ie 1+00). */\n Station,\n}\n\n/** required if type is scientific\n * @beta */\nexport enum ScientificType {\n /** Non-zero value left of decimal point (ie 1.2345e3) */\n Normalized,\n /** Zero value left of decimal point (ie 0.12345e4) */\n ZeroNormalized,\n}\n\n/** Determines how the sign of values are displayed\n * @beta */\nexport enum ShowSignOption {\n /** Never show a sign even if the value is negative. */\n NoSign,\n /** Only show a sign when the value is negative. */\n OnlyNegative,\n /** Always show a sign whether the value is positive or negative. */\n SignAlways,\n /** Only show a sign when the value is negative but use parentheses instead of a negative sign. For example, -10 is formatted as `(10)`. */\n NegativeParentheses,\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Quantity
|
|
3
|
+
*/
|
|
4
|
+
import { FormatterSpec } from "./FormatterSpec";
|
|
5
|
+
/** A helper class that contains methods used to format quantity values based on a format that are defined via the Format class.
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare class Formatter {
|
|
9
|
+
private static FPV_MINTHRESHOLD;
|
|
10
|
+
private static isNegligible;
|
|
11
|
+
/** Return floating point value rounded by specific rounding factor.
|
|
12
|
+
* @param value Value to be rounded.
|
|
13
|
+
* @param roundTo Rounding factor.
|
|
14
|
+
*/
|
|
15
|
+
private static roundDouble;
|
|
16
|
+
/** Generate a formatted text string integer value insert 1000 separators if appropriate.
|
|
17
|
+
* @param wholePart Integer value to be formatted.
|
|
18
|
+
*/
|
|
19
|
+
private static integerPartToText;
|
|
20
|
+
/** Trim trailing "0" from the text that represent the fractional part of a floating point value.
|
|
21
|
+
* @param strVal The value string.
|
|
22
|
+
*/
|
|
23
|
+
private static trimTrailingZeroes;
|
|
24
|
+
/** Format a quantity value into a composite format such as ft-in or deg-min-sec.
|
|
25
|
+
* @param compositeValue The value for this part of the composite
|
|
26
|
+
* @param isLastPart If false the composite value should be a whole value, if true then the value should be formatted as a floating point value.
|
|
27
|
+
* @param label Label for this part of the composite. This will be either the default unit label or a custom label specified the format specification.
|
|
28
|
+
*/
|
|
29
|
+
private static formatCompositePart;
|
|
30
|
+
/** Format a quantity value into a composite format such as ft-in or deg-min-sec.
|
|
31
|
+
* @param magnitude quantity value
|
|
32
|
+
* @param fromUnit quantity unit
|
|
33
|
+
*/
|
|
34
|
+
private static formatComposite;
|
|
35
|
+
/** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.
|
|
36
|
+
* @param magnitude quantity value
|
|
37
|
+
*/
|
|
38
|
+
private static formatMagnitude;
|
|
39
|
+
/** Format a quantity value into a single text string based on the current format specification of this class.
|
|
40
|
+
* @param magnitude defines the value to spec.format.
|
|
41
|
+
* @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
|
|
42
|
+
*/
|
|
43
|
+
static formatQuantity(magnitude: number, spec: FormatterSpec): string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Formatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAuFhD;;GAEG;AACH,qBAAa,SAAS;IAEpB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAW;IAE1C,OAAO,CAAC,MAAM,CAAC,YAAY;IAE3B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA0BhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAajC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAiBlC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAqC9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA8G9B;;;OAGG;WACW,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM;CAqD7E"}
|