|
4 | 4 |
|
5 | 5 | ```ts
|
6 | 6 |
|
| 7 | +import { BeEvent } from '@itwin/core-bentley'; |
7 | 8 | import { FormatDefinition } from '@itwin/core-quantity';
|
| 9 | +import type { FormatsChangedArgs } from '@itwin/core-quantity'; |
8 | 10 | import type { FormatSet } from '@itwin/ecschema-metadata';
|
| 11 | +import type { FormatsProvider } from '@itwin/core-quantity'; |
| 12 | +import type { IModelConnection } from '@itwin/core-frontend'; |
9 | 13 | import type { Localization } from '@itwin/core-common';
|
| 14 | +import type { MutableFormatsProvider } from '@itwin/core-quantity'; |
10 | 15 | import * as React_2 from 'react';
|
11 | 16 | import { UnitProps } from '@itwin/core-quantity';
|
12 | 17 | import type { UnitsProvider } from '@itwin/core-quantity';
|
13 | 18 |
|
| 19 | +// @beta |
| 20 | +export class FormatManager { |
| 21 | + [Symbol.dispose](): void; |
| 22 | + constructor(options: FormatManagerInitializeOptions); |
| 23 | + get activeFormatSet(): FormatSet | undefined; |
| 24 | + get activeFormatSetFormatsProvider(): FormatSetFormatsProvider | undefined; |
| 25 | + addFormatSet(formatSet: FormatSet): void; |
| 26 | + get fallbackFormatsProvider(): FormatsProvider | undefined; |
| 27 | + set fallbackFormatsProvider(provider: FormatsProvider | undefined); |
| 28 | + get formatSets(): FormatSet[]; |
| 29 | + set formatSets(formatSets: FormatSet[]); |
| 30 | + getFormatSet(name: string): FormatSet | undefined; |
| 31 | + static initialize(options: FormatManagerInitializeOptions): Promise<void>; |
| 32 | + static get instance(): FormatManager | undefined; |
| 33 | + readonly onActiveFormatSetChanged: BeEvent<(args: FormatSetChangedEventArgs) => void>; |
| 34 | + readonly onFormatSetsChanged: BeEvent<(formatSets: FormatSet[]) => void>; |
| 35 | + onIModelClose(): Promise<void>; |
| 36 | + onIModelOpen(iModel: IModelConnection, options?: OnIModelOpenOptions): Promise<void>; |
| 37 | + removeFormatSet(name: string): boolean; |
| 38 | + setActiveFormatSet(formatSet: FormatSet): void; |
| 39 | + static terminate(): void; |
| 40 | +} |
| 41 | + |
| 42 | +// @beta |
| 43 | +export interface FormatManagerInitializeOptions { |
| 44 | + fallbackProvider?: FormatsProvider; |
| 45 | + formatSets: FormatSet[]; |
| 46 | + schemaNames?: string[]; |
| 47 | + setupSchemaFormatSetOnIModelOpen?: boolean; |
| 48 | +} |
| 49 | + |
14 | 50 | // @beta
|
15 | 51 | export function FormatPanel(props: FormatPanelProps): React_2.JSX.Element;
|
16 | 52 |
|
@@ -54,6 +90,36 @@ interface FormatSelectorProps {
|
54 | 90 | onListItemChange: (formatDefinition: FormatDefinition, key: string) => void;
|
55 | 91 | }
|
56 | 92 |
|
| 93 | +// @beta |
| 94 | +export interface FormatSetChangedEventArgs { |
| 95 | + currentFormatSet: FormatSet; |
| 96 | + previousFormatSet?: FormatSet; |
| 97 | +} |
| 98 | + |
| 99 | +// @beta |
| 100 | +export class FormatSetFormatsProvider implements MutableFormatsProvider { |
| 101 | + constructor(formatSet: FormatSet, fallbackProvider?: FormatsProvider); |
| 102 | + addFormat(name: string, format: FormatDefinition): Promise<void>; |
| 103 | + clearFallbackProvider(): void; |
| 104 | + get fallbackProvider(): FormatsProvider | undefined; |
| 105 | + get formatSet(): FormatSet; |
| 106 | + getFormat(input: string): Promise<FormatDefinition | undefined>; |
| 107 | + readonly onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>; |
| 108 | + removeFormat(name: string): Promise<void>; |
| 109 | +} |
| 110 | + |
| 111 | +// @beta |
| 112 | +export function getUsedKindOfQuantitiesFromIModel(iModel: IModelConnection): Promise<{ |
| 113 | + kindOfQuantityFullName: string; |
| 114 | +}[]>; |
| 115 | + |
| 116 | +// @beta |
| 117 | +export interface OnIModelOpenOptions { |
| 118 | + excludeUsedKindOfQuantities?: boolean; |
| 119 | + formatSetLabel?: string; |
| 120 | + schemaNames?: string[]; |
| 121 | +} |
| 122 | + |
57 | 123 | // @beta
|
58 | 124 | export function QuantityFormatPanel(props: QuantityFormatPanelProps): React_2.JSX.Element;
|
59 | 125 |
|
|
0 commit comments