@itwin/core-quantity 5.2.0-dev.2 → 5.2.0-dev.20
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 +31 -1
- package/lib/cjs/Formatter/Interfaces.d.ts +11 -0
- package/lib/cjs/Formatter/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Formatter/Interfaces.js.map +1 -1
- package/lib/esm/Formatter/Interfaces.d.ts +11 -0
- package/lib/esm/Formatter/Interfaces.d.ts.map +1 -1
- package/lib/esm/Formatter/Interfaces.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
# Change Log - @itwin/core-quantity
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 22 Aug 2025 14:26:46 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.1.4
|
|
6
|
+
Fri, 22 Aug 2025 14:22:33 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.1.3
|
|
11
|
+
Wed, 20 Aug 2025 13:57:10 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 5.1.2
|
|
16
|
+
Thu, 14 Aug 2025 19:38:08 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 5.1.1
|
|
21
|
+
Fri, 08 Aug 2025 18:06:10 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 5.1.0
|
|
26
|
+
Fri, 08 Aug 2025 12:51:53 GMT
|
|
27
|
+
|
|
28
|
+
### Updates
|
|
29
|
+
|
|
30
|
+
- Expand parsing flexibility for Bearing formats
|
|
31
|
+
- Add support for `stationBaseFactor` in `FormatProps`
|
|
32
|
+
- Make error message clearer
|
|
33
|
+
- Updated deprecation comments to new template
|
|
4
34
|
|
|
5
35
|
## 5.0.5
|
|
6
36
|
Wed, 06 Aug 2025 15:34:15 GMT
|
|
@@ -103,13 +103,24 @@ export interface FormatsProvider {
|
|
|
103
103
|
* @param name The full name of the Format or KindOfQuantity.
|
|
104
104
|
*/
|
|
105
105
|
getFormat(name: string): Promise<FormatDefinition | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* Fired when formats are added, removed, or changed.
|
|
108
|
+
* If all formats are changed, a single string "all" is emitted. Else, an array of changed format names is emitted.
|
|
109
|
+
*/
|
|
106
110
|
onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
|
|
107
111
|
}
|
|
108
112
|
/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.
|
|
109
113
|
* @beta
|
|
110
114
|
*/
|
|
111
115
|
export interface MutableFormatsProvider extends FormatsProvider {
|
|
116
|
+
/**
|
|
117
|
+
* Adds a new format or updates an existing format associated with the specified name.
|
|
118
|
+
*/
|
|
112
119
|
addFormat(name: string, format: FormatDefinition): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Removes the format associated with the specified name.
|
|
122
|
+
* @param name The name of the format to remove.
|
|
123
|
+
*/
|
|
113
124
|
removeFormat(name: string): Promise<void>;
|
|
114
125
|
}
|
|
115
126
|
//# sourceMappingURL=Interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,C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AAM,KAAK,SAAS,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { UnitProps } from \"../Interfaces\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\n\n/** This interface defines the persistence format for describing the formatting of quantity values.\n * @beta\n */\nexport interface FormatProps {\n readonly type: string;\n readonly precision?: number;\n readonly roundFactor?: number;\n readonly minWidth?: number;\n readonly showSignOption?: string;\n readonly formatTraits?: string | string[];\n readonly decimalSeparator?: string;\n readonly thousandSeparator?: string;\n readonly uomSeparator?: string;\n\n /** conditionally required. */\n readonly scientificType?: string;\n\n /** conditionally required. */\n readonly ratioType?: string;\n\n /** conditionally required. */\n readonly stationOffsetSize?: number;\n readonly stationSeparator?: string;\n\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\n readonly stationBaseFactor?: number;\n\n /** The base value for azimuth, specified from east counter-clockwise. */\n readonly azimuthBase?: number;\n\n /** The name of the unit for the azimuth base value. */\n readonly azimuthBaseUnit?: string;\n\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\n readonly azimuthCounterClockwise?: boolean;\n\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\n readonly revolutionUnit?: string;\n\n readonly allowMathematicOperations?: boolean;\n readonly composite?: {\n /** separates values when formatting composite strings */\n readonly spacer?: string;\n readonly includeZero?: boolean;\n readonly units: Array<{\n readonly name: string;\n readonly label?: string;\n }>;\n };\n}\n\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\n * @beta\n */\nexport interface CustomFormatProps extends FormatProps {\n readonly custom: any;\n}\n\n/** CustomFormatProps type guard.\n * @beta\n */\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\n return (item as CustomFormatProps).custom !== undefined;\n};\n\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\n * @beta\n */\nexport interface CloneUnit {\n unit?: UnitProps;\n label?: string;\n}\n\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\n * @beta\n */\nexport interface CloneOptions {\n /** allows composite formats to be converted to only show primary unit */\n showOnlyPrimaryUnit?: boolean;\n /** allow format traits to be set */\n traits?: FormatTraits;\n /** allows new FormatType to be specified */\n type?: FormatType;\n /** allows precision to be set, this will throw if value is not valid for FormatType */\n precision?: DecimalPrecision | FractionalPrecision;\n /** allows primary unit and label to be specified */\n primaryUnit?: CloneUnit;\n}\n\n/** An extension of FormatProps to help identify formats.\n * @beta\n */\nexport interface FormatDefinition extends FormatProps {\n readonly name?: string;\n readonly label?: string;\n readonly description?: string;\n}\n\n/** Argument for [[FormatsProvider.onFormatsChanged]]\n * @beta\n */\nexport interface FormatsChangedArgs {\n /**\n * If `all` - all formats within the `FormatsProvider` have changed.\n * If array, the array items list the names of formats that were changed or removed.\n */\n formatsChanged: \"all\" | string[];\n}\n\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\n * @beta\n */\nexport interface FormatsProvider {\n /**\n * @param name The full name of the Format or KindOfQuantity.\n */\n getFormat(name: string): Promise<FormatDefinition | undefined>;\n\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\n}\n\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\n * @beta\n */\nexport interface MutableFormatsProvider extends FormatsProvider {\n addFormat(name: string, format: FormatDefinition): Promise<void>;\n removeFormat(name: string): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAgEH;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAA6B,EAAE;IAClF,OAAQ,IAA0B,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { UnitProps } from \"../Interfaces\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\n\n/** This interface defines the persistence format for describing the formatting of quantity values.\n * @beta\n */\nexport interface FormatProps {\n readonly type: string;\n readonly precision?: number;\n readonly roundFactor?: number;\n readonly minWidth?: number;\n readonly showSignOption?: string;\n readonly formatTraits?: string | string[];\n readonly decimalSeparator?: string;\n readonly thousandSeparator?: string;\n readonly uomSeparator?: string;\n\n /** conditionally required. */\n readonly scientificType?: string;\n\n /** conditionally required. */\n readonly ratioType?: string;\n\n /** conditionally required. */\n readonly stationOffsetSize?: number;\n readonly stationSeparator?: string;\n\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\n readonly stationBaseFactor?: number;\n\n /** The base value for azimuth, specified from east counter-clockwise. */\n readonly azimuthBase?: number;\n\n /** The name of the unit for the azimuth base value. */\n readonly azimuthBaseUnit?: string;\n\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\n readonly azimuthCounterClockwise?: boolean;\n\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\n readonly revolutionUnit?: string;\n\n readonly allowMathematicOperations?: boolean;\n readonly composite?: {\n /** separates values when formatting composite strings */\n readonly spacer?: string;\n readonly includeZero?: boolean;\n readonly units: Array<{\n readonly name: string;\n readonly label?: string;\n }>;\n };\n}\n\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\n * @beta\n */\nexport interface CustomFormatProps extends FormatProps {\n readonly custom: any;\n}\n\n/** CustomFormatProps type guard.\n * @beta\n */\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\n return (item as CustomFormatProps).custom !== undefined;\n};\n\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\n * @beta\n */\nexport interface CloneUnit {\n unit?: UnitProps;\n label?: string;\n}\n\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\n * @beta\n */\nexport interface CloneOptions {\n /** allows composite formats to be converted to only show primary unit */\n showOnlyPrimaryUnit?: boolean;\n /** allow format traits to be set */\n traits?: FormatTraits;\n /** allows new FormatType to be specified */\n type?: FormatType;\n /** allows precision to be set, this will throw if value is not valid for FormatType */\n precision?: DecimalPrecision | FractionalPrecision;\n /** allows primary unit and label to be specified */\n primaryUnit?: CloneUnit;\n}\n\n/** An extension of FormatProps to help identify formats.\n * @beta\n */\nexport interface FormatDefinition extends FormatProps {\n readonly name?: string;\n readonly label?: string;\n readonly description?: string;\n}\n\n/** Argument for [[FormatsProvider.onFormatsChanged]]\n * @beta\n */\nexport interface FormatsChangedArgs {\n /**\n * If `all` - all formats within the `FormatsProvider` have changed.\n * If array, the array items list the names of formats that were changed or removed.\n */\n formatsChanged: \"all\" | string[];\n}\n\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\n * @beta\n */\nexport interface FormatsProvider {\n /**\n * @param name The full name of the Format or KindOfQuantity.\n */\n getFormat(name: string): Promise<FormatDefinition | undefined>;\n\n /**\n * Fired when formats are added, removed, or changed.\n * If all formats are changed, a single string \"all\" is emitted. Else, an array of changed format names is emitted.\n */\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\n}\n\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\n * @beta\n */\nexport interface MutableFormatsProvider extends FormatsProvider {\n /**\n * Adds a new format or updates an existing format associated with the specified name.\n */\n addFormat(name: string, format: FormatDefinition): Promise<void>;\n /**\n * Removes the format associated with the specified name.\n * @param name The name of the format to remove.\n */\n removeFormat(name: string): Promise<void>;\n}\n"]}
|
|
@@ -103,13 +103,24 @@ export interface FormatsProvider {
|
|
|
103
103
|
* @param name The full name of the Format or KindOfQuantity.
|
|
104
104
|
*/
|
|
105
105
|
getFormat(name: string): Promise<FormatDefinition | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* Fired when formats are added, removed, or changed.
|
|
108
|
+
* If all formats are changed, a single string "all" is emitted. Else, an array of changed format names is emitted.
|
|
109
|
+
*/
|
|
106
110
|
onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
|
|
107
111
|
}
|
|
108
112
|
/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.
|
|
109
113
|
* @beta
|
|
110
114
|
*/
|
|
111
115
|
export interface MutableFormatsProvider extends FormatsProvider {
|
|
116
|
+
/**
|
|
117
|
+
* Adds a new format or updates an existing format associated with the specified name.
|
|
118
|
+
*/
|
|
112
119
|
addFormat(name: string, format: FormatDefinition): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Removes the format associated with the specified name.
|
|
122
|
+
* @param name The name of the format to remove.
|
|
123
|
+
*/
|
|
113
124
|
removeFormat(name: string): Promise<void>;
|
|
114
125
|
}
|
|
115
126
|
//# sourceMappingURL=Interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,E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B,uFAAuF;IACvF,SAAS,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;IACnD,oDAAoD;IACpD,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,cAAc,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAE/D;;;OAGG;IACH,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAgEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAA6B,EAAE;IAClF,OAAQ,IAA0B,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,CAAC,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 { BeEvent } from \"@itwin/core-bentley\";\nimport { UnitProps } from \"../Interfaces\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\n\n/** This interface defines the persistence format for describing the formatting of quantity values.\n * @beta\n */\nexport interface FormatProps {\n readonly type: string;\n readonly precision?: number;\n readonly roundFactor?: number;\n readonly minWidth?: number;\n readonly showSignOption?: string;\n readonly formatTraits?: string | string[];\n readonly decimalSeparator?: string;\n readonly thousandSeparator?: string;\n readonly uomSeparator?: string;\n\n /** conditionally required. */\n readonly scientificType?: string;\n\n /** conditionally required. */\n readonly ratioType?: string;\n\n /** conditionally required. */\n readonly stationOffsetSize?: number;\n readonly stationSeparator?: string;\n\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\n readonly stationBaseFactor?: number;\n\n /** The base value for azimuth, specified from east counter-clockwise. */\n readonly azimuthBase?: number;\n\n /** The name of the unit for the azimuth base value. */\n readonly azimuthBaseUnit?: string;\n\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\n readonly azimuthCounterClockwise?: boolean;\n\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\n readonly revolutionUnit?: string;\n\n readonly allowMathematicOperations?: boolean;\n readonly composite?: {\n /** separates values when formatting composite strings */\n readonly spacer?: string;\n readonly includeZero?: boolean;\n readonly units: Array<{\n readonly name: string;\n readonly label?: string;\n }>;\n };\n}\n\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\n * @beta\n */\nexport interface CustomFormatProps extends FormatProps {\n readonly custom: any;\n}\n\n/** CustomFormatProps type guard.\n * @beta\n */\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\n return (item as CustomFormatProps).custom !== undefined;\n};\n\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\n * @beta\n */\nexport interface CloneUnit {\n unit?: UnitProps;\n label?: string;\n}\n\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\n * @beta\n */\nexport interface CloneOptions {\n /** allows composite formats to be converted to only show primary unit */\n showOnlyPrimaryUnit?: boolean;\n /** allow format traits to be set */\n traits?: FormatTraits;\n /** allows new FormatType to be specified */\n type?: FormatType;\n /** allows precision to be set, this will throw if value is not valid for FormatType */\n precision?: DecimalPrecision | FractionalPrecision;\n /** allows primary unit and label to be specified */\n primaryUnit?: CloneUnit;\n}\n\n/** An extension of FormatProps to help identify formats.\n * @beta\n */\nexport interface FormatDefinition extends FormatProps {\n readonly name?: string;\n readonly label?: string;\n readonly description?: string;\n}\n\n/** Argument for [[FormatsProvider.onFormatsChanged]]\n * @beta\n */\nexport interface FormatsChangedArgs {\n /**\n * If `all` - all formats within the `FormatsProvider` have changed.\n * If array, the array items list the names of formats that were changed or removed.\n */\n formatsChanged: \"all\" | string[];\n}\n\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\n * @beta\n */\nexport interface FormatsProvider {\n /**\n * @param name The full name of the Format or KindOfQuantity.\n */\n getFormat(name: string): Promise<FormatDefinition | undefined>;\n\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\n}\n\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\n * @beta\n */\nexport interface MutableFormatsProvider extends FormatsProvider {\n addFormat(name: string, format: FormatDefinition): Promise<void>;\n removeFormat(name: string): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/Formatter/Interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAgEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAA6B,EAAE;IAClF,OAAQ,IAA0B,CAAC,MAAM,KAAK,SAAS,CAAC;AAC1D,CAAC,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 { BeEvent } from \"@itwin/core-bentley\";\nimport { UnitProps } from \"../Interfaces\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision } from \"./FormatEnums\";\n\n/** This interface defines the persistence format for describing the formatting of quantity values.\n * @beta\n */\nexport interface FormatProps {\n readonly type: string;\n readonly precision?: number;\n readonly roundFactor?: number;\n readonly minWidth?: number;\n readonly showSignOption?: string;\n readonly formatTraits?: string | string[];\n readonly decimalSeparator?: string;\n readonly thousandSeparator?: string;\n readonly uomSeparator?: string;\n\n /** conditionally required. */\n readonly scientificType?: string;\n\n /** conditionally required. */\n readonly ratioType?: string;\n\n /** conditionally required. */\n readonly stationOffsetSize?: number;\n readonly stationSeparator?: string;\n\n /** Optional base factor for station formatting. A positive integer, defaults to 1. */\n readonly stationBaseFactor?: number;\n\n /** The base value for azimuth, specified from east counter-clockwise. */\n readonly azimuthBase?: number;\n\n /** The name of the unit for the azimuth base value. */\n readonly azimuthBaseUnit?: string;\n\n /** If set to true, azimuth values are returned counter-clockwise from the base. */\n readonly azimuthCounterClockwise?: boolean;\n\n /** The name of the unit that represents a revolution/perigon. Required for bearing or azimuth types. */\n readonly revolutionUnit?: string;\n\n readonly allowMathematicOperations?: boolean;\n readonly composite?: {\n /** separates values when formatting composite strings */\n readonly spacer?: string;\n readonly includeZero?: boolean;\n readonly units: Array<{\n readonly name: string;\n readonly label?: string;\n }>;\n };\n}\n\n/** This interface is used when supporting Custom Formatters that need more than the standard set of properties.\n * @beta\n */\nexport interface CustomFormatProps extends FormatProps {\n readonly custom: any;\n}\n\n/** CustomFormatProps type guard.\n * @beta\n */\nexport const isCustomFormatProps = (item: FormatProps): item is CustomFormatProps => {\n return (item as CustomFormatProps).custom !== undefined;\n};\n\n/** CloneFormat defines unit and label specification if primary unit is to be set during clone.\n * @beta\n */\nexport interface CloneUnit {\n unit?: UnitProps;\n label?: string;\n}\n\n/** CloneOptions that define modifications that can be made during the cloning of a Format.\n * @beta\n */\nexport interface CloneOptions {\n /** allows composite formats to be converted to only show primary unit */\n showOnlyPrimaryUnit?: boolean;\n /** allow format traits to be set */\n traits?: FormatTraits;\n /** allows new FormatType to be specified */\n type?: FormatType;\n /** allows precision to be set, this will throw if value is not valid for FormatType */\n precision?: DecimalPrecision | FractionalPrecision;\n /** allows primary unit and label to be specified */\n primaryUnit?: CloneUnit;\n}\n\n/** An extension of FormatProps to help identify formats.\n * @beta\n */\nexport interface FormatDefinition extends FormatProps {\n readonly name?: string;\n readonly label?: string;\n readonly description?: string;\n}\n\n/** Argument for [[FormatsProvider.onFormatsChanged]]\n * @beta\n */\nexport interface FormatsChangedArgs {\n /**\n * If `all` - all formats within the `FormatsProvider` have changed.\n * If array, the array items list the names of formats that were changed or removed.\n */\n formatsChanged: \"all\" | string[];\n}\n\n/** This interface is implemented by a class that would provide formats for use in formatting quantities.\n * @beta\n */\nexport interface FormatsProvider {\n /**\n * @param name The full name of the Format or KindOfQuantity.\n */\n getFormat(name: string): Promise<FormatDefinition | undefined>;\n\n /**\n * Fired when formats are added, removed, or changed.\n * If all formats are changed, a single string \"all\" is emitted. Else, an array of changed format names is emitted.\n */\n onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;\n}\n\n/** This interface is implemented by a class that would provide and allow creating formats for use in formatting quantities.\n * @beta\n */\nexport interface MutableFormatsProvider extends FormatsProvider {\n /**\n * Adds a new format or updates an existing format associated with the specified name.\n */\n addFormat(name: string, format: FormatDefinition): Promise<void>;\n /**\n * Removes the format associated with the specified name.\n * @param name The name of the format to remove.\n */\n removeFormat(name: string): Promise<void>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-quantity",
|
|
3
|
-
"version": "5.2.0-dev.
|
|
3
|
+
"version": "5.2.0-dev.20",
|
|
4
4
|
"description": "Quantity parsing, formatting and conversions for iModel.js",
|
|
5
5
|
"main": "lib/cjs/core-quantity.js",
|
|
6
6
|
"module": "lib/esm/core-quantity.js",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"rimraf": "^6.0.1",
|
|
29
29
|
"typescript": "~5.6.2",
|
|
30
30
|
"vitest": "^3.0.6",
|
|
31
|
-
"@itwin/build-tools": "5.2.0-dev.
|
|
32
|
-
"@itwin/core-bentley": "5.2.0-dev.
|
|
31
|
+
"@itwin/build-tools": "5.2.0-dev.20",
|
|
32
|
+
"@itwin/core-bentley": "5.2.0-dev.20"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@itwin/core-bentley": "5.2.0-dev.
|
|
35
|
+
"@itwin/core-bentley": "5.2.0-dev.20"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "npm run -s build:cjs && npm run -s build:esm",
|