UNPKG

@itwin/presentation-shared

Version:

The package contains types and utilities used across different iTwin.js Presentation packages.

44 lines 1.62 kB
import { ConcatenatedValue } from "./ConcatenatedValue.js"; import { TypedPrimitiveValue } from "./Values.js"; /** * A type definition for a function that knows how to create a display string for a typed primitive value. * @see `createDefaultValueFormatter` * @public */ export type IPrimitiveValueFormatter = (value: TypedPrimitiveValue) => Promise<string>; /** * Formats a concatenated value into a string, taking into account different types of `ConcatenatedValuePart` that * the value consists of. * * @public */ export declare function formatConcatenatedValue(props: { value: ConcatenatedValue | string; valueFormatter: IPrimitiveValueFormatter; }): Promise<string>; /** * A values' formatter that knows how to format the following types: * * - `Boolean` values are formatted to either "true" or "false". * * - `Integer` and `Long` values are rounded to the closest integer. * * - `Double` values are rounded to 2 decimal places. * * - `DateTime` values accept 2 formats in addition to `Date`: * - if the value is numeric, assume it's a julian day format, * - if the value is string, assume it's an ISO 8601 format. * * If extended type is set to `ShortDate`, the date is formatted as locale date string. Otherwise, it's * formatted as locale date + time string. * * - `Point2d` values are formatted in `(x, y)` format. * * - `Point3d` values are formatted in `(x, y, z)` format. * * - `String` and `Id` values are returned as-is. * * @public */ export declare function createDefaultValueFormatter(): IPrimitiveValueFormatter; //# sourceMappingURL=Formatting.d.ts.map