@itwin/ecschema-metadata 3.1.0-dev.26 → 3.1.0-dev.31
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 +15 -3
- package/lib/cjs/Context.d.ts +5 -0
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +13 -0
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +3 -3
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +2 -15
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +42 -119
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +2 -2
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +4 -0
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +6 -0
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -2
- package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js +1 -2
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.d.ts +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts +76 -0
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -0
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +228 -0
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -0
- package/lib/cjs/ecschema-metadata.d.ts +3 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +3 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/package.json +7 -5
- package/lib/cjs/utils/FormatEnums.d.ts +0 -106
- package/lib/cjs/utils/FormatEnums.d.ts.map +0 -1
- package/lib/cjs/utils/FormatEnums.js +0 -265
- package/lib/cjs/utils/FormatEnums.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.js","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;AAE/F,8CAA4B;AAC5B,4CAA0B;AAC1B,mDAAiC;AACjC,oEAAkD;AAClD,8DAA4C;AAC5C,2DAAyC;AACzC,8DAA4C;AAC5C,2CAAyB;AACzB,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,0CAAwD;AAA/C,gGAAA,OAAO,OAAA;AAAE,oGAAA,WAAW,OAAA;AAC7B,gDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,wEAAuE;AAA9D,4HAAA,oBAAoB,OAAA;AAC7B,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAgF;AAAxD,0GAAA,WAAW,OAAA;AACnC,4CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,0CAAyC;AAAhC,8FAAA,KAAK,OAAA;AACd,4DAA0C;AAC1C,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,gDAI6B;AAH3B,oGAAA,QAAQ,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxF,+GAAA,mBAAmB,OAAA;AAAE,oHAAA,wBAAwB,O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AAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxF,+GAAA,mBAAmB,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AACX,yGAAA,aAAa,OAAA;AAAE,uHAAA,2BAA2B,OAAA;AAElG,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,kEAAmH;AAA1G,sHAAA,iBAAiB,OAAA;AAAE,2HAAA,sBAAsB,OAAA;AAAE,6HAAA,wBAAwB,OAAA;AAC5E,4CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,wDAAsC;AACtC,wCAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,kDAAgC;AAChC,8CAA4B;AAC5B,kEAAgD;AAChD,iEAA+C;AAC/C,oEAAkD;AAClD,4DAA0C;AAC1C,8DAA4C;AAE5C,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAEpB;;GAEG;AACH;;;GAGG;AACH;;;GAGG","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\r\nexport * from \"./Constants\";\r\nexport * from \"./Context\";\r\nexport * from \"./DelayedPromise\";\r\nexport * from \"./Deserialization/SchemaGraphUtil\";\r\nexport * from \"./Deserialization/JsonProps\";\r\nexport * from \"./Deserialization/Helper\";\r\nexport * from \"./Deserialization/XmlParser\";\r\nexport * from \"./ECName\";\r\nexport * from \"./ECObjects\";\r\nexport * from \"./Exception\";\r\nexport * from \"./Interfaces\";\r\nexport { ECClass, StructClass } from \"./Metadata/Class\";\r\nexport { Constant } from \"./Metadata/Constant\";\r\nexport { CustomAttributeClass } from \"./Metadata/CustomAttributeClass\";\r\nexport { EntityClass } from \"./Metadata/EntityClass\";\r\nexport { AnyEnumerator, Enumeration, Enumerator } from \"./Metadata/Enumeration\";\r\nexport { Format } from \"./Metadata/Format\";\r\nexport { InvertedUnit } from \"./Metadata/InvertedUnit\";\r\nexport { KindOfQuantity } from \"./Metadata/KindOfQuantity\";\r\nexport { Mixin } from \"./Metadata/Mixin\";\r\nexport * from \"./Metadata/OverrideFormat\";\r\nexport { Phenomenon } from \"./Metadata/Phenomenon\";\r\nexport {\r\n Property, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty,\r\n StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty,\r\n AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase,\r\n} from \"./Metadata/Property\";\r\nexport { PropertyCategory } from \"./Metadata/PropertyCategory\";\r\nexport { RelationshipClass, RelationshipConstraint, RelationshipMultiplicity } from \"./Metadata/RelationshipClass\";\r\nexport { Schema } from \"./Metadata/Schema\";\r\nexport * from \"./Metadata/SchemaItem\";\r\nexport { Unit } from \"./Metadata/Unit\";\r\nexport { UnitSystem } from \"./Metadata/UnitSystem\";\r\nexport * from \"./PropertyTypes\";\r\nexport * from \"./SchemaKey\";\r\nexport * from \"./UnitConversion/UnitConversion\";\r\nexport * from \"./UnitConversion/UnitConverter\";\r\nexport * from \"./UnitProvider/SchemaUnitProvider\";\r\nexport * from \"./Validation/SchemaWalker\";\r\nexport * from \"./SchemaPartVisitorDelegate\";\r\nexport { CustomAttribute, CustomAttributeContainerProps} from \"./Metadata/CustomAttribute\";\r\nexport { SchemaGraph } from \"./utils/SchemaGraph\";\r\n\r\n/** @docs-package-description\r\n * The ecschema-metadata package contains classes for working with ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Metadata\r\n * Definitions of classes and interfaces that represent all [EC elements]($docs/bis/ec/index.md).\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * A set of utility classes used throughout the package.\r\n */\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-metadata",
|
|
3
|
-
"version": "3.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.31",
|
|
4
4
|
"description": "ECObjects core concepts in typescript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/ecschema-metadata.js",
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@bentley/units-schema": "^1.0.5",
|
|
26
|
-
"@itwin/build-tools": "3.1.0-dev.
|
|
27
|
-
"@itwin/core-bentley": "3.1.0-dev.
|
|
28
|
-
"@itwin/
|
|
26
|
+
"@itwin/build-tools": "3.1.0-dev.31",
|
|
27
|
+
"@itwin/core-bentley": "3.1.0-dev.31",
|
|
28
|
+
"@itwin/core-quantity": "3.1.0-dev.31",
|
|
29
|
+
"@itwin/eslint-plugin": "3.1.0-dev.31",
|
|
29
30
|
"@types/almost-equal": "1.1.0",
|
|
30
31
|
"@types/benchmark": "^2.1.0",
|
|
31
32
|
"@types/chai": "^4.1.4",
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
"typescript": "~4.4.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"@itwin/core-bentley": "^3.1.0-dev.
|
|
50
|
+
"@itwin/core-bentley": "^3.1.0-dev.31",
|
|
51
|
+
"@itwin/core-quantity": "^3.1.0-dev.31"
|
|
50
52
|
},
|
|
51
53
|
"dependencies": {
|
|
52
54
|
"almost-equal": "^1.1.0"
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Metadata
|
|
3
|
-
*/
|
|
4
|
-
/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)
|
|
5
|
-
* provided in serialized formats as well as the full name of an [[OverrideFormat]].
|
|
6
|
-
*
|
|
7
|
-
* `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`
|
|
8
|
-
*
|
|
9
|
-
* Explanation of the regex:
|
|
10
|
-
* - ([\w.:]+)
|
|
11
|
-
* - Grabs the format full name
|
|
12
|
-
* - (\(([^\)]+)\))?
|
|
13
|
-
* - Grabs the precision part with and without the `()`.
|
|
14
|
-
* - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)
|
|
15
|
-
* - (\[([^\|\]]+)([\|])?([^\]]+)?\])?
|
|
16
|
-
* - 4 of these make up the rest of the regex, none of them are required so each end in `?`
|
|
17
|
-
* - Grabs the unit name and label including the `[]`
|
|
18
|
-
* - Grabs the unit name, `|` and label separately
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export declare const formatStringRgx: RegExp;
|
|
22
|
-
/** @internal Needs to be moved to quantity */
|
|
23
|
-
export declare function getItemNamesFromFormatString(formatString: string): Iterable<string>;
|
|
24
|
-
/** @beta Needs to be moved to quantity */
|
|
25
|
-
export declare enum FormatTraits {
|
|
26
|
-
TrailZeroes = 1,
|
|
27
|
-
KeepSingleZero = 2,
|
|
28
|
-
ZeroEmpty = 4,
|
|
29
|
-
KeepDecimalPoint = 8,
|
|
30
|
-
ApplyRounding = 16,
|
|
31
|
-
FractionDash = 32,
|
|
32
|
-
ShowUnitLabel = 64,
|
|
33
|
-
PrependUnitLabel = 128,
|
|
34
|
-
Use1000Separator = 256,
|
|
35
|
-
ExponentOnlyNegative = 512
|
|
36
|
-
}
|
|
37
|
-
/** @beta Needs to be moved to quantity */
|
|
38
|
-
export declare enum FractionalPrecision {
|
|
39
|
-
One = 1,
|
|
40
|
-
Two = 2,
|
|
41
|
-
Four = 4,
|
|
42
|
-
Eight = 8,
|
|
43
|
-
Sixteen = 16,
|
|
44
|
-
ThirtyTwo = 32,
|
|
45
|
-
SixtyFour = 64,
|
|
46
|
-
OneHundredTwentyEight = 128,
|
|
47
|
-
TwoHundredFiftySix = 256
|
|
48
|
-
}
|
|
49
|
-
/** @beta Needs to be moved to quantity */
|
|
50
|
-
export declare enum DecimalPrecision {
|
|
51
|
-
Zero = 0,
|
|
52
|
-
One = 1,
|
|
53
|
-
Two = 2,
|
|
54
|
-
Three = 3,
|
|
55
|
-
Four = 4,
|
|
56
|
-
Five = 5,
|
|
57
|
-
Six = 6,
|
|
58
|
-
Seven = 7,
|
|
59
|
-
Eight = 8,
|
|
60
|
-
Nine = 9,
|
|
61
|
-
Ten = 10,
|
|
62
|
-
Eleven = 11,
|
|
63
|
-
Twelve = 12
|
|
64
|
-
}
|
|
65
|
-
/** @beta Needs to be moved to quantity */
|
|
66
|
-
export declare enum FormatType {
|
|
67
|
-
Decimal = 0,
|
|
68
|
-
Fractional = 1,
|
|
69
|
-
Scientific = 2,
|
|
70
|
-
Station = 3
|
|
71
|
-
}
|
|
72
|
-
/** @beta Needs to be moved to quantity */
|
|
73
|
-
export declare enum ScientificType {
|
|
74
|
-
Normalized = 0,
|
|
75
|
-
ZeroNormalized = 1
|
|
76
|
-
}
|
|
77
|
-
/** @beta Needs to be moved to quantity */
|
|
78
|
-
export declare enum ShowSignOption {
|
|
79
|
-
NoSign = 0,
|
|
80
|
-
OnlyNegative = 1,
|
|
81
|
-
SignAlways = 2,
|
|
82
|
-
NegativeParentheses = 3
|
|
83
|
-
}
|
|
84
|
-
/** @internal Needs to be moved to quantity */
|
|
85
|
-
export declare function parseScientificType(scientificType: string): ScientificType | undefined;
|
|
86
|
-
/** @internal Needs to be moved to quantity */
|
|
87
|
-
export declare function scientificTypeToString(scientificType: ScientificType): string;
|
|
88
|
-
/** @internal Needs to be moved to quantity */
|
|
89
|
-
export declare function parseShowSignOption(showSignOption: string): ShowSignOption | undefined;
|
|
90
|
-
/** @internal Needs to be moved to quantity */
|
|
91
|
-
export declare function showSignOptionToString(showSign: ShowSignOption): string;
|
|
92
|
-
/** @internal Needs to be moved to quantity */
|
|
93
|
-
export declare function parseFormatTrait(formatTraitsString: string): FormatTraits | undefined;
|
|
94
|
-
/** @internal Needs to be moved to quantity */
|
|
95
|
-
export declare function formatTraitsToArray(currentFormatTrait: FormatTraits): string[];
|
|
96
|
-
/** @internal Needs to be moved to quantity */
|
|
97
|
-
export declare function parseFormatType(jsonObjType: string): FormatType | undefined;
|
|
98
|
-
/** @internal Needs to be moved to quantity */
|
|
99
|
-
export declare function formatTypeToString(type: FormatType): string;
|
|
100
|
-
/** @internal Needs to be moved to quantity */
|
|
101
|
-
export declare function parseDecimalPrecision(jsonObjPrecision: number): DecimalPrecision | undefined;
|
|
102
|
-
/** @internal Needs to be moved to quantity */
|
|
103
|
-
export declare function parseFractionalPrecision(jsonObjPrecision: number): FractionalPrecision | undefined;
|
|
104
|
-
/** @internal Needs to be moved to quantity */
|
|
105
|
-
export declare function parsePrecision(precision: number, type: FormatType): DecimalPrecision | FractionalPrecision | undefined;
|
|
106
|
-
//# sourceMappingURL=FormatEnums.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatEnums.d.ts","sourceRoot":"","sources":["../../../src/utils/FormatEnums.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,QAAiK,CAAC;AAE9L,8CAA8C;AAC9C,wBAAiB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAWpF;AAED,2CAA2C;AAC3C,oBAAY,YAAY;IAEtB,WAAW,IAAO;IAClB,cAAc,IAAM;IACpB,SAAS,IAAM;IACf,gBAAgB,IAAM;IACtB,aAAa,KAAO;IACpB,YAAY,KAAO;IACnB,aAAa,KAAO;IACpB,gBAAgB,MAAO;IACvB,gBAAgB,MAAQ;IACxB,oBAAoB,MAAQ;CAC7B;AAED,2CAA2C;AAC3C,oBAAY,mBAAmB;IAC7B,GAAG,IAAI;IACP,GAAG,IAAI;IACP,IAAI,IAAI;IACR,KAAK,IAAI;IACT,OAA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AAM,GAAG,UAAU,GAAG,SAAS,CAS3E;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAO3D;AAED,+CAA+C;AAC/C,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAkB5F;AAED,+CAA+C;AAC/C,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAclG;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,CAWtH"}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Metadata
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.parsePrecision = exports.parseFractionalPrecision = exports.parseDecimalPrecision = exports.formatTypeToString = exports.parseFormatType = exports.formatTraitsToArray = exports.parseFormatTrait = exports.showSignOptionToString = exports.parseShowSignOption = exports.scientificTypeToString = exports.parseScientificType = exports.ShowSignOption = exports.ScientificType = exports.FormatType = exports.DecimalPrecision = exports.FractionalPrecision = exports.FormatTraits = exports.getItemNamesFromFormatString = exports.formatStringRgx = void 0;
|
|
11
|
-
/** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string)
|
|
12
|
-
* provided in serialized formats as well as the full name of an [[OverrideFormat]].
|
|
13
|
-
*
|
|
14
|
-
* `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]`
|
|
15
|
-
*
|
|
16
|
-
* Explanation of the regex:
|
|
17
|
-
* - ([\w.:]+)
|
|
18
|
-
* - Grabs the format full name
|
|
19
|
-
* - (\(([^\)]+)\))?
|
|
20
|
-
* - Grabs the precision part with and without the `()`.
|
|
21
|
-
* - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true)
|
|
22
|
-
* - (\[([^\|\]]+)([\|])?([^\]]+)?\])?
|
|
23
|
-
* - 4 of these make up the rest of the regex, none of them are required so each end in `?`
|
|
24
|
-
* - Grabs the unit name and label including the `[]`
|
|
25
|
-
* - Grabs the unit name, `|` and label separately
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
exports.formatStringRgx = /([\w.:]+)(\(([^\)]+)\))?(\[([^\|\]]+)([\|])?([^\]]+)?\])?(\[([^\|\]]+)([\|])?([^\]]+)?\])?(\[([^\|\]]+)([\|])?([^\]]+)?\])?(\[([^\|\]]+)([\|])?([^\]]+)?\])?/;
|
|
29
|
-
/** @internal Needs to be moved to quantity */
|
|
30
|
-
function* getItemNamesFromFormatString(formatString) {
|
|
31
|
-
const match = formatString.split(exports.formatStringRgx);
|
|
32
|
-
yield match[1]; // the Format Name
|
|
33
|
-
let index = 4;
|
|
34
|
-
while (index < match.length - 1) { // index 0 and 21 are empty strings
|
|
35
|
-
if (match[index] !== undefined)
|
|
36
|
-
yield match[index + 1]; // Unit Name
|
|
37
|
-
else
|
|
38
|
-
break;
|
|
39
|
-
index += 4;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.getItemNamesFromFormatString = getItemNamesFromFormatString;
|
|
43
|
-
/** @beta Needs to be moved to quantity */
|
|
44
|
-
var FormatTraits;
|
|
45
|
-
(function (FormatTraits) {
|
|
46
|
-
// the leading + opts TypeScript out of inferring a union enum
|
|
47
|
-
FormatTraits[FormatTraits["TrailZeroes"] = 1] = "TrailZeroes";
|
|
48
|
-
FormatTraits[FormatTraits["KeepSingleZero"] = 2] = "KeepSingleZero";
|
|
49
|
-
FormatTraits[FormatTraits["ZeroEmpty"] = 4] = "ZeroEmpty";
|
|
50
|
-
FormatTraits[FormatTraits["KeepDecimalPoint"] = 8] = "KeepDecimalPoint";
|
|
51
|
-
FormatTraits[FormatTraits["ApplyRounding"] = 16] = "ApplyRounding";
|
|
52
|
-
FormatTraits[FormatTraits["FractionDash"] = 32] = "FractionDash";
|
|
53
|
-
FormatTraits[FormatTraits["ShowUnitLabel"] = 64] = "ShowUnitLabel";
|
|
54
|
-
FormatTraits[FormatTraits["PrependUnitLabel"] = 128] = "PrependUnitLabel";
|
|
55
|
-
FormatTraits[FormatTraits["Use1000Separator"] = 256] = "Use1000Separator";
|
|
56
|
-
FormatTraits[FormatTraits["ExponentOnlyNegative"] = 512] = "ExponentOnlyNegative";
|
|
57
|
-
})(FormatTraits = exports.FormatTraits || (exports.FormatTraits = {}));
|
|
58
|
-
/** @beta Needs to be moved to quantity */
|
|
59
|
-
var FractionalPrecision;
|
|
60
|
-
(function (FractionalPrecision) {
|
|
61
|
-
FractionalPrecision[FractionalPrecision["One"] = 1] = "One";
|
|
62
|
-
FractionalPrecision[FractionalPrecision["Two"] = 2] = "Two";
|
|
63
|
-
FractionalPrecision[FractionalPrecision["Four"] = 4] = "Four";
|
|
64
|
-
FractionalPrecision[FractionalPrecision["Eight"] = 8] = "Eight";
|
|
65
|
-
FractionalPrecision[FractionalPrecision["Sixteen"] = 16] = "Sixteen";
|
|
66
|
-
FractionalPrecision[FractionalPrecision["ThirtyTwo"] = 32] = "ThirtyTwo";
|
|
67
|
-
FractionalPrecision[FractionalPrecision["SixtyFour"] = 64] = "SixtyFour";
|
|
68
|
-
FractionalPrecision[FractionalPrecision["OneHundredTwentyEight"] = 128] = "OneHundredTwentyEight";
|
|
69
|
-
FractionalPrecision[FractionalPrecision["TwoHundredFiftySix"] = 256] = "TwoHundredFiftySix";
|
|
70
|
-
})(FractionalPrecision = exports.FractionalPrecision || (exports.FractionalPrecision = {}));
|
|
71
|
-
/** @beta Needs to be moved to quantity */
|
|
72
|
-
var DecimalPrecision;
|
|
73
|
-
(function (DecimalPrecision) {
|
|
74
|
-
DecimalPrecision[DecimalPrecision["Zero"] = 0] = "Zero";
|
|
75
|
-
DecimalPrecision[DecimalPrecision["One"] = 1] = "One";
|
|
76
|
-
DecimalPrecision[DecimalPrecision["Two"] = 2] = "Two";
|
|
77
|
-
DecimalPrecision[DecimalPrecision["Three"] = 3] = "Three";
|
|
78
|
-
DecimalPrecision[DecimalPrecision["Four"] = 4] = "Four";
|
|
79
|
-
DecimalPrecision[DecimalPrecision["Five"] = 5] = "Five";
|
|
80
|
-
DecimalPrecision[DecimalPrecision["Six"] = 6] = "Six";
|
|
81
|
-
DecimalPrecision[DecimalPrecision["Seven"] = 7] = "Seven";
|
|
82
|
-
DecimalPrecision[DecimalPrecision["Eight"] = 8] = "Eight";
|
|
83
|
-
DecimalPrecision[DecimalPrecision["Nine"] = 9] = "Nine";
|
|
84
|
-
DecimalPrecision[DecimalPrecision["Ten"] = 10] = "Ten";
|
|
85
|
-
DecimalPrecision[DecimalPrecision["Eleven"] = 11] = "Eleven";
|
|
86
|
-
DecimalPrecision[DecimalPrecision["Twelve"] = 12] = "Twelve";
|
|
87
|
-
})(DecimalPrecision = exports.DecimalPrecision || (exports.DecimalPrecision = {}));
|
|
88
|
-
/** @beta Needs to be moved to quantity */
|
|
89
|
-
var FormatType;
|
|
90
|
-
(function (FormatType) {
|
|
91
|
-
FormatType[FormatType["Decimal"] = 0] = "Decimal";
|
|
92
|
-
FormatType[FormatType["Fractional"] = 1] = "Fractional";
|
|
93
|
-
FormatType[FormatType["Scientific"] = 2] = "Scientific";
|
|
94
|
-
FormatType[FormatType["Station"] = 3] = "Station";
|
|
95
|
-
})(FormatType = exports.FormatType || (exports.FormatType = {}));
|
|
96
|
-
/** @beta Needs to be moved to quantity */
|
|
97
|
-
var ScientificType;
|
|
98
|
-
(function (ScientificType) {
|
|
99
|
-
ScientificType[ScientificType["Normalized"] = 0] = "Normalized";
|
|
100
|
-
ScientificType[ScientificType["ZeroNormalized"] = 1] = "ZeroNormalized";
|
|
101
|
-
})(ScientificType = exports.ScientificType || (exports.ScientificType = {}));
|
|
102
|
-
/** @beta Needs to be moved to quantity */
|
|
103
|
-
var ShowSignOption;
|
|
104
|
-
(function (ShowSignOption) {
|
|
105
|
-
ShowSignOption[ShowSignOption["NoSign"] = 0] = "NoSign";
|
|
106
|
-
ShowSignOption[ShowSignOption["OnlyNegative"] = 1] = "OnlyNegative";
|
|
107
|
-
ShowSignOption[ShowSignOption["SignAlways"] = 2] = "SignAlways";
|
|
108
|
-
ShowSignOption[ShowSignOption["NegativeParentheses"] = 3] = "NegativeParentheses";
|
|
109
|
-
})(ShowSignOption = exports.ShowSignOption || (exports.ShowSignOption = {}));
|
|
110
|
-
// parse and toString methods
|
|
111
|
-
/** @internal Needs to be moved to quantity */
|
|
112
|
-
function parseScientificType(scientificType) {
|
|
113
|
-
switch (scientificType.toLowerCase()) {
|
|
114
|
-
case "normalized": return ScientificType.Normalized;
|
|
115
|
-
case "zeronormalized": return ScientificType.ZeroNormalized;
|
|
116
|
-
default:
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.parseScientificType = parseScientificType;
|
|
121
|
-
/** @internal Needs to be moved to quantity */
|
|
122
|
-
function scientificTypeToString(scientificType) {
|
|
123
|
-
return (scientificType === ScientificType.Normalized) ? "Normalized" : "ZeroNormalized";
|
|
124
|
-
}
|
|
125
|
-
exports.scientificTypeToString = scientificTypeToString;
|
|
126
|
-
/** @internal Needs to be moved to quantity */
|
|
127
|
-
function parseShowSignOption(showSignOption) {
|
|
128
|
-
switch (showSignOption.toLowerCase()) {
|
|
129
|
-
case "nosign": return ShowSignOption.NoSign;
|
|
130
|
-
case "onlynegative": return ShowSignOption.OnlyNegative;
|
|
131
|
-
case "signalways": return ShowSignOption.SignAlways;
|
|
132
|
-
case "negativeparentheses": return ShowSignOption.NegativeParentheses;
|
|
133
|
-
default:
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.parseShowSignOption = parseShowSignOption;
|
|
138
|
-
/** @internal Needs to be moved to quantity */
|
|
139
|
-
function showSignOptionToString(showSign) {
|
|
140
|
-
switch (showSign) {
|
|
141
|
-
case ShowSignOption.NegativeParentheses: return "NegativeParentheses";
|
|
142
|
-
case ShowSignOption.NoSign: return "NoSign";
|
|
143
|
-
case ShowSignOption.OnlyNegative: return "OnlyNegative";
|
|
144
|
-
case ShowSignOption.SignAlways: return "SignAlways";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.showSignOptionToString = showSignOptionToString;
|
|
148
|
-
/** @internal Needs to be moved to quantity */
|
|
149
|
-
function parseFormatTrait(formatTraitsString) {
|
|
150
|
-
switch (formatTraitsString.toLowerCase()) {
|
|
151
|
-
case "trailzeroes": return FormatTraits.TrailZeroes;
|
|
152
|
-
case "keepsinglezero": return FormatTraits.KeepSingleZero;
|
|
153
|
-
case "zeroempty": return FormatTraits.ZeroEmpty;
|
|
154
|
-
case "keepdecimalpoint": return FormatTraits.KeepDecimalPoint;
|
|
155
|
-
case "applyrounding": return FormatTraits.ApplyRounding;
|
|
156
|
-
case "fractiondash": return FormatTraits.FractionDash;
|
|
157
|
-
case "showunitlabel": return FormatTraits.ShowUnitLabel;
|
|
158
|
-
case "prependunitlabel": return FormatTraits.PrependUnitLabel;
|
|
159
|
-
case "use1000separator": return FormatTraits.Use1000Separator;
|
|
160
|
-
case "exponentonlynegative": return FormatTraits.ExponentOnlyNegative;
|
|
161
|
-
default: return undefined;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.parseFormatTrait = parseFormatTrait;
|
|
165
|
-
/** @internal Needs to be moved to quantity */
|
|
166
|
-
function formatTraitsToArray(currentFormatTrait) {
|
|
167
|
-
const formatTraitsArr = Array();
|
|
168
|
-
if ((currentFormatTrait & FormatTraits.TrailZeroes) === FormatTraits.TrailZeroes)
|
|
169
|
-
formatTraitsArr.push("TrailZeroes");
|
|
170
|
-
if ((currentFormatTrait & FormatTraits.KeepSingleZero) === FormatTraits.KeepSingleZero)
|
|
171
|
-
formatTraitsArr.push("KeepSingleZero");
|
|
172
|
-
if ((currentFormatTrait & FormatTraits.ZeroEmpty) === FormatTraits.ZeroEmpty)
|
|
173
|
-
formatTraitsArr.push("ZeroEmpty");
|
|
174
|
-
if ((currentFormatTrait & FormatTraits.KeepDecimalPoint) === FormatTraits.KeepDecimalPoint)
|
|
175
|
-
formatTraitsArr.push("KeepDecimalPoint");
|
|
176
|
-
if ((currentFormatTrait & FormatTraits.ApplyRounding) === FormatTraits.ApplyRounding)
|
|
177
|
-
formatTraitsArr.push("ApplyRounding");
|
|
178
|
-
if ((currentFormatTrait & FormatTraits.FractionDash) === FormatTraits.FractionDash)
|
|
179
|
-
formatTraitsArr.push("FractionDash");
|
|
180
|
-
if ((currentFormatTrait & FormatTraits.ShowUnitLabel) === FormatTraits.ShowUnitLabel)
|
|
181
|
-
formatTraitsArr.push("ShowUnitLabel");
|
|
182
|
-
if ((currentFormatTrait & FormatTraits.PrependUnitLabel) === FormatTraits.PrependUnitLabel)
|
|
183
|
-
formatTraitsArr.push("PrependUnitLabel");
|
|
184
|
-
if ((currentFormatTrait & FormatTraits.Use1000Separator) === FormatTraits.Use1000Separator)
|
|
185
|
-
formatTraitsArr.push("Use1000Separator");
|
|
186
|
-
if ((currentFormatTrait & FormatTraits.ExponentOnlyNegative) === FormatTraits.ExponentOnlyNegative)
|
|
187
|
-
formatTraitsArr.push("ExponentOnlyNegative");
|
|
188
|
-
return formatTraitsArr;
|
|
189
|
-
}
|
|
190
|
-
exports.formatTraitsToArray = formatTraitsToArray;
|
|
191
|
-
/** @internal Needs to be moved to quantity */
|
|
192
|
-
function parseFormatType(jsonObjType) {
|
|
193
|
-
switch (jsonObjType.toLowerCase()) {
|
|
194
|
-
case "decimal": return FormatType.Decimal;
|
|
195
|
-
case "scientific": return FormatType.Scientific;
|
|
196
|
-
case "station": return FormatType.Station;
|
|
197
|
-
case "fractional": return FormatType.Fractional;
|
|
198
|
-
default:
|
|
199
|
-
return undefined;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
exports.parseFormatType = parseFormatType;
|
|
203
|
-
/** @internal Needs to be moved to quantity */
|
|
204
|
-
function formatTypeToString(type) {
|
|
205
|
-
switch (type) {
|
|
206
|
-
case FormatType.Decimal: return "Decimal";
|
|
207
|
-
case FormatType.Scientific: return "Scientific";
|
|
208
|
-
case FormatType.Station: return "Station";
|
|
209
|
-
case FormatType.Fractional: return "Fractional";
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
exports.formatTypeToString = formatTypeToString;
|
|
213
|
-
/** @internal Needs to be moved to quantity */
|
|
214
|
-
function parseDecimalPrecision(jsonObjPrecision) {
|
|
215
|
-
switch (jsonObjPrecision) {
|
|
216
|
-
case 0: return DecimalPrecision.Zero;
|
|
217
|
-
case 1: return DecimalPrecision.One;
|
|
218
|
-
case 2: return DecimalPrecision.Two;
|
|
219
|
-
case 3: return DecimalPrecision.Three;
|
|
220
|
-
case 4: return DecimalPrecision.Four;
|
|
221
|
-
case 5: return DecimalPrecision.Five;
|
|
222
|
-
case 6: return DecimalPrecision.Six;
|
|
223
|
-
case 7: return DecimalPrecision.Seven;
|
|
224
|
-
case 8: return DecimalPrecision.Eight;
|
|
225
|
-
case 9: return DecimalPrecision.Nine;
|
|
226
|
-
case 10: return DecimalPrecision.Ten;
|
|
227
|
-
case 11: return DecimalPrecision.Eleven;
|
|
228
|
-
case 12: return DecimalPrecision.Twelve;
|
|
229
|
-
default:
|
|
230
|
-
return undefined;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
exports.parseDecimalPrecision = parseDecimalPrecision;
|
|
234
|
-
/** @internal Needs to be moved to quantity */
|
|
235
|
-
function parseFractionalPrecision(jsonObjPrecision) {
|
|
236
|
-
switch (jsonObjPrecision) {
|
|
237
|
-
case 1: return FractionalPrecision.One;
|
|
238
|
-
case 2: return FractionalPrecision.Two;
|
|
239
|
-
case 4: return FractionalPrecision.Four;
|
|
240
|
-
case 8: return FractionalPrecision.Eight;
|
|
241
|
-
case 16: return FractionalPrecision.Sixteen;
|
|
242
|
-
case 32: return FractionalPrecision.ThirtyTwo;
|
|
243
|
-
case 64: return FractionalPrecision.SixtyFour;
|
|
244
|
-
case 128: return FractionalPrecision.OneHundredTwentyEight;
|
|
245
|
-
case 256: return FractionalPrecision.TwoHundredFiftySix;
|
|
246
|
-
default:
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
exports.parseFractionalPrecision = parseFractionalPrecision;
|
|
251
|
-
/** @internal Needs to be moved to quantity */
|
|
252
|
-
function parsePrecision(precision, type) {
|
|
253
|
-
switch (type) { // type must be decimal, fractional, scientific, or station
|
|
254
|
-
case FormatType.Decimal:
|
|
255
|
-
case FormatType.Scientific:
|
|
256
|
-
case FormatType.Station:
|
|
257
|
-
return parseDecimalPrecision(precision);
|
|
258
|
-
case FormatType.Fractional:
|
|
259
|
-
return parseFractionalPrecision(precision);
|
|
260
|
-
default:
|
|
261
|
-
return undefined;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
exports.parsePrecision = parsePrecision;
|
|
265
|
-
//# sourceMappingURL=FormatEnums.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatEnums.js","sourceRoot":"","sources":["../../../src/utils/FormatEnums.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,eAAe,GAAG,8JAA8J,CAAC;AAE9L,8CAA8C;AAC9C,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,kBA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CAAC,CAAC,OAAO,mBAAmB,CAAC,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,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAdD,4DAcC;AAED,+CAA+C;AAC/C,SAAgB,cAAc,CAAC,SAAiB,EAAE,IAAgB;IAChE,QAAQ,IAAI,EAAE,EAAE,2DAA2D;QACzE,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,UAAU,CAAC;QAC3B,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,qBAAqB,CAAC,SAAS,CAAC,CAAC;QAC1C,KAAK,UAAU,CAAC,UAAU;YACxB,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;QAC7C;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAXD,wCAWC","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 Metadata\r\n */\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 Needs to be moved to quantity */\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\r\n/** @beta Needs to be moved to quantity */\r\nexport enum FormatTraits {\r\n // the leading + opts TypeScript out of inferring a union enum\r\n TrailZeroes = +0x1,\r\n KeepSingleZero = 0x2,\r\n ZeroEmpty = 0x4,\r\n KeepDecimalPoint = 0x8,\r\n ApplyRounding = 0x10,\r\n FractionDash = 0x20,\r\n ShowUnitLabel = 0x40,\r\n PrependUnitLabel = 0x80,\r\n Use1000Separator = 0x100,\r\n ExponentOnlyNegative = 0x200,\r\n}\r\n\r\n/** @beta Needs to be moved to quantity */\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/** @beta Needs to be moved to quantity */\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/** @beta Needs to be moved to quantity */\r\nexport enum FormatType {\r\n Decimal,\r\n Fractional,\r\n Scientific,\r\n Station,\r\n}\r\n\r\n/** @beta Needs to be moved to quantity */\r\nexport enum ScientificType { // required if type is scientific; options: normalized, zeroNormalized\r\n Normalized,\r\n ZeroNormalized,\r\n}\r\n\r\n/** @beta Needs to be moved to quantity */\r\nexport enum ShowSignOption { // default is no sign\r\n NoSign,\r\n OnlyNegative,\r\n SignAlways,\r\n NegativeParentheses,\r\n}\r\n\r\n// parse and toString methods\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function parseScientificType(scientificType: string): ScientificType | undefined {\r\n switch (scientificType.toLowerCase()) {\r\n case \"normalized\": return ScientificType.Normalized;\r\n case \"zeronormalized\": return ScientificType.ZeroNormalized;\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function scientificTypeToString(scientificType: ScientificType): string {\r\n return (scientificType === ScientificType.Normalized) ? \"Normalized\" : \"ZeroNormalized\";\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function parseShowSignOption(showSignOption: string): ShowSignOption | undefined {\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 return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\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/** @internal Needs to be moved to quantity */\r\nexport function parseFormatTrait(formatTraitsString: string): FormatTraits | undefined {\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: return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\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/** @internal Needs to be moved to quantity */\r\nexport function parseFormatType(jsonObjType: string): FormatType | undefined {\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 default:\r\n return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\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 }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function parseDecimalPrecision(jsonObjPrecision: number): DecimalPrecision | undefined {\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 return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function parseFractionalPrecision(jsonObjPrecision: number): FractionalPrecision | undefined {\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 return undefined;\r\n }\r\n}\r\n\r\n/** @internal Needs to be moved to quantity */\r\nexport function parsePrecision(precision: number, type: FormatType): DecimalPrecision | FractionalPrecision | undefined {\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 return parseDecimalPrecision(precision);\r\n case FormatType.Fractional:\r\n return parseFractionalPrecision(precision);\r\n default:\r\n return undefined;\r\n }\r\n}\r\n"]}
|