@itwin/core-quantity 5.1.0-dev.40 → 5.1.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/lib/cjs/Formatter/FormatEnums.d.ts +3 -3
- package/lib/cjs/Formatter/FormatEnums.js +3 -3
- package/lib/cjs/Formatter/FormatEnums.js.map +1 -1
- package/lib/cjs/Parser.d.ts +1 -1
- package/lib/cjs/Parser.js +1 -1
- package/lib/cjs/Parser.js.map +1 -1
- package/lib/esm/Formatter/FormatEnums.d.ts +3 -3
- package/lib/esm/Formatter/FormatEnums.js +3 -3
- package/lib/esm/Formatter/FormatEnums.js.map +1 -1
- package/lib/esm/Parser.d.ts +1 -1
- package/lib/esm/Parser.js +1 -1
- package/lib/esm/Parser.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Change Log - @itwin/core-quantity
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 16 Jun 2025 15:03:02 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.0.0
|
|
6
|
+
Fri, 13 Jun 2025 20:25:38 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Depreciate ECSqlStatement API
|
|
11
|
+
- Upgrade compile target to ES2023 and module to ES2022
|
|
12
|
+
- Add `FormatDefinition`, `FormatsProvider` and `MutableFormatsProvider` interfaces.
|
|
13
|
+
- Add limitations to quantity parsing logic
|
|
14
|
+
- minor fix in parseToken
|
|
15
|
+
- minor fixes in bearing parser
|
|
16
|
+
- Change core peer dependencies to strict version.
|
|
17
|
+
|
|
18
|
+
## 4.11.6
|
|
19
|
+
Mon, 16 Jun 2025 15:00:15 GMT
|
|
20
|
+
|
|
21
|
+
_Version update only_
|
|
4
22
|
|
|
5
23
|
## 4.11.5
|
|
6
24
|
Fri, 06 Jun 2025 13:41:18 GMT
|
|
@@ -127,7 +127,7 @@ export declare enum ShowSignOption {
|
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* @beta
|
|
130
|
-
* @deprecated in 4.10 -
|
|
130
|
+
* @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.
|
|
131
131
|
*/
|
|
132
132
|
export declare function scientificTypeToString(scientificType: ScientificType): string;
|
|
133
133
|
/**
|
|
@@ -140,7 +140,7 @@ export declare function parseRatioType(ratioType: string, formatName: string): R
|
|
|
140
140
|
export declare function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption;
|
|
141
141
|
/**
|
|
142
142
|
* @beta
|
|
143
|
-
* @deprecated in 4.10 -
|
|
143
|
+
* @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.
|
|
144
144
|
*/
|
|
145
145
|
export declare function showSignOptionToString(showSign: ShowSignOption): string;
|
|
146
146
|
/** @beta */
|
|
@@ -152,7 +152,7 @@ export declare function formatTraitsToArray(currentFormatTrait: FormatTraits): s
|
|
|
152
152
|
/** @beta */
|
|
153
153
|
export declare function parseFormatType(jsonObjType: string, formatName: string): FormatType;
|
|
154
154
|
/** @beta
|
|
155
|
-
* @deprecated in 4.10 -
|
|
155
|
+
* @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.
|
|
156
156
|
*/
|
|
157
157
|
export declare function formatTypeToString(type: FormatType): string;
|
|
158
158
|
/** @beta */
|
|
@@ -168,7 +168,7 @@ var ShowSignOption;
|
|
|
168
168
|
// parse and toString methods
|
|
169
169
|
/**
|
|
170
170
|
* @beta
|
|
171
|
-
* @deprecated in 4.10 -
|
|
171
|
+
* @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.
|
|
172
172
|
*/
|
|
173
173
|
function scientificTypeToString(scientificType) {
|
|
174
174
|
return (scientificType === ScientificType.Normalized) ? "Normalized" : "ZeroNormalized";
|
|
@@ -210,7 +210,7 @@ function parseShowSignOption(showSignOption, formatName) {
|
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
212
|
* @beta
|
|
213
|
-
* @deprecated in 4.10 -
|
|
213
|
+
* @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.
|
|
214
214
|
*/
|
|
215
215
|
function showSignOptionToString(showSign) {
|
|
216
216
|
switch (showSign) {
|
|
@@ -303,7 +303,7 @@ function parseFormatType(jsonObjType, formatName) {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
/** @beta
|
|
306
|
-
* @deprecated in 4.10 -
|
|
306
|
+
* @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.
|
|
307
307
|
*/
|
|
308
308
|
function formatTypeToString(type) {
|
|
309
309
|
switch (type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatEnums.js","sourceRoot":"","sources":["../../../src/Formatter/FormatEnums.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwBH,oEAWC;AAsHD,wDAEC;AAKD,kDAOC;AAGD,wCAWC;AAGD,kDASC;AAMD,wDAOC;AAGD,4CAeC;AAGD,wCAwBC;AAGD,kDAuBC;AAGD,0CAYC;AAKD,gDAUC;AAGD,sDAkBC;AAGD,4DAcC;AAGD,wCAcC;AAxWD,4CAA6D;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,eAAe,GAAG,8JAA8J,CAAC;AAE9L,gBAAgB;AAChB,QAAe,CAAC,CAAC,4BAA4B,CAAC,YAAoB;IAChE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,uBAAe,CAAC,CAAC;IAClD,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC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,SAAS,CAAC;QAC9C,KAAK,EAAE,CAAC,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC;QAC9C,KAAK,GAAG,CAAC,CAAC,OAAO,mBAAmB,CAAC,qBAAqB,CAAC;QAC3D,KAAK,GAAG,CAAC,CAAC,OAAO,mBAAmB,CAAC,kBAAkB,CAAC;QACxD;YACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC;AAED,iJAAiJ;AACjJ,SAAgB,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,KAAK,CAAC;QACtB,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACtD,KAAK,UAAU,CAAC,UAAU;YACxB,OAAO,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACzD;YACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityError, QuantityStatus } from \"../Exception\";\n\n/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)\n * provided in serialized formats as well as the full name of an [[OverrideFormat]].\n *\n * `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`\n *\n * Explanation of the regex:\n * - ([\\w.:]+)\n * - Grabs the format full name\n * - (\\(([^\\)]+)\\))?\n * - Grabs the precision part with and without the `()`.\n * - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)\n * - (\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?\n * - 4 of these make up the rest of the regex, none of them are required so each end in `?`\n * - Grabs the unit name and label including the `[]`\n * - Grabs the unit name, `|` and label separately\n * @internal\n */\nexport const formatStringRgx = /([\\w.:]+)(\\(([^\\)]+)\\))?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?/;\n\n/** @internal */\nexport function* getItemNamesFromFormatString(formatString: string): Iterable<string> {\n const match = formatString.split(formatStringRgx);\n yield match[1]; // the Format Name\n let index = 4;\n while (index < match.length - 1) { // index 0 and 21 are empty strings\n if (match[index] !== undefined)\n yield match[index + 1]; // Unit Name\n else\n break;\n index += 4;\n }\n}\n/** @beta */\nexport enum FormatTraits {\n Uninitialized = 0,\n /** Show trailing zeroes to requested precision. */\n TrailZeroes = 1 << 0,\n /** Indicates that the fractional part of the number is required when the fraction is zero */\n KeepSingleZero = 1 << 1,\n /** Zero magnitude returns blank display value */\n ZeroEmpty = 1 << 2,\n /** Show decimal point when value to right of decimal is empty */\n KeepDecimalPoint = 1 << 3,\n /** Use the rounding factor. Not yet supported */\n ApplyRounding = 1 << 4,\n /** Show a dash between whole value and fractional value */\n FractionDash = 1 << 5,\n /** Append the quantity's unit label */\n ShowUnitLabel = 1 << 6,\n /** Prepend unit label. Not yet supported */\n PrependUnitLabel = 1 << 7,\n /** show a grouping in each group of 1000. */\n Use1000Separator = 1 << 8,\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 = 1 << 9,\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 = \"Decimal\",\n /** Fractional display (ie 2-1/8) */\n Fractional = \"Fractional\",\n /** Scientific Notation (ie 1.04e3) */\n Scientific = \"Scientific\",\n /** Civil Engineering Stationing (ie 1+00). */\n Station = \"Station\",\n /** Bearing angle e.g. N05:00:00E. Requires provided quantities to be of the angle phenomenon */\n Bearing = \"Bearing\",\n /** Azimuth angle e.g. 45°30'00\". Requires provided quantities to be of the angle phenomenon */\n Azimuth = \"Azimuth\",\n /** Ratio display e,g. 1:2 or 0.3:1. */\n Ratio = \"Ratio\",\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 = \"Normalized\",\n /** Zero value left of decimal point (ie 0.12345e4) */\n ZeroNormalized = \"ZeroNormalized\",\n}\n\n/** required if type is ratio\n * @beta */\nexport enum RatioType {\n /** One to N ratio (ie 1:N) */\n OneToN = \"OneToN\",\n /** N to One ratio (ie N:1) */\n NToOne = \"NToOne\",\n /** the lesser value scales to 1. e.g. input 0.5 turns into 2:1 | input 2 turns into 1:2 */\n ValueBased = \"ValueBased\",\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 */\n UseGreatestCommonDivisor = \"UseGreatestCommonDivisor\",\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 = \"NoSign\",\n /** Only show a sign when the value is negative. */\n OnlyNegative = \"OnlyNegative\",\n /** Always show a sign whether the value is positive or negative. */\n SignAlways = \"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 = \"NegativeParentheses\",\n}\n\n// parse and toString methods\n\n/**\n * @beta\n * @deprecated in 4.10 - might be removed in next major version. ScientificType is now a string enum and doesn't need a serialization method. You can access the enum directly.\n*/\nexport function scientificTypeToString(scientificType: ScientificType): string {\n return (scientificType === ScientificType.Normalized) ? \"Normalized\" : \"ZeroNormalized\";\n}\n\n/**\n * @beta\n*/\nexport function parseScientificType(scientificType: string, formatName: string): ScientificType {\n switch (scientificType.toLowerCase()) {\n case \"normalized\": return ScientificType.Normalized;\n case \"zeronormalized\": return ScientificType.ZeroNormalized;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'scientificType' attribute.`);\n }\n}\n\n/** @beta */\nexport function parseRatioType(ratioType: string, formatName: string): RatioType {\n const normalizedValue = ratioType.toLowerCase();\n for (const key in RatioType) {\n if (RatioType.hasOwnProperty(key)) {\n const enumValue = RatioType[key as keyof typeof RatioType];\n if (enumValue.toLowerCase() === normalizedValue) {\n return enumValue as RatioType;\n }\n }\n }\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioType' attribute.`);\n}\n\n/** @beta */\nexport function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption {\n switch (showSignOption.toLowerCase()) {\n case \"nosign\": return ShowSignOption.NoSign;\n case \"onlynegative\": return ShowSignOption.OnlyNegative;\n case \"signalways\": return ShowSignOption.SignAlways;\n case \"negativeparentheses\": return ShowSignOption.NegativeParentheses;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'showSignOption' attribute.`);\n }\n}\n\n/**\n * @beta\n * @deprecated in 4.10 - might be removed in next major version. ShowSignOption is now a string enum and doesn't need a serialization method. You can access the enum directly.\n*/\nexport function showSignOptionToString(showSign: ShowSignOption): string {\n switch (showSign) {\n case ShowSignOption.NegativeParentheses: return \"NegativeParentheses\";\n case ShowSignOption.NoSign: return \"NoSign\";\n case ShowSignOption.OnlyNegative: return \"OnlyNegative\";\n case ShowSignOption.SignAlways: return \"SignAlways\";\n }\n}\n\n/** @beta */\nexport function parseFormatTrait(formatTraitsString: string, formatName: string): FormatTraits {\n switch (formatTraitsString.toLowerCase()) {\n case \"trailzeroes\": return FormatTraits.TrailZeroes;\n case \"keepsinglezero\": return FormatTraits.KeepSingleZero;\n case \"zeroempty\": return FormatTraits.ZeroEmpty;\n case \"keepdecimalpoint\": return FormatTraits.KeepDecimalPoint;\n case \"applyrounding\": return FormatTraits.ApplyRounding;\n case \"fractiondash\": return FormatTraits.FractionDash;\n case \"showunitlabel\": return FormatTraits.ShowUnitLabel;\n case \"prependunitlabel\": return FormatTraits.PrependUnitLabel;\n case \"use1000separator\": return FormatTraits.Use1000Separator;\n case \"exponentonlynegative\": return FormatTraits.ExponentOnlyNegative;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'formatTraits' attribute.`);\n }\n}\n\n/** @beta */\nexport function 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/** @beta */\nexport function formatTraitsToArray(currentFormatTrait: FormatTraits): string[] {\n const formatTraitsArr = Array<string>();\n if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes)\n formatTraitsArr.push(\"TrailZeroes\");\n if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero)\n formatTraitsArr.push(\"KeepSingleZero\");\n if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty)\n formatTraitsArr.push(\"ZeroEmpty\");\n if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint)\n formatTraitsArr.push(\"KeepDecimalPoint\");\n if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding)\n formatTraitsArr.push(\"ApplyRounding\");\n if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash)\n formatTraitsArr.push(\"FractionDash\");\n if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel)\n formatTraitsArr.push(\"ShowUnitLabel\");\n if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel)\n formatTraitsArr.push(\"PrependUnitLabel\");\n if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator)\n formatTraitsArr.push(\"Use1000Separator\");\n if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative)\n formatTraitsArr.push(\"ExponentOnlyNegative\");\n return formatTraitsArr;\n}\n\n/** @beta */\nexport function parseFormatType(jsonObjType: string, formatName: string): FormatType {\n switch (jsonObjType.toLowerCase()) {\n case \"decimal\": return FormatType.Decimal;\n case \"scientific\": return FormatType.Scientific;\n case \"station\": return FormatType.Station;\n case \"fractional\": return FormatType.Fractional;\n case \"bearing\": return FormatType.Bearing;\n case \"azimuth\": return FormatType.Azimuth;\n case \"ratio\": return FormatType.Ratio;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'type' attribute.`);\n }\n}\n\n/** @beta\n * @deprecated in 4.10 - might be removed in next major version. FormatType is now a string enum and doesn't need a serialization method. You can access the enum directly.\n*/\nexport function formatTypeToString(type: FormatType): string {\n switch (type) {\n case FormatType.Decimal: return \"Decimal\";\n case FormatType.Scientific: return \"Scientific\";\n case FormatType.Station: return \"Station\";\n case FormatType.Fractional: return \"Fractional\";\n case FormatType.Bearing: return \"Bearing\";\n case FormatType.Azimuth: return \"Azimuth\";\n case FormatType.Ratio: return \"Ratio\";\n }\n}\n\n/** @beta */\nexport function parseDecimalPrecision(jsonObjPrecision: number, formatName: string): DecimalPrecision {\n switch (jsonObjPrecision) {\n case 0: return DecimalPrecision.Zero;\n case 1: return DecimalPrecision.One;\n case 2: return DecimalPrecision.Two;\n case 3: return DecimalPrecision.Three;\n case 4: return DecimalPrecision.Four;\n case 5: return DecimalPrecision.Five;\n case 6: return DecimalPrecision.Six;\n case 7: return DecimalPrecision.Seven;\n case 8: return DecimalPrecision.Eight;\n case 9: return DecimalPrecision.Nine;\n case 10: return DecimalPrecision.Ten;\n case 11: return DecimalPrecision.Eleven;\n case 12: return DecimalPrecision.Twelve;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision */\nexport function parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision {\n switch (jsonObjPrecision) {\n case 1: return FractionalPrecision.One;\n case 2: return FractionalPrecision.Two;\n case 4: return FractionalPrecision.Four;\n case 8: return FractionalPrecision.Eight;\n case 16: return FractionalPrecision.Sixteen;\n case 32: return FractionalPrecision.ThirtyTwo;\n case 64: return FractionalPrecision.SixtyFour;\n case 128: return FractionalPrecision.OneHundredTwentyEight;\n case 256: return FractionalPrecision.TwoHundredFiftySix;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. */\nexport function parsePrecision(precision: number, type: FormatType, formatName: string): 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 case FormatType.Ratio:\n case FormatType.Bearing:\n case FormatType.Azimuth:\n return parseDecimalPrecision(precision, formatName);\n case FormatType.Fractional:\n return parseFractionalPrecision(precision, formatName);\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FormatEnums.js","sourceRoot":"","sources":["../../../src/Formatter/FormatEnums.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwBH,oEAWC;AAsHD,wDAEC;AAKD,kDAOC;AAGD,wCAWC;AAGD,kDASC;AAMD,wDAOC;AAGD,4CAeC;AAGD,wCAwBC;AAGD,kDAuBC;AAGD,0CAYC;AAKD,gDAUC;AAGD,sDAkBC;AAGD,4DAcC;AAGD,wCAcC;AAxWD,4CAA6D;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,eAAe,GAAG,8JAA8J,CAAC;AAE9L,gBAAgB;AAChB,QAAe,CAAC,CAAC,4BAA4B,CAAC,YAAoB;IAChE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,uBAAe,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,EA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,OAAO,mBAAmB,CAAC,qBAAqB,CAAC;QAC3D,KAAK,GAAG,CAAC,CAAC,OAAO,mBAAmB,CAAC,kBAAkB,CAAC;QACxD;YACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC;AAED,iJAAiJ;AACjJ,SAAgB,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,KAAK,CAAC;QACtB,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACtD,KAAK,UAAU,CAAC,UAAU;YACxB,OAAO,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACzD;YACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,cAAc,UAAU,wCAAwC,CAAC,CAAC;IAC1H,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityError, QuantityStatus } from \"../Exception\";\n\n/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)\n * provided in serialized formats as well as the full name of an [[OverrideFormat]].\n *\n * `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`\n *\n * Explanation of the regex:\n * - ([\\w.:]+)\n * - Grabs the format full name\n * - (\\(([^\\)]+)\\))?\n * - Grabs the precision part with and without the `()`.\n * - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)\n * - (\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?\n * - 4 of these make up the rest of the regex, none of them are required so each end in `?`\n * - Grabs the unit name and label including the `[]`\n * - Grabs the unit name, `|` and label separately\n * @internal\n */\nexport const formatStringRgx = /([\\w.:]+)(\\(([^\\)]+)\\))?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?(\\[([^\\|\\]]+)([\\|])?([^\\]]+)?\\])?/;\n\n/** @internal */\nexport function* getItemNamesFromFormatString(formatString: string): Iterable<string> {\n const match = formatString.split(formatStringRgx);\n yield match[1]; // the Format Name\n let index = 4;\n while (index < match.length - 1) { // index 0 and 21 are empty strings\n if (match[index] !== undefined)\n yield match[index + 1]; // Unit Name\n else\n break;\n index += 4;\n }\n}\n/** @beta */\nexport enum FormatTraits {\n Uninitialized = 0,\n /** Show trailing zeroes to requested precision. */\n TrailZeroes = 1 << 0,\n /** Indicates that the fractional part of the number is required when the fraction is zero */\n KeepSingleZero = 1 << 1,\n /** Zero magnitude returns blank display value */\n ZeroEmpty = 1 << 2,\n /** Show decimal point when value to right of decimal is empty */\n KeepDecimalPoint = 1 << 3,\n /** Use the rounding factor. Not yet supported */\n ApplyRounding = 1 << 4,\n /** Show a dash between whole value and fractional value */\n FractionDash = 1 << 5,\n /** Append the quantity's unit label */\n ShowUnitLabel = 1 << 6,\n /** Prepend unit label. Not yet supported */\n PrependUnitLabel = 1 << 7,\n /** show a grouping in each group of 1000. */\n Use1000Separator = 1 << 8,\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 = 1 << 9,\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 = \"Decimal\",\n /** Fractional display (ie 2-1/8) */\n Fractional = \"Fractional\",\n /** Scientific Notation (ie 1.04e3) */\n Scientific = \"Scientific\",\n /** Civil Engineering Stationing (ie 1+00). */\n Station = \"Station\",\n /** Bearing angle e.g. N05:00:00E. Requires provided quantities to be of the angle phenomenon */\n Bearing = \"Bearing\",\n /** Azimuth angle e.g. 45°30'00\". Requires provided quantities to be of the angle phenomenon */\n Azimuth = \"Azimuth\",\n /** Ratio display e,g. 1:2 or 0.3:1. */\n Ratio = \"Ratio\",\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 = \"Normalized\",\n /** Zero value left of decimal point (ie 0.12345e4) */\n ZeroNormalized = \"ZeroNormalized\",\n}\n\n/** required if type is ratio\n * @beta */\nexport enum RatioType {\n /** One to N ratio (ie 1:N) */\n OneToN = \"OneToN\",\n /** N to One ratio (ie N:1) */\n NToOne = \"NToOne\",\n /** the lesser value scales to 1. e.g. input 0.5 turns into 2:1 | input 2 turns into 1:2 */\n ValueBased = \"ValueBased\",\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 */\n UseGreatestCommonDivisor = \"UseGreatestCommonDivisor\",\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 = \"NoSign\",\n /** Only show a sign when the value is negative. */\n OnlyNegative = \"OnlyNegative\",\n /** Always show a sign whether the value is positive or negative. */\n SignAlways = \"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 = \"NegativeParentheses\",\n}\n\n// parse and toString methods\n\n/**\n * @beta\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.\n*/\nexport function scientificTypeToString(scientificType: ScientificType): string {\n return (scientificType === ScientificType.Normalized) ? \"Normalized\" : \"ZeroNormalized\";\n}\n\n/**\n * @beta\n*/\nexport function parseScientificType(scientificType: string, formatName: string): ScientificType {\n switch (scientificType.toLowerCase()) {\n case \"normalized\": return ScientificType.Normalized;\n case \"zeronormalized\": return ScientificType.ZeroNormalized;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'scientificType' attribute.`);\n }\n}\n\n/** @beta */\nexport function parseRatioType(ratioType: string, formatName: string): RatioType {\n const normalizedValue = ratioType.toLowerCase();\n for (const key in RatioType) {\n if (RatioType.hasOwnProperty(key)) {\n const enumValue = RatioType[key as keyof typeof RatioType];\n if (enumValue.toLowerCase() === normalizedValue) {\n return enumValue as RatioType;\n }\n }\n }\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'ratioType' attribute.`);\n}\n\n/** @beta */\nexport function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption {\n switch (showSignOption.toLowerCase()) {\n case \"nosign\": return ShowSignOption.NoSign;\n case \"onlynegative\": return ShowSignOption.OnlyNegative;\n case \"signalways\": return ShowSignOption.SignAlways;\n case \"negativeparentheses\": return ShowSignOption.NegativeParentheses;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'showSignOption' attribute.`);\n }\n}\n\n/**\n * @beta\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.\n*/\nexport function showSignOptionToString(showSign: ShowSignOption): string {\n switch (showSign) {\n case ShowSignOption.NegativeParentheses: return \"NegativeParentheses\";\n case ShowSignOption.NoSign: return \"NoSign\";\n case ShowSignOption.OnlyNegative: return \"OnlyNegative\";\n case ShowSignOption.SignAlways: return \"SignAlways\";\n }\n}\n\n/** @beta */\nexport function parseFormatTrait(formatTraitsString: string, formatName: string): FormatTraits {\n switch (formatTraitsString.toLowerCase()) {\n case \"trailzeroes\": return FormatTraits.TrailZeroes;\n case \"keepsinglezero\": return FormatTraits.KeepSingleZero;\n case \"zeroempty\": return FormatTraits.ZeroEmpty;\n case \"keepdecimalpoint\": return FormatTraits.KeepDecimalPoint;\n case \"applyrounding\": return FormatTraits.ApplyRounding;\n case \"fractiondash\": return FormatTraits.FractionDash;\n case \"showunitlabel\": return FormatTraits.ShowUnitLabel;\n case \"prependunitlabel\": return FormatTraits.PrependUnitLabel;\n case \"use1000separator\": return FormatTraits.Use1000Separator;\n case \"exponentonlynegative\": return FormatTraits.ExponentOnlyNegative;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'formatTraits' attribute.`);\n }\n}\n\n/** @beta */\nexport function 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/** @beta */\nexport function formatTraitsToArray(currentFormatTrait: FormatTraits): string[] {\n const formatTraitsArr = Array<string>();\n if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes)\n formatTraitsArr.push(\"TrailZeroes\");\n if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero)\n formatTraitsArr.push(\"KeepSingleZero\");\n if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty)\n formatTraitsArr.push(\"ZeroEmpty\");\n if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint)\n formatTraitsArr.push(\"KeepDecimalPoint\");\n if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding)\n formatTraitsArr.push(\"ApplyRounding\");\n if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash)\n formatTraitsArr.push(\"FractionDash\");\n if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel)\n formatTraitsArr.push(\"ShowUnitLabel\");\n if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel)\n formatTraitsArr.push(\"PrependUnitLabel\");\n if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator)\n formatTraitsArr.push(\"Use1000Separator\");\n if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative)\n formatTraitsArr.push(\"ExponentOnlyNegative\");\n return formatTraitsArr;\n}\n\n/** @beta */\nexport function parseFormatType(jsonObjType: string, formatName: string): FormatType {\n switch (jsonObjType.toLowerCase()) {\n case \"decimal\": return FormatType.Decimal;\n case \"scientific\": return FormatType.Scientific;\n case \"station\": return FormatType.Station;\n case \"fractional\": return FormatType.Fractional;\n case \"bearing\": return FormatType.Bearing;\n case \"azimuth\": return FormatType.Azimuth;\n case \"ratio\": return FormatType.Ratio;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'type' attribute.`);\n }\n}\n\n/** @beta\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.\n*/\nexport function formatTypeToString(type: FormatType): string {\n switch (type) {\n case FormatType.Decimal: return \"Decimal\";\n case FormatType.Scientific: return \"Scientific\";\n case FormatType.Station: return \"Station\";\n case FormatType.Fractional: return \"Fractional\";\n case FormatType.Bearing: return \"Bearing\";\n case FormatType.Azimuth: return \"Azimuth\";\n case FormatType.Ratio: return \"Ratio\";\n }\n}\n\n/** @beta */\nexport function parseDecimalPrecision(jsonObjPrecision: number, formatName: string): DecimalPrecision {\n switch (jsonObjPrecision) {\n case 0: return DecimalPrecision.Zero;\n case 1: return DecimalPrecision.One;\n case 2: return DecimalPrecision.Two;\n case 3: return DecimalPrecision.Three;\n case 4: return DecimalPrecision.Four;\n case 5: return DecimalPrecision.Five;\n case 6: return DecimalPrecision.Six;\n case 7: return DecimalPrecision.Seven;\n case 8: return DecimalPrecision.Eight;\n case 9: return DecimalPrecision.Nine;\n case 10: return DecimalPrecision.Ten;\n case 11: return DecimalPrecision.Eleven;\n case 12: return DecimalPrecision.Twelve;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision */\nexport function parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision {\n switch (jsonObjPrecision) {\n case 1: return FractionalPrecision.One;\n case 2: return FractionalPrecision.Two;\n case 4: return FractionalPrecision.Four;\n case 8: return FractionalPrecision.Eight;\n case 16: return FractionalPrecision.Sixteen;\n case 32: return FractionalPrecision.ThirtyTwo;\n case 64: return FractionalPrecision.SixtyFour;\n case 128: return FractionalPrecision.OneHundredTwentyEight;\n case 256: return FractionalPrecision.TwoHundredFiftySix;\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n\n/** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. */\nexport function parsePrecision(precision: number, type: FormatType, formatName: string): 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 case FormatType.Ratio:\n case FormatType.Bearing:\n case FormatType.Azimuth:\n return parseDecimalPrecision(precision, formatName);\n case FormatType.Fractional:\n return parseFractionalPrecision(precision, formatName);\n default:\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${formatName} has an invalid 'precision' attribute.`);\n }\n}\n"]}
|
package/lib/cjs/Parser.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare class Parser {
|
|
|
107
107
|
* @param inString A string that contains text represent a quantity.
|
|
108
108
|
* @param format Defines the likely format of inString. Primary unit serves as a default unit if no unit label found in string.
|
|
109
109
|
* @param unitsConversions dictionary of conversions used to convert from unit used in inString to output quantity
|
|
110
|
-
* @deprecated in 4.10 -
|
|
110
|
+
* @deprecated in 4.10 - will not be removed until after 2026-06-13. Check [[Parser.parseQuantityString]] for replacements.
|
|
111
111
|
*/
|
|
112
112
|
static parseToQuantityValue(inString: string, format: Format, unitsConversions: UnitConversionSpec[]): QuantityParseResult;
|
|
113
113
|
private static parseBearingFormat;
|
package/lib/cjs/Parser.js
CHANGED
|
@@ -603,7 +603,7 @@ class Parser {
|
|
|
603
603
|
* @param inString A string that contains text represent a quantity.
|
|
604
604
|
* @param format Defines the likely format of inString. Primary unit serves as a default unit if no unit label found in string.
|
|
605
605
|
* @param unitsConversions dictionary of conversions used to convert from unit used in inString to output quantity
|
|
606
|
-
* @deprecated in 4.10 -
|
|
606
|
+
* @deprecated in 4.10 - will not be removed until after 2026-06-13. Check [[Parser.parseQuantityString]] for replacements.
|
|
607
607
|
*/
|
|
608
608
|
static parseToQuantityValue(inString, format, unitsConversions) {
|
|
609
609
|
// TODO: This method is not able to do bearing and azimuth formatting and is overlapping with parseQuantityString.
|