UNPKG

angular-ecmascript-intl

Version:

Contains Angular pipes to transform internationalization data using Intl.* browser APIs

183 lines (158 loc) 10 kB
import * as i0 from '@angular/core'; import { PipeTransform, InjectionToken, OnDestroy, ChangeDetectorRef } from '@angular/core'; interface IntlPipeOptions { locale?: string; } type IntlCountryPipeOptions = Omit<Partial<Intl.DisplayNamesOptions>, 'languageDisplay'> & IntlPipeOptions; declare class IntlCountryPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: string | null | undefined, options?: IntlCountryPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlCountryPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlCountryPipe, "intlCountry", true>; } declare const INTL_COUNTRY_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlCountryPipeOptions, "locale">>; type OmitOptions$3 = 'unit' | 'unitDisplay' | 'currency'; type IntlCurrencyPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$3> & IntlPipeOptions; declare class IntlCurrencyPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: number | string | null | undefined, currency: string, options?: IntlCurrencyPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlCurrencyPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlCurrencyPipe, "intlCurrency", true>; } declare const INTL_CURRENCY_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlCurrencyPipeOptions, "locale">>; type IntlDatePipeOptions = Partial<Intl.DateTimeFormatOptions> & IntlPipeOptions; declare class IntlDatePipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: string | number | Date | null | undefined, options?: IntlDatePipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlDatePipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlDatePipe, "intlDate", true>; } declare const INTL_DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDatePipeOptions, "locale">>; type OmitOptions$2 = 'unit' | 'unitDisplay' | 'currency' | 'currencyDisplay' | 'currencySign'; type IntlDecimalPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$2> & IntlPipeOptions; declare class IntlDecimalPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: number | string | null | undefined, options?: IntlDecimalPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlDecimalPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlDecimalPipe, "intlDecimal", true>; } declare const INTL_DECIMAL_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDecimalPipeOptions, "locale">>; declare namespace Intl$1 { class DurationFormat { constructor(locale?: string[] | string, options?: DurationFormatOptions); format(duration: Duration): string; } interface DurationFormatOptions { style?: DurationItemStyle | 'digital'; years?: DurationItemStyle; yearsDisplay?: DurationItemDisplay; months?: DurationItemStyle; monthsDisplay?: DurationItemDisplay; weeks?: DurationItemStyle; weeksDisplay?: DurationItemDisplay; days?: DurationItemStyle; daysDisplay?: DurationItemDisplay; hours?: DurationItemStyle | 'numeric' | '2-digit'; hoursDisplay?: DurationItemDisplay; minutes?: DurationItemStyle | 'numeric' | '2-digit'; minutesDisplay?: DurationItemDisplay; seconds?: DurationItemStyle | 'numeric' | '2-digit'; secondsDisplay?: DurationItemDisplay; milliseconds?: DurationItemStyle | 'numeric' | '2-digit'; millisecondsDisplay?: DurationItemDisplay; microseconds?: DurationItemStyle | 'numeric'; microsecondsDisplay?: DurationItemDisplay; nanoseconds?: DurationItemStyle | 'numeric'; nanosecondsDisplay?: DurationItemDisplay; fractionalDigits?: number; } type DurationItemStyle = 'long' | 'short' | 'narrow'; type DurationItemDisplay = 'always' | 'auto'; interface Duration { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; milliseconds?: number; microseconds?: number; nanoseconds?: number; } } type IntlDurationPipeOptions = Partial<Intl$1.DurationFormatOptions> & IntlPipeOptions; declare class IntlDurationPipe implements PipeTransform { readonly locale: string | string[] | null | undefined; readonly defaultOptions: Omit<IntlDurationPipeOptions, "locale"> | null; transform(value: Intl$1.Duration | null | undefined, options?: IntlDurationPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlDurationPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlDurationPipe, "intlDuration", true>; } declare const INTL_DURATION_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDurationPipeOptions, "locale">>; type IntlLanguagePipeOptions = Partial<Intl.DisplayNamesOptions> & IntlPipeOptions; declare class IntlLanguagePipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: string | null | undefined, options?: IntlLanguagePipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlLanguagePipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlLanguagePipe, "intlLanguage", true>; } type OmitOptions$1 = 'unit' | 'unitDisplay' | 'currency' | 'currencyDisplay' | 'currencySign'; type IntlPercentPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$1> & IntlPipeOptions; declare class IntlPercentPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: number | string | null | undefined, options?: IntlPercentPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlPercentPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlPercentPipe, "intlPercent", true>; } type OmitOptions = 'unit' | 'currency' | 'currencyDisplay' | 'currencySign'; type IntlUnitPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions> & IntlPipeOptions; declare class IntlUnitPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: number | string | null | undefined, unit: string | undefined, options?: IntlUnitPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlUnitPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlUnitPipe, "intlUnit", true>; } type IntlListPipeOptions = Partial<Intl.ListFormatOptions> & IntlPipeOptions; declare class IntlListPipe implements PipeTransform { private readonly locale?; private readonly defaultOptions?; transform(value: Iterable<string> | null | undefined, options?: IntlListPipeOptions): string | null; static ɵfac: i0.ɵɵFactoryDeclaration<IntlListPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlListPipe, "intlList", true>; } type IntlRelativeTimePipeOptions = Partial<Intl.RelativeTimeFormatOptions> & IntlPipeOptions; declare class IntlRelativeTimePipe implements PipeTransform, OnDestroy { #private; readonly cdr: ChangeDetectorRef | null; private readonly locales?; private readonly defaultOptions?; transform(value: string | number | Date | null | undefined, options?: IntlRelativeTimePipeOptions): string | null; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<IntlRelativeTimePipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<IntlRelativeTimePipe, "intlRelativeTime", true>; } declare class IntlModule { static ɵfac: i0.ɵɵFactoryDeclaration<IntlModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<IntlModule, never, [typeof IntlDatePipe, typeof IntlLanguagePipe, typeof IntlDecimalPipe, typeof IntlPercentPipe, typeof IntlCurrencyPipe, typeof IntlCountryPipe, typeof IntlUnitPipe, typeof IntlListPipe, typeof IntlRelativeTimePipe, typeof IntlDurationPipe], [typeof IntlDatePipe, typeof IntlLanguagePipe, typeof IntlDecimalPipe, typeof IntlPercentPipe, typeof IntlCurrencyPipe, typeof IntlCountryPipe, typeof IntlUnitPipe, typeof IntlListPipe, typeof IntlRelativeTimePipe, typeof IntlDurationPipe]>; static ɵinj: i0.ɵɵInjectorDeclaration<IntlModule>; } declare const INTL_LANGUAGE_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlLanguagePipeOptions, "locale">>; declare const INTL_LIST_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlListPipeOptions, "locale">>; /** * Set the locale(s) for all Intl Pipes. If not specified, the user language specified in the browser will be used. If * specified, it needs to be a string with a BCP 47 language tag, or an array of such strings. */ declare const INTL_LOCALES: InjectionToken<string | string[] | undefined>; declare const INTL_PERCENT_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlPercentPipeOptions, "locale">>; declare const INTL_RELATIVE_TIME_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlRelativeTimePipeOptions, "locale">>; declare const INTL_UNIT_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlUnitPipeOptions, "locale">>; export { INTL_COUNTRY_PIPE_DEFAULT_OPTIONS, INTL_CURRENCY_PIPE_DEFAULT_OPTIONS, INTL_DATE_PIPE_DEFAULT_OPTIONS, INTL_DECIMAL_PIPE_DEFAULT_OPTIONS, INTL_DURATION_PIPE_DEFAULT_OPTIONS, INTL_LANGUAGE_PIPE_DEFAULT_OPTIONS, INTL_LIST_PIPE_DEFAULT_OPTIONS, INTL_LOCALES, INTL_PERCENT_PIPE_DEFAULT_OPTIONS, INTL_RELATIVE_TIME_PIPE_DEFAULT_OPTIONS, INTL_UNIT_PIPE_DEFAULT_OPTIONS, IntlCountryPipe, IntlCurrencyPipe, IntlDatePipe, IntlDecimalPipe, IntlDurationPipe, IntlLanguagePipe, IntlListPipe, IntlModule, IntlPercentPipe, IntlRelativeTimePipe, IntlUnitPipe }; export type { IntlCountryPipeOptions, IntlCurrencyPipeOptions, IntlDatePipeOptions, IntlDecimalPipeOptions, IntlDurationPipeOptions, IntlLanguagePipeOptions, IntlListPipeOptions, IntlPercentPipeOptions, IntlRelativeTimePipeOptions, IntlUnitPipeOptions };