UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

152 lines 5.41 kB
/** @packageDocumentation * @module Metadata */ import { SchemaItemFormatProps } from "../Deserialization/JsonProps"; import { SchemaItemType } from "../ECObjects"; import { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from "@itwin/core-quantity"; import { Schema } from "./Schema"; import { SchemaItem } from "./SchemaItem"; import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces"; /** * @public @preview */ export declare class Format extends SchemaItem { readonly schemaItemType: SchemaItemType; /** @internal */ static get schemaItemType(): SchemaItemType; private _base; private _units?; /** @internal */ constructor(schema: Schema, name: string); get roundFactor(): number; get type(): FormatType; get precision(): DecimalPrecision | FractionalPrecision; 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 stationBaseFactor(): number | undefined; get formatTraits(): FormatTraits; get spacer(): string | undefined; get includeZero(): boolean | undefined; get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined; private parseFormatTraits; hasFormatTrait(formatTrait: FormatTraits): boolean; /** * Adds a Unit, or InvertedUnit, with an optional label override. * @param unit The Unit, or InvertedUnit, to add to this Format. * @param label A label that overrides the label defined within the Unit when a value is formatted. * @internal */ protected addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void; /** * * @param precision * @internal */ protected setPrecision(precision: number): void; private typecheck; fromJSONSync(formatProps: SchemaItemFormatProps): void; fromJSON(formatProps: SchemaItemFormatProps): Promise<void>; /** * Save this Format's properties to an object for serializing to JSON. * @param standalone Serialization includes only this object (as opposed to the full schema). * @param includeSchemaVersion Include the Schema's version information in the serialized object. */ toJSON(standalone?: boolean, includeSchemaVersion?: boolean): SchemaItemFormatProps; /** @internal */ toXml(schemaXml: Document): Promise<Element>; /** * @internal */ protected setFormatType(formatType: FormatType): void; /** * @internal */ protected setRoundFactor(roundFactor: number): void; /** * @internal */ protected setShowSignOption(signOption: ShowSignOption): void; /** * @internal */ protected setDecimalSeparator(separator: string): void; /** * @internal */ protected setThousandSeparator(separator: string): void; /** * @internal */ protected setUomSeparator(separator: string): void; /** * @internal */ protected setStationSeparator(separator: string): void; /** * @internal */ protected setStationOffsetSize(stationOffsetSize: number): void; /** * @internal */ protected setStationBaseFactor(stationBaseFactor: number): void; /** * @internal */ protected setScientificType(scientificType: ScientificType): void; /** * @internal */ protected setMinWidth(minWidth: number): void; /** * @internal */ protected setSpacer(spacer: string): void; /** * @internal */ protected setIncludeZero(includeZero: boolean): void; /** * @internal */ protected setFormatTraits(formatTraits: FormatTraits): void; /** * @internal */ protected setUnits(units: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): void; /** Type guard to check if the SchemaItem is of type Format. * @param item The SchemaItem to check. * @returns True if the item is a Format, false otherwise. */ static isFormat(item?: SchemaItem): item is Format; /** * Type assertion to check if the SchemaItem is of type Format. * @param item The SchemaItem to check. * @returns The item cast to Format if it is a Format, undefined otherwise. * @internal */ static assertIsFormat(item?: SchemaItem): asserts item is Format; } /** * @internal * An abstract class used for schema editing. */ export declare abstract class MutableFormat extends Format { abstract addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void; abstract setPrecision(precision: number): void; abstract setFormatType(formatType: FormatType): void; abstract setRoundFactor(roundFactor: number): void; abstract setShowSignOption(signOption: ShowSignOption): void; abstract setDecimalSeparator(separator: string): void; abstract setThousandSeparator(separator: string): void; abstract setUomSeparator(separator: string): void; abstract setStationSeparator(separator: string): void; abstract setDisplayLabel(displayLabel: string): void; } //# sourceMappingURL=Format.d.ts.map