@itwin/ecschema-metadata 4.8.0-dev.9 → 4.9.0-dev.1
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 +36 -1
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +4 -0
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +0 -6
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +0 -8
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +7 -3
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +16 -10
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +3 -1
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +14 -0
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +21 -0
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +5 -0
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +7 -0
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.d.ts +24 -0
- package/lib/esm/Constants.d.ts.map +1 -0
- package/lib/esm/Constants.js +30 -0
- package/lib/esm/Constants.js.map +1 -0
- package/lib/esm/Context.d.ts +219 -0
- package/lib/esm/Context.d.ts.map +1 -0
- package/lib/esm/Context.js +321 -0
- package/lib/esm/Context.js.map +1 -0
- package/lib/esm/DelayedPromise.d.ts +89 -0
- package/lib/esm/DelayedPromise.d.ts.map +1 -0
- package/lib/esm/DelayedPromise.js +88 -0
- package/lib/esm/DelayedPromise.js.map +1 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts +46 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/AbstractParser.js +8 -0
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -0
- package/lib/esm/Deserialization/Helper.d.ts +263 -0
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -0
- package/lib/esm/Deserialization/Helper.js +871 -0
- package/lib/esm/Deserialization/Helper.js.map +1 -0
- package/lib/esm/Deserialization/JsonParser.d.ts +166 -0
- package/lib/esm/Deserialization/JsonParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/JsonParser.js +677 -0
- package/lib/esm/Deserialization/JsonParser.js.map +1 -0
- package/lib/esm/Deserialization/JsonProps.d.ts +273 -0
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -0
- package/lib/esm/Deserialization/JsonProps.js +9 -0
- package/lib/esm/Deserialization/JsonProps.js.map +1 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts +35 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts.map +1 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.js +74 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -0
- package/lib/esm/Deserialization/XmlParser.d.ts +86 -0
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/XmlParser.js +970 -0
- package/lib/esm/Deserialization/XmlParser.js.map +1 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +55 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.js +172 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -0
- package/lib/esm/ECName.d.ts +31 -0
- package/lib/esm/ECName.d.ts.map +1 -0
- package/lib/esm/ECName.js +82 -0
- package/lib/esm/ECName.js.map +1 -0
- package/lib/esm/ECObjects.d.ts +166 -0
- package/lib/esm/ECObjects.d.ts.map +1 -0
- package/lib/esm/ECObjects.js +422 -0
- package/lib/esm/ECObjects.js.map +1 -0
- package/lib/esm/Exception.d.ts +45 -0
- package/lib/esm/Exception.d.ts.map +1 -0
- package/lib/esm/Exception.js +82 -0
- package/lib/esm/Exception.js.map +1 -0
- package/lib/esm/Interfaces.d.ts +79 -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/Metadata/Class.d.ts +245 -0
- package/lib/esm/Metadata/Class.d.ts.map +1 -0
- package/lib/esm/Metadata/Class.js +552 -0
- package/lib/esm/Metadata/Class.js.map +1 -0
- package/lib/esm/Metadata/Constant.d.ts +65 -0
- package/lib/esm/Metadata/Constant.d.ts.map +1 -0
- package/lib/esm/Metadata/Constant.js +119 -0
- package/lib/esm/Metadata/Constant.js.map +1 -0
- package/lib/esm/Metadata/CustomAttribute.d.ts +24 -0
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -0
- package/lib/esm/Metadata/CustomAttribute.js +24 -0
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -0
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +44 -0
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -0
- package/lib/esm/Metadata/CustomAttributeClass.js +70 -0
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -0
- package/lib/esm/Metadata/EntityClass.d.ts +78 -0
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -0
- package/lib/esm/Metadata/EntityClass.js +224 -0
- package/lib/esm/Metadata/EntityClass.js.map +1 -0
- package/lib/esm/Metadata/Enumeration.d.ts +87 -0
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -0
- package/lib/esm/Metadata/Enumeration.js +155 -0
- package/lib/esm/Metadata/Enumeration.js.map +1 -0
- package/lib/esm/Metadata/Format.d.ts +99 -0
- package/lib/esm/Metadata/Format.d.ts.map +1 -0
- package/lib/esm/Metadata/Format.js +238 -0
- package/lib/esm/Metadata/Format.js.map +1 -0
- package/lib/esm/Metadata/InvertedUnit.d.ts +50 -0
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -0
- package/lib/esm/Metadata/InvertedUnit.js +93 -0
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -0
- package/lib/esm/Metadata/KindOfQuantity.d.ts +72 -0
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -0
- package/lib/esm/Metadata/KindOfQuantity.js +229 -0
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -0
- package/lib/esm/Metadata/Mixin.d.ts +55 -0
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -0
- package/lib/esm/Metadata/Mixin.js +109 -0
- package/lib/esm/Metadata/Mixin.js.map +1 -0
- package/lib/esm/Metadata/OverrideFormat.d.ts +68 -0
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -0
- package/lib/esm/Metadata/OverrideFormat.js +124 -0
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -0
- package/lib/esm/Metadata/Phenomenon.d.ts +34 -0
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -0
- package/lib/esm/Metadata/Phenomenon.js +55 -0
- package/lib/esm/Metadata/Phenomenon.js.map +1 -0
- package/lib/esm/Metadata/Property.d.ts +247 -0
- package/lib/esm/Metadata/Property.d.ts.map +1 -0
- package/lib/esm/Metadata/Property.js +565 -0
- package/lib/esm/Metadata/Property.js.map +1 -0
- package/lib/esm/Metadata/PropertyCategory.d.ts +40 -0
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -0
- package/lib/esm/Metadata/PropertyCategory.js +57 -0
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -0
- package/lib/esm/Metadata/RelationshipClass.d.ts +170 -0
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -0
- package/lib/esm/Metadata/RelationshipClass.js +380 -0
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -0
- package/lib/esm/Metadata/Schema.d.ts +330 -0
- package/lib/esm/Metadata/Schema.d.ts.map +1 -0
- package/lib/esm/Metadata/Schema.js +570 -0
- package/lib/esm/Metadata/Schema.js.map +1 -0
- package/lib/esm/Metadata/SchemaItem.d.ts +67 -0
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -0
- package/lib/esm/Metadata/SchemaItem.js +140 -0
- package/lib/esm/Metadata/SchemaItem.js.map +1 -0
- package/lib/esm/Metadata/Unit.d.ts +77 -0
- package/lib/esm/Metadata/Unit.d.ts.map +1 -0
- package/lib/esm/Metadata/Unit.js +158 -0
- package/lib/esm/Metadata/Unit.js.map +1 -0
- package/lib/esm/Metadata/UnitSystem.d.ts +21 -0
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -0
- package/lib/esm/Metadata/UnitSystem.js +25 -0
- package/lib/esm/Metadata/UnitSystem.js.map +1 -0
- package/lib/esm/PropertyTypes.d.ts +50 -0
- package/lib/esm/PropertyTypes.d.ts.map +1 -0
- package/lib/esm/PropertyTypes.js +88 -0
- package/lib/esm/PropertyTypes.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +42 -0
- package/lib/esm/SchemaJsonLocater.d.ts.map +1 -0
- package/lib/esm/SchemaJsonLocater.js +54 -0
- package/lib/esm/SchemaJsonLocater.js.map +1 -0
- package/lib/esm/SchemaKey.d.ts +111 -0
- package/lib/esm/SchemaKey.d.ts.map +1 -0
- package/lib/esm/SchemaKey.js +214 -0
- package/lib/esm/SchemaKey.js.map +1 -0
- package/lib/esm/SchemaLoader.d.ts +32 -0
- package/lib/esm/SchemaLoader.d.ts.map +1 -0
- package/lib/esm/SchemaLoader.js +53 -0
- package/lib/esm/SchemaLoader.js.map +1 -0
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +275 -0
- package/lib/esm/SchemaPartVisitorDelegate.d.ts.map +1 -0
- package/lib/esm/SchemaPartVisitorDelegate.js +209 -0
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -0
- package/lib/esm/UnitConversion/Graph.d.ts +35 -0
- package/lib/esm/UnitConversion/Graph.d.ts.map +1 -0
- package/lib/esm/UnitConversion/Graph.js +80 -0
- package/lib/esm/UnitConversion/Graph.js.map +1 -0
- package/lib/esm/UnitConversion/Parser.d.ts +9 -0
- package/lib/esm/UnitConversion/Parser.d.ts.map +1 -0
- package/lib/esm/UnitConversion/Parser.js +39 -0
- package/lib/esm/UnitConversion/Parser.js.map +1 -0
- package/lib/esm/UnitConversion/UnitConversion.d.ts +46 -0
- package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitConversion.js +74 -0
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -0
- package/lib/esm/UnitConversion/UnitConverter.d.ts +40 -0
- package/lib/esm/UnitConversion/UnitConverter.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitConverter.js +113 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts +44 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitTree.js +165 -0
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts +78 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +231 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -0
- package/lib/esm/Validation/SchemaWalker.d.ts +24 -0
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaWalker.js +50 -0
- package/lib/esm/Validation/SchemaWalker.js.map +1 -0
- package/lib/esm/ecschema-metadata.d.ts +52 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -0
- package/lib/esm/ecschema-metadata.js +55 -0
- package/lib/esm/ecschema-metadata.js.map +1 -0
- package/lib/esm/utils/SchemaGraph.d.ts +44 -0
- package/lib/esm/utils/SchemaGraph.d.ts.map +1 -0
- package/lib/esm/utils/SchemaGraph.js +111 -0
- package/lib/esm/utils/SchemaGraph.js.map +1 -0
- package/package.json +9 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Format.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAuB,UAAU,EAAsB,mBAAmB,EACpH,cAAc,EAA0B,cAAc,EACvD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;GAEG;AACH,qBAAa,MAAO,SAAQ,UAAU;IACpC,SAAyB,cAAc,EAAG,cAAc,CAAC,MAAM,CAAC;IAChE,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC;IAC5B,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,GAAG,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;gBAExD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAOxC,IAAW,W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;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU;IAI9C;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM;IAI5C;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc;IAItD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM;IAI/C;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAIhD;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IAI3C;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM;CAGhD;AAED;;;GAGG;AACH,8BAAsB,aAAc,SAAQ,MAAM;aACvB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;aACxD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aACrC,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;aAC3C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;aACzC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;aACnD,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC5C,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC7C,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aACxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC5C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
|
|
@@ -0,0 +1,238 @@
|
|
|
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 Metadata
|
|
7
|
+
*/
|
|
8
|
+
import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
|
|
9
|
+
import { SchemaItemType } from "../ECObjects";
|
|
10
|
+
import { ECObjectsError, ECObjectsStatus } from "../Exception";
|
|
11
|
+
import { BaseFormat, FormatTraits, formatTraitsToArray, FormatType, formatTypeToString, scientificTypeToString, ShowSignOption, showSignOptionToString, } from "@itwin/core-quantity";
|
|
12
|
+
import { SchemaItem } from "./SchemaItem";
|
|
13
|
+
/**
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export class Format extends SchemaItem {
|
|
17
|
+
constructor(schema, name) {
|
|
18
|
+
super(schema, name);
|
|
19
|
+
this.schemaItemType = SchemaItemType.Format;
|
|
20
|
+
this._base = new BaseFormat(name);
|
|
21
|
+
}
|
|
22
|
+
get roundFactor() { return this._base.roundFactor; }
|
|
23
|
+
get type() { return this._base.type; }
|
|
24
|
+
get precision() { return this._base.precision; }
|
|
25
|
+
get minWidth() { return this._base.minWidth; }
|
|
26
|
+
get scientificType() { return this._base.scientificType; }
|
|
27
|
+
get showSignOption() { return this._base.showSignOption; }
|
|
28
|
+
get decimalSeparator() { return this._base.decimalSeparator; }
|
|
29
|
+
get thousandSeparator() { return this._base.thousandSeparator; }
|
|
30
|
+
get uomSeparator() { return this._base.uomSeparator; }
|
|
31
|
+
get stationSeparator() { return this._base.stationSeparator; }
|
|
32
|
+
get stationOffsetSize() { return this._base.stationOffsetSize; }
|
|
33
|
+
get formatTraits() { return this._base.formatTraits; }
|
|
34
|
+
get spacer() { return this._base.spacer; }
|
|
35
|
+
get includeZero() { return this._base.includeZero; }
|
|
36
|
+
get units() { return this._units; }
|
|
37
|
+
parseFormatTraits(formatTraitsFromJson) {
|
|
38
|
+
return this._base.parseFormatTraits(formatTraitsFromJson);
|
|
39
|
+
}
|
|
40
|
+
hasFormatTrait(formatTrait) {
|
|
41
|
+
return this._base.hasFormatTraitSet(formatTrait);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Adds a Unit, or InvertedUnit, with an optional label override.
|
|
45
|
+
* @param unit The Unit, or InvertedUnit, to add to this Format.
|
|
46
|
+
* @param label A label that overrides the label defined within the Unit when a value is formatted.
|
|
47
|
+
*/
|
|
48
|
+
addUnit(unit, label) {
|
|
49
|
+
if (undefined === this._units)
|
|
50
|
+
this._units = [];
|
|
51
|
+
else { // Validate that a duplicate is not added.
|
|
52
|
+
for (const existingUnit of this._units) {
|
|
53
|
+
if (unit.fullName.toLowerCase() === existingUnit[0].fullName.toLowerCase())
|
|
54
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has duplicate units, '${unit.fullName}'.`); // TODO: Validation - this should be a validation error not a hard failure.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
this._units.push([unit, label]);
|
|
58
|
+
}
|
|
59
|
+
setPrecision(precision) { this._base.precision = precision; }
|
|
60
|
+
typecheck(formatProps) {
|
|
61
|
+
this._base.loadFormatProperties(formatProps);
|
|
62
|
+
if (undefined !== formatProps.composite) { // TODO: This is duplicated below when the units need to be processed...
|
|
63
|
+
if (undefined !== formatProps.composite.includeZero)
|
|
64
|
+
this._base.includeZero = formatProps.composite.includeZero;
|
|
65
|
+
if (undefined !== formatProps.composite.spacer) {
|
|
66
|
+
if (formatProps.composite.spacer.length > 1)
|
|
67
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has a composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);
|
|
68
|
+
this._base.spacer = formatProps.composite.spacer;
|
|
69
|
+
}
|
|
70
|
+
// Composite requires 1-4 units
|
|
71
|
+
if (formatProps.composite.units.length <= 0 || formatProps.composite.units.length > 4)
|
|
72
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has an invalid 'Composite' attribute. It should have 1-4 units.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
fromJSONSync(formatProps) {
|
|
76
|
+
super.fromJSONSync(formatProps);
|
|
77
|
+
this.typecheck(formatProps);
|
|
78
|
+
if (undefined === formatProps.composite)
|
|
79
|
+
return;
|
|
80
|
+
// Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation
|
|
81
|
+
for (const unit of formatProps.composite.units) {
|
|
82
|
+
const newUnit = this.schema.lookupItemSync(unit.name);
|
|
83
|
+
if (undefined === newUnit)
|
|
84
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);
|
|
85
|
+
this.addUnit(newUnit, unit.label);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async fromJSON(formatProps) {
|
|
89
|
+
await super.fromJSON(formatProps);
|
|
90
|
+
this.typecheck(formatProps);
|
|
91
|
+
if (undefined === formatProps.composite)
|
|
92
|
+
return;
|
|
93
|
+
// Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation
|
|
94
|
+
for (const unit of formatProps.composite.units) {
|
|
95
|
+
const newUnit = await this.schema.lookupItem(unit.name);
|
|
96
|
+
if (undefined === newUnit)
|
|
97
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);
|
|
98
|
+
this.addUnit(newUnit, unit.label);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Save this Format's properties to an object for serializing to JSON.
|
|
103
|
+
* @param standalone Serialization includes only this object (as opposed to the full schema).
|
|
104
|
+
* @param includeSchemaVersion Include the Schema's version information in the serialized object.
|
|
105
|
+
*/
|
|
106
|
+
toJSON(standalone = false, includeSchemaVersion = false) {
|
|
107
|
+
const schemaJson = super.toJSON(standalone, includeSchemaVersion);
|
|
108
|
+
schemaJson.type = formatTypeToString(this.type);
|
|
109
|
+
schemaJson.precision = this.precision;
|
|
110
|
+
// this._spacer = " ";
|
|
111
|
+
// this._includeZero = true;
|
|
112
|
+
// Serialize the minimal amount of information needed so anything that is the same as the default, do not serialize.
|
|
113
|
+
if (0.0 !== this.roundFactor)
|
|
114
|
+
schemaJson.roundFactor = this.roundFactor;
|
|
115
|
+
if (ShowSignOption.OnlyNegative !== this.showSignOption)
|
|
116
|
+
schemaJson.showSignOption = showSignOptionToString(this.showSignOption);
|
|
117
|
+
if (FormatTraits.Uninitialized !== this.formatTraits)
|
|
118
|
+
schemaJson.formatTraits = formatTraitsToArray(this.formatTraits);
|
|
119
|
+
if ("." !== this.decimalSeparator)
|
|
120
|
+
schemaJson.decimalSeparator = this.decimalSeparator;
|
|
121
|
+
if ("," !== this.thousandSeparator)
|
|
122
|
+
schemaJson.thousandSeparator = this.thousandSeparator;
|
|
123
|
+
if (" " !== this.uomSeparator)
|
|
124
|
+
schemaJson.uomSeparator = this.uomSeparator;
|
|
125
|
+
if (undefined !== this.minWidth)
|
|
126
|
+
schemaJson.minWidth = this.minWidth;
|
|
127
|
+
if (FormatType.Scientific === this.type && undefined !== this.scientificType)
|
|
128
|
+
schemaJson.scientificType = scientificTypeToString(this.scientificType);
|
|
129
|
+
if (FormatType.Station === this.type) {
|
|
130
|
+
if (undefined !== this.stationOffsetSize)
|
|
131
|
+
schemaJson.stationOffsetSize = this.stationOffsetSize;
|
|
132
|
+
if (" " !== this.stationSeparator)
|
|
133
|
+
schemaJson.stationSeparator = this.stationSeparator;
|
|
134
|
+
}
|
|
135
|
+
if (undefined === this.units)
|
|
136
|
+
return schemaJson;
|
|
137
|
+
schemaJson.composite = {};
|
|
138
|
+
if (" " !== this.spacer)
|
|
139
|
+
schemaJson.composite.spacer = this.spacer;
|
|
140
|
+
if (true !== this.includeZero)
|
|
141
|
+
schemaJson.composite.includeZero = this.includeZero;
|
|
142
|
+
schemaJson.composite.units = [];
|
|
143
|
+
for (const unit of this.units) {
|
|
144
|
+
schemaJson.composite.units.push({
|
|
145
|
+
name: unit[0].fullName,
|
|
146
|
+
label: unit[1],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return schemaJson;
|
|
150
|
+
}
|
|
151
|
+
/** @internal */
|
|
152
|
+
async toXml(schemaXml) {
|
|
153
|
+
const itemElement = await super.toXml(schemaXml);
|
|
154
|
+
itemElement.setAttribute("type", formatTypeToString(this.type).toLowerCase());
|
|
155
|
+
itemElement.setAttribute("precision", this.precision.toString());
|
|
156
|
+
itemElement.setAttribute("roundFactor", this.roundFactor.toString());
|
|
157
|
+
itemElement.setAttribute("showSignOption", showSignOptionToString(this.showSignOption));
|
|
158
|
+
itemElement.setAttribute("decimalSeparator", this.decimalSeparator);
|
|
159
|
+
itemElement.setAttribute("thousandSeparator", this.thousandSeparator);
|
|
160
|
+
itemElement.setAttribute("uomSeparator", this.uomSeparator);
|
|
161
|
+
itemElement.setAttribute("stationSeparator", this.stationSeparator);
|
|
162
|
+
if (undefined !== this.minWidth)
|
|
163
|
+
itemElement.setAttribute("minWidth", this.minWidth.toString());
|
|
164
|
+
if (undefined !== this.scientificType)
|
|
165
|
+
itemElement.setAttribute("scientificType", scientificTypeToString(this.scientificType));
|
|
166
|
+
if (undefined !== this.stationOffsetSize)
|
|
167
|
+
itemElement.setAttribute("stationOffsetSize", this.stationOffsetSize.toString());
|
|
168
|
+
const formatTraits = formatTraitsToArray(this.formatTraits);
|
|
169
|
+
if (formatTraits.length > 0)
|
|
170
|
+
itemElement.setAttribute("formatTraits", formatTraits.join("|"));
|
|
171
|
+
if (undefined !== this.units) {
|
|
172
|
+
const compositeElement = schemaXml.createElement("Composite");
|
|
173
|
+
if (undefined !== this.spacer)
|
|
174
|
+
compositeElement.setAttribute("spacer", this.spacer);
|
|
175
|
+
if (undefined !== this.includeZero)
|
|
176
|
+
compositeElement.setAttribute("includeZero", this.includeZero.toString());
|
|
177
|
+
this.units.forEach(([unit, label]) => {
|
|
178
|
+
const unitElement = schemaXml.createElement("Unit");
|
|
179
|
+
if (undefined !== label)
|
|
180
|
+
unitElement.setAttribute("label", label);
|
|
181
|
+
const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, unit.schema, unit.name);
|
|
182
|
+
unitElement.textContent = unitName;
|
|
183
|
+
compositeElement.appendChild(unitElement);
|
|
184
|
+
});
|
|
185
|
+
itemElement.appendChild(compositeElement);
|
|
186
|
+
}
|
|
187
|
+
return itemElement;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @alpha Used in schema editing.
|
|
191
|
+
*/
|
|
192
|
+
setFormatType(formatType) {
|
|
193
|
+
this._base.type = formatType;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @alpha Used in schema editing.
|
|
197
|
+
*/
|
|
198
|
+
setRoundFactor(roundFactor) {
|
|
199
|
+
this._base.roundFactor = roundFactor;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @alpha Used in schema editing.
|
|
203
|
+
*/
|
|
204
|
+
setShowSignOption(signOption) {
|
|
205
|
+
this._base.showSignOption = signOption;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @alpha Used in schema editing.
|
|
209
|
+
*/
|
|
210
|
+
setDecimalSeparator(separator) {
|
|
211
|
+
this._base.decimalSeparator = separator;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @alpha Used in schema editing.
|
|
215
|
+
*/
|
|
216
|
+
setThousandSeparator(separator) {
|
|
217
|
+
this._base.thousandSeparator = separator;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* @alpha Used in schema editing.
|
|
221
|
+
*/
|
|
222
|
+
setUomSeparator(separator) {
|
|
223
|
+
this._base.uomSeparator = separator;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @alpha Used in schema editing.
|
|
227
|
+
*/
|
|
228
|
+
setStationSeparator(separator) {
|
|
229
|
+
this._base.stationSeparator = separator;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @internal
|
|
234
|
+
* An abstract class used for schema editing.
|
|
235
|
+
*/
|
|
236
|
+
export class MutableFormat extends Format {
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=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AED;;OAEG;IACO,mBAAmB,CAAC,SAAiB;QAC7C,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,oBAAoB,CAAC,SAAiB;QAC9C,IAAI,CAAC,KAAK,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAC3C,CAAC;IAED;;OAEG;IACO,eAAe,CAAC,SAAiB;QACzC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;IACtC,CAAC;IAED;;OAEG;IACO,mBAAmB,CAAC,SAAiB;QAC7C,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAC1C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,aAAc,SAAQ,MAAM;CAWjD","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\nimport { SchemaItemFormatProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport {\r\n BaseFormat, DecimalPrecision, FormatTraits, formatTraitsToArray, FormatType, formatTypeToString, FractionalPrecision,\r\n ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class Format extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.Format; // eslint-disable-line\r\n protected _base: BaseFormat;\r\n protected _units?: Array<[Unit | InvertedUnit, string | undefined]>;\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.Format;\r\n\r\n this._base = new BaseFormat(name);\r\n }\r\n\r\n public get roundFactor(): number { return this._base.roundFactor; }\r\n public get type(): FormatType { return this._base.type; }\r\n public get precision(): DecimalPrecision | FractionalPrecision { return this._base.precision; }\r\n public get minWidth(): number | undefined { return this._base.minWidth; }\r\n public get scientificType(): ScientificType | undefined { return this._base.scientificType; }\r\n public get showSignOption(): ShowSignOption { return this._base.showSignOption; }\r\n public get decimalSeparator(): string { return this._base.decimalSeparator; }\r\n public get thousandSeparator(): string { return this._base.thousandSeparator; }\r\n public get uomSeparator(): string { return this._base.uomSeparator; }\r\n public get stationSeparator(): string { return this._base.stationSeparator; }\r\n public get stationOffsetSize(): number | undefined { return this._base.stationOffsetSize; }\r\n public get formatTraits(): FormatTraits { return this._base.formatTraits; }\r\n public get spacer(): string | undefined { return this._base.spacer; }\r\n public get includeZero(): boolean | undefined { return this._base.includeZero; }\r\n public get units(): Array<[Unit | InvertedUnit, string | undefined]> | undefined { return this._units; }\r\n\r\n private parseFormatTraits(formatTraitsFromJson: string | string[]) {\r\n return this._base.parseFormatTraits(formatTraitsFromJson);\r\n }\r\n\r\n public hasFormatTrait(formatTrait: FormatTraits) {\r\n return this._base.hasFormatTraitSet(formatTrait);\r\n }\r\n\r\n /**\r\n * Adds a Unit, or InvertedUnit, with an optional label override.\r\n * @param unit The Unit, or InvertedUnit, to add to this Format.\r\n * @param label A label that overrides the label defined within the Unit when a value is formatted.\r\n */\r\n protected addUnit(unit: Unit | InvertedUnit, label?: string) {\r\n if (undefined === this._units)\r\n this._units = [];\r\n else { // Validate that a duplicate is not added.\r\n for (const existingUnit of this._units) {\r\n if (unit.fullName.toLowerCase() === existingUnit[0].fullName.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has duplicate units, '${unit.fullName}'.`); // TODO: Validation - this should be a validation error not a hard failure.\r\n }\r\n }\r\n\r\n this._units.push([unit, label]);\r\n }\r\n\r\n protected setPrecision(precision: number) { this._base.precision = precision; }\r\n\r\n private typecheck(formatProps: SchemaItemFormatProps) {\r\n this._base.loadFormatProperties(formatProps);\r\n\r\n if (undefined !== formatProps.composite) { // TODO: This is duplicated below when the units need to be processed...\r\n if (undefined !== formatProps.composite.includeZero)\r\n this._base.includeZero = formatProps.composite.includeZero;\r\n\r\n if (undefined !== formatProps.composite.spacer) {\r\n if (formatProps.composite.spacer.length > 1)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has a composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);\r\n this._base.spacer = formatProps.composite.spacer;\r\n }\r\n\r\n // Composite requires 1-4 units\r\n if (formatProps.composite.units.length <= 0 || formatProps.composite.units.length > 4)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Format ${this.fullName} has an invalid 'Composite' attribute. It should have 1-4 units.`);\r\n }\r\n }\r\n\r\n public override fromJSONSync(formatProps: SchemaItemFormatProps) {\r\n super.fromJSONSync(formatProps);\r\n this.typecheck(formatProps);\r\n if (undefined === formatProps.composite)\r\n return;\r\n\r\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\r\n for (const unit of formatProps.composite.units) {\r\n const newUnit = this.schema.lookupItemSync<Unit | InvertedUnit>(unit.name);\r\n if (undefined === newUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n this.addUnit(newUnit, unit.label);\r\n }\r\n }\r\n\r\n public override async fromJSON(formatProps: SchemaItemFormatProps) {\r\n await super.fromJSON(formatProps);\r\n this.typecheck(formatProps);\r\n if (undefined === formatProps.composite)\r\n return;\r\n\r\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\r\n for (const unit of formatProps.composite.units) {\r\n const newUnit = await this.schema.lookupItem<Unit | InvertedUnit>(unit.name);\r\n if (undefined === newUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n this.addUnit(newUnit, unit.label);\r\n }\r\n }\r\n\r\n /**\r\n * Save this Format's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): SchemaItemFormatProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.type = formatTypeToString(this.type);\r\n schemaJson.precision = this.precision;\r\n\r\n // this._spacer = \" \";\r\n // this._includeZero = true;\r\n\r\n // Serialize the minimal amount of information needed so anything that is the same as the default, do not serialize.\r\n if (0.0 !== this.roundFactor)\r\n schemaJson.roundFactor = this.roundFactor;\r\n if (ShowSignOption.OnlyNegative !== this.showSignOption)\r\n schemaJson.showSignOption = showSignOptionToString(this.showSignOption);\r\n if (FormatTraits.Uninitialized !== this.formatTraits)\r\n schemaJson.formatTraits = formatTraitsToArray(this.formatTraits);\r\n if (\".\" !== this.decimalSeparator)\r\n schemaJson.decimalSeparator = this.decimalSeparator;\r\n if (\",\" !== this.thousandSeparator)\r\n schemaJson.thousandSeparator = this.thousandSeparator;\r\n if (\" \" !== this.uomSeparator)\r\n schemaJson.uomSeparator = this.uomSeparator;\r\n\r\n if (undefined !== this.minWidth)\r\n schemaJson.minWidth = this.minWidth;\r\n\r\n if (FormatType.Scientific === this.type && undefined !== this.scientificType)\r\n schemaJson.scientificType = scientificTypeToString(this.scientificType);\r\n\r\n if (FormatType.Station === this.type) {\r\n if (undefined !== this.stationOffsetSize)\r\n schemaJson.stationOffsetSize = this.stationOffsetSize;\r\n if (\" \" !== this.stationSeparator)\r\n schemaJson.stationSeparator = this.stationSeparator;\r\n }\r\n\r\n if (undefined === this.units)\r\n return schemaJson;\r\n\r\n schemaJson.composite = {};\r\n\r\n if (\" \" !== this.spacer)\r\n schemaJson.composite.spacer = this.spacer;\r\n\r\n if (true !== this.includeZero)\r\n schemaJson.composite.includeZero = this.includeZero;\r\n\r\n schemaJson.composite.units = [];\r\n for (const unit of this.units) {\r\n schemaJson.composite.units.push({\r\n name: unit[0].fullName,\r\n label: unit[1],\r\n });\r\n }\r\n\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"type\", formatTypeToString(this.type).toLowerCase());\r\n itemElement.setAttribute(\"precision\", this.precision.toString());\r\n itemElement.setAttribute(\"roundFactor\", this.roundFactor.toString());\r\n itemElement.setAttribute(\"showSignOption\", showSignOptionToString(this.showSignOption));\r\n itemElement.setAttribute(\"decimalSeparator\", this.decimalSeparator);\r\n itemElement.setAttribute(\"thousandSeparator\", this.thousandSeparator);\r\n itemElement.setAttribute(\"uomSeparator\", this.uomSeparator);\r\n itemElement.setAttribute(\"stationSeparator\", this.stationSeparator);\r\n\r\n if (undefined !== this.minWidth)\r\n itemElement.setAttribute(\"minWidth\", this.minWidth.toString());\r\n if (undefined !== this.scientificType)\r\n itemElement.setAttribute(\"scientificType\", scientificTypeToString(this.scientificType));\r\n if (undefined !== this.stationOffsetSize)\r\n itemElement.setAttribute(\"stationOffsetSize\", this.stationOffsetSize.toString());\r\n\r\n const formatTraits = formatTraitsToArray(this.formatTraits);\r\n if (formatTraits.length > 0)\r\n itemElement.setAttribute(\"formatTraits\", formatTraits.join(\"|\"));\r\n\r\n if (undefined !== this.units) {\r\n const compositeElement = schemaXml.createElement(\"Composite\");\r\n if (undefined !== this.spacer)\r\n compositeElement.setAttribute(\"spacer\", this.spacer);\r\n if (undefined !== this.includeZero)\r\n compositeElement.setAttribute(\"includeZero\", this.includeZero.toString());\r\n\r\n this.units.forEach(([unit, label]) => {\r\n const unitElement = schemaXml.createElement(\"Unit\");\r\n if (undefined !== label)\r\n unitElement.setAttribute(\"label\", label);\r\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, unit.schema, unit.name);\r\n unitElement.textContent = unitName;\r\n compositeElement.appendChild(unitElement);\r\n });\r\n\r\n itemElement.appendChild(compositeElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setFormatType(formatType: FormatType) {\r\n this._base.type = formatType;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setRoundFactor(roundFactor: number) {\r\n this._base.roundFactor = roundFactor;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setShowSignOption(signOption: ShowSignOption) {\r\n this._base.showSignOption = signOption;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setDecimalSeparator(separator: string) {\r\n this._base.decimalSeparator = separator;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setThousandSeparator(separator: string) {\r\n this._base.thousandSeparator = separator;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setUomSeparator(separator: string) {\r\n this._base.uomSeparator = separator;\r\n }\r\n\r\n /**\r\n * @alpha Used in schema editing.\r\n */\r\n protected setStationSeparator(separator: string) {\r\n this._base.stationSeparator = separator;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableFormat extends Format {\r\n public abstract override addUnit(unit: Unit | InvertedUnit, label?: string): void;\r\n public abstract override setPrecision(precision: number): void;\r\n public abstract override setFormatType(formatType: FormatType): void;\r\n public abstract override setRoundFactor(roundFactor: number): void;\r\n public abstract override setShowSignOption(signOption: ShowSignOption): void;\r\n public abstract override setDecimalSeparator(separator: string): void;\r\n public abstract override setThousandSeparator(separator: string): void;\r\n public abstract override setUomSeparator(separator: string): void;\r\n public abstract override setStationSeparator(separator: string): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Metadata
|
|
3
|
+
*/
|
|
4
|
+
import { InvertedUnitProps } from "../Deserialization/JsonProps";
|
|
5
|
+
import { SchemaItemType } from "../ECObjects";
|
|
6
|
+
import { LazyLoadedUnit, LazyLoadedUnitSystem } from "../Interfaces";
|
|
7
|
+
import { Schema } from "./Schema";
|
|
8
|
+
import { SchemaItem } from "./SchemaItem";
|
|
9
|
+
/**
|
|
10
|
+
* An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export declare class InvertedUnit extends SchemaItem {
|
|
14
|
+
readonly schemaItemType: SchemaItemType.InvertedUnit;
|
|
15
|
+
protected _invertsUnit?: LazyLoadedUnit;
|
|
16
|
+
protected _unitSystem?: LazyLoadedUnitSystem;
|
|
17
|
+
constructor(schema: Schema, name: string);
|
|
18
|
+
get invertsUnit(): LazyLoadedUnit | undefined;
|
|
19
|
+
get unitSystem(): LazyLoadedUnitSystem | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Save this InvertedUnit's properties to an object for serializing to JSON.
|
|
22
|
+
* @param standalone Serialization includes only this object (as opposed to the full schema).
|
|
23
|
+
* @param includeSchemaVersion Include the Schema's version information in the serialized object.
|
|
24
|
+
*/
|
|
25
|
+
toJSON(standalone?: boolean, includeSchemaVersion?: boolean): InvertedUnitProps;
|
|
26
|
+
/** @internal */
|
|
27
|
+
toXml(schemaXml: Document): Promise<Element>;
|
|
28
|
+
fromJSONSync(invertedUnitProps: InvertedUnitProps): void;
|
|
29
|
+
fromJSON(invertedUnitProps: InvertedUnitProps): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* @alpha
|
|
32
|
+
* Used for schema editing
|
|
33
|
+
*/
|
|
34
|
+
protected setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
|
|
35
|
+
/**
|
|
36
|
+
* @alpha
|
|
37
|
+
* Used for schema editing
|
|
38
|
+
*/
|
|
39
|
+
protected setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* An abstract class used for schema editing.
|
|
44
|
+
*/
|
|
45
|
+
export declare abstract class MutableInvertedUnit extends InvertedUnit {
|
|
46
|
+
abstract setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
|
|
47
|
+
abstract setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
|
|
48
|
+
abstract setDisplayLabel(displayLabel: string): void;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=InvertedUnit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvertedUnit.d.ts","sourceRoot":"","sources":["../../../src/Metadata/InvertedUnit.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,SAAyB,cAAc,EAAG,cAAc,CAAC,YAAY,CAAC;IACtE,SAAS,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC;IACxC,SAAS,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC;gBAEjC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKxC,IAAW,WAAW,IAAI,cAAc,GAAG,SAAS,CAA8B;IAClF,IAAW,UAAU,IAAI,oBAAoB,GAAG,SAAS,CAA6B;IAEtF;;;;OAIG;IACa,MAAM,CAAC,UAAU,GAAE,OAAe,EAAE,oBAAoB,GAAE,OAAe,GAAG,iBAAiB;IAO7G,gBAAgB;IACM,KAAK,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBlD,YAAY,CAAC,iBAAiB,EAAE,iBAAiB;IAuB3C,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB;IAInE;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc;IAIpD;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,oBAAoB;CAGzD;AAED;;;GAGG;AACH,8BAAsB,mBAAoB,SAAQ,YAAY;aACnC,cAAc,CAAC,WAAW,EAAE,cAAc,GAAG,IAAI;aACjD,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;aACrD,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 Metadata
|
|
7
|
+
*/
|
|
8
|
+
import { DelayedPromiseWithProps } from "../DelayedPromise";
|
|
9
|
+
import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
|
|
10
|
+
import { SchemaItemType } from "../ECObjects";
|
|
11
|
+
import { ECObjectsError, ECObjectsStatus } from "../Exception";
|
|
12
|
+
import { SchemaItem } from "./SchemaItem";
|
|
13
|
+
/**
|
|
14
|
+
* An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export class InvertedUnit extends SchemaItem {
|
|
18
|
+
constructor(schema, name) {
|
|
19
|
+
super(schema, name);
|
|
20
|
+
this.schemaItemType = SchemaItemType.InvertedUnit;
|
|
21
|
+
}
|
|
22
|
+
get invertsUnit() { return this._invertsUnit; }
|
|
23
|
+
get unitSystem() { return this._unitSystem; }
|
|
24
|
+
/**
|
|
25
|
+
* Save this InvertedUnit's properties to an object for serializing to JSON.
|
|
26
|
+
* @param standalone Serialization includes only this object (as opposed to the full schema).
|
|
27
|
+
* @param includeSchemaVersion Include the Schema's version information in the serialized object.
|
|
28
|
+
*/
|
|
29
|
+
toJSON(standalone = false, includeSchemaVersion = false) {
|
|
30
|
+
const schemaJson = super.toJSON(standalone, includeSchemaVersion);
|
|
31
|
+
schemaJson.invertsUnit = this.invertsUnit.fullName;
|
|
32
|
+
schemaJson.unitSystem = this.unitSystem.fullName;
|
|
33
|
+
return schemaJson;
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
async toXml(schemaXml) {
|
|
37
|
+
const itemElement = await super.toXml(schemaXml);
|
|
38
|
+
const unitSystem = await this.unitSystem;
|
|
39
|
+
if (undefined !== unitSystem) {
|
|
40
|
+
const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);
|
|
41
|
+
itemElement.setAttribute("unitSystem", unitSystemName);
|
|
42
|
+
}
|
|
43
|
+
const invertsUnit = await this.invertsUnit;
|
|
44
|
+
if (undefined !== invertsUnit) {
|
|
45
|
+
const invertsUnitName = XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);
|
|
46
|
+
itemElement.setAttribute("invertsUnit", invertsUnitName);
|
|
47
|
+
}
|
|
48
|
+
return itemElement;
|
|
49
|
+
}
|
|
50
|
+
fromJSONSync(invertedUnitProps) {
|
|
51
|
+
super.fromJSONSync(invertedUnitProps);
|
|
52
|
+
const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);
|
|
53
|
+
this._invertsUnit = new DelayedPromiseWithProps(unitSchemaItemKey, async () => {
|
|
54
|
+
const invertsUnit = await this.schema.lookupItem(unitSchemaItemKey);
|
|
55
|
+
if (undefined === invertsUnit)
|
|
56
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);
|
|
57
|
+
return invertsUnit;
|
|
58
|
+
});
|
|
59
|
+
const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);
|
|
60
|
+
if (!unitSystemSchemaItemKey)
|
|
61
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
|
|
62
|
+
this._unitSystem = new DelayedPromiseWithProps(unitSystemSchemaItemKey, async () => {
|
|
63
|
+
const unitSystem = await this.schema.lookupItem(unitSystemSchemaItemKey);
|
|
64
|
+
if (undefined === unitSystem)
|
|
65
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
|
|
66
|
+
return unitSystem;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async fromJSON(invertedUnitProps) {
|
|
70
|
+
this.fromJSONSync(invertedUnitProps);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @alpha
|
|
74
|
+
* Used for schema editing
|
|
75
|
+
*/
|
|
76
|
+
setInvertsUnit(invertsUnit) {
|
|
77
|
+
this._invertsUnit = invertsUnit;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @alpha
|
|
81
|
+
* Used for schema editing
|
|
82
|
+
*/
|
|
83
|
+
setUnitSystem(unitSystem) {
|
|
84
|
+
this._unitSystem = unitSystem;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
* An abstract class used for schema editing.
|
|
90
|
+
*/
|
|
91
|
+
export class MutableInvertedUnit extends InvertedUnit {
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=InvertedUnit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvertedUnit.js","sourceRoot":"","sources":["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C,iBAAiB,CAAC,UAAU,GAAG,CAAC,CAAC;QAC9H,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAuB,CAA4B,uBAAuB,EAC/F,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAa,uBAAuB,CAAC,CAAC;YACrF,IAAI,SAAS,KAAK,UAAU;gBAC1B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,mCAAmC,iBAAiB,CAAC,UAAU,GAAG,CAAC,CAAC;YAC9H,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,iBAAoC;QACjE,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAA2B;QAClD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,UAAgC;QACtD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,YAAY;CAI7D","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\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { InvertedUnitProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedUnit, LazyLoadedUnitSystem } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\n/**\r\n * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.\r\n * @beta\r\n */\r\nexport class InvertedUnit extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.InvertedUnit; // eslint-disable-line\r\n protected _invertsUnit?: LazyLoadedUnit; // required\r\n protected _unitSystem?: LazyLoadedUnitSystem; // required\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.InvertedUnit;\r\n }\r\n\r\n public get invertsUnit(): LazyLoadedUnit | undefined { return this._invertsUnit; }\r\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\r\n\r\n /**\r\n * Save this InvertedUnit's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): InvertedUnitProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.invertsUnit = this.invertsUnit!.fullName;\r\n schemaJson.unitSystem = this.unitSystem!.fullName;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n const unitSystem = await this.unitSystem;\r\n if (undefined !== unitSystem) {\r\n const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);\r\n itemElement.setAttribute(\"unitSystem\", unitSystemName);\r\n }\r\n\r\n const invertsUnit = await this.invertsUnit;\r\n if (undefined !== invertsUnit) {\r\n const invertsUnitName = XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);\r\n itemElement.setAttribute(\"invertsUnit\", invertsUnitName);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(invertedUnitProps: InvertedUnitProps) {\r\n super.fromJSONSync(invertedUnitProps);\r\n const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);\r\n this._invertsUnit = new DelayedPromiseWithProps<SchemaItemKey, Unit>(unitSchemaItemKey,\r\n async () => {\r\n const invertsUnit = await this.schema.lookupItem<Unit>(unitSchemaItemKey);\r\n if (undefined === invertsUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);\r\n return invertsUnit;\r\n });\r\n\r\n const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);\r\n if (!unitSystemSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\r\n this._unitSystem = new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemSchemaItemKey,\r\n async () => {\r\n const unitSystem = await this.schema.lookupItem<UnitSystem>(unitSystemSchemaItemKey);\r\n if (undefined === unitSystem)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\r\n return unitSystem;\r\n });\r\n }\r\n\r\n public override async fromJSON(invertedUnitProps: InvertedUnitProps) {\r\n this.fromJSONSync(invertedUnitProps);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing\r\n */\r\n protected setInvertsUnit(invertsUnit: LazyLoadedUnit) {\r\n this._invertsUnit = invertsUnit;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing\r\n */\r\n protected setUnitSystem(unitSystem: LazyLoadedUnitSystem) {\r\n this._unitSystem = unitSystem;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableInvertedUnit extends InvertedUnit {\r\n public abstract override setInvertsUnit(invertsUnit: LazyLoadedUnit): void;\r\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Metadata
|
|
3
|
+
*/
|
|
4
|
+
import { KindOfQuantityProps } from "../Deserialization/JsonProps";
|
|
5
|
+
import { SchemaItemType } from "../ECObjects";
|
|
6
|
+
import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces";
|
|
7
|
+
import { Format } from "./Format";
|
|
8
|
+
import { InvertedUnit } from "./InvertedUnit";
|
|
9
|
+
import { OverrideFormat } from "./OverrideFormat";
|
|
10
|
+
import { Schema } from "./Schema";
|
|
11
|
+
import { SchemaItem } from "./SchemaItem";
|
|
12
|
+
import { Unit } from "./Unit";
|
|
13
|
+
/** A Typescript class representation of a KindOfQuantity.
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class KindOfQuantity extends SchemaItem {
|
|
17
|
+
readonly schemaItemType: SchemaItemType.KindOfQuantity;
|
|
18
|
+
protected _relativeError: number;
|
|
19
|
+
protected _presentationFormats: Array<Format | OverrideFormat>;
|
|
20
|
+
protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;
|
|
21
|
+
/** The first presentation format in the list of Formats. */
|
|
22
|
+
get defaultPresentationFormat(): Format | OverrideFormat | undefined;
|
|
23
|
+
/** A list of presentation formats. */
|
|
24
|
+
get presentationFormats(): Array<Format | OverrideFormat>;
|
|
25
|
+
get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined;
|
|
26
|
+
protected set persistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined);
|
|
27
|
+
get relativeError(): number;
|
|
28
|
+
constructor(schema: Schema, name: string);
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param format The Format to add to this KindOfQuantity
|
|
32
|
+
* @param isDefault
|
|
33
|
+
*/
|
|
34
|
+
protected addPresentationFormat(format: Format | OverrideFormat, isDefault?: boolean): void;
|
|
35
|
+
/** Parses the format string into the parts that make up an Override Format
|
|
36
|
+
* @param formatString
|
|
37
|
+
*/
|
|
38
|
+
private parseFormatString;
|
|
39
|
+
/** Creates an OverrideFormat in the context of this KindOfQuantity.
|
|
40
|
+
* @param parent The Format to override.
|
|
41
|
+
* @param precision The precision override
|
|
42
|
+
* @param unitLabelOverrides The list of unit and label overrides.
|
|
43
|
+
*/
|
|
44
|
+
protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
|
|
45
|
+
private processPresentationUnits;
|
|
46
|
+
private processPresentationUnitsSync;
|
|
47
|
+
/**
|
|
48
|
+
* Save this KindOfQuantity's properties to an object for serializing to JSON.
|
|
49
|
+
* @param standalone Serialization includes only this object (as opposed to the full schema).
|
|
50
|
+
* @param includeSchemaVersion Include the Schema's version information in the serialized object.
|
|
51
|
+
*/
|
|
52
|
+
toJSON(standalone?: boolean, includeSchemaVersion?: boolean): KindOfQuantityProps;
|
|
53
|
+
/** @internal */
|
|
54
|
+
toXml(schemaXml: Document): Promise<Element>;
|
|
55
|
+
fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void;
|
|
56
|
+
fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* @alpha
|
|
59
|
+
* Used for schema editing.
|
|
60
|
+
*/
|
|
61
|
+
protected setRelativeError(relativeError: number): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* An abstract class used for schema editing.
|
|
66
|
+
*/
|
|
67
|
+
export declare abstract class MutableKindOfQuantity extends KindOfQuantity {
|
|
68
|
+
abstract addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean): void;
|
|
69
|
+
abstract createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
|
|
70
|
+
abstract setDisplayLabel(displayLabel: string): void;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=KindOfQuantity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KindOfQuantity.d.ts","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAQ9B;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,SAAyB,cAAc,EAAG,cAAc,CAAC,cAAc,CAAC;IACxE,SAAS,CAAC,cAAc,EAAE,MAAM,CAAO;IACvC,SAAS,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,CAAwC;IACtG,SAAS,CAAC,gBAAgB,CAAC,EAAE,cAAc,GAAG,sBAAsB,CAAC;IAErE,4DAA4D;IAC5D,IAAW,yBAAyB,IAAI,MAAM,GAAG,cAAc,GAAG,SAAS,CAAwC;IAEnH,sCAAsC;IACtC,IAAW,mBAAmB,IAAI,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,CAAsC;IAEtG,IAAW,eAAe,IAAI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