UNPKG

@taiga-ui/core

Version:

Core library for creating Angular components and applications using Taiga UI

40 lines (39 loc) 1.31 kB
import { InjectionToken, type Provider } from '@angular/core'; import { type TuiRounding } from '@taiga-ui/cdk/types'; import { type Observable } from 'rxjs'; export type TuiDecimalMode = 'always' | 'not-zero' | 'pad'; export type TuiDecimalSymbol = ',' | '.'; /** * Formatting configuration for displayed numbers */ export interface TuiNumberFormatSettings { /** * Number of digits of decimal part. * @note Use `Infinity` to keep untouched. */ readonly precision: number; /** * Separator between the integer and the decimal part. * @example 0,42 (',' by default) */ readonly decimalSeparator: TuiDecimalSymbol; /** * Rounding method. */ readonly rounding: TuiRounding; /** * Separator between thousands. * @example 360 000 (' ' by default) */ readonly thousandSeparator: string; /** * Decimal part display mode. ('pad' by default) */ readonly decimalMode: TuiDecimalMode; } export declare const TUI_DEFAULT_NUMBER_FORMAT: TuiNumberFormatSettings; /** * Formatting configuration for displayed numbers */ export declare const TUI_NUMBER_FORMAT: InjectionToken<Observable<TuiNumberFormatSettings>>; export declare function tuiNumberFormatProvider(options: Partial<TuiNumberFormatSettings>): Provider;