@itwin/core-quantity 3.0.0-dev.76 → 3.0.0-dev.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{Constants.d.ts → cjs/Constants.d.ts} +0 -0
- package/lib/cjs/Constants.d.ts.map +1 -0
- package/lib/{Constants.js → cjs/Constants.js} +0 -0
- package/lib/cjs/Constants.js.map +1 -0
- package/lib/{Exception.d.ts → cjs/Exception.d.ts} +0 -0
- package/lib/cjs/Exception.d.ts.map +1 -0
- package/lib/{Exception.js → cjs/Exception.js} +0 -0
- package/lib/cjs/Exception.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Format.d.ts +0 -0
- package/lib/cjs/Formatter/Format.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Format.js +0 -0
- package/lib/cjs/Formatter/Format.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatEnums.d.ts +0 -0
- package/lib/cjs/Formatter/FormatEnums.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatEnums.js +0 -0
- package/lib/cjs/Formatter/FormatEnums.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Formatter.d.ts +0 -0
- package/lib/cjs/Formatter/Formatter.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Formatter.js +0 -0
- package/lib/cjs/Formatter/Formatter.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatterSpec.d.ts +0 -0
- package/lib/cjs/Formatter/FormatterSpec.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/FormatterSpec.js +0 -0
- package/lib/cjs/Formatter/FormatterSpec.js.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Interfaces.d.ts +0 -0
- package/lib/cjs/Formatter/Interfaces.d.ts.map +1 -0
- package/lib/{Formatter → cjs/Formatter}/Interfaces.js +0 -0
- package/lib/cjs/Formatter/Interfaces.js.map +1 -0
- package/lib/{Interfaces.d.ts → cjs/Interfaces.d.ts} +0 -0
- package/lib/cjs/Interfaces.d.ts.map +1 -0
- package/lib/{Interfaces.js → cjs/Interfaces.js} +0 -0
- package/lib/cjs/Interfaces.js.map +1 -0
- package/lib/{Parser.d.ts → cjs/Parser.d.ts} +0 -0
- package/lib/cjs/Parser.d.ts.map +1 -0
- package/lib/{Parser.js → cjs/Parser.js} +0 -0
- package/lib/cjs/Parser.js.map +1 -0
- package/lib/{ParserSpec.d.ts → cjs/ParserSpec.d.ts} +0 -0
- package/lib/cjs/ParserSpec.d.ts.map +1 -0
- package/lib/{ParserSpec.js → cjs/ParserSpec.js} +0 -0
- package/lib/cjs/ParserSpec.js.map +1 -0
- package/lib/{Quantity.d.ts → cjs/Quantity.d.ts} +0 -0
- package/lib/cjs/Quantity.d.ts.map +1 -0
- package/lib/{Quantity.js → cjs/Quantity.js} +0 -0
- package/lib/cjs/Quantity.js.map +1 -0
- package/lib/{Unit.d.ts → cjs/Unit.d.ts} +0 -0
- package/lib/cjs/Unit.d.ts.map +1 -0
- package/lib/{Unit.js → cjs/Unit.js} +0 -0
- package/lib/cjs/Unit.js.map +1 -0
- package/lib/{core-quantity.d.ts → cjs/core-quantity.d.ts} +0 -0
- package/lib/cjs/core-quantity.d.ts.map +1 -0
- package/lib/{core-quantity.js → cjs/core-quantity.js} +0 -0
- package/lib/cjs/core-quantity.js.map +1 -0
- package/lib/esm/Constants.d.ts +28 -0
- package/lib/esm/Constants.d.ts.map +1 -0
- package/lib/esm/Constants.js +49 -0
- package/lib/esm/Constants.js.map +1 -0
- package/lib/esm/Exception.d.ts +27 -0
- package/lib/esm/Exception.d.ts.map +1 -0
- package/lib/esm/Exception.js +34 -0
- package/lib/esm/Exception.js.map +1 -0
- package/lib/esm/Formatter/Format.d.ts +96 -0
- package/lib/esm/Formatter/Format.d.ts.map +1 -0
- package/lib/esm/Formatter/Format.js +550 -0
- package/lib/esm/Formatter/Format.js.map +1 -0
- package/lib/esm/Formatter/FormatEnums.d.ts +89 -0
- package/lib/esm/Formatter/FormatEnums.d.ts.map +1 -0
- package/lib/esm/Formatter/FormatEnums.js +99 -0
- package/lib/esm/Formatter/FormatEnums.js.map +1 -0
- package/lib/esm/Formatter/Formatter.d.ts +45 -0
- package/lib/esm/Formatter/Formatter.d.ts.map +1 -0
- package/lib/esm/Formatter/Formatter.js +368 -0
- package/lib/esm/Formatter/Formatter.js.map +1 -0
- package/lib/esm/Formatter/FormatterSpec.d.ts +40 -0
- package/lib/esm/Formatter/FormatterSpec.d.ts.map +1 -0
- package/lib/esm/Formatter/FormatterSpec.js +98 -0
- package/lib/esm/Formatter/FormatterSpec.js.map +1 -0
- package/lib/esm/Formatter/Interfaces.d.ts +63 -0
- package/lib/esm/Formatter/Interfaces.d.ts.map +1 -0
- package/lib/esm/Formatter/Interfaces.js +14 -0
- package/lib/esm/Formatter/Interfaces.js.map +1 -0
- package/lib/esm/Interfaces.d.ts +75 -0
- package/lib/esm/Interfaces.d.ts.map +1 -0
- package/lib/esm/Interfaces.js +9 -0
- package/lib/esm/Interfaces.js.map +1 -0
- package/lib/esm/Parser.d.ts +94 -0
- package/lib/esm/Parser.d.ts.map +1 -0
- package/lib/esm/Parser.js +584 -0
- package/lib/esm/Parser.js.map +1 -0
- package/lib/esm/ParserSpec.d.ts +35 -0
- package/lib/esm/ParserSpec.d.ts.map +1 -0
- package/lib/esm/ParserSpec.js +44 -0
- package/lib/esm/ParserSpec.js.map +1 -0
- package/lib/esm/Quantity.d.ts +28 -0
- package/lib/esm/Quantity.d.ts.map +1 -0
- package/lib/esm/Quantity.js +43 -0
- package/lib/esm/Quantity.js.map +1 -0
- package/lib/esm/Unit.d.ts +27 -0
- package/lib/esm/Unit.d.ts.map +1 -0
- package/lib/esm/Unit.js +41 -0
- package/lib/esm/Unit.js.map +1 -0
- package/lib/esm/core-quantity.d.ts +20 -0
- package/lib/esm/core-quantity.d.ts.map +1 -0
- package/lib/esm/core-quantity.js +24 -0
- package/lib/esm/core-quantity.js.map +1 -0
- package/package.json +11 -8
- package/lib/Constants.d.ts.map +0 -1
- package/lib/Constants.js.map +0 -1
- package/lib/Exception.d.ts.map +0 -1
- package/lib/Exception.js.map +0 -1
- package/lib/Formatter/Format.d.ts.map +0 -1
- package/lib/Formatter/Format.js.map +0 -1
- package/lib/Formatter/FormatEnums.d.ts.map +0 -1
- package/lib/Formatter/FormatEnums.js.map +0 -1
- package/lib/Formatter/Formatter.d.ts.map +0 -1
- package/lib/Formatter/Formatter.js.map +0 -1
- package/lib/Formatter/FormatterSpec.d.ts.map +0 -1
- package/lib/Formatter/FormatterSpec.js.map +0 -1
- package/lib/Formatter/Interfaces.d.ts.map +0 -1
- package/lib/Formatter/Interfaces.js.map +0 -1
- package/lib/Interfaces.d.ts.map +0 -1
- package/lib/Interfaces.js.map +0 -1
- package/lib/Parser.d.ts.map +0 -1
- package/lib/Parser.js.map +0 -1
- package/lib/ParserSpec.d.ts.map +0 -1
- package/lib/ParserSpec.js.map +0 -1
- package/lib/Quantity.d.ts.map +0 -1
- package/lib/Quantity.js.map +0 -1
- package/lib/Unit.d.ts.map +0 -1
- package/lib/Unit.js.map +0 -1
- package/lib/core-quantity.d.ts.map +0 -1
- package/lib/core-quantity.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-quantity.js","sourceRoot":"","sources":["../../src/core-quantity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB;AACzB,+CAA6B;AAC7B,6CAA2B;AAC3B,yCAAuB;AAEvB,qDAAmC;AACnC,4DAA0C;AAC1C,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC;AAEvC;;GAEG;AAEH;;;GAGG","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*--------------------------------------------------------------------------------------------*/\nexport * from \"./Constants\";\nexport * from \"./Exception\";\nexport * from \"./Interfaces\";\nexport * from \"./Parser\";\nexport * from \"./ParserSpec\";\nexport * from \"./Quantity\";\nexport * from \"./Unit\";\n\nexport * from \"./Formatter/Format\";\nexport * from \"./Formatter/FormatterSpec\";\nexport * from \"./Formatter/FormatEnums\";\nexport * from \"./Formatter/Formatter\";\nexport * from \"./Formatter/Interfaces\";\n\n/** @docs-package-description\n * The core-quantity package always runs in a web browser. It contains classes, interfaces, and definitions for formatting and parsing quantity values.\n */\n\n/**\n * @docs-group-description Quantity\n * Classes, Interfaces, and definitions used to format and parse quantity values.\n */\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Constants used internally for both formatting and parsing.
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export declare class QuantityConstants {
|
|
5
|
+
static readonly CHAR_COMMA = 44;
|
|
6
|
+
static readonly CHAR_SPACE = 32;
|
|
7
|
+
static readonly CHAR_NUMBER = 35;
|
|
8
|
+
static readonly CHAR_PLUS = 43;
|
|
9
|
+
static readonly CHAR_MINUS = 45;
|
|
10
|
+
static readonly CHAR_PERIOD = 46;
|
|
11
|
+
static readonly CHAR_SLASH = 47;
|
|
12
|
+
static readonly CHAR_DIVISION_SLASH = 8725;
|
|
13
|
+
static readonly CHAR_FRACTION_SLASH = 8260;
|
|
14
|
+
static readonly CHAR_ONE_QUARTER = 188;
|
|
15
|
+
static readonly CHAR_ONE_HALF = 189;
|
|
16
|
+
static readonly CHAR_THREE_QUARTER = 190;
|
|
17
|
+
static readonly CHAR_DIGIT_ZERO = 48;
|
|
18
|
+
static readonly CHAR_DIGIT_NINE = 57;
|
|
19
|
+
static readonly CHAR_UPPER_E = 69;
|
|
20
|
+
static readonly CHAR_LOWER_E = 101;
|
|
21
|
+
private static _LOCALE_DECIMAL_SEPARATOR;
|
|
22
|
+
private static _LOCALE_THOUSAND_SEPARATOR;
|
|
23
|
+
/** Return the decimal separator for the current locale. */
|
|
24
|
+
static get LocaleSpecificDecimalSeparator(): string;
|
|
25
|
+
/** Return the thousand separator for the current locale. */
|
|
26
|
+
static get LocaleSpecificThousandSeparator(): string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,gBAAuB,UAAU,MAAM;IACvC,gBAAuB,UAAU,MAAM;IACvC,gBAAuB,WAAW,MAAM;IACxC,gBAAuB,SAAS,MAAM;IACtC,gBAAuB,UAAU,MAAM;IACvC,gBAAuB,WAAW,MAAM;IACxC,gBAAuB,UAAU,MAAM;IACvC,gBAAuB,mBAAmB,QAAQ;IAClD,gBAAuB,mBAAmB,QAAQ;IAClD,gBAAuB,gBAAgB,OAAO;IAC9C,gBAAuB,aAAa,OAAO;IAC3C,gBAAuB,kBAAkB,OAAO;IAChD,gBAAuB,eAAe,MAAM;IAC5C,gBAAuB,eAAe,MAAM;IAC5C,gBAAuB,YAAY,MAAM;IACzC,gBAAuB,YAAY,OAAO;IAC1C,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAM;IAC9C,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAM;IAE/C,2DAA2D;IAC3D,WAAkB,8BAA8B,IAAI,MAAM,CAUzD;IAED,4DAA4D;IAC5D,WAAkB,+BAA+B,IAAI,MAAM,CAU1D;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
|
+
/** Constants used internally for both formatting and parsing.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export class QuantityConstants {
|
|
10
|
+
/** Return the decimal separator for the current locale. */
|
|
11
|
+
static get LocaleSpecificDecimalSeparator() {
|
|
12
|
+
if (QuantityConstants._LOCALE_DECIMAL_SEPARATOR.length > 0)
|
|
13
|
+
return QuantityConstants._LOCALE_DECIMAL_SEPARATOR;
|
|
14
|
+
QuantityConstants._LOCALE_DECIMAL_SEPARATOR = ".";
|
|
15
|
+
const matches = (12345.6789).toLocaleString().match(/345(.*)67/);
|
|
16
|
+
if (matches && matches.length > 1)
|
|
17
|
+
QuantityConstants._LOCALE_DECIMAL_SEPARATOR = matches[1];
|
|
18
|
+
return QuantityConstants._LOCALE_DECIMAL_SEPARATOR;
|
|
19
|
+
}
|
|
20
|
+
/** Return the thousand separator for the current locale. */
|
|
21
|
+
static get LocaleSpecificThousandSeparator() {
|
|
22
|
+
if (QuantityConstants._LOCALE_THOUSAND_SEPARATOR.length > 0)
|
|
23
|
+
return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;
|
|
24
|
+
QuantityConstants._LOCALE_THOUSAND_SEPARATOR = ",";
|
|
25
|
+
const matches = (12345.6789).toLocaleString().match(/12(.*)345/);
|
|
26
|
+
if (matches && matches.length > 0)
|
|
27
|
+
QuantityConstants._LOCALE_THOUSAND_SEPARATOR = matches[1];
|
|
28
|
+
return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
QuantityConstants.CHAR_COMMA = 44;
|
|
32
|
+
QuantityConstants.CHAR_SPACE = 32;
|
|
33
|
+
QuantityConstants.CHAR_NUMBER = 35;
|
|
34
|
+
QuantityConstants.CHAR_PLUS = 43;
|
|
35
|
+
QuantityConstants.CHAR_MINUS = 45;
|
|
36
|
+
QuantityConstants.CHAR_PERIOD = 46;
|
|
37
|
+
QuantityConstants.CHAR_SLASH = 47;
|
|
38
|
+
QuantityConstants.CHAR_DIVISION_SLASH = 8725;
|
|
39
|
+
QuantityConstants.CHAR_FRACTION_SLASH = 8260;
|
|
40
|
+
QuantityConstants.CHAR_ONE_QUARTER = 188;
|
|
41
|
+
QuantityConstants.CHAR_ONE_HALF = 189;
|
|
42
|
+
QuantityConstants.CHAR_THREE_QUARTER = 190;
|
|
43
|
+
QuantityConstants.CHAR_DIGIT_ZERO = 48;
|
|
44
|
+
QuantityConstants.CHAR_DIGIT_NINE = 57;
|
|
45
|
+
QuantityConstants.CHAR_UPPER_E = 69;
|
|
46
|
+
QuantityConstants.CHAR_LOWER_E = 101;
|
|
47
|
+
QuantityConstants._LOCALE_DECIMAL_SEPARATOR = "";
|
|
48
|
+
QuantityConstants._LOCALE_THOUSAND_SEPARATOR = "";
|
|
49
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,yDAAyD;AAEzD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAoB5B,2DAA2D;IACpD,MAAM,KAAK,8BAA8B;QAC9C,IAAI,iBAAiB,CAAC,yBAAyB,CAAC,MAAM,GAAG,CAAC;YACxD,OAAO,iBAAiB,CAAC,yBAAyB,CAAC;QAErD,iBAAiB,CAAC,yBAAyB,GAAG,GAAG,CAAC;QAClD,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,cAAc,EAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAClE,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAC/B,iBAAiB,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAE3D,OAAO,iBAAiB,CAAC,yBAAyB,CAAC;IACrD,CAAC;IAED,4DAA4D;IACrD,MAAM,KAAK,+BAA+B;QAC/C,IAAI,iBAAiB,CAAC,0BAA0B,CAAC,MAAM,GAAG,CAAC;YACzD,OAAO,iBAAiB,CAAC,0BAA0B,CAAC;QAEtD,iBAAiB,CAAC,0BAA0B,GAAG,GAAG,CAAC;QACnD,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,cAAc,EAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAClE,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAC/B,iBAAiB,CAAC,0BAA0B,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAE5D,OAAO,iBAAiB,CAAC,0BAA0B,CAAC;IACtD,CAAC;;AA3CsB,4BAAU,GAAG,EAAE,CAAC;AAChB,4BAAU,GAAG,EAAE,CAAC;AAChB,6BAAW,GAAG,EAAE,CAAC;AACjB,2BAAS,GAAG,EAAE,CAAC;AACf,4BAAU,GAAG,EAAE,CAAC;AAChB,6BAAW,GAAG,EAAE,CAAC;AACjB,4BAAU,GAAG,EAAE,CAAC;AAChB,qCAAmB,GAAG,IAAI,CAAC;AAC3B,qCAAmB,GAAG,IAAI,CAAC;AAC3B,kCAAgB,GAAG,GAAG,CAAC;AACvB,+BAAa,GAAG,GAAG,CAAC;AACpB,oCAAkB,GAAG,GAAG,CAAC;AACzB,iCAAe,GAAG,EAAE,CAAC;AACrB,iCAAe,GAAG,EAAE,CAAC;AACrB,8BAAY,GAAG,EAAE,CAAC;AAClB,8BAAY,GAAG,GAAG,CAAC;AAC3B,2CAAyB,GAAG,EAAE,CAAC;AAC/B,4CAA0B,GAAG,EAAE,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\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** Constants used internally for both formatting and parsing.\n * @internal\n */\nexport class QuantityConstants {\n public static readonly CHAR_COMMA = 44;\n public static readonly CHAR_SPACE = 32;\n public static readonly CHAR_NUMBER = 35;\n public static readonly CHAR_PLUS = 43;\n public static readonly CHAR_MINUS = 45;\n public static readonly CHAR_PERIOD = 46;\n public static readonly CHAR_SLASH = 47;\n public static readonly CHAR_DIVISION_SLASH = 8725;\n public static readonly CHAR_FRACTION_SLASH = 8260;\n public static readonly CHAR_ONE_QUARTER = 188;\n public static readonly CHAR_ONE_HALF = 189;\n public static readonly CHAR_THREE_QUARTER = 190;\n public static readonly CHAR_DIGIT_ZERO = 48;\n public static readonly CHAR_DIGIT_NINE = 57;\n public static readonly CHAR_UPPER_E = 69;\n public static readonly CHAR_LOWER_E = 101;\n private static _LOCALE_DECIMAL_SEPARATOR = \"\";\n private static _LOCALE_THOUSAND_SEPARATOR = \"\";\n\n /** Return the decimal separator for the current locale. */\n public static get LocaleSpecificDecimalSeparator(): string {\n if (QuantityConstants._LOCALE_DECIMAL_SEPARATOR.length > 0)\n return QuantityConstants._LOCALE_DECIMAL_SEPARATOR;\n\n QuantityConstants._LOCALE_DECIMAL_SEPARATOR = \".\";\n const matches = (12345.6789).toLocaleString()!.match(/345(.*)67/);\n if (matches && matches.length > 1)\n QuantityConstants._LOCALE_DECIMAL_SEPARATOR = matches[1];\n\n return QuantityConstants._LOCALE_DECIMAL_SEPARATOR;\n }\n\n /** Return the thousand separator for the current locale. */\n public static get LocaleSpecificThousandSeparator(): string {\n if (QuantityConstants._LOCALE_THOUSAND_SEPARATOR.length > 0)\n return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;\n\n QuantityConstants._LOCALE_THOUSAND_SEPARATOR = \",\";\n const matches = (12345.6789).toLocaleString()!.match(/12(.*)345/);\n if (matches && matches.length > 0)\n QuantityConstants._LOCALE_THOUSAND_SEPARATOR = matches[1];\n\n return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Quantity
|
|
3
|
+
*/
|
|
4
|
+
import { BentleyError } from "@itwin/core-bentley";
|
|
5
|
+
/**
|
|
6
|
+
* Status codes used during Quantity parsing and formatting processing.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare enum QuantityStatus {
|
|
10
|
+
QUANTITY_ERROR_BASE = 35039,
|
|
11
|
+
Success = 0,
|
|
12
|
+
InvalidJson = 35040,
|
|
13
|
+
InvalidCompositeFormat = 35041,
|
|
14
|
+
UnableToGenerateParseTokens = 35042,
|
|
15
|
+
NoValueOrUnitFoundInString = 35043,
|
|
16
|
+
UnitLabelSuppliedButNotMatched = 35044,
|
|
17
|
+
UnknownUnit = 35045,
|
|
18
|
+
UnableToConvertParseTokensToQuantity = 35046
|
|
19
|
+
}
|
|
20
|
+
/** The error type thrown by this module. See [[QuantityStatus]] for `errorNumber` values.
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export declare class QuantityError extends BentleyError {
|
|
24
|
+
readonly errorNumber: number;
|
|
25
|
+
constructor(errorNumber: number, message?: string);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.d.ts","sourceRoot":"","sources":["../../src/Exception.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,oBAAY,cAAc;IACxB,mBAAmB,QAAS;IAC5B,OAAO,IAAI;IACX,WAAW,QAA0B;IACrC,sBAAsB,QAA0B;IAChD,2BAA2B,QAA0B;IACrD,0BAA0B,QAA0B;IACpD,8BAA8B,QAA0B;IACxD,WAAW,QAA0B;IACrC,oCAAoC,QAA0B;CAC/D;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;aACD,WAAW,EAAE,MAAM;gBAAnB,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAGlF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Quantity
|
|
7
|
+
*/
|
|
8
|
+
import { BentleyError } from "@itwin/core-bentley";
|
|
9
|
+
/**
|
|
10
|
+
* Status codes used during Quantity parsing and formatting processing.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export var QuantityStatus;
|
|
14
|
+
(function (QuantityStatus) {
|
|
15
|
+
QuantityStatus[QuantityStatus["QUANTITY_ERROR_BASE"] = 35039] = "QUANTITY_ERROR_BASE";
|
|
16
|
+
QuantityStatus[QuantityStatus["Success"] = 0] = "Success";
|
|
17
|
+
QuantityStatus[QuantityStatus["InvalidJson"] = 35040] = "InvalidJson";
|
|
18
|
+
QuantityStatus[QuantityStatus["InvalidCompositeFormat"] = 35041] = "InvalidCompositeFormat";
|
|
19
|
+
QuantityStatus[QuantityStatus["UnableToGenerateParseTokens"] = 35042] = "UnableToGenerateParseTokens";
|
|
20
|
+
QuantityStatus[QuantityStatus["NoValueOrUnitFoundInString"] = 35043] = "NoValueOrUnitFoundInString";
|
|
21
|
+
QuantityStatus[QuantityStatus["UnitLabelSuppliedButNotMatched"] = 35044] = "UnitLabelSuppliedButNotMatched";
|
|
22
|
+
QuantityStatus[QuantityStatus["UnknownUnit"] = 35045] = "UnknownUnit";
|
|
23
|
+
QuantityStatus[QuantityStatus["UnableToConvertParseTokensToQuantity"] = 35046] = "UnableToConvertParseTokensToQuantity";
|
|
24
|
+
})(QuantityStatus || (QuantityStatus = {}));
|
|
25
|
+
/** The error type thrown by this module. See [[QuantityStatus]] for `errorNumber` values.
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export class QuantityError extends BentleyError {
|
|
29
|
+
constructor(errorNumber, message) {
|
|
30
|
+
super(errorNumber, message);
|
|
31
|
+
this.errorNumber = errorNumber;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=Exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../src/Exception.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB,qFAA4B,CAAA;IAC5B,yDAAW,CAAA;IACX,qEAAqC,CAAA;IACrC,2FAAgD,CAAA;IAChD,qGAAqD,CAAA;IACrD,mGAAoD,CAAA;IACpD,2GAAwD,CAAA;IACxD,qEAAqC,CAAA;IACrC,uHAA8D,CAAA;AAChE,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C,YAA4C,WAAmB,EAAE,OAAgB;QAC/E,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QADc,gBAAW,GAAX,WAAW,CAAQ;IAE/D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { BentleyError } from \"@itwin/core-bentley\";\n\n/**\n * Status codes used during Quantity parsing and formatting processing.\n * @beta\n */\nexport enum QuantityStatus {\n QUANTITY_ERROR_BASE = 0x88DF,\n Success = 0,\n InvalidJson = QUANTITY_ERROR_BASE + 1,\n InvalidCompositeFormat = QUANTITY_ERROR_BASE + 2,\n UnableToGenerateParseTokens = QUANTITY_ERROR_BASE + 3,\n NoValueOrUnitFoundInString = QUANTITY_ERROR_BASE + 4,\n UnitLabelSuppliedButNotMatched = QUANTITY_ERROR_BASE + 5,\n UnknownUnit = QUANTITY_ERROR_BASE + 6,\n UnableToConvertParseTokensToQuantity = QUANTITY_ERROR_BASE + 7,\n}\n\n/** The error type thrown by this module. See [[QuantityStatus]] for `errorNumber` values.\n * @beta\n */\nexport class QuantityError extends BentleyError {\n public constructor(public override readonly errorNumber: number, message?: string) {\n super(errorNumber, message);\n }\n}\n"]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Quantity
|
|
3
|
+
*/
|
|
4
|
+
import { UnitProps, UnitsProvider } from "../Interfaces";
|
|
5
|
+
import { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from "./FormatEnums";
|
|
6
|
+
import { CloneOptions, FormatProps } from "./Interfaces";
|
|
7
|
+
/** A class used to define the specifications for formatting quantity values. This class is typically loaded by reading [[FormatProps]].
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare class Format {
|
|
11
|
+
private _name;
|
|
12
|
+
protected _roundFactor: number;
|
|
13
|
+
protected _type: FormatType;
|
|
14
|
+
protected _precision: number;
|
|
15
|
+
protected _minWidth?: number;
|
|
16
|
+
protected _scientificType?: ScientificType;
|
|
17
|
+
protected _showSignOption: ShowSignOption;
|
|
18
|
+
protected _decimalSeparator: string;
|
|
19
|
+
protected _thousandSeparator: string;
|
|
20
|
+
protected _uomSeparator: string;
|
|
21
|
+
protected _stationSeparator: string;
|
|
22
|
+
protected _stationOffsetSize?: number;
|
|
23
|
+
protected _formatTraits: FormatTraits;
|
|
24
|
+
protected _spacer: string;
|
|
25
|
+
protected _includeZero: boolean;
|
|
26
|
+
protected _units?: Array<[UnitProps, string | undefined]>;
|
|
27
|
+
protected _customProps?: any;
|
|
28
|
+
/** Constructor
|
|
29
|
+
* @param name The name of a format specification. TODO: make optional or remove
|
|
30
|
+
*/
|
|
31
|
+
constructor(name: string);
|
|
32
|
+
get name(): string;
|
|
33
|
+
get roundFactor(): number;
|
|
34
|
+
get type(): FormatType;
|
|
35
|
+
get precision(): DecimalPrecision | FractionalPrecision;
|
|
36
|
+
get minWidth(): number | undefined;
|
|
37
|
+
get scientificType(): ScientificType | undefined;
|
|
38
|
+
get showSignOption(): ShowSignOption;
|
|
39
|
+
get decimalSeparator(): string;
|
|
40
|
+
get thousandSeparator(): string;
|
|
41
|
+
get uomSeparator(): string;
|
|
42
|
+
get stationSeparator(): string;
|
|
43
|
+
get stationOffsetSize(): number | undefined;
|
|
44
|
+
get formatTraits(): FormatTraits;
|
|
45
|
+
get spacer(): string;
|
|
46
|
+
get includeZero(): boolean;
|
|
47
|
+
get units(): Array<[UnitProps, string | undefined]> | undefined;
|
|
48
|
+
get hasUnits(): boolean;
|
|
49
|
+
get customProps(): any;
|
|
50
|
+
static scientificTypeToString(scientificType: ScientificType): string;
|
|
51
|
+
/** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid ScientificType. Throws exception if not valid. */
|
|
52
|
+
static parseScientificType(scientificType: string, formatName: string): ScientificType;
|
|
53
|
+
/** Method used when generating a JSON object that represents this Format. */
|
|
54
|
+
static showSignOptionToString(showSign: ShowSignOption): string;
|
|
55
|
+
/** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid ShowSignOption. Throws exception if not valid. */
|
|
56
|
+
static parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption;
|
|
57
|
+
static isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits): boolean;
|
|
58
|
+
/** Get string used in FormatProps */
|
|
59
|
+
static getTraitString(trait: FormatTraits): "trailZeroes" | "keepSingleZero" | "zeroEmpty" | "keepDecimalPoint" | "applyRounding" | "fractionDash" | "showUnitLabel" | "prependUnitLabel" | "use1000Separator" | "exponentOnlyNegative";
|
|
60
|
+
/** Method used when generating a JSON object that represents this Format. */
|
|
61
|
+
static formatTraitsToArray(currentFormatTrait: FormatTraits): string[];
|
|
62
|
+
/** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatTrait. Throws exception if not valid. */
|
|
63
|
+
static parseFormatTrait(stringToCheck: string, currentFormatTrait: number): FormatTraits;
|
|
64
|
+
/** Get FormatTrait from entry in FormatProps */
|
|
65
|
+
static parseFormatTraits(formatTraitsFromJson: string | string[] | undefined): FormatTraits | undefined;
|
|
66
|
+
/** Method used when generating a JSON object that represents this Format. */
|
|
67
|
+
static formatTypeToString(type: FormatType): string;
|
|
68
|
+
/** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType. Throws exception if not valid. */
|
|
69
|
+
static parseFormatType(jsonObjType: string, formatName: string): FormatType;
|
|
70
|
+
/** This method validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision. Throws exception if not valid. */
|
|
71
|
+
static parseDecimalPrecision(jsonObjPrecision: number): DecimalPrecision;
|
|
72
|
+
/** This method validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision. Throws exception if not valid. */
|
|
73
|
+
static parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision;
|
|
74
|
+
/** This method validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. Throws exception if not valid. */
|
|
75
|
+
static parsePrecision(precision: number, formatName: string, type: FormatType): DecimalPrecision | FractionalPrecision;
|
|
76
|
+
private verifyFormatTraitsOptions;
|
|
77
|
+
/** This method returns true if the formatTrait is set in this Format object. */
|
|
78
|
+
hasFormatTraitSet(formatTrait: FormatTraits): boolean;
|
|
79
|
+
private createUnit;
|
|
80
|
+
/**
|
|
81
|
+
* Clone Format
|
|
82
|
+
*/
|
|
83
|
+
clone(options?: CloneOptions): Format;
|
|
84
|
+
private loadFormatProperties;
|
|
85
|
+
/**
|
|
86
|
+
* Populates this Format with the values from the provided.
|
|
87
|
+
*/
|
|
88
|
+
fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void>;
|
|
89
|
+
/** Create a Format from FormatProps */
|
|
90
|
+
static createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<Format>;
|
|
91
|
+
/**
|
|
92
|
+
* Returns a JSON object that contain the specification for this Format.
|
|
93
|
+
*/
|
|
94
|
+
toJSON(): FormatProps;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=Format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Format.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,YAAY,EAAqB,WAAW,EAAuB,MAAM,cAAc,CAAC;AAKjG;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAM;IACnB,SAAS,CAAC,YAAY,EAAE,MAAM,CAAO;IACrC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAsB;IACjD,SAAS,CAAC,UAAU,EAAE,MAAM,CAAwB;IACpD,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,eAAe,EAAE,cAAc,CAA+B;IACxE,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAoD;IACvF,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAqD;IACzF,SAAS,CAAC,aAAa,SAAO;IAC9B,SAAS,CAAC,iBAAiB,SAAO;IAClC,SAAS,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACtC,SAAS,CAAC,aAAa,EAAE,YAAY,CAAO;IAC5C,SAAS,CAAC,OAAO,EAAE,MAAM,CAAO;IAChC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAQ;IACvC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,SAAS,EAAE,MAAM,GA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