@itwin/core-quantity 5.7.0-dev.5 → 5.7.0-dev.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"FormatEnums.js","sourceRoot":"","sources":["../../../src/Formatter/FormatEnums.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,8JAA8J,CAAC;AAE9L,gBAAgB;AAChB,MAAM,SAAS,CAAC,CAAC,4BAA4B,CAAC,YAAoB;IAChE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClD,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB;IAClC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,mCAAmC;QACpE,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS;YAC5B,MAAM,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY;;YAEpC,MAAM;QACR,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AACD,YAAY;AACZ,MAAM,CAAN,IAAY,YAsBX;AAtBD,WAAY,YAAY;IACtB,iEAAiB,CAAA;IACjB,mDAAmD;IACnD,6DAAoB,CAAA;IACpB,6FAA6F;IAC7F,mEAAuB,CAAA;IACvB,iDAAiD;IACjD,yDAAkB,CAAA;IAClB,iEAAiE;IACjE,uEAAyB,CAAA;IACzB,kDAAkD;IAClD,kEAAsB,CAAA;IACtB,2DAA2D;IAC3D,gEAAqB,CAAA;IACrB,uCAAuC;IACvC,kEAAsB,CAAA;IACtB,4CAA4C;IAC5C,yE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---------------------------------------------------------------------------------------------\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 Quantity\r\n */\r\n\r\nimport { QuantityError, QuantityStatus } from \"../Exception\";\r\n\r\n/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)\r\n * provided in serialized formats as well as the full name of an [[OverrideFormat]].\r\n *\r\n * `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`\r\n *\r\n * Explanation of the regex:\r\n * - ([\\w.:]+)\r\n * - Grabs the format full name\r\n * - (\\(([^\\)]+)\\))?\r\n * - Grabs the precision part with and without the `()`.\r\n * - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)\r\n * - (\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?\r\n * - 4 of these make up the rest of the regex, none of them are required so each end in `?`\r\n * - Grabs the unit name and label including the `[]`\r\n * - Grabs the unit name, `|` and label separately\r\n * @internal\r\n */\r\nexport const formatStringRgx = /([\\w.:]+)(\\(([^\\)]+)\\))?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?/;\r\n\r\n/** @internal */\r\nexport function* getItemNamesFromFormatString(formatString: string): Iterable<string> {\r\n const match = formatString.split(formatStringRgx);\r\n yield match[1]; // the Format Name\r\n let index = 4;\r\n while (index < match.length - 1) { // index 0 and 21 are empty strings\r\n if (match[index] !== undefined)\r\n yield match[index + 1]; // Unit Name\r\n else\r\n break;\r\n index += 4;\r\n }\r\n}\r\n/** @beta */\r\nexport enum FormatTraits {\r\n Uninitialized = 0,\r\n /** Show trailing zeroes to requested precision. */\r\n TrailZeroes = 1 << 0,\r\n /** Indicates that the fractional part of the number is required when the fraction is zero */\r\n KeepSingleZero = 1 << 1,\r\n /** Zero magnitude returns blank display value */\r\n ZeroEmpty = 1 << 2,\r\n /** Show decimal point when value to right of decimal is empty */\r\n KeepDecimalPoint = 1 << 3,\r\n /** Use the rounding factor. Not yet supported */\r\n ApplyRounding = 1 << 4,\r\n /** Show a dash between whole value and fractional value */\r\n FractionDash = 1 << 5,\r\n /** Append the quantity's unit label */\r\n ShowUnitLabel = 1 << 6,\r\n /** Prepend unit label. Not yet supported */\r\n PrependUnitLabel = 1 << 7,\r\n /** show a grouping in each group of 1000. */\r\n Use1000Separator = 1 << 8,\r\n /** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */\r\n ExponentOnlyNegative = 1 << 9,\r\n}\r\n\r\n/** Precision for Fractional formatted value types. Range from Whole (1/1) through 1/256.\r\n * @beta */\r\nexport enum FractionalPrecision {\r\n One = 1,\r\n Two = 2,\r\n Four = 4,\r\n Eight = 8,\r\n Sixteen = 16,\r\n ThirtyTwo = 32,\r\n SixtyFour = 64,\r\n OneHundredTwentyEight = 128,\r\n TwoHundredFiftySix = 256,\r\n}\r\n\r\n/** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12).\r\n * @beta */\r\nexport enum DecimalPrecision {\r\n Zero = 0,\r\n One = 1,\r\n Two = 2,\r\n Three = 3,\r\n Four = 4,\r\n Five = 5,\r\n Six = 6,\r\n Seven = 7,\r\n Eight = 8,\r\n Nine = 9,\r\n Ten = 10,\r\n Eleven = 11,\r\n Twelve = 12,\r\n}\r\n\r\n/** Supported format types\r\n * @beta */\r\nexport enum FormatType {\r\n /** Decimal display (ie 2.125) */\r\n Decimal = \"Decimal\",\r\n /** Fractional display (ie 2-1/8) */\r\n Fractional = \"Fractional\",\r\n /** Scientific Notation (ie 1.04e3) */\r\n Scientific = \"Scientific\",\r\n /** Civil Engineering Stationing (ie 1+00). */\r\n Station = \"Station\",\r\n /** Bearing angle e.g. N05:00:00E. Requires provided quantities to be of the angle phenomenon */\r\n Bearing = \"Bearing\",\r\n /** Azimuth angle e.g. 45°30'00\". Requires provided quantities to be of the angle phenomenon */\r\n Azimuth = \"Azimuth\",\r\n /** Ratio display e,g. 1:2 or 0.3:1. */\r\n Ratio = \"Ratio\",\r\n}\r\n\r\n/** required if type is scientific\r\n * @beta */\r\nexport enum ScientificType {\r\n /** Non-zero value left of decimal point (ie 1.2345e3) */\r\n Normalized = \"Normalized\",\r\n /** Zero value left of decimal point (ie 0.12345e4) */\r\n ZeroNormalized = \"ZeroNormalized\",\r\n}\r\n\r\n/** required if type is ratio\r\n * @beta */\r\nexport enum RatioType {\r\n /** One to N ratio (ie 1:N) */\r\n OneToN = \"OneToN\",\r\n /** N to One ratio (ie N:1) */\r\n NToOne = \"NToOne\",\r\n /** the lesser value scales to 1. e.g. input 0.5 turns into 2:1 | input 2 turns into 1:2 */\r\n ValueBased = \"ValueBased\",\r\n /** scales the input ratio to its simplest integer form using the greatest common divisor (GCD) of the values. e.g. 0.3 turns into 3:10 */\r\n UseGreatestCommonDivisor = \"UseGreatestCommonDivisor\",\r\n}\r\n\r\n/** The format type for the numbers within a ratio.\r\n * @beta\r\n */\r\nexport enum RatioFormatType {\r\n /** Decimal display (ie 2.125) */\r\n Decimal = \"Decimal\",\r\n /** Fractional display (ie 2-1/8) */\r\n Fractional = \"Fractional\",\r\n}\r\n/** Determines how the sign of values are displayed\r\n * @beta */\r\nexport enum ShowSignOption {\r\n /** Never show a sign even if the value is negative. */\r\n NoSign = \"NoSign\",\r\n /** Only show a sign when the value is negative. */\r\n OnlyNegative = \"OnlyNegative\",\r\n /** Always show a sign whether the value is positive or negative. */\r\n SignAlways = \"SignAlways\",\r\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)`. */\r\n NegativeParentheses = \"NegativeParentheses\",\r\n}\r\n\r\n// parse and toString methods\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. ScientificType is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function scientificTypeToString(scientificType: ScientificType): string {\r\n return (scientificType === ScientificType.Normalized) ? \"Normalized\" : \"ZeroNormalized\";\r\n}\r\n\r\n/**\r\n * @beta\r\n*/\r\nexport function parseScientificType(scientificType: string, formatName: string): ScientificType {\r\n switch (scientificType.toLowerCase()) {\r\n case \"normalized\": return ScientificType.Normalized;\r\n case \"zeronormalized\": return ScientificType.ZeroNormalized;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'scientificType' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseRatioType(ratioType: string, formatName: string): RatioType {\r\n const normalizedValue = ratioType.toLowerCase();\r\n for (const key in RatioType) {\r\n if (RatioType.hasOwnProperty(key)) {\r\n const enumValue = RatioType[key as keyof typeof RatioType];\r\n if (enumValue.toLowerCase() === normalizedValue) {\r\n return enumValue as RatioType;\r\n }\r\n }\r\n }\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioType' attribute.`);\r\n}\r\n\r\n/** @beta */\r\nexport function parseRatioFormatType(ratioFormatType: string, formatName: string): RatioFormatType {\r\n const normalizedValue = ratioFormatType.toLowerCase();\r\n for (const key in RatioFormatType) {\r\n if (RatioFormatType.hasOwnProperty(key)) {\r\n const enumValue = RatioFormatType[key as keyof typeof RatioFormatType];\r\n if (enumValue.toLowerCase() === normalizedValue)\r\n return enumValue as RatioFormatType;\r\n }\r\n }\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioFormatType' attribute.`);\r\n}\r\n\r\n/** @beta */\r\nexport function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption {\r\n switch (showSignOption.toLowerCase()) {\r\n case \"nosign\": return ShowSignOption.NoSign;\r\n case \"onlynegative\": return ShowSignOption.OnlyNegative;\r\n case \"signalways\": return ShowSignOption.SignAlways;\r\n case \"negativeparentheses\": return ShowSignOption.NegativeParentheses;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'showSignOption' attribute.`);\r\n }\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. ShowSignOption is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function showSignOptionToString(showSign: ShowSignOption): string {\r\n switch (showSign) {\r\n case ShowSignOption.NegativeParentheses: return \"NegativeParentheses\";\r\n case ShowSignOption.NoSign: return \"NoSign\";\r\n case ShowSignOption.OnlyNegative: return \"OnlyNegative\";\r\n case ShowSignOption.SignAlways: return \"SignAlways\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseFormatTrait(formatTraitsString: string, formatName: string): FormatTraits {\r\n switch (formatTraitsString.toLowerCase()) {\r\n case \"trailzeroes\": return FormatTraits.TrailZeroes;\r\n case \"keepsinglezero\": return FormatTraits.KeepSingleZero;\r\n case \"zeroempty\": return FormatTraits.ZeroEmpty;\r\n case \"keepdecimalpoint\": return FormatTraits.KeepDecimalPoint;\r\n case \"applyrounding\": return FormatTraits.ApplyRounding;\r\n case \"fractiondash\": return FormatTraits.FractionDash;\r\n case \"showunitlabel\": return FormatTraits.ShowUnitLabel;\r\n case \"prependunitlabel\": return FormatTraits.PrependUnitLabel;\r\n case \"use1000separator\": return FormatTraits.Use1000Separator;\r\n case \"exponentonlynegative\": return FormatTraits.ExponentOnlyNegative;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'formatTraits' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function getTraitString(trait: FormatTraits) {\r\n switch (trait) {\r\n case FormatTraits.TrailZeroes:\r\n return \"trailZeroes\";\r\n case FormatTraits.KeepSingleZero:\r\n return \"keepSingleZero\";\r\n case FormatTraits.ZeroEmpty:\r\n return \"zeroEmpty\";\r\n case FormatTraits.KeepDecimalPoint:\r\n return \"keepDecimalPoint\";\r\n case FormatTraits.ApplyRounding:\r\n return \"applyRounding\";\r\n case FormatTraits.FractionDash:\r\n return \"fractionDash\";\r\n case FormatTraits.ShowUnitLabel:\r\n return \"showUnitLabel\";\r\n case FormatTraits.PrependUnitLabel:\r\n return \"prependUnitLabel\";\r\n case FormatTraits.Use1000Separator:\r\n return \"use1000Separator\";\r\n case FormatTraits.ExponentOnlyNegative:\r\n default:\r\n return \"exponentOnlyNegative\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function formatTraitsToArray(currentFormatTrait: FormatTraits): string[] {\r\n const formatTraitsArr = Array<string>();\r\n if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes)\r\n formatTraitsArr.push(\"TrailZeroes\");\r\n if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero)\r\n formatTraitsArr.push(\"KeepSingleZero\");\r\n if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty)\r\n formatTraitsArr.push(\"ZeroEmpty\");\r\n if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint)\r\n formatTraitsArr.push(\"KeepDecimalPoint\");\r\n if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding)\r\n formatTraitsArr.push(\"ApplyRounding\");\r\n if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash)\r\n formatTraitsArr.push(\"FractionDash\");\r\n if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel)\r\n formatTraitsArr.push(\"ShowUnitLabel\");\r\n if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel)\r\n formatTraitsArr.push(\"PrependUnitLabel\");\r\n if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator)\r\n formatTraitsArr.push(\"Use1000Separator\");\r\n if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative)\r\n formatTraitsArr.push(\"ExponentOnlyNegative\");\r\n return formatTraitsArr;\r\n}\r\n\r\n/** @beta */\r\nexport function parseFormatType(jsonObjType: string, formatName: string): FormatType {\r\n switch (jsonObjType.toLowerCase()) {\r\n case \"decimal\": return FormatType.Decimal;\r\n case \"scientific\": return FormatType.Scientific;\r\n case \"station\": return FormatType.Station;\r\n case \"fractional\": return FormatType.Fractional;\r\n case \"bearing\": return FormatType.Bearing;\r\n case \"azimuth\": return FormatType.Azimuth;\r\n case \"ratio\": return FormatType.Ratio;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'type' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. FormatType is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function formatTypeToString(type: FormatType): string {\r\n switch (type) {\r\n case FormatType.Decimal: return \"Decimal\";\r\n case FormatType.Scientific: return \"Scientific\";\r\n case FormatType.Station: return \"Station\";\r\n case FormatType.Fractional: return \"Fractional\";\r\n case FormatType.Bearing: return \"Bearing\";\r\n case FormatType.Azimuth: return \"Azimuth\";\r\n case FormatType.Ratio: return \"Ratio\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseDecimalPrecision(jsonObjPrecision: number, formatName: string): DecimalPrecision {\r\n switch (jsonObjPrecision) {\r\n case 0: return DecimalPrecision.Zero;\r\n case 1: return DecimalPrecision.One;\r\n case 2: return DecimalPrecision.Two;\r\n case 3: return DecimalPrecision.Three;\r\n case 4: return DecimalPrecision.Four;\r\n case 5: return DecimalPrecision.Five;\r\n case 6: return DecimalPrecision.Six;\r\n case 7: return DecimalPrecision.Seven;\r\n case 8: return DecimalPrecision.Eight;\r\n case 9: return DecimalPrecision.Nine;\r\n case 10: return DecimalPrecision.Ten;\r\n case 11: return DecimalPrecision.Eleven;\r\n case 12: return DecimalPrecision.Twelve;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision */\r\nexport function parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision {\r\n switch (jsonObjPrecision) {\r\n case 1: return FractionalPrecision.One;\r\n case 2: return FractionalPrecision.Two;\r\n case 4: return FractionalPrecision.Four;\r\n case 8: return FractionalPrecision.Eight;\r\n case 16: return FractionalPrecision.Sixteen;\r\n case 32: return FractionalPrecision.ThirtyTwo;\r\n case 64: return FractionalPrecision.SixtyFour;\r\n case 128: return FractionalPrecision.OneHundredTwentyEight;\r\n case 256: return FractionalPrecision.TwoHundredFiftySix;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. */\r\nexport function parsePrecision(precision: number, type: FormatType, formatName: string): DecimalPrecision | FractionalPrecision {\r\n switch (type) { // type must be decimal, fractional, scientific, or station\r\n case FormatType.Decimal:\r\n case FormatType.Scientific:\r\n case FormatType.Station:\r\n case FormatType.Bearing:\r\n case FormatType.Azimuth:\r\n return parseDecimalPrecision(precision, formatName);\r\n case FormatType.Ratio:\r\n // Ratio type can use either decimal or fractional precision depending on ratioFormatType\r\n // Try decimal first, if it fails, try fractional\r\n try {\r\n return parseDecimalPrecision(precision, formatName);\r\n } catch {\r\n return parseFractionalPrecision(precision, formatName);\r\n }\r\n case FormatType.Fractional:\r\n return parseFractionalPrecision(precision, formatName);\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FormatEnums.js","sourceRoot":"","sources":["../../../src/Formatter/FormatEnums.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AAC,CAAC,OAAO,mBAAmB,CAAC,qBAAqB,CAAC;QAC3D,KAAK,GAAG,CAAC,CAAC,OAAO,mBAAmB,CAAC,kBAAkB,CAAC;QACxD;YACE,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC;AAED,iJAAiJ;AACjJ,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAgB,EAAE,UAAkB;IACpF,QAAQ,IAAI,EAAE,CAAC,CAAC,2DAA2D;QACzE,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,UAAU,CAAC;QAC3B,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACtD,KAAK,UAAU,CAAC,KAAK;YACnB,yFAAyF;YACzF,iDAAiD;YACjD,IAAI,CAAC;gBACH,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACtD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,KAAK,UAAU,CAAC,UAAU;YACxB,OAAO,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACzD;YACE,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,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 Quantity\r\n */\r\n\r\nimport { QuantityError, QuantityStatus } from \"../Exception\";\r\n\r\n/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)\r\n * provided in serialized formats as well as the full name of an [[OverrideFormat]].\r\n *\r\n * `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`\r\n *\r\n * Explanation of the regex:\r\n * - ([\\w.:]+)\r\n * - Grabs the format full name\r\n * - (\\(([^\\)]+)\\))?\r\n * - Grabs the precision part with and without the `()`.\r\n * - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)\r\n * - (\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?\r\n * - 4 of these make up the rest of the regex, none of them are required so each end in `?`\r\n * - Grabs the unit name and label including the `[]`\r\n * - Grabs the unit name, `|` and label separately\r\n * @internal\r\n */\r\nexport const formatStringRgx = /([\\w.:]+)(\\(([^\\)]+)\\))?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?/;\r\n\r\n/** @internal */\r\nexport function* getItemNamesFromFormatString(formatString: string): Iterable<string> {\r\n const match = formatString.split(formatStringRgx);\r\n yield match[1]; // the Format Name\r\n let index = 4;\r\n while (index < match.length - 1) { // index 0 and 21 are empty strings\r\n if (match[index] !== undefined)\r\n yield match[index + 1]; // Unit Name\r\n else\r\n break;\r\n index += 4;\r\n }\r\n}\r\n/** @beta */\r\nexport enum FormatTraits {\r\n Uninitialized = 0,\r\n /** Show trailing zeroes to requested precision. */\r\n TrailZeroes = 1 << 0,\r\n /** Indicates that the fractional part of the number is required when the fraction is zero */\r\n KeepSingleZero = 1 << 1,\r\n /** Zero magnitude returns blank display value */\r\n ZeroEmpty = 1 << 2,\r\n /** Show decimal point when value to right of decimal is empty */\r\n KeepDecimalPoint = 1 << 3,\r\n /** Use the rounding factor. Not yet supported */\r\n ApplyRounding = 1 << 4,\r\n /** Show a dash between whole value and fractional value */\r\n FractionDash = 1 << 5,\r\n /** Append the quantity's unit label */\r\n ShowUnitLabel = 1 << 6,\r\n /** Prepend unit label. Not yet supported */\r\n PrependUnitLabel = 1 << 7,\r\n /** show a grouping in each group of 1000. */\r\n Use1000Separator = 1 << 8,\r\n /** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */\r\n ExponentOnlyNegative = 1 << 9,\r\n}\r\n\r\n/** Precision for Fractional formatted value types. Values must be powers of 2, ranging from Whole (1/1) through 1/256.\r\n * @beta */\r\nexport enum FractionalPrecision {\r\n One = 1,\r\n Two = 2,\r\n Four = 4,\r\n Eight = 8,\r\n Sixteen = 16,\r\n ThirtyTwo = 32,\r\n SixtyFour = 64,\r\n OneHundredTwentyEight = 128,\r\n TwoHundredFiftySix = 256,\r\n}\r\n\r\n/** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12).\r\n * @beta */\r\nexport enum DecimalPrecision {\r\n Zero = 0,\r\n One = 1,\r\n Two = 2,\r\n Three = 3,\r\n Four = 4,\r\n Five = 5,\r\n Six = 6,\r\n Seven = 7,\r\n Eight = 8,\r\n Nine = 9,\r\n Ten = 10,\r\n Eleven = 11,\r\n Twelve = 12,\r\n}\r\n\r\n/** Supported format types\r\n * @beta */\r\nexport enum FormatType {\r\n /** Decimal display (ie 2.125) */\r\n Decimal = \"Decimal\",\r\n /** Fractional display (ie 2-1/8) */\r\n Fractional = \"Fractional\",\r\n /** Scientific Notation (ie 1.04e3) */\r\n Scientific = \"Scientific\",\r\n /** Civil Engineering Stationing (ie 1+00). */\r\n Station = \"Station\",\r\n /** Bearing angle e.g. N05:00:00E. Requires provided quantities to be of the angle phenomenon */\r\n Bearing = \"Bearing\",\r\n /** Azimuth angle e.g. 45°30'00\". Requires provided quantities to be of the angle phenomenon */\r\n Azimuth = \"Azimuth\",\r\n /** Ratio display e,g. 1:2 or 0.3:1. */\r\n Ratio = \"Ratio\",\r\n}\r\n\r\n/** required if type is scientific\r\n * @beta */\r\nexport enum ScientificType {\r\n /** Non-zero value left of decimal point (ie 1.2345e3) */\r\n Normalized = \"Normalized\",\r\n /** Zero value left of decimal point (ie 0.12345e4) */\r\n ZeroNormalized = \"ZeroNormalized\",\r\n}\r\n\r\n/** required if type is ratio\r\n * @beta */\r\nexport enum RatioType {\r\n /** One to N ratio (ie 1:N) */\r\n OneToN = \"OneToN\",\r\n /** N to One ratio (ie N:1) */\r\n NToOne = \"NToOne\",\r\n /** the lesser value scales to 1. e.g. input 0.5 turns into 2:1 | input 2 turns into 1:2 */\r\n ValueBased = \"ValueBased\",\r\n /** scales the input ratio to its simplest integer form using the greatest common divisor (GCD) of the values. e.g. 0.3 turns into 3:10 */\r\n UseGreatestCommonDivisor = \"UseGreatestCommonDivisor\",\r\n}\r\n\r\n/** The format type for the numbers within a ratio.\r\n * @beta\r\n */\r\nexport enum RatioFormatType {\r\n /** Decimal display (ie 2.125) */\r\n Decimal = \"Decimal\",\r\n /** Fractional display (ie 2-1/8) */\r\n Fractional = \"Fractional\",\r\n}\r\n/** Determines how the sign of values are displayed\r\n * @beta */\r\nexport enum ShowSignOption {\r\n /** Never show a sign even if the value is negative. */\r\n NoSign = \"NoSign\",\r\n /** Only show a sign when the value is negative. */\r\n OnlyNegative = \"OnlyNegative\",\r\n /** Always show a sign whether the value is positive or negative. */\r\n SignAlways = \"SignAlways\",\r\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)`. */\r\n NegativeParentheses = \"NegativeParentheses\",\r\n}\r\n\r\n// parse and toString methods\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. ScientificType is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function scientificTypeToString(scientificType: ScientificType): string {\r\n return (scientificType === ScientificType.Normalized) ? \"Normalized\" : \"ZeroNormalized\";\r\n}\r\n\r\n/**\r\n * @beta\r\n*/\r\nexport function parseScientificType(scientificType: string, formatName: string): ScientificType {\r\n switch (scientificType.toLowerCase()) {\r\n case \"normalized\": return ScientificType.Normalized;\r\n case \"zeronormalized\": return ScientificType.ZeroNormalized;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'scientificType' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseRatioType(ratioType: string, formatName: string): RatioType {\r\n const normalizedValue = ratioType.toLowerCase();\r\n for (const key in RatioType) {\r\n if (RatioType.hasOwnProperty(key)) {\r\n const enumValue = RatioType[key as keyof typeof RatioType];\r\n if (enumValue.toLowerCase() === normalizedValue) {\r\n return enumValue as RatioType;\r\n }\r\n }\r\n }\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioType' attribute.`);\r\n}\r\n\r\n/** @beta */\r\nexport function parseRatioFormatType(ratioFormatType: string, formatName: string): RatioFormatType {\r\n const normalizedValue = ratioFormatType.toLowerCase();\r\n for (const key in RatioFormatType) {\r\n if (RatioFormatType.hasOwnProperty(key)) {\r\n const enumValue = RatioFormatType[key as keyof typeof RatioFormatType];\r\n if (enumValue.toLowerCase() === normalizedValue)\r\n return enumValue as RatioFormatType;\r\n }\r\n }\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioFormatType' attribute.`);\r\n}\r\n\r\n/** @beta */\r\nexport function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption {\r\n switch (showSignOption.toLowerCase()) {\r\n case \"nosign\": return ShowSignOption.NoSign;\r\n case \"onlynegative\": return ShowSignOption.OnlyNegative;\r\n case \"signalways\": return ShowSignOption.SignAlways;\r\n case \"negativeparentheses\": return ShowSignOption.NegativeParentheses;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'showSignOption' attribute.`);\r\n }\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. ShowSignOption is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function showSignOptionToString(showSign: ShowSignOption): string {\r\n switch (showSign) {\r\n case ShowSignOption.NegativeParentheses: return \"NegativeParentheses\";\r\n case ShowSignOption.NoSign: return \"NoSign\";\r\n case ShowSignOption.OnlyNegative: return \"OnlyNegative\";\r\n case ShowSignOption.SignAlways: return \"SignAlways\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseFormatTrait(formatTraitsString: string, formatName: string): FormatTraits {\r\n switch (formatTraitsString.toLowerCase()) {\r\n case \"trailzeroes\": return FormatTraits.TrailZeroes;\r\n case \"keepsinglezero\": return FormatTraits.KeepSingleZero;\r\n case \"zeroempty\": return FormatTraits.ZeroEmpty;\r\n case \"keepdecimalpoint\": return FormatTraits.KeepDecimalPoint;\r\n case \"applyrounding\": return FormatTraits.ApplyRounding;\r\n case \"fractiondash\": return FormatTraits.FractionDash;\r\n case \"showunitlabel\": return FormatTraits.ShowUnitLabel;\r\n case \"prependunitlabel\": return FormatTraits.PrependUnitLabel;\r\n case \"use1000separator\": return FormatTraits.Use1000Separator;\r\n case \"exponentonlynegative\": return FormatTraits.ExponentOnlyNegative;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'formatTraits' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function getTraitString(trait: FormatTraits) {\r\n switch (trait) {\r\n case FormatTraits.TrailZeroes:\r\n return \"trailZeroes\";\r\n case FormatTraits.KeepSingleZero:\r\n return \"keepSingleZero\";\r\n case FormatTraits.ZeroEmpty:\r\n return \"zeroEmpty\";\r\n case FormatTraits.KeepDecimalPoint:\r\n return \"keepDecimalPoint\";\r\n case FormatTraits.ApplyRounding:\r\n return \"applyRounding\";\r\n case FormatTraits.FractionDash:\r\n return \"fractionDash\";\r\n case FormatTraits.ShowUnitLabel:\r\n return \"showUnitLabel\";\r\n case FormatTraits.PrependUnitLabel:\r\n return \"prependUnitLabel\";\r\n case FormatTraits.Use1000Separator:\r\n return \"use1000Separator\";\r\n case FormatTraits.ExponentOnlyNegative:\r\n default:\r\n return \"exponentOnlyNegative\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function formatTraitsToArray(currentFormatTrait: FormatTraits): string[] {\r\n const formatTraitsArr = Array<string>();\r\n if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes)\r\n formatTraitsArr.push(\"TrailZeroes\");\r\n if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero)\r\n formatTraitsArr.push(\"KeepSingleZero\");\r\n if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty)\r\n formatTraitsArr.push(\"ZeroEmpty\");\r\n if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint)\r\n formatTraitsArr.push(\"KeepDecimalPoint\");\r\n if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding)\r\n formatTraitsArr.push(\"ApplyRounding\");\r\n if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash)\r\n formatTraitsArr.push(\"FractionDash\");\r\n if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel)\r\n formatTraitsArr.push(\"ShowUnitLabel\");\r\n if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel)\r\n formatTraitsArr.push(\"PrependUnitLabel\");\r\n if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator)\r\n formatTraitsArr.push(\"Use1000Separator\");\r\n if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative)\r\n formatTraitsArr.push(\"ExponentOnlyNegative\");\r\n return formatTraitsArr;\r\n}\r\n\r\n/** @beta */\r\nexport function parseFormatType(jsonObjType: string, formatName: string): FormatType {\r\n switch (jsonObjType.toLowerCase()) {\r\n case \"decimal\": return FormatType.Decimal;\r\n case \"scientific\": return FormatType.Scientific;\r\n case \"station\": return FormatType.Station;\r\n case \"fractional\": return FormatType.Fractional;\r\n case \"bearing\": return FormatType.Bearing;\r\n case \"azimuth\": return FormatType.Azimuth;\r\n case \"ratio\": return FormatType.Ratio;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'type' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. FormatType is now a string enum and doesn't need a serialization method. You can access the enum directly.\r\n*/\r\nexport function formatTypeToString(type: FormatType): string {\r\n switch (type) {\r\n case FormatType.Decimal: return \"Decimal\";\r\n case FormatType.Scientific: return \"Scientific\";\r\n case FormatType.Station: return \"Station\";\r\n case FormatType.Fractional: return \"Fractional\";\r\n case FormatType.Bearing: return \"Bearing\";\r\n case FormatType.Azimuth: return \"Azimuth\";\r\n case FormatType.Ratio: return \"Ratio\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function parseDecimalPrecision(jsonObjPrecision: number, formatName: string): DecimalPrecision {\r\n switch (jsonObjPrecision) {\r\n case 0: return DecimalPrecision.Zero;\r\n case 1: return DecimalPrecision.One;\r\n case 2: return DecimalPrecision.Two;\r\n case 3: return DecimalPrecision.Three;\r\n case 4: return DecimalPrecision.Four;\r\n case 5: return DecimalPrecision.Five;\r\n case 6: return DecimalPrecision.Six;\r\n case 7: return DecimalPrecision.Seven;\r\n case 8: return DecimalPrecision.Eight;\r\n case 9: return DecimalPrecision.Nine;\r\n case 10: return DecimalPrecision.Ten;\r\n case 11: return DecimalPrecision.Eleven;\r\n case 12: return DecimalPrecision.Twelve;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision */\r\nexport function parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision {\r\n switch (jsonObjPrecision) {\r\n case 1: return FractionalPrecision.One;\r\n case 2: return FractionalPrecision.Two;\r\n case 4: return FractionalPrecision.Four;\r\n case 8: return FractionalPrecision.Eight;\r\n case 16: return FractionalPrecision.Sixteen;\r\n case 32: return FractionalPrecision.ThirtyTwo;\r\n case 64: return FractionalPrecision.SixtyFour;\r\n case 128: return FractionalPrecision.OneHundredTwentyEight;\r\n case 256: return FractionalPrecision.TwoHundredFiftySix;\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n\r\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. */\r\nexport function parsePrecision(precision: number, type: FormatType, formatName: string): DecimalPrecision | FractionalPrecision {\r\n switch (type) { // type must be decimal, fractional, scientific, or station\r\n case FormatType.Decimal:\r\n case FormatType.Scientific:\r\n case FormatType.Station:\r\n case FormatType.Bearing:\r\n case FormatType.Azimuth:\r\n return parseDecimalPrecision(precision, formatName);\r\n case FormatType.Ratio:\r\n // Ratio type can use either decimal or fractional precision depending on ratioFormatType\r\n // Try decimal first, if it fails, try fractional\r\n try {\r\n return parseDecimalPrecision(precision, formatName);\r\n } catch {\r\n return parseFractionalPrecision(precision, formatName);\r\n }\r\n case FormatType.Fractional:\r\n return parseFractionalPrecision(precision, formatName);\r\n default:\r\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\r\n }\r\n}\r\n"]}
@@ -29,8 +29,9 @@ export interface ResolvedFormatUnitSpec {
29
29
  * @beta
30
30
  */
31
31
  export interface FormatCompositeProps {
32
- /** separates values when formatting composite strings */
32
+ /** Separator character between unit values when formatting composite strings. Must be empty or a single character. */
33
33
  readonly spacer?: string;
34
+ /** Whether to include unit segments with zero magnitude in the formatted output. */
34
35
  readonly includeZero?: boolean;
35
36
  /** Array of units this format is comprised of. Each unit specifies the unit name and
36
37
  * an optional custom label that will override the unit's default label when displaying values. */
@@ -40,37 +41,49 @@ export interface FormatCompositeProps {
40
41
  * @beta
41
42
  */
42
43
  export interface FormatProps {
44
+ /** The format type. See [[FormatType]] */
43
45
  readonly type: string;
46
+ /** The precision for the format. Must be an integer. See [[DecimalPrecision]] and [[FractionalPrecision]] */
44
47
  readonly precision?: number;
48
+ /** Value is rounded to a multiple of this factor if nonzero and the `applyRounding` trait is set, defaults to 0 */
45
49
  readonly roundFactor?: number;
50
+ /** Minimum width of the formatted output including digits and separators. Must be a positive integer (≥ 0). */
46
51
  readonly minWidth?: number;
52
+ /** How and when positive and negative signs are displayed. See [[ShowSignOption]] */
47
53
  readonly showSignOption?: string;
54
+ /** Array of format traits controlling display behavior. See [[FormatTraits]] */
48
55
  readonly formatTraits?: string | string[];
56
+ /** Character separating integer from fractional part. Must be empty or a single character. */
49
57
  readonly decimalSeparator?: string;
58
+ /** Character separating thousands in the integer part. Must be empty or a single character. */
50
59
  readonly thousandSeparator?: string;
60
+ /** Character separating the magnitude from the unit label. Must be empty or a single character. */
51
61
  readonly uomSeparator?: string;
52
- /** conditionally required. */
62
+ /** Required when type is Scientific. See [[ScientificType]] */
53
63
  readonly scientificType?: string;
54
- /** conditionally required. */
64
+ /** Required when type is Ratio. See [[RatioType]]*/
55
65
  readonly ratioType?: string;
56
66
  /** The separator character for ratio formatting. Defaults to ':' if not specified. */
57
67
  readonly ratioSeparator?: string;
58
68
  /** The format type for the numbers within a ratio. Defaults to "Decimal". */
59
69
  readonly ratioFormatType?: string;
60
- /** conditionally required. */
70
+ /** Required when type is Station. Number of decimal places for calculating station offset magnitude. Must be a positive integer > 0. */
61
71
  readonly stationOffsetSize?: number;
72
+ /** Character separating station and offset portions of a Station formatted value. Must be empty or a single character. */
62
73
  readonly stationSeparator?: string;
63
74
  /** Optional base factor for station formatting. A positive integer, defaults to 1. */
64
75
  readonly stationBaseFactor?: number;
65
76
  /** The base value for azimuth, specified from east counter-clockwise. */
66
77
  readonly azimuthBase?: number;
67
- /** The name of the unit for the azimuth base value. */
78
+ /** The name of the unit for the azimuth base value. Required if azimuthBase is set. */
68
79
  readonly azimuthBaseUnit?: string;
69
80
  /** If set to true, azimuth values are returned counter-clockwise from the base. */
70
81
  readonly azimuthCounterClockwise?: boolean;
71
82
  /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */
72
83
  readonly revolutionUnit?: string;
84
+ /** Enables calculating mathematic operations during parsing; only addition and subtraction are supported. */
73
85
  readonly allowMathematicOperations?: boolean;
86
+ /** Composite format specification for multi-unit display. */
74
87
  readonly composite?: FormatCompositeProps;
75
88
  }
76
89
  /** This interface is used when supporting Custom Formatters that need more than the standard set of properties.
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEhG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CA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SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AA+FH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAA6B,EAAE;IAClF,OAAQ,IAA0B,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,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 Quantity\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { UnitProps } from \"../Interfaces\";\r\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\r\n\r\n/** Defines a unit specification with a name and optional label override.\r\n * Used in composite formats and ratio unit specifications.\r\n * @beta\r\n */\r\nexport interface FormatUnitSpec {\r\n /** The name of the unit (e.g., \"Units.FT\", \"Units.IN\") */\r\n readonly name: string;\r\n /** Optional custom label that overrides the unit's default label (e.g., '\"' for inches, \"'\" for feet) */\r\n readonly label?: string;\r\n}\r\n\r\n/** A resolved [[FormatUnitSpec]] with the unit name replaced with the resolved UnitProps.\r\n * @beta\r\n */\r\nexport interface ResolvedFormatUnitSpec {\r\n /** The resolved unit */\r\n readonly unit: UnitProps;\r\n /** Optional custom label that overrides the unit's default label */\r\n readonly label?: string;\r\n}\r\n\r\n/** Defines the units that make up a composite format and their display properties.\r\n * A composite format allows displaying a single quantity value across multiple units,\r\n * such as displaying length as \"5 feet 6 inches\" or angle as \"45° 30' 15\"\".\r\n * @beta\r\n */\r\nexport interface FormatCompositeProps {\r\n /** separates values when formatting composite strings */\r\n readonly spacer?: string;\r\n readonly includeZero?: boolean;\r\n /** Array of units this format is comprised of. Each unit specifies the unit name and\r\n * an optional custom label that will override the unit's default label when displaying values. */\r\n readonly units: FormatUnitSpec[];\r\n}\r\n\r\n/** This interface defines the persistence format for describing the formatting of quantity values.\r\n * @beta\r\n */\r\nexport interface FormatProps {\r\n readonly type: string;\r\n readonly precision?: number;\r\n readonly roundFactor?: number;\r\n readonly minWidth?: number;\r\n readonly showSignOption?: string;\r\n readonly formatTraits?: string | string[];\r\n readonly decimalSeparator?: string;\r\n readonly thousandSeparator?: string;\r\n readonly uomSeparator?: string;\r\n\r\n /** conditionally required. */\r\n readonly scientificType?: string;\r\n\r\n /** conditionally required. */\r\n readonly ratioType?: string;\r\n /** The separator character for ratio formatting. Defaults to ':' if not specified. */\r\n readonly ratioSeparator?: string;\r\n /** The format type for the numbers within a ratio. Defaults to \"Decimal\". */\r\n readonly ratioFormatType?: string;\r\n\r\n /** conditionally required. */\r\n readonly stationOffsetSize?: number;\r\n readonly stationSeparator?: string;\r\n\r\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\r\n readonly stationBaseFactor?: number;\r\n\r\n /** The base value for azimuth, specified from east counter-clockwise. */\r\n readonly azimuthBase?: number;\r\n\r\n /** The name of the unit for the azimuth base value. */\r\n readonly azimuthBaseUnit?: string;\r\n\r\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\r\n readonly azimuthCounterClockwise?: boolean;\r\n\r\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\r\n readonly revolutionUnit?: string;\r\n\r\n readonly allowMathematicOperations?: boolean;\r\n readonly composite?: FormatCompositeProps;\r\n}\r\n\r\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\r\n * @beta\r\n */\r\nexport interface CustomFormatProps extends FormatProps {\r\n readonly custom: any;\r\n}\r\n\r\n/** CustomFormatProps type guard.\r\n * @beta\r\n */\r\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\r\n return (item as CustomFormatProps).custom !== undefined;\r\n};\r\n\r\n/** A [[FormatCompositeProps]] with unit names replaced with JSON representations of those units.\r\n * @beta\r\n */\r\nexport type ResolvedFormatCompositeProps = Omit<FormatCompositeProps, \"units\"> & {\r\n readonly units: ResolvedFormatUnitSpec[];\r\n};\r\n\r\n/** A [[FormatProps]] with all the references to units replaced with JSON representations of those units.\r\n * @beta\r\n */\r\nexport type ResolvedFormatProps = Omit<FormatDefinition, \"azimuthBaseUnit\" | \"revolutionUnit\" | \"composite\"> & {\r\n readonly azimuthBaseUnit?: UnitProps;\r\n readonly revolutionUnit?: UnitProps;\r\n readonly composite?: ResolvedFormatCompositeProps;\r\n readonly custom?: any;\r\n};\r\n\r\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\r\n * @beta\r\n */\r\nexport interface CloneUnit {\r\n unit?: UnitProps;\r\n label?: string;\r\n}\r\n\r\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\r\n * @beta\r\n */\r\nexport interface CloneOptions {\r\n /** allows composite formats to be converted to only show primary unit */\r\n showOnlyPrimaryUnit?: boolean;\r\n /** allow format traits to be set */\r\n traits?: FormatTraits;\r\n /** allows new FormatType to be specified */\r\n type?: FormatType;\r\n /** allows precision to be set, this will throw if value is not valid for FormatType */\r\n precision?: DecimalPrecision | FractionalPrecision;\r\n /** allows primary unit and label to be specified */\r\n primaryUnit?: CloneUnit;\r\n}\r\n\r\n/** An extension of FormatProps to help identify formats.\r\n * @beta\r\n */\r\nexport interface FormatDefinition extends FormatProps {\r\n readonly name?: string;\r\n readonly label?: string;\r\n readonly description?: string;\r\n}\r\n\r\n/** Argument for [[FormatsProvider.onFormatsChanged]]\r\n * @beta\r\n */\r\nexport interface FormatsChangedArgs {\r\n /**\r\n * If `all` - all formats within the `FormatsProvider` have changed.\r\n * If array, the array items list the names of formats that were changed or removed.\r\n */\r\n formatsChanged: \"all\" | string[];\r\n}\r\n\r\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\r\n * @beta\r\n */\r\nexport interface FormatsProvider {\r\n /**\r\n * @param name The full name of the Format or KindOfQuantity.\r\n */\r\n getFormat(name: string): Promise<FormatDefinition | undefined>;\r\n\r\n /**\r\n * Fired when formats are added, removed, or changed.\r\n * If all formats are changed, a single string \"all\" is emitted. Else, an array of changed format names is emitted.\r\n */\r\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\r\n}\r\n\r\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\r\n * @beta\r\n */\r\nexport interface MutableFormatsProvider extends FormatsProvider {\r\n /**\r\n * Adds a new format or updates an existing format associated with the specified name.\r\n */\r\n addFormat(name: string, format: FormatDefinition): Promise<void>;\r\n /**\r\n * Removes the format associated with the specified name.\r\n * @param name The name of the format to remove.\r\n */\r\n removeFormat(name: string): Promise<void>;\r\n}\r\n"]}
1
+ {"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAsHH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAA6B,EAAE;IAClF,OAAQ,IAA0B,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,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 Quantity\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { UnitProps } from \"../Interfaces\";\r\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\r\n\r\n/** Defines a unit specification with a name and optional label override.\r\n * Used in composite formats and ratio unit specifications.\r\n * @beta\r\n */\r\nexport interface FormatUnitSpec {\r\n /** The name of the unit (e.g., \"Units.FT\", \"Units.IN\") */\r\n readonly name: string;\r\n /** Optional custom label that overrides the unit's default label (e.g., '\"' for inches, \"'\" for feet) */\r\n readonly label?: string;\r\n}\r\n\r\n/** A resolved [[FormatUnitSpec]] with the unit name replaced with the resolved UnitProps.\r\n * @beta\r\n */\r\nexport interface ResolvedFormatUnitSpec {\r\n /** The resolved unit */\r\n readonly unit: UnitProps;\r\n /** Optional custom label that overrides the unit's default label */\r\n readonly label?: string;\r\n}\r\n\r\n/** Defines the units that make up a composite format and their display properties.\r\n * A composite format allows displaying a single quantity value across multiple units,\r\n * such as displaying length as \"5 feet 6 inches\" or angle as \"45° 30' 15\"\".\r\n * @beta\r\n */\r\nexport interface FormatCompositeProps {\r\n /** Separator character between unit values when formatting composite strings. Must be empty or a single character. */\r\n readonly spacer?: string;\r\n /** Whether to include unit segments with zero magnitude in the formatted output. */\r\n readonly includeZero?: boolean;\r\n /** Array of units this format is comprised of. Each unit specifies the unit name and\r\n * an optional custom label that will override the unit's default label when displaying values. */\r\n readonly units: FormatUnitSpec[];\r\n}\r\n\r\n/** This interface defines the persistence format for describing the formatting of quantity values.\r\n * @beta\r\n */\r\nexport interface FormatProps {\r\n /** The format type. See [[FormatType]] */\r\n readonly type: string;\r\n\r\n /** The precision for the format. Must be an integer. See [[DecimalPrecision]] and [[FractionalPrecision]] */\r\n readonly precision?: number;\r\n\r\n /** Value is rounded to a multiple of this factor if nonzero and the `applyRounding` trait is set, defaults to 0 */\r\n readonly roundFactor?: number;\r\n\r\n /** Minimum width of the formatted output including digits and separators. Must be a positive integer (≥ 0). */\r\n readonly minWidth?: number;\r\n\r\n /** How and when positive and negative signs are displayed. See [[ShowSignOption]] */\r\n readonly showSignOption?: string;\r\n\r\n /** Array of format traits controlling display behavior. See [[FormatTraits]] */\r\n readonly formatTraits?: string | string[];\r\n\r\n /** Character separating integer from fractional part. Must be empty or a single character. */\r\n readonly decimalSeparator?: string;\r\n\r\n /** Character separating thousands in the integer part. Must be empty or a single character. */\r\n readonly thousandSeparator?: string;\r\n\r\n /** Character separating the magnitude from the unit label. Must be empty or a single character. */\r\n readonly uomSeparator?: string;\r\n\r\n /** Required when type is Scientific. See [[ScientificType]] */\r\n readonly scientificType?: string;\r\n\r\n /** Required when type is Ratio. See [[RatioType]]*/\r\n readonly ratioType?: string;\r\n /** The separator character for ratio formatting. Defaults to ':' if not specified. */\r\n readonly ratioSeparator?: string;\r\n /** The format type for the numbers within a ratio. Defaults to \"Decimal\". */\r\n readonly ratioFormatType?: string;\r\n\r\n /** Required when type is Station. Number of decimal places for calculating station offset magnitude. Must be a positive integer > 0. */\r\n readonly stationOffsetSize?: number;\r\n\r\n /** Character separating station and offset portions of a Station formatted value. Must be empty or a single character. */\r\n readonly stationSeparator?: string;\r\n\r\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\r\n readonly stationBaseFactor?: number;\r\n\r\n /** The base value for azimuth, specified from east counter-clockwise. */\r\n readonly azimuthBase?: number;\r\n\r\n /** The name of the unit for the azimuth base value. Required if azimuthBase is set. */\r\n readonly azimuthBaseUnit?: string;\r\n\r\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\r\n readonly azimuthCounterClockwise?: boolean;\r\n\r\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\r\n readonly revolutionUnit?: string;\r\n\r\n /** Enables calculating mathematic operations during parsing; only addition and subtraction are supported. */\r\n readonly allowMathematicOperations?: boolean;\r\n\r\n /** Composite format specification for multi-unit display. */\r\n readonly composite?: FormatCompositeProps;\r\n}\r\n\r\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\r\n * @beta\r\n */\r\nexport interface CustomFormatProps extends FormatProps {\r\n readonly custom: any;\r\n}\r\n\r\n/** CustomFormatProps type guard.\r\n * @beta\r\n */\r\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\r\n return (item as CustomFormatProps).custom !== undefined;\r\n};\r\n\r\n/** A [[FormatCompositeProps]] with unit names replaced with JSON representations of those units.\r\n * @beta\r\n */\r\nexport type ResolvedFormatCompositeProps = Omit<FormatCompositeProps, \"units\"> & {\r\n readonly units: ResolvedFormatUnitSpec[];\r\n};\r\n\r\n/** A [[FormatProps]] with all the references to units replaced with JSON representations of those units.\r\n * @beta\r\n */\r\nexport type ResolvedFormatProps = Omit<FormatDefinition, \"azimuthBaseUnit\" | \"revolutionUnit\" | \"composite\"> & {\r\n readonly azimuthBaseUnit?: UnitProps;\r\n readonly revolutionUnit?: UnitProps;\r\n readonly composite?: ResolvedFormatCompositeProps;\r\n readonly custom?: any;\r\n};\r\n\r\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\r\n * @beta\r\n */\r\nexport interface CloneUnit {\r\n unit?: UnitProps;\r\n label?: string;\r\n}\r\n\r\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\r\n * @beta\r\n */\r\nexport interface CloneOptions {\r\n /** allows composite formats to be converted to only show primary unit */\r\n showOnlyPrimaryUnit?: boolean;\r\n /** allow format traits to be set */\r\n traits?: FormatTraits;\r\n /** allows new FormatType to be specified */\r\n type?: FormatType;\r\n /** allows precision to be set, this will throw if value is not valid for FormatType */\r\n precision?: DecimalPrecision | FractionalPrecision;\r\n /** allows primary unit and label to be specified */\r\n primaryUnit?: CloneUnit;\r\n}\r\n\r\n/** An extension of FormatProps to help identify formats.\r\n * @beta\r\n */\r\nexport interface FormatDefinition extends FormatProps {\r\n readonly name?: string;\r\n readonly label?: string;\r\n readonly description?: string;\r\n}\r\n\r\n/** Argument for [[FormatsProvider.onFormatsChanged]]\r\n * @beta\r\n */\r\nexport interface FormatsChangedArgs {\r\n /**\r\n * If `all` - all formats within the `FormatsProvider` have changed.\r\n * If array, the array items list the names of formats that were changed or removed.\r\n */\r\n formatsChanged: \"all\" | string[];\r\n}\r\n\r\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\r\n * @beta\r\n */\r\nexport interface FormatsProvider {\r\n /**\r\n * @param name The full name of the Format or KindOfQuantity.\r\n */\r\n getFormat(name: string): Promise<FormatDefinition | undefined>;\r\n\r\n /**\r\n * Fired when formats are added, removed, or changed.\r\n * If all formats are changed, a single string \"all\" is emitted. Else, an array of changed format names is emitted.\r\n */\r\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\r\n}\r\n\r\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\r\n * @beta\r\n */\r\nexport interface MutableFormatsProvider extends FormatsProvider {\r\n /**\r\n * Adds a new format or updates an existing format associated with the specified name.\r\n */\r\n addFormat(name: string, format: FormatDefinition): Promise<void>;\r\n /**\r\n * Removes the format associated with the specified name.\r\n * @param name The name of the format to remove.\r\n */\r\n removeFormat(name: string): Promise<void>;\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-quantity",
3
- "version": "5.7.0-dev.5",
3
+ "version": "5.7.0-dev.6",
4
4
  "description": "Quantity parsing, formatting and conversions for iModel.js",
5
5
  "main": "lib/cjs/core-quantity.js",
6
6
  "module": "lib/esm/core-quantity.js",
@@ -27,11 +27,11 @@
27
27
  "rimraf": "^6.0.1",
28
28
  "typescript": "~5.6.2",
29
29
  "vitest": "^3.0.6",
30
- "@itwin/build-tools": "5.7.0-dev.5",
31
- "@itwin/core-bentley": "5.7.0-dev.5"
30
+ "@itwin/build-tools": "5.7.0-dev.6",
31
+ "@itwin/core-bentley": "5.7.0-dev.6"
32
32
  },
33
33
  "peerDependencies": {
34
- "@itwin/core-bentley": "5.7.0-dev.5"
34
+ "@itwin/core-bentley": "5.7.0-dev.6"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "npm run -s build:cjs && npm run -s build:esm",