1 | /**
|
2 | * @license Angular v9.1.8
|
3 | * (c) 2010-2020 Google LLC. https://angular.io/
|
4 | * License: MIT
|
5 | */
|
6 |
|
7 | import { ChangeDetectorRef } from '@angular/core';
|
8 | import { DoCheck } from '@angular/core';
|
9 | import { ElementRef } from '@angular/core';
|
10 | import { InjectionToken } from '@angular/core';
|
11 | import { Injector } from '@angular/core';
|
12 | import { IterableDiffers } from '@angular/core';
|
13 | import { KeyValueDiffers } from '@angular/core';
|
14 | import { NgIterable } from '@angular/core';
|
15 | import { NgModuleFactory } from '@angular/core';
|
16 | import { Observable } from 'rxjs';
|
17 | import { OnChanges } from '@angular/core';
|
18 | import { OnDestroy } from '@angular/core';
|
19 | import { PipeTransform } from '@angular/core';
|
20 | import { Provider } from '@angular/core';
|
21 | import { Renderer2 } from '@angular/core';
|
22 | import { SimpleChanges } from '@angular/core';
|
23 | import { SubscriptionLike } from 'rxjs';
|
24 | import { TemplateRef } from '@angular/core';
|
25 | import { TrackByFunction } from '@angular/core';
|
26 | import { Type } from '@angular/core';
|
27 | import { Version } from '@angular/core';
|
28 | import { ViewContainerRef } from '@angular/core';
|
29 |
|
30 | /**
|
31 | * A predefined [DI token](guide/glossary#di-token) for the base href
|
32 | * to be used with the `PathLocationStrategy`.
|
33 | * The base href is the URL prefix that should be preserved when generating
|
34 | * and recognizing URLs.
|
35 | *
|
36 | * @usageNotes
|
37 | *
|
38 | * The following example shows how to use this token to configure the root app injector
|
39 | * with a base href value, so that the DI framework can supply the dependency anywhere in the app.
|
40 | *
|
41 | * ```typescript
|
42 | * import {Component, NgModule} from '@angular/core';
|
43 | * import {APP_BASE_HREF} from '@angular/common';
|
44 | *
|
45 | * @NgModule({
|
46 | * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
|
47 | * })
|
48 | * class AppModule {}
|
49 | * ```
|
50 | *
|
51 | * @publicApi
|
52 | */
|
53 | export declare const APP_BASE_HREF: InjectionToken<string>;
|
54 |
|
55 | /**
|
56 | * @ngModule CommonModule
|
57 | * @description
|
58 | *
|
59 | * Unwraps a value from an asynchronous primitive.
|
60 | *
|
61 | * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
|
62 | * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
|
63 | * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
|
64 | * potential memory leaks.
|
65 | *
|
66 | * @usageNotes
|
67 | *
|
68 | * ### Examples
|
69 | *
|
70 | * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
|
71 | * promise.
|
72 | *
|
73 | * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
|
74 | *
|
75 | * It's also possible to use `async` with Observables. The example below binds the `time` Observable
|
76 | * to the view. The Observable continuously updates the view with the current time.
|
77 | *
|
78 | * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
|
79 | *
|
80 | * @publicApi
|
81 | */
|
82 | export declare class AsyncPipe implements OnDestroy, PipeTransform {
|
83 | private _ref;
|
84 | private _latestValue;
|
85 | private _latestReturnedValue;
|
86 | private _subscription;
|
87 | private _obj;
|
88 | private _strategy;
|
89 | constructor(_ref: ChangeDetectorRef);
|
90 | ngOnDestroy(): void;
|
91 | transform<T>(obj: null): null;
|
92 | transform<T>(obj: undefined): undefined;
|
93 | transform<T>(obj: Observable<T> | null | undefined): T | null;
|
94 | transform<T>(obj: Promise<T> | null | undefined): T | null;
|
95 | private _subscribe;
|
96 | private _selectStrategy;
|
97 | private _dispose;
|
98 | private _updateLatestValue;
|
99 | }
|
100 |
|
101 |
|
102 | /**
|
103 | * Exports all the basic Angular directives and pipes,
|
104 | * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
|
105 | * Re-exported by `BrowserModule`, which is included automatically in the root
|
106 | * `AppModule` when you create a new app with the CLI `new` command.
|
107 | *
|
108 | * * The `providers` options configure the NgModule's injector to provide
|
109 | * localization dependencies to members.
|
110 | * * The `exports` options make the declared directives and pipes available for import
|
111 | * by other NgModules.
|
112 | *
|
113 | * @publicApi
|
114 | */
|
115 | export declare class CommonModule {
|
116 | }
|
117 |
|
118 | /**
|
119 | * @ngModule CommonModule
|
120 | * @description
|
121 | *
|
122 | * Transforms a number to a currency string, formatted according to locale rules
|
123 | * that determine group sizing and separator, decimal-point character,
|
124 | * and other locale-specific configurations.
|
125 | *
|
126 | * {@a currency-code-deprecation}
|
127 | * <div class="alert is-helpful">
|
128 | *
|
129 | * **Deprecation notice:**
|
130 | *
|
131 | * The default currency code is currently always `USD` but this is deprecated from v9.
|
132 | *
|
133 | * **In v11 the default currency code will be taken from the current locale identified by
|
134 | * the `LOCAL_ID` token. See the [i18n guide](guide/i18n#setting-up-the-locale-of-your-app) for
|
135 | * more information.**
|
136 | *
|
137 | * If you need the previous behavior then set it by creating a `DEFAULT_CURRENCY_CODE` provider in
|
138 | * your application `NgModule`:
|
139 | *
|
140 | * ```ts
|
141 | * {provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
|
142 | * ```
|
143 | *
|
144 | * </div>
|
145 | *
|
146 | * @see `getCurrencySymbol()`
|
147 | * @see `formatCurrency()`
|
148 | *
|
149 | * @usageNotes
|
150 | * The following code shows how the pipe transforms numbers
|
151 | * into text strings, according to various format specifications,
|
152 | * where the caller's default locale is `en-US`.
|
153 | *
|
154 | * <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example>
|
155 | *
|
156 | * @publicApi
|
157 | */
|
158 | export declare class CurrencyPipe implements PipeTransform {
|
159 | private _locale;
|
160 | private _defaultCurrencyCode;
|
161 | constructor(_locale: string, _defaultCurrencyCode?: string);
|
162 | /**
|
163 | *
|
164 | * @param value The number to be formatted as currency.
|
165 | * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
|
166 | * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
|
167 | * configured using the `DEFAULT_CURRENCY_CODE` injection token.
|
168 | * for the currency indicator. One of the following:
display The format |
169 | * - `code`: Show the code (such as `USD`).
|
170 | * - `symbol`(default): Show the symbol (such as `$`).
|
171 | * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
|
172 | * currency.
|
173 | * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
|
174 | * locale has no narrow symbol, uses the standard symbol for the locale.
|
175 | * - String: Use the given string value instead of a code or a symbol.
|
176 | * For example, an empty string will suppress the currency & symbol.
|
177 | * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
|
178 | *
|
179 | * string
digitsInfo Decimal representation options, specified by a |
180 | * in the following format:<br>
|
181 | * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
|
182 | * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
|
183 | * Default is `1`.
|
184 | * - `minFractionDigits`: The minimum number of digits after the decimal point.
|
185 | * Default is `2`.
|
186 | * - `maxFractionDigits`: The maximum number of digits after the decimal point.
|
187 | * Default is `2`.
|
188 | * If not provided, the number will be formatted with the proper amount of digits,
|
189 | * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
|
190 | * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
|
191 | * for the locale format rules to use.
locale A locale code |
192 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
193 | * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
|
194 | */
|
195 | transform(value: any, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
|
196 | }
|
197 |
|
198 | /**
|
199 | * @ngModule CommonModule
|
200 | * @description
|
201 | *
|
202 | * Formats a date value according to locale rules.
|
203 | *
|
204 | * Only the `en-US` locale data comes with Angular. To localize dates
|
205 | * in another language, you must import the corresponding locale data.
|
206 | * See the [I18n guide](guide/i18n#i18n-pipes) for more information.
|
207 | *
|
208 | * @see `formatDate()`
|
209 | *
|
210 | *
|
211 | * @usageNotes
|
212 | *
|
213 | * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
|
214 | * reformat the date on every change-detection cycle, treat the date as an immutable object
|
215 | * and change the reference when the pipe needs to run again.
|
216 | *
|
217 | * ### Pre-defined format options
|
218 | *
|
219 | * Examples are given in `en-US` locale.
|
220 | *
|
221 | * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (`6/15/15, 9:03 AM`).
|
222 | * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (`Jun 15, 2015, 9:03:01 AM`).
|
223 | * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (`June 15, 2015 at 9:03:01 AM
|
224 | * GMT+1`).
|
225 | * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (`Monday, June 15, 2015 at
|
226 | * 9:03:01 AM GMT+01:00`).
|
227 | * - `'shortDate'`: equivalent to `'M/d/yy'` (`6/15/15`).
|
228 | * - `'mediumDate'`: equivalent to `'MMM d, y'` (`Jun 15, 2015`).
|
229 | * - `'longDate'`: equivalent to `'MMMM d, y'` (`June 15, 2015`).
|
230 | * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (`Monday, June 15, 2015`).
|
231 | * - `'shortTime'`: equivalent to `'h:mm a'` (`9:03 AM`).
|
232 | * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (`9:03:01 AM`).
|
233 | * - `'longTime'`: equivalent to `'h:mm:ss a z'` (`9:03:01 AM GMT+1`).
|
234 | * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (`9:03:01 AM GMT+01:00`).
|
235 | *
|
236 | * ### Custom format options
|
237 | *
|
238 | * You can construct a format string using symbols to specify the components
|
239 | * of a date-time value, as described in the following table.
|
240 | * Format details depend on the locale.
|
241 | * Fields marked with (*) are only available in the extra data set for the given locale.
|
242 | *
|
243 | * | Field type | Format | Description | Example Value |
|
244 | * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
|
245 | * | Era | G, GG & GGG | Abbreviated | AD |
|
246 | * | | GGGG | Wide | Anno Domini |
|
247 | * | | GGGGG | Narrow | A |
|
248 | * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
|
249 | * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
|
250 | * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
|
251 | * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
|
252 | * | Month | M | Numeric: 1 digit | 9, 12 |
|
253 | * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
|
254 | * | | MMM | Abbreviated | Sep |
|
255 | * | | MMMM | Wide | September |
|
256 | * | | MMMMM | Narrow | S |
|
257 | * | Month standalone | L | Numeric: 1 digit | 9, 12 |
|
258 | * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
|
259 | * | | LLL | Abbreviated | Sep |
|
260 | * | | LLLL | Wide | September |
|
261 | * | | LLLLL | Narrow | S |
|
262 | * | Week of year | w | Numeric: minimum digits | 1... 53 |
|
263 | * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
|
264 | * | Week of month | W | Numeric: 1 digit | 1... 5 |
|
265 | * | Day of month | d | Numeric: minimum digits | 1 |
|
266 | * | | dd | Numeric: 2 digits + zero padded | 01 |
|
267 | * | Week day | E, EE & EEE | Abbreviated | Tue |
|
268 | * | | EEEE | Wide | Tuesday |
|
269 | * | | EEEEE | Narrow | T |
|
270 | * | | EEEEEE | Short | Tu |
|
271 | * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
|
272 | * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
|
273 | * | | aaaaa | Narrow | a/p |
|
274 | * | Period* | B, BB & BBB | Abbreviated | mid. |
|
275 | * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
|
276 | * | | BBBBB | Narrow | md |
|
277 | * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
|
278 | * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
|
279 | * | | bbbbb | Narrow | md |
|
280 | * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
|
281 | * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
|
282 | * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
|
283 | * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
|
284 | * | Minute | m | Numeric: minimum digits | 8, 59 |
|
285 | * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
|
286 | * | Second | s | Numeric: minimum digits | 0... 59 |
|
287 | * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
|
288 | * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
|
289 | * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
|
290 | * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
|
291 | * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
|
292 | * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
|
293 | * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
|
294 | * | | ZZZZ | Long localized GMT format | GMT-8:00 |
|
295 | * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
|
296 | * | | O, OO & OOO | Short localized GMT format | GMT-8 |
|
297 | * | | OOOO | Long localized GMT format | GMT-08:00 |
|
298 | *
|
299 | * Note that timezone correction is not applied to an ISO string that has no time component, such as "2016-09-19"
|
300 | *
|
301 | * ### Format examples
|
302 | *
|
303 | * These examples transform a date into various formats,
|
304 | * assuming that `dateObj` is a JavaScript `Date` object for
|
305 | * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
|
306 | * given in the local time for the `en-US` locale.
|
307 | *
|
308 | * ```
|
309 | * {{ dateObj | date }} // output is 'Jun 15, 2015'
|
310 | * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
|
311 | * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
|
312 | * {{ dateObj | date:'mm:ss' }} // output is '43:11'
|
313 | * ```
|
314 | *
|
315 | * ### Usage example
|
316 | *
|
317 | * The following component uses a date pipe to display the current date in different formats.
|
318 | *
|
319 | * ```
|
320 | * @Component({
|
321 | * selector: 'date-pipe',
|
322 | * template: `<div>
|
323 | * <p>Today is {{today | date}}</p>
|
324 | * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
|
325 | * <p>The time is {{today | date:'h:mm a z'}}</p>
|
326 | * </div>`
|
327 | * })
|
328 | * // Get the current date and time as a date-time value.
|
329 | * export class DatePipeComponent {
|
330 | * today: number = Date.now();
|
331 | * }
|
332 | * ```
|
333 | *
|
334 | * @publicApi
|
335 | */
|
336 | export declare class DatePipe implements PipeTransform {
|
337 | private locale;
|
338 | constructor(locale: string);
|
339 | /**
|
340 | * @param value The date expression: a `Date` object, a number
|
341 | * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
|
342 | * @param format The date/time components to include, using predefined options or a
|
343 | * custom format string.
|
344 | * @param timezone A timezone offset (such as `'+0430'`), or a standard
|
345 | * UTC/GMT or continental US timezone abbreviation.
|
346 | * When not supplied, uses the end-user's local system timezone.
|
347 | * @param locale A locale code for the locale format rules to use.
|
348 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
349 | * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
|
350 | * @returns A date string in the desired format.
|
351 | */
|
352 | transform(value: any, format?: string, timezone?: string, locale?: string): string | null;
|
353 | }
|
354 |
|
355 | /**
|
356 | * @ngModule CommonModule
|
357 | * @description
|
358 | *
|
359 | * Transforms a number into a string,
|
360 | * formatted according to locale rules that determine group sizing and
|
361 | * separator, decimal-point character, and other locale-specific
|
362 | * configurations.
|
363 | *
|
364 | * If no parameters are specified, the function rounds off to the nearest value using this
|
365 | * [rounding method](https://en.wikibooks.org/wiki/Arithmetic/Rounding).
|
366 | * The behavior differs from that of the JavaScript ```Math.round()``` function.
|
367 | * In the following case for example, the pipe rounds down where
|
368 | * ```Math.round()``` rounds up:
|
369 | *
|
370 | * ```html
|
371 | * -2.5 | number:'1.0-0'
|
372 | * > -3
|
373 | * Math.round(-2.5)
|
374 | * > -2
|
375 | * ```
|
376 | *
|
377 | * @see `formatNumber()`
|
378 | *
|
379 | * @usageNotes
|
380 | * The following code shows how the pipe transforms numbers
|
381 | * into text strings, according to various format specifications,
|
382 | * where the caller's default locale is `en-US`.
|
383 | *
|
384 | * ### Example
|
385 | *
|
386 | * <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
|
387 | *
|
388 | * @publicApi
|
389 | */
|
390 | export declare class DecimalPipe implements PipeTransform {
|
391 | private _locale;
|
392 | constructor(_locale: string);
|
393 | /**
|
394 | * @param value The number to be formatted.
|
395 | * @param digitsInfo Decimal representation options, specified by a string
|
396 | * in the following format:<br>
|
397 | * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
|
398 | * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
|
399 | * Default is `1`.
|
400 | * - `minFractionDigits`: The minimum number of digits after the decimal point.
|
401 | * Default is `0`.
|
402 | * - `maxFractionDigits`: The maximum number of digits after the decimal point.
|
403 | * Default is `3`.
|
404 | * @param locale A locale code for the locale format rules to use.
|
405 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
406 | * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
|
407 | */
|
408 | transform(value: any, digitsInfo?: string, locale?: string): string | null;
|
409 | }
|
410 |
|
411 | /**
|
412 | * A DI Token representing the main rendering context. In a browser this is the DOM Document.
|
413 | *
|
414 | * Note: Document might not be available in the Application Context when Application and Rendering
|
415 | * Contexts are not the same (e.g. when running the application in a Web Worker).
|
416 | *
|
417 | * @publicApi
|
418 | */
|
419 | export declare const DOCUMENT: InjectionToken<Document>;
|
420 |
|
421 | /**
|
422 | * @ngModule CommonModule
|
423 | * @description
|
424 | *
|
425 | * Formats a number as currency using locale rules.
|
426 | *
|
427 | * @param value The number to format.
|
428 | * @param locale A locale code for the locale format rules to use.
|
429 | * @param currency A string containing the currency symbol or its name,
|
430 | * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation
|
431 | * of the function.
|
432 | * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
|
433 | * currency code, such as `USD` for the US dollar and `EUR` for the euro.
|
434 | * Used to determine the number of digits in the decimal part.
|
435 | * @param digitInfo Decimal representation options, specified by a string in the following format:
|
436 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
437 | *
|
438 | * @returns The formatted currency value.
|
439 | *
|
440 | * @see `formatNumber()`
|
441 | * @see `DecimalPipe`
|
442 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
443 | *
|
444 | * @publicApi
|
445 | */
|
446 | export declare function formatCurrency(value: number, locale: string, currency: string, currencyCode?: string, digitsInfo?: string): string;
|
447 |
|
448 | /**
|
449 | * @ngModule CommonModule
|
450 | * @description
|
451 | *
|
452 | * Formats a date according to locale rules.
|
453 | *
|
454 | * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)
|
455 | * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
|
456 | * @param format The date-time components to include. See `DatePipe` for details.
|
457 | * @param locale A locale code for the locale format rules to use.
|
458 | * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`),
|
459 | * or a standard UTC/GMT or continental US time zone abbreviation.
|
460 | * If not specified, uses host system settings.
|
461 | *
|
462 | * @returns The formatted date string.
|
463 | *
|
464 | * @see `DatePipe`
|
465 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
466 | *
|
467 | * @publicApi
|
468 | */
|
469 | export declare function formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string;
|
470 |
|
471 | /**
|
472 | * @ngModule CommonModule
|
473 | * @description
|
474 | *
|
475 | * Formats a number as text, with group sizing, separator, and other
|
476 | * parameters based on the locale.
|
477 | *
|
478 | * @param value The number to format.
|
479 | * @param locale A locale code for the locale format rules to use.
|
480 | * @param digitInfo Decimal representation options, specified by a string in the following format:
|
481 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
482 | *
|
483 | * @returns The formatted text string.
|
484 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
485 | *
|
486 | * @publicApi
|
487 | */
|
488 | export declare function formatNumber(value: number, locale: string, digitsInfo?: string): string;
|
489 |
|
490 | /**
|
491 | * @ngModule CommonModule
|
492 | * @description
|
493 | *
|
494 | * Formats a number as a percentage according to locale rules.
|
495 | *
|
496 | * @param value The number to format.
|
497 | * @param locale A locale code for the locale format rules to use.
|
498 | * @param digitInfo Decimal representation options, specified by a string in the following format:
|
499 | * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
|
500 | *
|
501 | * @returns The formatted percentage value.
|
502 | *
|
503 | * @see `formatNumber()`
|
504 | * @see `DecimalPipe`
|
505 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
506 | * @publicApi
|
507 | *
|
508 | */
|
509 | export declare function formatPercent(value: number, locale: string, digitsInfo?: string): string;
|
510 |
|
511 | /**
|
512 | * String widths available for date-time formats.
|
513 | * The specific character widths are locale-specific.
|
514 | * Examples are given for `en-US`.
|
515 | *
|
516 | * @see `getLocaleDateFormat()`
|
517 | * @see `getLocaleTimeFormat()``
|
518 | * @see `getLocaleDateTimeFormat()`
|
519 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
520 | * @publicApi
|
521 | */
|
522 | export declare enum FormatWidth {
|
523 | /**
|
524 | * For `en-US`, 'M/d/yy, h:mm a'`
|
525 | * (Example: `6/15/15, 9:03 AM`)
|
526 | */
|
527 | Short = 0,
|
528 | /**
|
529 | * For `en-US`, `'MMM d, y, h:mm:ss a'`
|
530 | * (Example: `Jun 15, 2015, 9:03:01 AM`)
|
531 | */
|
532 | Medium = 1,
|
533 | /**
|
534 | * For `en-US`, `'MMMM d, y, h:mm:ss a z'`
|
535 | * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)
|
536 | */
|
537 | Long = 2,
|
538 | /**
|
539 | * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`
|
540 | * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)
|
541 | */
|
542 | Full = 3
|
543 | }
|
544 |
|
545 | /**
|
546 | * Context-dependant translation forms for strings.
|
547 | * Typically the standalone version is for the nominative form of the word,
|
548 | * and the format version is used for the genitive case.
|
549 | * @see [CLDR website](http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles)
|
550 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
551 | *
|
552 | * @publicApi
|
553 | */
|
554 | export declare enum FormStyle {
|
555 | Format = 0,
|
556 | Standalone = 1
|
557 | }
|
558 |
|
559 | /**
|
560 | * Retrieves the currency symbol for a given currency code.
|
561 | *
|
562 | * For example, for the default `en-US` locale, the code `USD` can
|
563 | * be represented by the narrow symbol `$` or the wide symbol `US$`.
|
564 | *
|
565 | * @param code The currency code.
|
566 | * @param format The format, `wide` or `narrow`.
|
567 | * @param locale A locale code for the locale format rules to use.
|
568 | *
|
569 | * @returns The symbol, or the currency code if no symbol is available.
|
570 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
571 | *
|
572 | * @publicApi
|
573 | */
|
574 | export declare function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale?: string): string;
|
575 |
|
576 | /**
|
577 | * Retrieves the default currency code for the given locale.
|
578 | *
|
579 | * The default is defined as the first currency which is still in use.
|
580 | *
|
581 | * @param locale The code of the locale whose currency code we want.
|
582 | * @returns The code of the default currency for the given locale.
|
583 | *
|
584 | * @publicApi
|
585 | */
|
586 | export declare function getLocaleCurrencyCode(locale: string): string | null;
|
587 |
|
588 | /**
|
589 | * Retrieves the name of the currency for the main country corresponding
|
590 | * to a given locale. For example, 'US Dollar' for `en-US`.
|
591 | * @param locale A locale code for the locale format rules to use.
|
592 | * @returns The currency name,
|
593 | * or `null` if the main country cannot be determined.
|
594 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
595 | *
|
596 | * @publicApi
|
597 | */
|
598 | export declare function getLocaleCurrencyName(locale: string): string | null;
|
599 |
|
600 | /**
|
601 | * Retrieves the symbol used to represent the currency for the main country
|
602 | * corresponding to a given locale. For example, '$' for `en-US`.
|
603 | *
|
604 | * @param locale A locale code for the locale format rules to use.
|
605 | * @returns The localized symbol character,
|
606 | * or `null` if the main country cannot be determined.
|
607 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
608 | *
|
609 | * @publicApi
|
610 | */
|
611 | export declare function getLocaleCurrencySymbol(locale: string): string | null;
|
612 |
|
613 | /**
|
614 | * Retrieves a localized date-value formating string.
|
615 | *
|
616 | * @param locale A locale code for the locale format rules to use.
|
617 | * @param width The format type.
|
618 | * @returns The localized formating string.
|
619 | * @see `FormatWidth`
|
620 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
621 | *
|
622 | * @publicApi
|
623 | */
|
624 | export declare function getLocaleDateFormat(locale: string, width: FormatWidth): string;
|
625 |
|
626 | /**
|
627 | * Retrieves a localized date-time formatting string.
|
628 | *
|
629 | * @param locale A locale code for the locale format rules to use.
|
630 | * @param width The format type.
|
631 | * @returns The localized formatting string.
|
632 | * @see `FormatWidth`
|
633 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
634 | *
|
635 | * @publicApi
|
636 | */
|
637 | export declare function getLocaleDateTimeFormat(locale: string, width: FormatWidth): string;
|
638 |
|
639 | /**
|
640 | * Retrieves days of the week for the given locale, using the Gregorian calendar.
|
641 | *
|
642 | * @param locale A locale code for the locale format rules to use.
|
643 | * @param formStyle The required grammatical form.
|
644 | * @param width The required character width.
|
645 | * @returns An array of localized name strings.
|
646 | * For example,`[Sunday, Monday, ... Saturday]` for `en-US`.
|
647 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
648 | *
|
649 | * @publicApi
|
650 | */
|
651 | export declare function getLocaleDayNames(locale: string, formStyle: FormStyle, width: TranslationWidth): string[];
|
652 |
|
653 | /**
|
654 | * Retrieves day period strings for the given locale.
|
655 | *
|
656 | * @param locale A locale code for the locale format rules to use.
|
657 | * @param formStyle The required grammatical form.
|
658 | * @param width The required character width.
|
659 | * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`.
|
660 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
661 | *
|
662 | * @publicApi
|
663 | */
|
664 | export declare function getLocaleDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): [string, string];
|
665 |
|
666 | /**
|
667 | * Retrieves the writing direction of a specified locale
|
668 | * @param locale A locale code for the locale format rules to use.
|
669 | * @publicApi
|
670 | * @returns 'rtl' or 'ltr'
|
671 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
672 | */
|
673 | export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
|
674 |
|
675 | /**
|
676 | * Retrieves Gregorian-calendar eras for the given locale.
|
677 | * @param locale A locale code for the locale format rules to use.
|
678 | * @param formStyle The required grammatical form.
|
679 | * @param width The required character width.
|
680 |
|
681 | * @returns An array of localized era strings.
|
682 | * For example, `[AD, BC]` for `en-US`.
|
683 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
684 | *
|
685 | * @publicApi
|
686 | */
|
687 | export declare function getLocaleEraNames(locale: string, width: TranslationWidth): [string, string];
|
688 |
|
689 | /**
|
690 | * Retrieves locale-specific rules used to determine which day period to use
|
691 | * when more than one period is defined for a locale.
|
692 | *
|
693 | * There is a rule for each defined day period. The
|
694 | * first rule is applied to the first day period and so on.
|
695 | * Fall back to AM/PM when no rules are available.
|
696 | *
|
697 | * A rule can specify a period as time range, or as a single time value.
|
698 | *
|
699 | * This functionality is only available when you have loaded the full locale data.
|
700 | * See the ["I18n guide"](guide/i18n#i18n-pipes).
|
701 | *
|
702 | * @param locale A locale code for the locale format rules to use.
|
703 | * @returns The rules for the locale, a single time value or array of *from-time, to-time*,
|
704 | * or null if no periods are available.
|
705 | *
|
706 | * @see `getLocaleExtraDayPeriods()`
|
707 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
708 | *
|
709 | * @publicApi
|
710 | */
|
711 | export declare function getLocaleExtraDayPeriodRules(locale: string): (Time | [Time, Time])[];
|
712 |
|
713 | /**
|
714 | * Retrieves locale-specific day periods, which indicate roughly how a day is broken up
|
715 | * in different languages.
|
716 | * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.
|
717 | *
|
718 | * This functionality is only available when you have loaded the full locale data.
|
719 | * See the ["I18n guide"](guide/i18n#i18n-pipes).
|
720 | *
|
721 | * @param locale A locale code for the locale format rules to use.
|
722 | * @param formStyle The required grammatical form.
|
723 | * @param width The required character width.
|
724 | * @returns The translated day-period strings.
|
725 | * @see `getLocaleExtraDayPeriodRules()`
|
726 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
727 | *
|
728 | * @publicApi
|
729 | */
|
730 | export declare function getLocaleExtraDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): string[];
|
731 |
|
732 | /**
|
733 | * Retrieves the first day of the week for the given locale.
|
734 | *
|
735 | * @param locale A locale code for the locale format rules to use.
|
736 | * @returns A day index number, using the 0-based week-day index for `en-US`
|
737 | * (Sunday = 0, Monday = 1, ...).
|
738 | * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.
|
739 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
740 | *
|
741 | * @publicApi
|
742 | */
|
743 | export declare function getLocaleFirstDayOfWeek(locale: string): WeekDay;
|
744 |
|
745 | /**
|
746 | * Retrieves the locale ID from the currently loaded locale.
|
747 | * The loaded locale could be, for example, a global one rather than a regional one.
|
748 | * @param locale A locale code, such as `fr-FR`.
|
749 | * @returns The locale code. For example, `fr`.
|
750 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
751 | *
|
752 | * @publicApi
|
753 | */
|
754 | export declare function getLocaleId(locale: string): string;
|
755 |
|
756 | /**
|
757 | * Retrieves months of the year for the given locale, using the Gregorian calendar.
|
758 | *
|
759 | * @param locale A locale code for the locale format rules to use.
|
760 | * @param formStyle The required grammatical form.
|
761 | * @param width The required character width.
|
762 | * @returns An array of localized name strings.
|
763 | * For example, `[January, February, ...]` for `en-US`.
|
764 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
765 | *
|
766 | * @publicApi
|
767 | */
|
768 | export declare function getLocaleMonthNames(locale: string, formStyle: FormStyle, width: TranslationWidth): string[];
|
769 |
|
770 | /**
|
771 | * Retrieves a number format for a given locale.
|
772 | *
|
773 | * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
|
774 | * when used to format the number 12345.678 could result in "12'345,678". That would happen if the
|
775 | * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
|
776 | *
|
777 | * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders
|
778 | * that stand for the decimal separator, and so on, and are NOT real characters.
|
779 | * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in
|
780 | * your language the decimal point is written with a comma. The symbols should be replaced by the
|
781 | * local equivalents, using the appropriate `NumberSymbol` for your language.
|
782 | *
|
783 | * Here are the special characters used in number patterns:
|
784 | *
|
785 | * | Symbol | Meaning |
|
786 | * |--------|---------|
|
787 | * | . | Replaced automatically by the character used for the decimal point. |
|
788 | * | , | Replaced by the "grouping" (thousands) separator. |
|
789 | * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
|
790 | * | # | Replaced by a digit (or nothing if there aren't enough). |
|
791 | * | ¤ | Replaced by a currency symbol, such as $ or USD. |
|
792 | * | % | Marks a percent format. The % symbol may change position, but must be retained. |
|
793 | * | E | Marks a scientific format. The E symbol may change position, but must be retained. |
|
794 | * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
|
795 | *
|
796 | * @param locale A locale code for the locale format rules to use.
|
797 | * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)
|
798 | * @returns The localized format string.
|
799 | * @see `NumberFormatStyle`
|
800 | * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns)
|
801 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
802 | *
|
803 | * @publicApi
|
804 | */
|
805 | export declare function getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string;
|
806 |
|
807 | /**
|
808 | * Retrieves a localized number symbol that can be used to replace placeholders in number formats.
|
809 | * @param locale The locale code.
|
810 | * @param symbol The symbol to localize.
|
811 | * @returns The character for the localized symbol.
|
812 | * @see `NumberSymbol`
|
813 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
814 | *
|
815 | * @publicApi
|
816 | */
|
817 | export declare function getLocaleNumberSymbol(locale: string, symbol: NumberSymbol): string;
|
818 |
|
819 | /**
|
820 | * @alias core/ɵgetLocalePluralCase
|
821 | * @publicApi
|
822 | */
|
823 | export declare const getLocalePluralCase: (locale: string) => ((value: number) => Plural);
|
824 |
|
825 | /**
|
826 | * Retrieves a localized time-value formatting string.
|
827 | *
|
828 | * @param locale A locale code for the locale format rules to use.
|
829 | * @param width The format type.
|
830 | * @returns The localized formatting string.
|
831 | * @see `FormatWidth`
|
832 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
833 |
|
834 | * @publicApi
|
835 | */
|
836 | export declare function getLocaleTimeFormat(locale: string, width: FormatWidth): string;
|
837 |
|
838 | /**
|
839 | * Range of week days that are considered the week-end for the given locale.
|
840 | *
|
841 | * @param locale A locale code for the locale format rules to use.
|
842 | * @returns The range of day values, `[startDay, endDay]`.
|
843 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
844 | *
|
845 | * @publicApi
|
846 | */
|
847 | export declare function getLocaleWeekEndRange(locale: string): [WeekDay, WeekDay];
|
848 |
|
849 | /**
|
850 | * Reports the number of decimal digits for a given currency.
|
851 | * The value depends upon the presence of cents in that particular currency.
|
852 | *
|
853 | * @param code The currency code.
|
854 | * @returns The number of decimal digits, typically 0 or 2.
|
855 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
856 | *
|
857 | * @publicApi
|
858 | */
|
859 | export declare function getNumberOfCurrencyDigits(code: string): number;
|
860 |
|
861 | /**
|
862 | * @description
|
863 | * A {@link LocationStrategy} used to configure the {@link Location} service to
|
864 | * represent its state in the
|
865 | * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
|
866 | * of the browser's URL.
|
867 | *
|
868 | * For instance, if you call `location.go('/foo')`, the browser's URL will become
|
869 | * `example.com#/foo`.
|
870 | *
|
871 | * @usageNotes
|
872 | *
|
873 | * ### Example
|
874 | *
|
875 | * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
|
876 | *
|
877 | * @publicApi
|
878 | */
|
879 | export declare class HashLocationStrategy extends LocationStrategy {
|
880 | private _platformLocation;
|
881 | private _baseHref;
|
882 | constructor(_platformLocation: PlatformLocation, _baseHref?: string);
|
883 | onPopState(fn: LocationChangeListener): void;
|
884 | getBaseHref(): string;
|
885 | path(includeHash?: boolean): string;
|
886 | prepareExternalUrl(internal: string): string;
|
887 | pushState(state: any, title: string, path: string, queryParams: string): void;
|
888 | replaceState(state: any, title: string, path: string, queryParams: string): void;
|
889 | forward(): void;
|
890 | back(): void;
|
891 | }
|
892 |
|
893 | /**
|
894 | * @ngModule CommonModule
|
895 | * @description
|
896 | *
|
897 | * Maps a value to a string that pluralizes the value according to locale rules.
|
898 | *
|
899 | * @usageNotes
|
900 | *
|
901 | * ### Example
|
902 | *
|
903 | * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
|
904 | *
|
905 | * @publicApi
|
906 | */
|
907 | export declare class I18nPluralPipe implements PipeTransform {
|
908 | private _localization;
|
909 | constructor(_localization: NgLocalization);
|
910 | /**
|
911 | * @param value the number to be formatted
|
912 | * @param pluralMap an object that mimics the ICU format, see
|
913 | * http://userguide.icu-project.org/formatparse/messages.
|
914 | * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
|
915 | * default).
|
916 | */
|
917 | transform(value: number, pluralMap: {
|
918 | [count: string]: string;
|
919 | }, locale?: string): string;
|
920 | }
|
921 |
|
922 | /**
|
923 | * @ngModule CommonModule
|
924 | * @description
|
925 | *
|
926 | * Generic selector that displays the string that matches the current value.
|
927 | *
|
928 | * If none of the keys of the `mapping` match the `value`, then the content
|
929 | * of the `other` key is returned when present, otherwise an empty string is returned.
|
930 | *
|
931 | * @usageNotes
|
932 | *
|
933 | * ### Example
|
934 | *
|
935 | * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
|
936 | *
|
937 | * @publicApi
|
938 | */
|
939 | export declare class I18nSelectPipe implements PipeTransform {
|
940 | /**
|
941 | * @param value a string to be internationalized.
|
942 | * @param mapping an object that indicates the text that should be displayed
|
943 | * for different values of the provided `value`.
|
944 | */
|
945 | transform(value: string | null | undefined, mapping: {
|
946 | [key: string]: string;
|
947 | }): string;
|
948 | }
|
949 |
|
950 | /**
|
951 | * Returns whether a platform id represents a browser platform.
|
952 | * @publicApi
|
953 | */
|
954 | export declare function isPlatformBrowser(platformId: Object): boolean;
|
955 |
|
956 | /**
|
957 | * Returns whether a platform id represents a server platform.
|
958 | * @publicApi
|
959 | */
|
960 | export declare function isPlatformServer(platformId: Object): boolean;
|
961 |
|
962 | /**
|
963 | * Returns whether a platform id represents a web worker app platform.
|
964 | * @publicApi
|
965 | */
|
966 | export declare function isPlatformWorkerApp(platformId: Object): boolean;
|
967 |
|
968 | /**
|
969 | * Returns whether a platform id represents a web worker UI platform.
|
970 | * @publicApi
|
971 | */
|
972 | export declare function isPlatformWorkerUi(platformId: Object): boolean;
|
973 |
|
974 | /**
|
975 | * @ngModule CommonModule
|
976 | * @description
|
977 | *
|
978 | * Converts a value into its JSON-format representation. Useful for debugging.
|
979 | *
|
980 | * @usageNotes
|
981 | *
|
982 | * The following component uses a JSON pipe to convert an object
|
983 | * to JSON format, and displays the string in both formats for comparison.
|
984 | *
|
985 | * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
|
986 | *
|
987 | * @publicApi
|
988 | */
|
989 | export declare class JsonPipe implements PipeTransform {
|
990 | /**
|
991 | * @param value A value of any type to convert into a JSON-format string.
|
992 | */
|
993 | transform(value: any): string;
|
994 | }
|
995 |
|
996 | /**
|
997 | * A key value pair.
|
998 | * Usually used to represent the key value pairs from a Map or Object.
|
999 | *
|
1000 | * @publicApi
|
1001 | */
|
1002 | export declare interface KeyValue<K, V> {
|
1003 | key: K;
|
1004 | value: V;
|
1005 | }
|
1006 |
|
1007 | /**
|
1008 | * @ngModule CommonModule
|
1009 | * @description
|
1010 | *
|
1011 | * Transforms Object or Map into an array of key value pairs.
|
1012 | *
|
1013 | * The output array will be ordered by keys.
|
1014 | * By default the comparator will be by Unicode point value.
|
1015 | * You can optionally pass a compareFn if your keys are complex types.
|
1016 | *
|
1017 | * @usageNotes
|
1018 | * ### Examples
|
1019 | *
|
1020 | * This examples show how an Object or a Map can be iterated by ngFor with the use of this keyvalue
|
1021 | * pipe.
|
1022 | *
|
1023 | * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
|
1024 | *
|
1025 | * @publicApi
|
1026 | */
|
1027 | export declare class KeyValuePipe implements PipeTransform {
|
1028 | private readonly differs;
|
1029 | constructor(differs: KeyValueDiffers);
|
1030 | private differ;
|
1031 | private keyValues;
|
1032 | transform<K, V>(input: null, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): null;
|
1033 | transform<V>(input: {
|
1034 | [key: string]: V;
|
1035 | } | Map<string, V>, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>>;
|
1036 | transform<V>(input: {
|
1037 | [key: string]: V;
|
1038 | } | Map<string, V> | null, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>> | null;
|
1039 | transform<V>(input: {
|
1040 | [key: number]: V;
|
1041 | } | Map<number, V>, compareFn?: (a: KeyValue<number, V>, b: KeyValue<number, V>) => number): Array<KeyValue<number, V>>;
|
1042 | transform<V>(input: {
|
1043 | [key: number]: V;
|
1044 | } | Map<number, V> | null, compareFn?: (a: KeyValue<number, V>, b: KeyValue<number, V>) => number): Array<KeyValue<number, V>> | null;
|
1045 | transform<K, V>(input: Map<K, V>, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>>;
|
1046 | transform<K, V>(input: Map<K, V> | null, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>> | null;
|
1047 | }
|
1048 |
|
1049 | /**
|
1050 | * @description
|
1051 | *
|
1052 | * A service that applications can use to interact with a browser's URL.
|
1053 | *
|
1054 | * Depending on the `LocationStrategy` used, `Location` persists
|
1055 | * to the URL's path or the URL's hash segment.
|
1056 | *
|
1057 | * @usageNotes
|
1058 | *
|
1059 | * It's better to use the `Router#navigate` service to trigger route changes. Use
|
1060 | * `Location` only if you need to interact with or create normalized URLs outside of
|
1061 | * routing.
|
1062 | *
|
1063 | * `Location` is responsible for normalizing the URL against the application's base href.
|
1064 | * A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
1065 | * trailing slash:
|
1066 | * - `/my/app/user/123` is normalized
|
1067 | * - `my/app/user/123` **is not** normalized
|
1068 | * - `/my/app/user/123/` **is not** normalized
|
1069 | *
|
1070 | * ### Example
|
1071 | *
|
1072 | * <code-example path='common/location/ts/path_location_component.ts'
|
1073 | * region='LocationComponent'></code-example>
|
1074 | *
|
1075 | * @publicApi
|
1076 | */
|
1077 | export declare class Location {
|
1078 | constructor(platformStrategy: LocationStrategy, platformLocation: PlatformLocation);
|
1079 | /**
|
1080 | * Normalizes the URL path for this location.
|
1081 | *
|
1082 | * @param includeHash True to include an anchor fragment in the path.
|
1083 | *
|
1084 | * @returns The normalized URL path.
|
1085 | */
|
1086 | path(includeHash?: boolean): string;
|
1087 | /**
|
1088 | * Reports the current state of the location history.
|
1089 | * @returns The current value of the `history.state` object.
|
1090 | */
|
1091 | getState(): unknown;
|
1092 | /**
|
1093 | * Normalizes the given path and compares to the current normalized path.
|
1094 | *
|
1095 | * @param path The given URL path.
|
1096 | * @param query Query parameters.
|
1097 | *
|
1098 | * @returns True if the given URL path is equal to the current normalized path, false
|
1099 | * otherwise.
|
1100 | */
|
1101 | isCurrentPathEqualTo(path: string, query?: string): boolean;
|
1102 | /**
|
1103 | * Normalizes a URL path by stripping any trailing slashes.
|
1104 | *
|
1105 | * @param url String representing a URL.
|
1106 | *
|
1107 | * @returns The normalized URL string.
|
1108 | */
|
1109 | normalize(url: string): string;
|
1110 | /**
|
1111 | * Normalizes an external URL path.
|
1112 | * If the given URL doesn't begin with a leading slash (`'/'`), adds one
|
1113 | * before normalizing. Adds a hash if `HashLocationStrategy` is
|
1114 | * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
|
1115 | *
|
1116 | * @param url String representing a URL.
|
1117 | *
|
1118 | * @returns A normalized platform-specific URL.
|
1119 | */
|
1120 | prepareExternalUrl(url: string): string;
|
1121 | /**
|
1122 | * Changes the browser's URL to a normalized version of a given URL, and pushes a
|
1123 | * new item onto the platform's history.
|
1124 | *
|
1125 | * @param path URL path to normalize.
|
1126 | * @param query Query parameters.
|
1127 | * @param state Location history state.
|
1128 | *
|
1129 | */
|
1130 | go(path: string, query?: string, state?: any): void;
|
1131 | /**
|
1132 | * Changes the browser's URL to a normalized version of the given URL, and replaces
|
1133 | * the top item on the platform's history stack.
|
1134 | *
|
1135 | * @param path URL path to normalize.
|
1136 | * @param query Query parameters.
|
1137 | * @param state Location history state.
|
1138 | */
|
1139 | replaceState(path: string, query?: string, state?: any): void;
|
1140 | /**
|
1141 | * Navigates forward in the platform's history.
|
1142 | */
|
1143 | forward(): void;
|
1144 | /**
|
1145 | * Navigates back in the platform's history.
|
1146 | */
|
1147 | back(): void;
|
1148 | /**
|
1149 | * Registers a URL change listener. Use to catch updates performed by the Angular
|
1150 | * framework that are not detectible through "popstate" or "hashchange" events.
|
1151 | *
|
1152 | * @param fn The change handler function, which take a URL and a location history state.
|
1153 | */
|
1154 | onUrlChange(fn: (url: string, state: unknown) => void): void;
|
1155 | /**
|
1156 | * Subscribes to the platform's `popState` events.
|
1157 | *
|
1158 | * @param value Event that is triggered when the state history changes.
|
1159 | * @param exception The exception to throw.
|
1160 | *
|
1161 | * @returns Subscribed events.
|
1162 | */
|
1163 | subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
|
1164 | /**
|
1165 | * Normalizes URL parameters by prepending with `?` if needed.
|
1166 | *
|
1167 | * @param params String of URL parameters.
|
1168 | *
|
1169 | * @returns The normalized URL parameters string.
|
1170 | */
|
1171 | static normalizeQueryParams: (params: string) => string;
|
1172 | /**
|
1173 | * Joins two parts of a URL with a slash if needed.
|
1174 | *
|
1175 | * @param start URL string
|
1176 | * @param end URL string
|
1177 | *
|
1178 | *
|
1179 | * @returns The joined URL string.
|
1180 | */
|
1181 | static joinWithSlash: (start: string, end: string) => string;
|
1182 | /**
|
1183 | * Removes a trailing slash from a URL string if needed.
|
1184 | * Looks for the first occurrence of either `#`, `?`, or the end of the
|
1185 | * line as `/` characters and removes the trailing slash if one exists.
|
1186 | *
|
1187 | * @param url URL string.
|
1188 | *
|
1189 | * @returns The URL string, modified if needed.
|
1190 | */
|
1191 | static stripTrailingSlash: (url: string) => string;
|
1192 | }
|
1193 |
|
1194 | /**
|
1195 | * @description
|
1196 | * Indicates when a location is initialized.
|
1197 | *
|
1198 | * @publicApi
|
1199 | */
|
1200 | export declare const LOCATION_INITIALIZED: InjectionToken<Promise<any>>;
|
1201 |
|
1202 | /**
|
1203 | * @description
|
1204 | * A serializable version of the event from `onPopState` or `onHashChange`
|
1205 | *
|
1206 | * @publicApi
|
1207 | */
|
1208 | export declare interface LocationChangeEvent {
|
1209 | type: string;
|
1210 | state: any;
|
1211 | }
|
1212 |
|
1213 | /**
|
1214 | * @publicApi
|
1215 | */
|
1216 | export declare interface LocationChangeListener {
|
1217 | (event: LocationChangeEvent): any;
|
1218 | }
|
1219 |
|
1220 | /**
|
1221 | * Enables the `Location` service to read route state from the browser's URL.
|
1222 | * Angular provides two strategies:
|
1223 | * `HashLocationStrategy` and `PathLocationStrategy`.
|
1224 | *
|
1225 | * Applications should use the `Router` or `Location` services to
|
1226 | * interact with application route state.
|
1227 | *
|
1228 | * For instance, `HashLocationStrategy` produces URLs like
|
1229 | * <code class="no-auto-link">http://example.com#/foo</code>,
|
1230 | * and `PathLocationStrategy` produces
|
1231 | * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL.
|
1232 | *
|
1233 | * See these two classes for more.
|
1234 | *
|
1235 | * @publicApi
|
1236 | */
|
1237 | export declare abstract class LocationStrategy {
|
1238 | abstract path(includeHash?: boolean): string;
|
1239 | abstract prepareExternalUrl(internal: string): string;
|
1240 | abstract pushState(state: any, title: string, url: string, queryParams: string): void;
|
1241 | abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
|
1242 | abstract forward(): void;
|
1243 | abstract back(): void;
|
1244 | abstract onPopState(fn: LocationChangeListener): void;
|
1245 | abstract getBaseHref(): string;
|
1246 | }
|
1247 |
|
1248 | /**
|
1249 | * Transforms text to all lower case.
|
1250 | *
|
1251 | * @see `UpperCasePipe`
|
1252 | * @see `TitleCasePipe`
|
1253 | * @usageNotes
|
1254 | *
|
1255 | * The following example defines a view that allows the user to enter
|
1256 | * text, and then uses the pipe to convert the input text to all lower case.
|
1257 | *
|
1258 | * <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example>
|
1259 | *
|
1260 | * @ngModule CommonModule
|
1261 | * @publicApi
|
1262 | */
|
1263 | export declare class LowerCasePipe implements PipeTransform {
|
1264 | /**
|
1265 | * @param value The string to transform to lower case.
|
1266 | */
|
1267 | transform(value: string): string;
|
1268 | }
|
1269 |
|
1270 | /**
|
1271 | * @ngModule CommonModule
|
1272 | *
|
1273 | * @usageNotes
|
1274 | * ```
|
1275 | * <some-element [ngClass]="'first second'">...</some-element>
|
1276 | *
|
1277 | * <some-element [ngClass]="['first', 'second']">...</some-element>
|
1278 | *
|
1279 | * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
|
1280 | *
|
1281 | * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
|
1282 | *
|
1283 | * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
|
1284 | * ```
|
1285 | *
|
1286 | * @description
|
1287 | *
|
1288 | * Adds and removes CSS classes on an HTML element.
|
1289 | *
|
1290 | * The CSS classes are updated as follows, depending on the type of the expression evaluation:
|
1291 | * - `string` - the CSS classes listed in the string (space delimited) are added,
|
1292 | * - `Array` - the CSS classes declared as Array elements are added,
|
1293 | * - `Object` - keys are CSS classes that get added when the expression given in the value
|
1294 | * evaluates to a truthy value, otherwise they are removed.
|
1295 | *
|
1296 | * @publicApi
|
1297 | */
|
1298 | export declare class NgClass implements DoCheck {
|
1299 | private _iterableDiffers;
|
1300 | private _keyValueDiffers;
|
1301 | private _ngEl;
|
1302 | private _renderer;
|
1303 | private _iterableDiffer;
|
1304 | private _keyValueDiffer;
|
1305 | private _initialClasses;
|
1306 | private _rawClass;
|
1307 | constructor(_iterableDiffers: IterableDiffers, _keyValueDiffers: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer2);
|
1308 | set klass(value: string);
|
1309 | set ngClass(value: string | string[] | Set<string> | {
|
1310 | [klass: string]: any;
|
1311 | });
|
1312 | ngDoCheck(): void;
|
1313 | private _applyKeyValueChanges;
|
1314 | private _applyIterableChanges;
|
1315 | /**
|
1316 | * Applies a collection of CSS classes to the DOM element.
|
1317 | *
|
1318 | * For argument of type Set and Array CSS class names contained in those collections are always
|
1319 | * added.
|
1320 | * For argument of type Map CSS class name in the map's key is toggled based on the value (added
|
1321 | * for truthy and removed for falsy).
|
1322 | */
|
1323 | private _applyClasses;
|
1324 | /**
|
1325 | * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
|
1326 | * purposes.
|
1327 | */
|
1328 | private _removeClasses;
|
1329 | private _toggleClass;
|
1330 | }
|
1331 |
|
1332 | /**
|
1333 | * Instantiates a single {@link Component} type and inserts its Host View into current View.
|
1334 | * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
|
1335 | *
|
1336 | * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
|
1337 | * any existing component will get destroyed.
|
1338 | *
|
1339 | * @usageNotes
|
1340 | *
|
1341 | * ### Fine tune control
|
1342 | *
|
1343 | * You can control the component creation process by using the following optional attributes:
|
1344 | *
|
1345 | * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
|
1346 | * the Component. Defaults to the injector of the current view container.
|
1347 | *
|
1348 | * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
|
1349 | * section of the component, if exists.
|
1350 | *
|
1351 | * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
|
1352 | * module, then load a component from that module.
|
1353 | *
|
1354 | * ### Syntax
|
1355 | *
|
1356 | * Simple
|
1357 | * ```
|
1358 | * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
|
1359 | * ```
|
1360 | *
|
1361 | * Customized injector/content
|
1362 | * ```
|
1363 | * <ng-container *ngComponentOutlet="componentTypeExpression;
|
1364 | * injector: injectorExpression;
|
1365 | * content: contentNodesExpression;">
|
1366 | * </ng-container>
|
1367 | * ```
|
1368 | *
|
1369 | * Customized ngModuleFactory
|
1370 | * ```
|
1371 | * <ng-container *ngComponentOutlet="componentTypeExpression;
|
1372 | * ngModuleFactory: moduleFactory;">
|
1373 | * </ng-container>
|
1374 | * ```
|
1375 | *
|
1376 | * ### A simple example
|
1377 | *
|
1378 | * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
|
1379 | *
|
1380 | * A more complete example with additional options:
|
1381 | *
|
1382 | * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
|
1383 | *
|
1384 | * @publicApi
|
1385 | * @ngModule CommonModule
|
1386 | */
|
1387 | export declare class NgComponentOutlet implements OnChanges, OnDestroy {
|
1388 | private _viewContainerRef;
|
1389 | ngComponentOutlet: Type<any>;
|
1390 | ngComponentOutletInjector: Injector;
|
1391 | ngComponentOutletContent: any[][];
|
1392 | ngComponentOutletNgModuleFactory: NgModuleFactory<any>;
|
1393 | private _componentRef;
|
1394 | private _moduleRef;
|
1395 | constructor(_viewContainerRef: ViewContainerRef);
|
1396 | ngOnChanges(changes: SimpleChanges): void;
|
1397 | ngOnDestroy(): void;
|
1398 | }
|
1399 |
|
1400 | /**
|
1401 | * A [structural directive](guide/structural-directives) that renders
|
1402 | * a template for each item in a collection.
|
1403 | * The directive is placed on an element, which becomes the parent
|
1404 | * of the cloned templates.
|
1405 | *
|
1406 | * The `ngForOf` directive is generally used in the
|
1407 | * [shorthand form](guide/structural-directives#the-asterisk--prefix) `*ngFor`.
|
1408 | * In this form, the template to be rendered for each iteration is the content
|
1409 | * of an anchor element containing the directive.
|
1410 | *
|
1411 | * The following example shows the shorthand syntax with some options,
|
1412 | * contained in an `<li>` element.
|
1413 | *
|
1414 | * ```
|
1415 | * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
|
1416 | * ```
|
1417 | *
|
1418 | * The shorthand form expands into a long form that uses the `ngForOf` selector
|
1419 | * on an `<ng-template>` element.
|
1420 | * The content of the `<ng-template>` element is the `<li>` element that held the
|
1421 | * short-form directive.
|
1422 | *
|
1423 | * Here is the expanded version of the short-form example.
|
1424 | *
|
1425 | * ```
|
1426 | * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
|
1427 | * <li>...</li>
|
1428 | * </ng-template>
|
1429 | * ```
|
1430 | *
|
1431 | * Angular automatically expands the shorthand syntax as it compiles the template.
|
1432 | * The context for each embedded view is logically merged to the current component
|
1433 | * context according to its lexical position.
|
1434 | *
|
1435 | * When using the shorthand syntax, Angular allows only [one structural directive
|
1436 | * on an element](guide/structural-directives#one-structural-directive-per-host-element).
|
1437 | * If you want to iterate conditionally, for example,
|
1438 | * put the `*ngIf` on a container element that wraps the `*ngFor` element.
|
1439 | * For futher discussion, see
|
1440 | * [Structural Directives](guide/structural-directives#one-per-element).
|
1441 | *
|
1442 | * @usageNotes
|
1443 | *
|
1444 | * ### Local variables
|
1445 | *
|
1446 | * `NgForOf` provides exported values that can be aliased to local variables.
|
1447 | * For example:
|
1448 | *
|
1449 | * ```
|
1450 | * <li *ngFor="let user of users; index as i; first as isFirst">
|
1451 | * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
|
1452 | * </li>
|
1453 | * ```
|
1454 | *
|
1455 | * The following exported values can be aliased to local variables:
|
1456 | *
|
1457 | * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
|
1458 | * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
|
1459 | * more complex then a property access, for example when using the async pipe (`userStreams |
|
1460 | * async`).
|
1461 | * - `index: number`: The index of the current item in the iterable.
|
1462 | * - `count: number`: The length of the iterable.
|
1463 | * - `first: boolean`: True when the item is the first item in the iterable.
|
1464 | * - `last: boolean`: True when the item is the last item in the iterable.
|
1465 | * - `even: boolean`: True when the item has an even index in the iterable.
|
1466 | * - `odd: boolean`: True when the item has an odd index in the iterable.
|
1467 | *
|
1468 | * ### Change propagation
|
1469 | *
|
1470 | * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
|
1471 | *
|
1472 | * * When an item is added, a new instance of the template is added to the DOM.
|
1473 | * * When an item is removed, its template instance is removed from the DOM.
|
1474 | * * When items are reordered, their respective templates are reordered in the DOM.
|
1475 | *
|
1476 | * Angular uses object identity to track insertions and deletions within the iterator and reproduce
|
1477 | * those changes in the DOM. This has important implications for animations and any stateful
|
1478 | * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
|
1479 | * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
|
1480 | * such as user input.
|
1481 | * For more on animations, see [Transitions and Triggers](guide/transition-and-triggers).
|
1482 | *
|
1483 | * The identities of elements in the iterator can change while the data does not.
|
1484 | * This can happen, for example, if the iterator is produced from an RPC to the server, and that
|
1485 | * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
|
1486 | * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
|
1487 | * elements were deleted and all new elements inserted).
|
1488 | *
|
1489 | * To avoid this expensive operation, you can customize the default tracking algorithm.
|
1490 | * by supplying the `trackBy` option to `NgForOf`.
|
1491 | * `trackBy` takes a function that has two arguments: `index` and `item`.
|
1492 | * If `trackBy` is given, Angular tracks changes by the return value of the function.
|
1493 | *
|
1494 | * @see [Structural Directives](guide/structural-directives)
|
1495 | * @ngModule CommonModule
|
1496 | * @publicApi
|
1497 | */
|
1498 | export declare class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
|
1499 | private _viewContainer;
|
1500 | private _template;
|
1501 | private _differs;
|
1502 | /**
|
1503 | * The value of the iterable expression, which can be used as a
|
1504 | * [template input variable](guide/structural-directives#template-input-variable).
|
1505 | */
|
1506 | set ngForOf(ngForOf: (U & NgIterable<T>) | undefined | null);
|
1507 | /**
|
1508 | * A function that defines how to track changes for items in the iterable.
|
1509 | *
|
1510 | * When items are added, moved, or removed in the iterable,
|
1511 | * the directive must re-render the appropriate DOM nodes.
|
1512 | * To minimize churn in the DOM, only nodes that have changed
|
1513 | * are re-rendered.
|
1514 | *
|
1515 | * By default, the change detector assumes that
|
1516 | * the object instance identifies the node in the iterable.
|
1517 | * When this function is supplied, the directive uses
|
1518 | * the result of calling this function to identify the item node,
|
1519 | * rather than the identity of the object itself.
|
1520 | *
|
1521 | * The function receives two inputs,
|
1522 | * the iteration index and the node object ID.
|
1523 | */
|
1524 | set ngForTrackBy(fn: TrackByFunction<T>);
|
1525 | get ngForTrackBy(): TrackByFunction<T>;
|
1526 | private _ngForOf;
|
1527 | private _ngForOfDirty;
|
1528 | private _differ;
|
1529 | private _trackByFn;
|
1530 | constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<NgForOfContext<T, U>>, _differs: IterableDiffers);
|
1531 | /**
|
1532 | * A reference to the template that is stamped out for each item in the iterable.
|
1533 | * @see [template reference variable](guide/template-syntax#template-reference-variables--var-)
|
1534 | */
|
1535 | set ngForTemplate(value: TemplateRef<NgForOfContext<T, U>>);
|
1536 | /**
|
1537 | * Applies the changes when needed.
|
1538 | */
|
1539 | ngDoCheck(): void;
|
1540 | private _applyChanges;
|
1541 | private _perViewChange;
|
1542 | /**
|
1543 | * Asserts the correct type of the context for the template that `NgForOf` will render.
|
1544 | *
|
1545 | * The presence of this method is a signal to the Ivy template type-check compiler that the
|
1546 | * `NgForOf` structural directive renders its template with a specific context type.
|
1547 | */
|
1548 | static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
|
1549 | }
|
1550 |
|
1551 | /**
|
1552 | * @publicApi
|
1553 | */
|
1554 | export declare class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
|
1555 | $implicit: T;
|
1556 | ngForOf: U;
|
1557 | index: number;
|
1558 | count: number;
|
1559 | constructor($implicit: T, ngForOf: U, index: number, count: number);
|
1560 | get first(): boolean;
|
1561 | get last(): boolean;
|
1562 | get even(): boolean;
|
1563 | get odd(): boolean;
|
1564 | }
|
1565 |
|
1566 | /**
|
1567 | * A structural directive that conditionally includes a template based on the value of
|
1568 | * an expression coerced to Boolean.
|
1569 | * When the expression evaluates to true, Angular renders the template
|
1570 | * provided in a `then` clause, and when false or null,
|
1571 | * Angular renders the template provided in an optional `else` clause. The default
|
1572 | * template for the `else` clause is blank.
|
1573 | *
|
1574 | * A [shorthand form](guide/structural-directives#the-asterisk--prefix) of the directive,
|
1575 | * `*ngIf="condition"`, is generally used, provided
|
1576 | * as an attribute of the anchor element for the inserted template.
|
1577 | * Angular expands this into a more explicit version, in which the anchor element
|
1578 | * is contained in an `<ng-template>` element.
|
1579 | *
|
1580 | * Simple form with shorthand syntax:
|
1581 | *
|
1582 | * ```
|
1583 | * <div *ngIf="condition">Content to render when condition is true.</div>
|
1584 | * ```
|
1585 | *
|
1586 | * Simple form with expanded syntax:
|
1587 | *
|
1588 | * ```
|
1589 | * <ng-template [ngIf]="condition"><div>Content to render when condition is
|
1590 | * true.</div></ng-template>
|
1591 | * ```
|
1592 | *
|
1593 | * Form with an "else" block:
|
1594 | *
|
1595 | * ```
|
1596 | * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
|
1597 | * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
|
1598 | * ```
|
1599 | *
|
1600 | * Shorthand form with "then" and "else" blocks:
|
1601 | *
|
1602 | * ```
|
1603 | * <div *ngIf="condition; then thenBlock else elseBlock"></div>
|
1604 | * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
|
1605 | * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
|
1606 | * ```
|
1607 | *
|
1608 | * Form with storing the value locally:
|
1609 | *
|
1610 | * ```
|
1611 | * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
|
1612 | * <ng-template #elseBlock>Content to render when value is null.</ng-template>
|
1613 | * ```
|
1614 | *
|
1615 | * @usageNotes
|
1616 | *
|
1617 | * The `*ngIf` directive is most commonly used to conditionally show an inline template,
|
1618 | * as seen in the following example.
|
1619 | * The default `else` template is blank.
|
1620 | *
|
1621 | * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
|
1622 | *
|
1623 | * ### Showing an alternative template using `else`
|
1624 | *
|
1625 | * To display a template when `expression` evaluates to false, use an `else` template
|
1626 | * binding as shown in the following example.
|
1627 | * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
|
1628 | * The template can be defined anywhere in the component view, but is typically placed right after
|
1629 | * `ngIf` for readability.
|
1630 | *
|
1631 | * {@example common/ngIf/ts/module.ts region='NgIfElse'}
|
1632 | *
|
1633 | * ### Using an external `then` template
|
1634 | *
|
1635 | * In the previous example, the then-clause template is specified inline, as the content of the
|
1636 | * tag that contains the `ngIf` directive. You can also specify a template that is defined
|
1637 | * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
|
1638 | * change which template to use at runtime, as shown in the following example.
|
1639 | *
|
1640 | * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
|
1641 | *
|
1642 | * ### Storing a conditional result in a variable
|
1643 | *
|
1644 | * You might want to show a set of properties from the same object. If you are waiting
|
1645 | * for asynchronous data, the object can be undefined.
|
1646 | * In this case, you can use `ngIf` and store the result of the condition in a local
|
1647 | * variable as shown in the the following example.
|
1648 | *
|
1649 | * {@example common/ngIf/ts/module.ts region='NgIfAs'}
|
1650 | *
|
1651 | * This code uses only one `AsyncPipe`, so only one subscription is created.
|
1652 | * The conditional statement stores the result of `userStream|async` in the local variable `user`.
|
1653 | * You can then bind the local `user` repeatedly.
|
1654 | *
|
1655 | * The conditional displays the data only if `userStream` returns a value,
|
1656 | * so you don't need to use the
|
1657 | * [safe-navigation-operator](guide/template-syntax#safe-navigation-operator) (`?.`)
|
1658 | * to guard against null values when accessing properties.
|
1659 | * You can display an alternative template while waiting for the data.
|
1660 | *
|
1661 | * ### Shorthand syntax
|
1662 | *
|
1663 | * The shorthand syntax `*ngIf` expands into two separate template specifications
|
1664 | * for the "then" and "else" clauses. For example, consider the following shorthand statement,
|
1665 | * that is meant to show a loading page while waiting for data to be loaded.
|
1666 | *
|
1667 | * ```
|
1668 | * <div class="hero-list" *ngIf="heroes else loading">
|
1669 | * ...
|
1670 | * </div>
|
1671 | *
|
1672 | * <ng-template #loading>
|
1673 | * <div>Loading...</div>
|
1674 | * </ng-template>
|
1675 | * ```
|
1676 | *
|
1677 | * You can see that the "else" clause references the `<ng-template>`
|
1678 | * with the `#loading` label, and the template for the "then" clause
|
1679 | * is provided as the content of the anchor element.
|
1680 | *
|
1681 | * However, when Angular expands the shorthand syntax, it creates
|
1682 | * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
|
1683 | * The anchor element containing the template for the "then" clause becomes
|
1684 | * the content of this unlabeled `<ng-template>` tag.
|
1685 | *
|
1686 | * ```
|
1687 | * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
|
1688 | * <div class="hero-list">
|
1689 | * ...
|
1690 | * </div>
|
1691 | * </ng-template>
|
1692 | *
|
1693 | * <ng-template #loading>
|
1694 | * <div>Loading...</div>
|
1695 | * </ng-template>
|
1696 | * ```
|
1697 | *
|
1698 | * The presence of the implicit template object has implications for the nesting of
|
1699 | * structural directives. For more on this subject, see
|
1700 | * [Structural Directives](https://angular.io/guide/structural-directives#one-per-element).
|
1701 | *
|
1702 | * @ngModule CommonModule
|
1703 | * @publicApi
|
1704 | */
|
1705 | export declare class NgIf<T = unknown> {
|
1706 | private _viewContainer;
|
1707 | private _context;
|
1708 | private _thenTemplateRef;
|
1709 | private _elseTemplateRef;
|
1710 | private _thenViewRef;
|
1711 | private _elseViewRef;
|
1712 | constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext<T>>);
|
1713 | /**
|
1714 | * The Boolean expression to evaluate as the condition for showing a template.
|
1715 | */
|
1716 | set ngIf(condition: T);
|
1717 | /**
|
1718 | * A template to show if the condition expression evaluates to true.
|
1719 | */
|
1720 | set ngIfThen(templateRef: TemplateRef<NgIfContext<T>> | null);
|
1721 | /**
|
1722 | * A template to show if the condition expression evaluates to false.
|
1723 | */
|
1724 | set ngIfElse(templateRef: TemplateRef<NgIfContext<T>> | null);
|
1725 | private _updateView;
|
1726 | /**
|
1727 | * Assert the correct type of the expression bound to the `ngIf` input within the template.
|
1728 | *
|
1729 | * The presence of this static field is a signal to the Ivy template type check compiler that
|
1730 | * when the `NgIf` structural directive renders its template, the type of the expression bound
|
1731 | * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
|
1732 | * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
|
1733 | */
|
1734 | static ngTemplateGuard_ngIf: 'binding';
|
1735 | /**
|
1736 | * Asserts the correct type of the context for the template that `NgIf` will render.
|
1737 | *
|
1738 | * The presence of this method is a signal to the Ivy template type-check compiler that the
|
1739 | * `NgIf` structural directive renders its template with a specific context type.
|
1740 | */
|
1741 | static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<NonNullable<T>>;
|
1742 | }
|
1743 |
|
1744 | /**
|
1745 | * @publicApi
|
1746 | */
|
1747 | export declare class NgIfContext<T = unknown> {
|
1748 | $implicit: T;
|
1749 | ngIf: T;
|
1750 | }
|
1751 |
|
1752 | /**
|
1753 | * Returns the plural case based on the locale
|
1754 | *
|
1755 | * @publicApi
|
1756 | */
|
1757 | export declare class NgLocaleLocalization extends NgLocalization {
|
1758 | protected locale: string;
|
1759 | constructor(locale: string);
|
1760 | getPluralCategory(value: any, locale?: string): string;
|
1761 | }
|
1762 |
|
1763 |
|
1764 | /**
|
1765 | * @publicApi
|
1766 | */
|
1767 | export declare abstract class NgLocalization {
|
1768 | abstract getPluralCategory(value: any, locale?: string): string;
|
1769 | }
|
1770 |
|
1771 | /**
|
1772 | * @ngModule CommonModule
|
1773 | *
|
1774 | * @usageNotes
|
1775 | * ```
|
1776 | * <some-element [ngPlural]="value">
|
1777 | * <ng-template ngPluralCase="=0">there is nothing</ng-template>
|
1778 | * <ng-template ngPluralCase="=1">there is one</ng-template>
|
1779 | * <ng-template ngPluralCase="few">there are a few</ng-template>
|
1780 | * </some-element>
|
1781 | * ```
|
1782 | *
|
1783 | * @description
|
1784 | *
|
1785 | * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
|
1786 | *
|
1787 | * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
|
1788 | * that match the switch expression's pluralization category.
|
1789 | *
|
1790 | * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
|
1791 | * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
|
1792 | * expression:
|
1793 | * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
|
1794 | * matches the switch expression exactly,
|
1795 | * - otherwise, the view will be treated as a "category match", and will only display if exact
|
1796 | * value matches aren't found and the value maps to its category for the defined locale.
|
1797 | *
|
1798 | * See http://cldr.unicode.org/index/cldr-spec/plural-rules
|
1799 | *
|
1800 | * @publicApi
|
1801 | */
|
1802 | export declare class NgPlural {
|
1803 | private _localization;
|
1804 | private _switchValue;
|
1805 | private _activeView;
|
1806 | private _caseViews;
|
1807 | constructor(_localization: NgLocalization);
|
1808 | set ngPlural(value: number);
|
1809 | addCase(value: string, switchView: SwitchView): void;
|
1810 | private _updateView;
|
1811 | private _clearViews;
|
1812 | private _activateView;
|
1813 | }
|
1814 |
|
1815 | /**
|
1816 | * @ngModule CommonModule
|
1817 | *
|
1818 | * @description
|
1819 | *
|
1820 | * Creates a view that will be added/removed from the parent {@link NgPlural} when the
|
1821 | * given expression matches the plural expression according to CLDR rules.
|
1822 | *
|
1823 | * @usageNotes
|
1824 | * ```
|
1825 | * <some-element [ngPlural]="value">
|
1826 | * <ng-template ngPluralCase="=0">...</ng-template>
|
1827 | * <ng-template ngPluralCase="other">...</ng-template>
|
1828 | * </some-element>
|
1829 | *```
|
1830 | *
|
1831 | * See {@link NgPlural} for more details and example.
|
1832 | *
|
1833 | * @publicApi
|
1834 | */
|
1835 | export declare class NgPluralCase {
|
1836 | value: string;
|
1837 | constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef, ngPlural: NgPlural);
|
1838 | }
|
1839 |
|
1840 | /**
|
1841 | * @ngModule CommonModule
|
1842 | *
|
1843 | * @usageNotes
|
1844 | *
|
1845 | * Set the font of the containing element to the result of an expression.
|
1846 | *
|
1847 | * ```
|
1848 | * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
|
1849 | * ```
|
1850 | *
|
1851 | * Set the width of the containing element to a pixel value returned by an expression.
|
1852 | *
|
1853 | * ```
|
1854 | * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
|
1855 | * ```
|
1856 | *
|
1857 | * Set a collection of style values using an expression that returns key-value pairs.
|
1858 | *
|
1859 | * ```
|
1860 | * <some-element [ngStyle]="objExp">...</some-element>
|
1861 | * ```
|
1862 | *
|
1863 | * @description
|
1864 | *
|
1865 | * An attribute directive that updates styles for the containing HTML element.
|
1866 | * Sets one or more style properties, specified as colon-separated key-value pairs.
|
1867 | * The key is a style name, with an optional `.<unit>` suffix
|
1868 | * (such as 'top.px', 'font-style.em').
|
1869 | * The value is an expression to be evaluated.
|
1870 | * The resulting non-null value, expressed in the given unit,
|
1871 | * is assigned to the given style property.
|
1872 | * If the result of evaluation is null, the corresponding style is removed.
|
1873 | *
|
1874 | * @publicApi
|
1875 | */
|
1876 | export declare class NgStyle implements DoCheck {
|
1877 | private _ngEl;
|
1878 | private _differs;
|
1879 | private _renderer;
|
1880 | private _ngStyle;
|
1881 | private _differ;
|
1882 | constructor(_ngEl: ElementRef, _differs: KeyValueDiffers, _renderer: Renderer2);
|
1883 | set ngStyle(values: {
|
1884 | [klass: string]: any;
|
1885 | } | null);
|
1886 | ngDoCheck(): void;
|
1887 | private _setStyle;
|
1888 | private _applyChanges;
|
1889 | }
|
1890 |
|
1891 | /**
|
1892 | * @ngModule CommonModule
|
1893 | *
|
1894 | * @description
|
1895 | * The `[ngSwitch]` directive on a container specifies an expression to match against.
|
1896 | * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
|
1897 | * - Every view that matches is rendered.
|
1898 | * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
|
1899 | * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
|
1900 | * or `ngSwitchDefault` directive are preserved at the location.
|
1901 | *
|
1902 | * @usageNotes
|
1903 | * Define a container element for the directive, and specify the switch expression
|
1904 | * to match against as an attribute:
|
1905 | *
|
1906 | * ```
|
1907 | * <container-element [ngSwitch]="switch_expression">
|
1908 | * ```
|
1909 | *
|
1910 | * Within the container, `*ngSwitchCase` statements specify the match expressions
|
1911 | * as attributes. Include `*ngSwitchDefault` as the final case.
|
1912 | *
|
1913 | * ```
|
1914 | * <container-element [ngSwitch]="switch_expression">
|
1915 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
1916 | * ...
|
1917 | * <some-element *ngSwitchDefault>...</some-element>
|
1918 | * </container-element>
|
1919 | * ```
|
1920 | *
|
1921 | * ### Usage Examples
|
1922 | *
|
1923 | * The following example shows how to use more than one case to display the same view:
|
1924 | *
|
1925 | * ```
|
1926 | * <container-element [ngSwitch]="switch_expression">
|
1927 | * <!-- the same view can be shown in more than one case -->
|
1928 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
1929 | * <some-element *ngSwitchCase="match_expression_2">...</some-element>
|
1930 | * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
|
1931 | * <!--default case when there are no matches -->
|
1932 | * <some-element *ngSwitchDefault>...</some-element>
|
1933 | * </container-element>
|
1934 | * ```
|
1935 | *
|
1936 | * The following example shows how cases can be nested:
|
1937 | * ```
|
1938 | * <container-element [ngSwitch]="switch_expression">
|
1939 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
1940 | * <some-element *ngSwitchCase="match_expression_2">...</some-element>
|
1941 | * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
|
1942 | * <ng-container *ngSwitchCase="match_expression_3">
|
1943 | * <!-- use a ng-container to group multiple root nodes -->
|
1944 | * <inner-element></inner-element>
|
1945 | * <inner-other-element></inner-other-element>
|
1946 | * </ng-container>
|
1947 | * <some-element *ngSwitchDefault>...</some-element>
|
1948 | * </container-element>
|
1949 | * ```
|
1950 | *
|
1951 | * @publicApi
|
1952 | * @see `NgSwitchCase`
|
1953 | * @see `NgSwitchDefault`
|
1954 | * @see [Structural Directives](guide/structural-directives)
|
1955 | *
|
1956 | */
|
1957 | export declare class NgSwitch {
|
1958 | private _defaultViews;
|
1959 | private _defaultUsed;
|
1960 | private _caseCount;
|
1961 | private _lastCaseCheckIndex;
|
1962 | private _lastCasesMatched;
|
1963 | private _ngSwitch;
|
1964 | set ngSwitch(newValue: any);
|
1965 | private _updateDefaultCases;
|
1966 | }
|
1967 |
|
1968 | /**
|
1969 | * @ngModule CommonModule
|
1970 | *
|
1971 | * @description
|
1972 | * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
|
1973 | * When the expressions match, the given `NgSwitchCase` template is rendered.
|
1974 | * If multiple match expressions match the switch expression value, all of them are displayed.
|
1975 | *
|
1976 | * @usageNotes
|
1977 | *
|
1978 | * Within a switch container, `*ngSwitchCase` statements specify the match expressions
|
1979 | * as attributes. Include `*ngSwitchDefault` as the final case.
|
1980 | *
|
1981 | * ```
|
1982 | * <container-element [ngSwitch]="switch_expression">
|
1983 | * <some-element *ngSwitchCase="match_expression_1">...</some-element>
|
1984 | * ...
|
1985 | * <some-element *ngSwitchDefault>...</some-element>
|
1986 | * </container-element>
|
1987 | * ```
|
1988 | *
|
1989 | * Each switch-case statement contains an in-line HTML template or template reference
|
1990 | * that defines the subtree to be selected if the value of the match expression
|
1991 | * matches the value of the switch expression.
|
1992 | *
|
1993 | * Unlike JavaScript, which uses strict equality, Angular uses loose equality.
|
1994 | * This means that the empty string, `""` matches 0.
|
1995 | *
|
1996 | * @publicApi
|
1997 | * @see `NgSwitch`
|
1998 | * @see `NgSwitchDefault`
|
1999 | *
|
2000 | */
|
2001 | export declare class NgSwitchCase implements DoCheck {
|
2002 | private ngSwitch;
|
2003 | private _view;
|
2004 | /**
|
2005 | * Stores the HTML template to be selected on match.
|
2006 | */
|
2007 | ngSwitchCase: any;
|
2008 | constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
|
2009 | /**
|
2010 | * Performs case matching. For internal use only.
|
2011 | */
|
2012 | ngDoCheck(): void;
|
2013 | }
|
2014 |
|
2015 | /**
|
2016 | * @ngModule CommonModule
|
2017 | *
|
2018 | * @description
|
2019 | *
|
2020 | * Creates a view that is rendered when no `NgSwitchCase` expressions
|
2021 | * match the `NgSwitch` expression.
|
2022 | * This statement should be the final case in an `NgSwitch`.
|
2023 | *
|
2024 | * @publicApi
|
2025 | * @see `NgSwitch`
|
2026 | * @see `NgSwitchCase`
|
2027 | *
|
2028 | */
|
2029 | export declare class NgSwitchDefault {
|
2030 | constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
|
2031 | }
|
2032 |
|
2033 | /**
|
2034 | * @ngModule CommonModule
|
2035 | *
|
2036 | * @description
|
2037 | *
|
2038 | * Inserts an embedded view from a prepared `TemplateRef`.
|
2039 | *
|
2040 | * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
|
2041 | * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
|
2042 | * by the local template `let` declarations.
|
2043 | *
|
2044 | * @usageNotes
|
2045 | * ```
|
2046 | * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
|
2047 | * ```
|
2048 | *
|
2049 | * Using the key `$implicit` in the context object will set its value as default.
|
2050 | *
|
2051 | * ### Example
|
2052 | *
|
2053 | * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
|
2054 | *
|
2055 | * @publicApi
|
2056 | */
|
2057 | export declare class NgTemplateOutlet implements OnChanges {
|
2058 | private _viewContainerRef;
|
2059 | private _viewRef;
|
2060 | /**
|
2061 | * A context object to attach to the {@link EmbeddedViewRef}. This should be an
|
2062 | * object, the object's keys will be available for binding by the local template `let`
|
2063 | * declarations.
|
2064 | * Using the key `$implicit` in the context object will set its value as default.
|
2065 | */
|
2066 | ngTemplateOutletContext: Object | null;
|
2067 | /**
|
2068 | * A string defining the template reference and optionally the context object for the template.
|
2069 | */
|
2070 | ngTemplateOutlet: TemplateRef<any> | null;
|
2071 | constructor(_viewContainerRef: ViewContainerRef);
|
2072 | ngOnChanges(changes: SimpleChanges): void;
|
2073 | /**
|
2074 | * We need to re-create existing embedded view if:
|
2075 | * - templateRef has changed
|
2076 | * - context has changes
|
2077 | *
|
2078 | * We mark context object as changed when the corresponding object
|
2079 | * shape changes (new properties are added or existing properties are removed).
|
2080 | * In other words we consider context with the same properties as "the same" even
|
2081 | * if object reference changes (see https://github.com/angular/angular/issues/13407).
|
2082 | */
|
2083 | private _shouldRecreateView;
|
2084 | private _hasContextShapeChanged;
|
2085 | private _updateExistingContext;
|
2086 | }
|
2087 |
|
2088 |
|
2089 | /**
|
2090 | * Format styles that can be used to represent numbers.
|
2091 | * @see `getLocaleNumberFormat()`.
|
2092 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
2093 | *
|
2094 | * @publicApi
|
2095 | */
|
2096 | export declare enum NumberFormatStyle {
|
2097 | Decimal = 0,
|
2098 | Percent = 1,
|
2099 | Currency = 2,
|
2100 | Scientific = 3
|
2101 | }
|
2102 |
|
2103 | /**
|
2104 | * Symbols that can be used to replace placeholders in number patterns.
|
2105 | * Examples are based on `en-US` values.
|
2106 | *
|
2107 | * @see `getLocaleNumberSymbol()`
|
2108 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
2109 | *
|
2110 | * @publicApi
|
2111 | */
|
2112 | export declare enum NumberSymbol {
|
2113 | /**
|
2114 | * Decimal separator.
|
2115 | * For `en-US`, the dot character.
|
2116 | * Example : 2,345`.`67
|
2117 | */
|
2118 | Decimal = 0,
|
2119 | /**
|
2120 | * Grouping separator, typically for thousands.
|
2121 | * For `en-US`, the comma character.
|
2122 | * Example: 2`,`345.67
|
2123 | */
|
2124 | Group = 1,
|
2125 | /**
|
2126 | * List-item separator.
|
2127 | * Example: "one, two, and three"
|
2128 | */
|
2129 | List = 2,
|
2130 | /**
|
2131 | * Sign for percentage (out of 100).
|
2132 | * Example: 23.4%
|
2133 | */
|
2134 | PercentSign = 3,
|
2135 | /**
|
2136 | * Sign for positive numbers.
|
2137 | * Example: +23
|
2138 | */
|
2139 | PlusSign = 4,
|
2140 | /**
|
2141 | * Sign for negative numbers.
|
2142 | * Example: -23
|
2143 | */
|
2144 | MinusSign = 5,
|
2145 | /**
|
2146 | * Computer notation for exponential value (n times a power of 10).
|
2147 | * Example: 1.2E3
|
2148 | */
|
2149 | Exponential = 6,
|
2150 | /**
|
2151 | * Human-readable format of exponential.
|
2152 | * Example: 1.2x103
|
2153 | */
|
2154 | SuperscriptingExponent = 7,
|
2155 | /**
|
2156 | * Sign for permille (out of 1000).
|
2157 | * Example: 23.4‰
|
2158 | */
|
2159 | PerMille = 8,
|
2160 | /**
|
2161 | * Infinity, can be used with plus and minus.
|
2162 | * Example: ∞, +∞, -∞
|
2163 | */
|
2164 | Infinity = 9,
|
2165 | /**
|
2166 | * Not a number.
|
2167 | * Example: NaN
|
2168 | */
|
2169 | NaN = 10,
|
2170 | /**
|
2171 | * Symbol used between time units.
|
2172 | * Example: 10:52
|
2173 | */
|
2174 | TimeSeparator = 11,
|
2175 | /**
|
2176 | * Decimal separator for currency values (fallback to `Decimal`).
|
2177 | * Example: $2,345.67
|
2178 | */
|
2179 | CurrencyDecimal = 12,
|
2180 | /**
|
2181 | * Group separator for currency values (fallback to `Group`).
|
2182 | * Example: $2,345.67
|
2183 | */
|
2184 | CurrencyGroup = 13
|
2185 | }
|
2186 |
|
2187 | /**
|
2188 | * @description
|
2189 | * A {@link LocationStrategy} used to configure the {@link Location} service to
|
2190 | * represent its state in the
|
2191 | * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
|
2192 | * browser's URL.
|
2193 | *
|
2194 | * If you're using `PathLocationStrategy`, you must provide a {@link APP_BASE_HREF}
|
2195 | * or add a base element to the document. This URL prefix that will be preserved
|
2196 | * when generating and recognizing URLs.
|
2197 | *
|
2198 | * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
|
2199 | * `location.go('/foo')`, the browser's URL will become
|
2200 | * `example.com/my/app/foo`.
|
2201 | *
|
2202 | * Similarly, if you add `<base href='/my/app'/>` to the document and call
|
2203 | * `location.go('/foo')`, the browser's URL will become
|
2204 | * `example.com/my/app/foo`.
|
2205 | *
|
2206 | * @usageNotes
|
2207 | *
|
2208 | * ### Example
|
2209 | *
|
2210 | * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
|
2211 | *
|
2212 | * @publicApi
|
2213 | */
|
2214 | export declare class PathLocationStrategy extends LocationStrategy {
|
2215 | private _platformLocation;
|
2216 | private _baseHref;
|
2217 | constructor(_platformLocation: PlatformLocation, href?: string);
|
2218 | onPopState(fn: LocationChangeListener): void;
|
2219 | getBaseHref(): string;
|
2220 | prepareExternalUrl(internal: string): string;
|
2221 | path(includeHash?: boolean): string;
|
2222 | pushState(state: any, title: string, url: string, queryParams: string): void;
|
2223 | replaceState(state: any, title: string, url: string, queryParams: string): void;
|
2224 | forward(): void;
|
2225 | back(): void;
|
2226 | }
|
2227 |
|
2228 | /**
|
2229 | * @ngModule CommonModule
|
2230 | * @description
|
2231 | *
|
2232 | * Transforms a number to a percentage
|
2233 | * string, formatted according to locale rules that determine group sizing and
|
2234 | * separator, decimal-point character, and other locale-specific
|
2235 | * configurations.
|
2236 | *
|
2237 | * @see `formatPercent()`
|
2238 | *
|
2239 | * @usageNotes
|
2240 | * The following code shows how the pipe transforms numbers
|
2241 | * into text strings, according to various format specifications,
|
2242 | * where the caller's default locale is `en-US`.
|
2243 | *
|
2244 | * <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example>
|
2245 | *
|
2246 | * @publicApi
|
2247 | */
|
2248 | export declare class PercentPipe implements PipeTransform {
|
2249 | private _locale;
|
2250 | constructor(_locale: string);
|
2251 | /**
|
2252 | *
|
2253 | * @param value The number to be formatted as a percentage.
|
2254 | * @param digitsInfo Decimal representation options, specified by a string
|
2255 | * in the following format:<br>
|
2256 | * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
|
2257 | * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
|
2258 | * Default is `1`.
|
2259 | * - `minFractionDigits`: The minimum number of digits after the decimal point.
|
2260 | * Default is `0`.
|
2261 | * - `maxFractionDigits`: The maximum number of digits after the decimal point.
|
2262 | * Default is `0`.
|
2263 | * @param locale A locale code for the locale format rules to use.
|
2264 | * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
|
2265 | * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
|
2266 | */
|
2267 | transform(value: any, digitsInfo?: string, locale?: string): string | null;
|
2268 | }
|
2269 |
|
2270 | /**
|
2271 | * This class should not be used directly by an application developer. Instead, use
|
2272 | * {@link Location}.
|
2273 | *
|
2274 | * `PlatformLocation` encapsulates all calls to DOM APIs, which allows the Router to be
|
2275 | * platform-agnostic.
|
2276 | * This means that we can have different implementation of `PlatformLocation` for the different
|
2277 | * platforms that Angular supports. For example, `@angular/platform-browser` provides an
|
2278 | * implementation specific to the browser environment, while `@angular/platform-server` provides
|
2279 | * one suitable for use with server-side rendering.
|
2280 | *
|
2281 | * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}
|
2282 | * when they need to interact with the DOM APIs like pushState, popState, etc.
|
2283 | *
|
2284 | * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly
|
2285 | * by the {@link Router} in order to navigate between routes. Since all interactions between {@link
|
2286 | * Router} /
|
2287 | * {@link Location} / {@link LocationStrategy} and DOM APIs flow through the `PlatformLocation`
|
2288 | * class, they are all platform-agnostic.
|
2289 | *
|
2290 | * @publicApi
|
2291 | */
|
2292 | export declare abstract class PlatformLocation {
|
2293 | abstract getBaseHrefFromDOM(): string;
|
2294 | abstract getState(): unknown;
|
2295 | abstract onPopState(fn: LocationChangeListener): void;
|
2296 | abstract onHashChange(fn: LocationChangeListener): void;
|
2297 | abstract get href(): string;
|
2298 | abstract get protocol(): string;
|
2299 | abstract get hostname(): string;
|
2300 | abstract get port(): string;
|
2301 | abstract get pathname(): string;
|
2302 | abstract get search(): string;
|
2303 | abstract get hash(): string;
|
2304 | abstract replaceState(state: any, title: string, url: string): void;
|
2305 | abstract pushState(state: any, title: string, url: string): void;
|
2306 | abstract forward(): void;
|
2307 | abstract back(): void;
|
2308 | }
|
2309 |
|
2310 | /**
|
2311 | * Plurality cases used for translating plurals to different languages.
|
2312 | *
|
2313 | * @see `NgPlural`
|
2314 | * @see `NgPluralCase`
|
2315 | * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
|
2316 | *
|
2317 | * @publicApi
|
2318 | */
|
2319 | export declare enum Plural {
|
2320 | Zero = 0,
|
2321 | One = 1,
|
2322 | Two = 2,
|
2323 | Few = 3,
|
2324 | Many = 4,
|
2325 | Other = 5
|
2326 | }
|
2327 |
|
2328 | /** @publicApi */
|
2329 | export declare interface PopStateEvent {
|
2330 | pop?: boolean;
|
2331 | state?: any;
|
2332 | type?: string;
|
2333 | url?: string;
|
2334 | }
|
2335 |
|
2336 |
|
2337 | /**
|
2338 | * Register global data to be used internally by Angular. See the
|
2339 | * ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data.
|
2340 | *
|
2341 | * The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
|
2342 | *
|
2343 | * @publicApi
|
2344 | */
|
2345 | export declare function registerLocaleData(data: any, localeId?: string | any, extraData?: any): void;
|
2346 |
|
2347 | /**
|
2348 | * @ngModule CommonModule
|
2349 | * @description
|
2350 | *
|
2351 | * Creates a new `Array` or `String` containing a subset (slice) of the elements.
|
2352 | *
|
2353 | * @usageNotes
|
2354 | *
|
2355 | * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
|
2356 | * and `String.prototype.slice()`.
|
2357 | *
|
2358 | * When operating on an `Array`, the returned `Array` is always a copy even when all
|
2359 | * the elements are being returned.
|
2360 | *
|
2361 | * When operating on a blank value, the pipe returns the blank value.
|
2362 | *
|
2363 | * ### List Example
|
2364 | *
|
2365 | * This `ngFor` example:
|
2366 | *
|
2367 | * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
|
2368 | *
|
2369 | * produces the following:
|
2370 | *
|
2371 | * ```html
|
2372 | * <li>b</li>
|
2373 | * <li>c</li>
|
2374 | * ```
|
2375 | *
|
2376 | * ### String Examples
|
2377 | *
|
2378 | * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
|
2379 | *
|
2380 | * @publicApi
|
2381 | */
|
2382 | export declare class SlicePipe implements PipeTransform {
|
2383 | /**
|
2384 | * @param value a list or a string to be sliced.
|
2385 | * @param start the starting index of the subset to return:
|
2386 | * - **a positive integer**: return the item at `start` index and all items after
|
2387 | * in the list or string expression.
|
2388 | * - **a negative integer**: return the item at `start` index from the end and all items after
|
2389 | * in the list or string expression.
|
2390 | * - **if positive and greater than the size of the expression**: return an empty list or
|
2391 | * string.
|
2392 | * - **if negative and greater than the size of the expression**: return entire list or string.
|
2393 | * @param end the ending index of the subset to return:
|
2394 | * - **omitted**: return all items until the end.
|
2395 | * - **if positive**: return all items before `end` index of the list or string.
|
2396 | * - **if negative**: return all items before `end` index from the end of the list or string.
|
2397 | */
|
2398 | transform<T>(value: ReadonlyArray<T>, start: number, end?: number): Array<T>;
|
2399 | transform(value: string, start: number, end?: number): string;
|
2400 | transform(value: null, start: number, end?: number): null;
|
2401 | transform(value: undefined, start: number, end?: number): undefined;
|
2402 | private supports;
|
2403 | }
|
2404 |
|
2405 | declare class SwitchView {
|
2406 | private _viewContainerRef;
|
2407 | private _templateRef;
|
2408 | private _created;
|
2409 | constructor(_viewContainerRef: ViewContainerRef, _templateRef: TemplateRef<Object>);
|
2410 | create(): void;
|
2411 | destroy(): void;
|
2412 | enforceState(created: boolean): void;
|
2413 | }
|
2414 |
|
2415 | /**
|
2416 | * Represents a time value with hours and minutes.
|
2417 | *
|
2418 | * @publicApi
|
2419 | */
|
2420 | export declare type Time = {
|
2421 | hours: number;
|
2422 | minutes: number;
|
2423 | };
|
2424 |
|
2425 | /**
|
2426 | * Transforms text to title case.
|
2427 | * Capitalizes the first letter of each word and transforms the
|
2428 | * rest of the word to lower case.
|
2429 | * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
|
2430 | *
|
2431 | * @see `LowerCasePipe`
|
2432 | * @see `UpperCasePipe`
|
2433 | *
|
2434 | * @usageNotes
|
2435 | * The following example shows the result of transforming various strings into title case.
|
2436 | *
|
2437 | * <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example>
|
2438 | *
|
2439 | * @ngModule CommonModule
|
2440 | * @publicApi
|
2441 | */
|
2442 | export declare class TitleCasePipe implements PipeTransform {
|
2443 | /**
|
2444 | * @param value The string to transform to title case.
|
2445 | */
|
2446 | transform(value: string): string;
|
2447 | }
|
2448 |
|
2449 | /**
|
2450 | * String widths available for translations.
|
2451 | * The specific character widths are locale-specific.
|
2452 | * Examples are given for the word "Sunday" in English.
|
2453 | *
|
2454 | * @publicApi
|
2455 | */
|
2456 | export declare enum TranslationWidth {
|
2457 | /** 1 character for `en-US`. For example: 'S' */
|
2458 | Narrow = 0,
|
2459 | /** 3 characters for `en-US`. For example: 'Sun' */
|
2460 | Abbreviated = 1,
|
2461 | /** Full length for `en-US`. For example: "Sunday" */
|
2462 | Wide = 2,
|
2463 | /** 2 characters for `en-US`, For example: "Su" */
|
2464 | Short = 3
|
2465 | }
|
2466 |
|
2467 | /**
|
2468 | * Transforms text to all upper case.
|
2469 | * @see `LowerCasePipe`
|
2470 | * @see `TitleCasePipe`
|
2471 | *
|
2472 | * @ngModule CommonModule
|
2473 | * @publicApi
|
2474 | */
|
2475 | export declare class UpperCasePipe implements PipeTransform {
|
2476 | /**
|
2477 | * @param value The string to transform to upper case.
|
2478 | */
|
2479 | transform(value: string): string;
|
2480 | }
|
2481 |
|
2482 | /**
|
2483 | * @publicApi
|
2484 | */
|
2485 | export declare const VERSION: Version;
|
2486 |
|
2487 | /**
|
2488 | * Defines a scroll position manager. Implemented by `BrowserViewportScroller`.
|
2489 | *
|
2490 | * @publicApi
|
2491 | */
|
2492 | export declare abstract class ViewportScroller {
|
2493 | /** @nocollapse */
|
2494 | static ɵprov: never;
|
2495 | /**
|
2496 | * Configures the top offset used when scrolling to an anchor.
|
2497 | * @param offset A position in screen coordinates (a tuple with x and y values)
|
2498 | * or a function that returns the top offset position.
|
2499 | *
|
2500 | */
|
2501 | abstract setOffset(offset: [number, number] | (() => [number, number])): void;
|
2502 | /**
|
2503 | * Retrieves the current scroll position.
|
2504 | * @returns A position in screen coordinates (a tuple with x and y values).
|
2505 | */
|
2506 | abstract getScrollPosition(): [number, number];
|
2507 | /**
|
2508 | * Scrolls to a specified position.
|
2509 | * @param position A position in screen coordinates (a tuple with x and y values).
|
2510 | */
|
2511 | abstract scrollToPosition(position: [number, number]): void;
|
2512 | /**
|
2513 | * Scrolls to an anchor element.
|
2514 | * @param anchor The ID of the anchor element.
|
2515 | */
|
2516 | abstract scrollToAnchor(anchor: string): void;
|
2517 | /**
|
2518 | * Disables automatic scroll restoration provided by the browser.
|
2519 | * See also [window.history.scrollRestoration
|
2520 | * info](https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration).
|
2521 | */
|
2522 | abstract setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
|
2523 | }
|
2524 |
|
2525 | /**
|
2526 | * The value for each day of the week, based on the `en-US` locale
|
2527 | *
|
2528 | * @publicApi
|
2529 | */
|
2530 | export declare enum WeekDay {
|
2531 | Sunday = 0,
|
2532 | Monday = 1,
|
2533 | Tuesday = 2,
|
2534 | Wednesday = 3,
|
2535 | Thursday = 4,
|
2536 | Friday = 5,
|
2537 | Saturday = 6
|
2538 | }
|
2539 |
|
2540 | export declare function ɵangular_packages_common_common_a(): ɵBrowserPlatformLocation;
|
2541 |
|
2542 | export declare function ɵangular_packages_common_common_b(): ɵBrowserPlatformLocation;
|
2543 |
|
2544 | export declare function ɵangular_packages_common_common_c(): Location;
|
2545 |
|
2546 | export declare function ɵangular_packages_common_common_d(platformLocation: PlatformLocation): PathLocationStrategy;
|
2547 |
|
2548 | /**
|
2549 | * A collection of Angular directives that are likely to be used in each and every Angular
|
2550 | * application.
|
2551 | */
|
2552 | export declare const ɵangular_packages_common_common_e: Provider[];
|
2553 |
|
2554 | /**
|
2555 | * A collection of Angular pipes that are likely to be used in each and every application.
|
2556 | */
|
2557 | export declare const ɵangular_packages_common_common_f: (typeof AsyncPipe | typeof SlicePipe | typeof DecimalPipe | typeof PercentPipe | typeof CurrencyPipe | typeof DatePipe | typeof I18nPluralPipe | typeof I18nSelectPipe | typeof KeyValuePipe)[];
|
2558 |
|
2559 | /**
|
2560 | * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
|
2561 | * This class should not be used directly by an application developer. Instead, use
|
2562 | * {@link Location}.
|
2563 | */
|
2564 | export declare class ɵBrowserPlatformLocation extends PlatformLocation {
|
2565 | private _doc;
|
2566 | readonly location: Location;
|
2567 | private _history;
|
2568 | constructor(_doc: any);
|
2569 | getBaseHrefFromDOM(): string;
|
2570 | onPopState(fn: LocationChangeListener): void;
|
2571 | onHashChange(fn: LocationChangeListener): void;
|
2572 | get href(): string;
|
2573 | get protocol(): string;
|
2574 | get hostname(): string;
|
2575 | get port(): string;
|
2576 | get pathname(): string;
|
2577 | get search(): string;
|
2578 | get hash(): string;
|
2579 | set pathname(newPath: string);
|
2580 | pushState(state: any, title: string, url: string): void;
|
2581 | replaceState(state: any, title: string, url: string): void;
|
2582 | forward(): void;
|
2583 | back(): void;
|
2584 | getState(): unknown;
|
2585 | }
|
2586 |
|
2587 | /**
|
2588 | * Provides DOM operations in an environment-agnostic way.
|
2589 | *
|
2590 | * @security Tread carefully! Interacting with the DOM directly is dangerous and
|
2591 | * can introduce XSS risks.
|
2592 | */
|
2593 | export declare abstract class ɵDomAdapter {
|
2594 | abstract getProperty(el: Element, name: string): any;
|
2595 | abstract dispatchEvent(el: any, evt: any): any;
|
2596 | abstract log(error: any): any;
|
2597 | abstract logGroup(error: any): any;
|
2598 | abstract logGroupEnd(): any;
|
2599 | abstract remove(el: any): Node;
|
2600 | abstract createElement(tagName: any, doc?: any): HTMLElement;
|
2601 | abstract createHtmlDocument(): HTMLDocument;
|
2602 | abstract getDefaultDocument(): Document;
|
2603 | abstract isElementNode(node: any): boolean;
|
2604 | abstract isShadowRoot(node: any): boolean;
|
2605 | abstract onAndCancel(el: any, evt: any, listener: any): Function;
|
2606 | abstract supportsDOMEvents(): boolean;
|
2607 | abstract getGlobalEventTarget(doc: Document, target: string): any;
|
2608 | abstract getHistory(): History;
|
2609 | abstract getLocation(): any; /** This is the ambient Location definition, NOT Location from @angular/common. */
|
2610 | abstract getBaseHref(doc: Document): string | null;
|
2611 | abstract resetBaseElement(): void;
|
2612 | abstract getUserAgent(): string;
|
2613 | abstract performanceNow(): number;
|
2614 | abstract supportsCookies(): boolean;
|
2615 | abstract getCookie(name: string): string | null;
|
2616 | }
|
2617 |
|
2618 |
|
2619 | export declare function ɵgetDOM(): ɵDomAdapter;
|
2620 |
|
2621 | /**
|
2622 | * Provides an empty implementation of the viewport scroller. This will
|
2623 | * live in @angular/common as it will be used by both platform-server and platform-webworker.
|
2624 | */
|
2625 | export declare class ɵNullViewportScroller implements ViewportScroller {
|
2626 | /**
|
2627 | * Empty implementation
|
2628 | */
|
2629 | setOffset(offset: [number, number] | (() => [number, number])): void;
|
2630 | /**
|
2631 | * Empty implementation
|
2632 | */
|
2633 | getScrollPosition(): [number, number];
|
2634 | /**
|
2635 | * Empty implementation
|
2636 | */
|
2637 | scrollToPosition(position: [number, number]): void;
|
2638 | /**
|
2639 | * Empty implementation
|
2640 | */
|
2641 | scrollToAnchor(anchor: string): void;
|
2642 | /**
|
2643 | * Empty implementation
|
2644 | */
|
2645 | setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
|
2646 | }
|
2647 |
|
2648 |
|
2649 | export declare function ɵparseCookieValue(cookieStr: string, name: string): string | null;
|
2650 |
|
2651 |
|
2652 | export declare const ɵPLATFORM_BROWSER_ID = "browser";
|
2653 |
|
2654 | export declare const ɵPLATFORM_SERVER_ID = "server";
|
2655 |
|
2656 | export declare const ɵPLATFORM_WORKER_APP_ID = "browserWorkerApp";
|
2657 |
|
2658 | export declare const ɵPLATFORM_WORKER_UI_ID = "browserWorkerUi";
|
2659 |
|
2660 | export declare function ɵsetRootDomAdapter(adapter: ɵDomAdapter): void;
|
2661 |
|
2662 | export { }
|
2663 |
|
\ | No newline at end of file |