UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

80 lines 3.71 kB
/** @packageDocumentation * @module Metadata */ import { DecimalPrecision, FormatProps, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from "@itwin/core-quantity"; import { Format } from "./Format"; import { Schema } from "./Schema"; import { SchemaItemOverrideFormatProps } from "../Deserialization/JsonProps"; import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces"; /** * @public @preview */ export interface OverrideFormatProps { readonly name: string; readonly precision?: number; readonly unitAndLabels?: Array<[string, string | undefined]>; } /** * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity. * @public @preview */ export declare class OverrideFormat { private _precision?; private _units?; /** The Format that this OverrideFormat is extending */ readonly parent: Format; /** The name of this OverrideFormat. * * This should be set to the [FormatString]($docs/bis/ec/kindofquantity/#format-string) which represents the format override. */ readonly name: string; /** @internal */ constructor(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>); get precision(): DecimalPrecision | FractionalPrecision; get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined; get fullName(): string; get roundFactor(): number; get type(): FormatType; get minWidth(): number | undefined; get scientificType(): ScientificType | undefined; get showSignOption(): ShowSignOption; get decimalSeparator(): string; get thousandSeparator(): string; get uomSeparator(): string; get stationSeparator(): string; get stationOffsetSize(): number | undefined; get formatTraits(): FormatTraits; get spacer(): string | undefined; get includeZero(): boolean | undefined; hasFormatTrait(formatTrait: FormatTraits): boolean; /** Returns the format string of this override in the Xml full name format. * @internal */ fullNameXml(koqSchema: Schema): string; /** * Creates a valid OverrideFormat fullName from the parent Format and overridden units. * @param parent The parent Format. * @param unitAndLabels The overridden unit and labels collection. */ static createOverrideFormatFullName(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): string; /** Parses the format string into the parts that make up an Override Format * @param formatString */ static parseFormatString(formatString: string): OverrideFormatProps; /** * @internal */ static isOverrideFormat(format: unknown): format is OverrideFormat; /** * Returns a JSON object that contains the specification for the OverrideFormat where the precision and units properties have been overriden. * If the precision and/or units properties have been overriden, the returned object will contain a "name" and a "parent" property. * The "name" property identifies the OverrideFormat object itself and the "parent" property identifies the Format that has been overriden. * This method is not intended for complete serialization as it does not serialize any of the schema item properties. */ getFormatProps(): SchemaItemOverrideFormatProps; } /** * @internal */ export declare function getFormatProps(format: Format | OverrideFormat): FormatProps; //# sourceMappingURL=OverrideFormat.d.ts.map