common_module.d-NEF7UaHr.d.ts 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import * as i0 from '@angular/core';
  7. import { InjectionToken, OnDestroy, DoCheck, ElementRef, Renderer2, OnChanges, Type, Injector, NgModuleFactory, ViewContainerRef, SimpleChanges, NgIterable, TrackByFunction, TemplateRef, IterableDiffers, KeyValueDiffers, PipeTransform, ChangeDetectorRef } from '@angular/core';
  8. import { SubscriptionLike, Observable, Subscribable } from 'rxjs';
  9. import { LocationChangeListener, PlatformLocation } from './platform_location.d-Lbv6Ueec.js';
  10. /**
  11. * Enables the `Location` service to read route state from the browser's URL.
  12. * Angular provides two strategies:
  13. * `HashLocationStrategy` and `PathLocationStrategy`.
  14. *
  15. * Applications should use the `Router` or `Location` services to
  16. * interact with application route state.
  17. *
  18. * For instance, `HashLocationStrategy` produces URLs like
  19. * <code class="no-auto-link">http://example.com/#/foo</code>,
  20. * and `PathLocationStrategy` produces
  21. * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL.
  22. *
  23. * See these two classes for more.
  24. *
  25. * @publicApi
  26. */
  27. declare abstract class LocationStrategy {
  28. abstract path(includeHash?: boolean): string;
  29. abstract prepareExternalUrl(internal: string): string;
  30. abstract getState(): unknown;
  31. abstract pushState(state: any, title: string, url: string, queryParams: string): void;
  32. abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
  33. abstract forward(): void;
  34. abstract back(): void;
  35. historyGo?(relativePosition: number): void;
  36. abstract onPopState(fn: LocationChangeListener): void;
  37. abstract getBaseHref(): string;
  38. static ɵfac: i0.ɵɵFactoryDeclaration<LocationStrategy, never>;
  39. static ɵprov: i0.ɵɵInjectableDeclaration<LocationStrategy>;
  40. }
  41. /**
  42. * A predefined DI token for the base href
  43. * to be used with the `PathLocationStrategy`.
  44. * The base href is the URL prefix that should be preserved when generating
  45. * and recognizing URLs.
  46. *
  47. * @usageNotes
  48. *
  49. * The following example shows how to use this token to configure the root app injector
  50. * with a base href value, so that the DI framework can supply the dependency anywhere in the app.
  51. *
  52. * ```ts
  53. * import {NgModule} from '@angular/core';
  54. * import {APP_BASE_HREF} from '@angular/common';
  55. *
  56. * @NgModule({
  57. * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
  58. * })
  59. * class AppModule {}
  60. * ```
  61. *
  62. * @publicApi
  63. */
  64. declare const APP_BASE_HREF: InjectionToken<string>;
  65. /**
  66. * @description
  67. * A {@link LocationStrategy} used to configure the {@link Location} service to
  68. * represent its state in the
  69. * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
  70. * browser's URL.
  71. *
  72. * If you're using `PathLocationStrategy`, you may provide a {@link APP_BASE_HREF}
  73. * or add a `<base href>` element to the document to override the default.
  74. *
  75. * For instance, if you provide an `APP_BASE_HREF` of `'/my/app/'` and call
  76. * `location.go('/foo')`, the browser's URL will become
  77. * `example.com/my/app/foo`. To ensure all relative URIs resolve correctly,
  78. * the `<base href>` and/or `APP_BASE_HREF` should end with a `/`.
  79. *
  80. * Similarly, if you add `<base href='/my/app/'/>` to the document and call
  81. * `location.go('/foo')`, the browser's URL will become
  82. * `example.com/my/app/foo`.
  83. *
  84. * Note that when using `PathLocationStrategy`, neither the query nor
  85. * the fragment in the `<base href>` will be preserved, as outlined
  86. * by the [RFC](https://tools.ietf.org/html/rfc3986#section-5.2.2).
  87. *
  88. * @usageNotes
  89. *
  90. * ### Example
  91. *
  92. * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
  93. *
  94. * @publicApi
  95. */
  96. declare class PathLocationStrategy extends LocationStrategy implements OnDestroy {
  97. private _platformLocation;
  98. private _baseHref;
  99. private _removeListenerFns;
  100. constructor(_platformLocation: PlatformLocation, href?: string);
  101. /** @docs-private */
  102. ngOnDestroy(): void;
  103. onPopState(fn: LocationChangeListener): void;
  104. getBaseHref(): string;
  105. prepareExternalUrl(internal: string): string;
  106. path(includeHash?: boolean): string;
  107. pushState(state: any, title: string, url: string, queryParams: string): void;
  108. replaceState(state: any, title: string, url: string, queryParams: string): void;
  109. forward(): void;
  110. back(): void;
  111. getState(): unknown;
  112. historyGo(relativePosition?: number): void;
  113. static ɵfac: i0.ɵɵFactoryDeclaration<PathLocationStrategy, [null, { optional: true; }]>;
  114. static ɵprov: i0.ɵɵInjectableDeclaration<PathLocationStrategy>;
  115. }
  116. /** @publicApi */
  117. interface PopStateEvent {
  118. pop?: boolean;
  119. state?: any;
  120. type?: string;
  121. url?: string;
  122. }
  123. /**
  124. * @description
  125. *
  126. * A service that applications can use to interact with a browser's URL.
  127. *
  128. * Depending on the `LocationStrategy` used, `Location` persists
  129. * to the URL's path or the URL's hash segment.
  130. *
  131. * @usageNotes
  132. *
  133. * It's better to use the `Router.navigate()` service to trigger route changes. Use
  134. * `Location` only if you need to interact with or create normalized URLs outside of
  135. * routing.
  136. *
  137. * `Location` is responsible for normalizing the URL against the application's base href.
  138. * A normalized URL is absolute from the URL host, includes the application's base href, and has no
  139. * trailing slash:
  140. * - `/my/app/user/123` is normalized
  141. * - `my/app/user/123` **is not** normalized
  142. * - `/my/app/user/123/` **is not** normalized
  143. *
  144. * ### Example
  145. *
  146. * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
  147. *
  148. * @publicApi
  149. */
  150. declare class Location implements OnDestroy {
  151. constructor(locationStrategy: LocationStrategy);
  152. /** @docs-private */
  153. ngOnDestroy(): void;
  154. /**
  155. * Normalizes the URL path for this location.
  156. *
  157. * @param includeHash True to include an anchor fragment in the path.
  158. *
  159. * @returns The normalized URL path.
  160. */
  161. path(includeHash?: boolean): string;
  162. /**
  163. * Reports the current state of the location history.
  164. * @returns The current value of the `history.state` object.
  165. */
  166. getState(): unknown;
  167. /**
  168. * Normalizes the given path and compares to the current normalized path.
  169. *
  170. * @param path The given URL path.
  171. * @param query Query parameters.
  172. *
  173. * @returns True if the given URL path is equal to the current normalized path, false
  174. * otherwise.
  175. */
  176. isCurrentPathEqualTo(path: string, query?: string): boolean;
  177. /**
  178. * Normalizes a URL path by stripping any trailing slashes.
  179. *
  180. * @param url String representing a URL.
  181. *
  182. * @returns The normalized URL string.
  183. */
  184. normalize(url: string): string;
  185. /**
  186. * Normalizes an external URL path.
  187. * If the given URL doesn't begin with a leading slash (`'/'`), adds one
  188. * before normalizing. Adds a hash if `HashLocationStrategy` is
  189. * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  190. *
  191. * @param url String representing a URL.
  192. *
  193. * @returns A normalized platform-specific URL.
  194. */
  195. prepareExternalUrl(url: string): string;
  196. /**
  197. * Changes the browser's URL to a normalized version of a given URL, and pushes a
  198. * new item onto the platform's history.
  199. *
  200. * @param path URL path to normalize.
  201. * @param query Query parameters.
  202. * @param state Location history state.
  203. *
  204. */
  205. go(path: string, query?: string, state?: any): void;
  206. /**
  207. * Changes the browser's URL to a normalized version of the given URL, and replaces
  208. * the top item on the platform's history stack.
  209. *
  210. * @param path URL path to normalize.
  211. * @param query Query parameters.
  212. * @param state Location history state.
  213. */
  214. replaceState(path: string, query?: string, state?: any): void;
  215. /**
  216. * Navigates forward in the platform's history.
  217. */
  218. forward(): void;
  219. /**
  220. * Navigates back in the platform's history.
  221. */
  222. back(): void;
  223. /**
  224. * Navigate to a specific page from session history, identified by its relative position to the
  225. * current page.
  226. *
  227. * @param relativePosition Position of the target page in the history relative to the current
  228. * page.
  229. * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
  230. * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
  231. * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
  232. * when `relativePosition` equals 0.
  233. * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
  234. */
  235. historyGo(relativePosition?: number): void;
  236. /**
  237. * Registers a URL change listener. Use to catch updates performed by the Angular
  238. * framework that are not detectible through "popstate" or "hashchange" events.
  239. *
  240. * @param fn The change handler function, which take a URL and a location history state.
  241. * @returns A function that, when executed, unregisters a URL change listener.
  242. */
  243. onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
  244. /**
  245. * Subscribes to the platform's `popState` events.
  246. *
  247. * Note: `Location.go()` does not trigger the `popState` event in the browser. Use
  248. * `Location.onUrlChange()` to subscribe to URL changes instead.
  249. *
  250. * @param value Event that is triggered when the state history changes.
  251. * @param exception The exception to throw.
  252. *
  253. * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
  254. *
  255. * @returns Subscribed events.
  256. */
  257. subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
  258. /**
  259. * Normalizes URL parameters by prepending with `?` if needed.
  260. *
  261. * @param params String of URL parameters.
  262. *
  263. * @returns The normalized URL parameters string.
  264. */
  265. static normalizeQueryParams: (params: string) => string;
  266. /**
  267. * Joins two parts of a URL with a slash if needed.
  268. *
  269. * @param start URL string
  270. * @param end URL string
  271. *
  272. *
  273. * @returns The joined URL string.
  274. */
  275. static joinWithSlash: (start: string, end: string) => string;
  276. /**
  277. * Removes a trailing slash from a URL string if needed.
  278. * Looks for the first occurrence of either `#`, `?`, or the end of the
  279. * line as `/` characters and removes the trailing slash if one exists.
  280. *
  281. * @param url URL string.
  282. *
  283. * @returns The URL string, modified if needed.
  284. */
  285. static stripTrailingSlash: (url: string) => string;
  286. static ɵfac: i0.ɵɵFactoryDeclaration<Location, never>;
  287. static ɵprov: i0.ɵɵInjectableDeclaration<Location>;
  288. }
  289. /**
  290. * @publicApi
  291. */
  292. declare abstract class NgLocalization {
  293. abstract getPluralCategory(value: any, locale?: string): string;
  294. static ɵfac: i0.ɵɵFactoryDeclaration<NgLocalization, never>;
  295. static ɵprov: i0.ɵɵInjectableDeclaration<NgLocalization>;
  296. }
  297. /**
  298. * Returns the plural case based on the locale
  299. *
  300. * @publicApi
  301. */
  302. declare class NgLocaleLocalization extends NgLocalization {
  303. protected locale: string;
  304. constructor(locale: string);
  305. getPluralCategory(value: any, locale?: string): string;
  306. static ɵfac: i0.ɵɵFactoryDeclaration<NgLocaleLocalization, never>;
  307. static ɵprov: i0.ɵɵInjectableDeclaration<NgLocaleLocalization>;
  308. }
  309. /**
  310. * @ngModule CommonModule
  311. *
  312. * @usageNotes
  313. * ```html
  314. * <some-element [ngClass]="stringExp|arrayExp|objExp|Set">...</some-element>
  315. *
  316. * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
  317. * ```
  318. *
  319. * For more simple use cases you can use the [class bindings](/guide/templates/binding#css-class-and-style-property-bindings) directly.
  320. * It doesn't require importing a directive.
  321. *
  322. * ```html
  323. * <some-element [class]="'first second'">...</some-element>
  324. *
  325. * <some-element [class.expanded]="isExpanded">...</some-element>
  326. *
  327. * <some-element [class]="['first', 'second']">...</some-element>
  328. *
  329. * <some-element [class]="{'first': true, 'second': true, 'third': false}">...</some-element>
  330. * ```
  331. * @description
  332. *
  333. * Adds and removes CSS classes on an HTML element.
  334. *
  335. * The CSS classes are updated as follows, depending on the type of the expression evaluation:
  336. * - `string` - the CSS classes listed in the string (space delimited) are added,
  337. * - `Array` - the CSS classes declared as Array elements are added,
  338. * - `Object` - keys are CSS classes that get added when the expression given in the value
  339. * evaluates to a truthy value, otherwise they are removed.
  340. *
  341. *
  342. * @see [Class bindings](/guide/templates/binding#css-class-and-style-property-bindings)
  343. *
  344. * @publicApi
  345. */
  346. declare class NgClass implements DoCheck {
  347. private _ngEl;
  348. private _renderer;
  349. private initialClasses;
  350. private rawClass;
  351. private stateMap;
  352. constructor(_ngEl: ElementRef, _renderer: Renderer2);
  353. set klass(value: string);
  354. set ngClass(value: string | string[] | Set<string> | {
  355. [klass: string]: any;
  356. } | null | undefined);
  357. ngDoCheck(): void;
  358. private _updateState;
  359. private _applyStateDiff;
  360. private _toggleClass;
  361. static ɵfac: i0.ɵɵFactoryDeclaration<NgClass, never>;
  362. static ɵdir: i0.ɵɵDirectiveDeclaration<NgClass, "[ngClass]", never, { "klass": { "alias": "class"; "required": false; }; "ngClass": { "alias": "ngClass"; "required": false; }; }, {}, never, never, true, never>;
  363. }
  364. /**
  365. * Instantiates a {@link /api/core/Component Component} type and inserts its Host View into the current View.
  366. * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
  367. *
  368. * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
  369. * any existing component will be destroyed.
  370. *
  371. * @usageNotes
  372. *
  373. * ### Fine tune control
  374. *
  375. * You can control the component creation process by using the following optional attributes:
  376. *
  377. * * `ngComponentOutletInputs`: Optional component inputs object, which will be bind to the
  378. * component.
  379. *
  380. * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
  381. * the Component. Defaults to the injector of the current view container.
  382. *
  383. * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
  384. * section of the component, if it exists.
  385. *
  386. * * `ngComponentOutletNgModule`: Optional NgModule class reference to allow loading another
  387. * module dynamically, then loading a component from that module.
  388. *
  389. * * `ngComponentOutletNgModuleFactory`: Deprecated config option that allows providing optional
  390. * NgModule factory to allow loading another module dynamically, then loading a component from that
  391. * module. Use `ngComponentOutletNgModule` instead.
  392. *
  393. * ### Syntax
  394. *
  395. * Simple
  396. * ```html
  397. * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
  398. * ```
  399. *
  400. * With inputs
  401. * ```html
  402. * <ng-container *ngComponentOutlet="componentTypeExpression;
  403. * inputs: inputsExpression;">
  404. * </ng-container>
  405. * ```
  406. *
  407. * Customized injector/content
  408. * ```html
  409. * <ng-container *ngComponentOutlet="componentTypeExpression;
  410. * injector: injectorExpression;
  411. * content: contentNodesExpression;">
  412. * </ng-container>
  413. * ```
  414. *
  415. * Customized NgModule reference
  416. * ```html
  417. * <ng-container *ngComponentOutlet="componentTypeExpression;
  418. * ngModule: ngModuleClass;">
  419. * </ng-container>
  420. * ```
  421. *
  422. * ### A simple example
  423. *
  424. * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
  425. *
  426. * A more complete example with additional options:
  427. *
  428. * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
  429. *
  430. * @publicApi
  431. * @ngModule CommonModule
  432. */
  433. declare class NgComponentOutlet<T = any> implements OnChanges, DoCheck, OnDestroy {
  434. private _viewContainerRef;
  435. /** Component that should be rendered in the outlet. */
  436. ngComponentOutlet: Type<any> | null;
  437. ngComponentOutletInputs?: Record<string, unknown>;
  438. ngComponentOutletInjector?: Injector;
  439. ngComponentOutletContent?: any[][];
  440. ngComponentOutletNgModule?: Type<any>;
  441. /**
  442. * @deprecated This input is deprecated, use `ngComponentOutletNgModule` instead.
  443. */
  444. ngComponentOutletNgModuleFactory?: NgModuleFactory<any>;
  445. private _componentRef;
  446. private _moduleRef;
  447. /**
  448. * A helper data structure that allows us to track inputs that were part of the
  449. * ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones
  450. * that are no longer referenced.
  451. */
  452. private _inputsUsed;
  453. /**
  454. * Gets the instance of the currently-rendered component.
  455. * Will be null if no component has been rendered.
  456. */
  457. get componentInstance(): T | null;
  458. constructor(_viewContainerRef: ViewContainerRef);
  459. private _needToReCreateNgModuleInstance;
  460. private _needToReCreateComponentInstance;
  461. /** @docs-private */
  462. ngOnChanges(changes: SimpleChanges): void;
  463. /** @docs-private */
  464. ngDoCheck(): void;
  465. /** @docs-private */
  466. ngOnDestroy(): void;
  467. private _applyInputStateDiff;
  468. static ɵfac: i0.ɵɵFactoryDeclaration<NgComponentOutlet<any>, never>;
  469. static ɵdir: i0.ɵɵDirectiveDeclaration<NgComponentOutlet<any>, "[ngComponentOutlet]", ["ngComponentOutlet"], { "ngComponentOutlet": { "alias": "ngComponentOutlet"; "required": false; }; "ngComponentOutletInputs": { "alias": "ngComponentOutletInputs"; "required": false; }; "ngComponentOutletInjector": { "alias": "ngComponentOutletInjector"; "required": false; }; "ngComponentOutletContent": { "alias": "ngComponentOutletContent"; "required": false; }; "ngComponentOutletNgModule": { "alias": "ngComponentOutletNgModule"; "required": false; }; "ngComponentOutletNgModuleFactory": { "alias": "ngComponentOutletNgModuleFactory"; "required": false; }; }, {}, never, never, true, never>;
  470. }
  471. /**
  472. * @publicApi
  473. */
  474. declare class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
  475. /** Reference to the current item from the collection. */
  476. $implicit: T;
  477. /**
  478. * The value of the iterable expression. Useful when the expression is
  479. * more complex then a property access, for example when using the async pipe
  480. * (`userStreams | async`).
  481. */
  482. ngForOf: U;
  483. /** Returns an index of the current item in the collection. */
  484. index: number;
  485. /** Returns total amount of items in the collection. */
  486. count: number;
  487. constructor(
  488. /** Reference to the current item from the collection. */
  489. $implicit: T,
  490. /**
  491. * The value of the iterable expression. Useful when the expression is
  492. * more complex then a property access, for example when using the async pipe
  493. * (`userStreams | async`).
  494. */
  495. ngForOf: U,
  496. /** Returns an index of the current item in the collection. */
  497. index: number,
  498. /** Returns total amount of items in the collection. */
  499. count: number);
  500. get first(): boolean;
  501. get last(): boolean;
  502. get even(): boolean;
  503. get odd(): boolean;
  504. }
  505. /**
  506. * A [structural directive](guide/directives/structural-directives) that renders
  507. * a template for each item in a collection.
  508. * The directive is placed on an element, which becomes the parent
  509. * of the cloned templates.
  510. *
  511. * The `ngForOf` directive is generally used in the
  512. * [shorthand form](guide/directives/structural-directives#asterisk) `*ngFor`.
  513. * In this form, the template to be rendered for each iteration is the content
  514. * of an anchor element containing the directive.
  515. *
  516. * The following example shows the shorthand syntax with some options,
  517. * contained in an `<li>` element.
  518. *
  519. * ```html
  520. * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
  521. * ```
  522. *
  523. * The shorthand form expands into a long form that uses the `ngForOf` selector
  524. * on an `<ng-template>` element.
  525. * The content of the `<ng-template>` element is the `<li>` element that held the
  526. * short-form directive.
  527. *
  528. * Here is the expanded version of the short-form example.
  529. *
  530. * ```html
  531. * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  532. * <li>...</li>
  533. * </ng-template>
  534. * ```
  535. *
  536. * Angular automatically expands the shorthand syntax as it compiles the template.
  537. * The context for each embedded view is logically merged to the current component
  538. * context according to its lexical position.
  539. *
  540. * When using the shorthand syntax, Angular allows only [one structural directive
  541. * on an element](guide/directives/structural-directives#one-per-element).
  542. * If you want to iterate conditionally, for example,
  543. * put the `*ngIf` on a container element that wraps the `*ngFor` element.
  544. * For further discussion, see
  545. * [Structural Directives](guide/directives/structural-directives#one-per-element).
  546. *
  547. * @usageNotes
  548. *
  549. * ### Local variables
  550. *
  551. * `NgForOf` provides exported values that can be aliased to local variables.
  552. * For example:
  553. *
  554. * ```html
  555. * <li *ngFor="let user of users; index as i; first as isFirst">
  556. * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
  557. * </li>
  558. * ```
  559. *
  560. * The following exported values can be aliased to local variables:
  561. *
  562. * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
  563. * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
  564. * more complex then a property access, for example when using the async pipe (`userStreams |
  565. * async`).
  566. * - `index: number`: The index of the current item in the iterable.
  567. * - `count: number`: The length of the iterable.
  568. * - `first: boolean`: True when the item is the first item in the iterable.
  569. * - `last: boolean`: True when the item is the last item in the iterable.
  570. * - `even: boolean`: True when the item has an even index in the iterable.
  571. * - `odd: boolean`: True when the item has an odd index in the iterable.
  572. *
  573. * ### Change propagation
  574. *
  575. * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
  576. *
  577. * * When an item is added, a new instance of the template is added to the DOM.
  578. * * When an item is removed, its template instance is removed from the DOM.
  579. * * When items are reordered, their respective templates are reordered in the DOM.
  580. *
  581. * Angular uses object identity to track insertions and deletions within the iterator and reproduce
  582. * those changes in the DOM. This has important implications for animations and any stateful
  583. * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
  584. * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
  585. * such as user input.
  586. * For more on animations, see [Transitions and Triggers](guide/animations/transition-and-triggers).
  587. *
  588. * The identities of elements in the iterator can change while the data does not.
  589. * This can happen, for example, if the iterator is produced from an RPC to the server, and that
  590. * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
  591. * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
  592. * elements were deleted and all new elements inserted).
  593. *
  594. * To avoid this expensive operation, you can customize the default tracking algorithm.
  595. * by supplying the `trackBy` option to `NgForOf`.
  596. * `trackBy` takes a function that has two arguments: `index` and `item`.
  597. * If `trackBy` is given, Angular tracks changes by the return value of the function.
  598. *
  599. * @see [Structural Directives](guide/directives/structural-directives)
  600. * @ngModule CommonModule
  601. * @publicApi
  602. */
  603. declare class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
  604. private _viewContainer;
  605. private _template;
  606. private _differs;
  607. /**
  608. * The value of the iterable expression, which can be used as a
  609. * [template input variable](guide/directives/structural-directives#shorthand).
  610. */
  611. set ngForOf(ngForOf: (U & NgIterable<T>) | undefined | null);
  612. /**
  613. * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
  614. *
  615. * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
  616. * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
  617. * as the key.
  618. *
  619. * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
  620. * it produces for these items.
  621. *
  622. * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
  623. * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
  624. * primary key), and this iterable could be updated with new object instances that still
  625. * represent the same underlying entity (for example, when data is re-fetched from the server,
  626. * and the iterable is recreated and re-rendered, but most of the data is still the same).
  627. *
  628. * @see {@link TrackByFunction}
  629. */
  630. set ngForTrackBy(fn: TrackByFunction<T>);
  631. get ngForTrackBy(): TrackByFunction<T>;
  632. private _ngForOf;
  633. private _ngForOfDirty;
  634. private _differ;
  635. private _trackByFn;
  636. constructor(_viewContainer: ViewContainerRef, _template: TemplateRef<NgForOfContext<T, U>>, _differs: IterableDiffers);
  637. /**
  638. * A reference to the template that is stamped out for each item in the iterable.
  639. * @see [template reference variable](guide/templates/variables#template-reference-variables)
  640. */
  641. set ngForTemplate(value: TemplateRef<NgForOfContext<T, U>>);
  642. /**
  643. * Applies the changes when needed.
  644. * @docs-private
  645. */
  646. ngDoCheck(): void;
  647. private _applyChanges;
  648. /**
  649. * Asserts the correct type of the context for the template that `NgForOf` will render.
  650. *
  651. * The presence of this method is a signal to the Ivy template type-check compiler that the
  652. * `NgForOf` structural directive renders its template with a specific context type.
  653. */
  654. static ngTemplateContextGuard<T, U extends NgIterable<T>>(dir: NgForOf<T, U>, ctx: any): ctx is NgForOfContext<T, U>;
  655. static ɵfac: i0.ɵɵFactoryDeclaration<NgForOf<any, any>, never>;
  656. static ɵdir: i0.ɵɵDirectiveDeclaration<NgForOf<any, any>, "[ngFor][ngForOf]", never, { "ngForOf": { "alias": "ngForOf"; "required": false; }; "ngForTrackBy": { "alias": "ngForTrackBy"; "required": false; }; "ngForTemplate": { "alias": "ngForTemplate"; "required": false; }; }, {}, never, never, true, never>;
  657. }
  658. /**
  659. * A structural directive that conditionally includes a template based on the value of
  660. * an expression coerced to Boolean.
  661. * When the expression evaluates to true, Angular renders the template
  662. * provided in a `then` clause, and when false or null,
  663. * Angular renders the template provided in an optional `else` clause. The default
  664. * template for the `else` clause is blank.
  665. *
  666. * A [shorthand form](guide/directives/structural-directives#asterisk) of the directive,
  667. * `*ngIf="condition"`, is generally used, provided
  668. * as an attribute of the anchor element for the inserted template.
  669. * Angular expands this into a more explicit version, in which the anchor element
  670. * is contained in an `<ng-template>` element.
  671. *
  672. * Simple form with shorthand syntax:
  673. *
  674. * ```html
  675. * <div *ngIf="condition">Content to render when condition is true.</div>
  676. * ```
  677. *
  678. * Simple form with expanded syntax:
  679. *
  680. * ```html
  681. * <ng-template [ngIf]="condition"><div>Content to render when condition is
  682. * true.</div></ng-template>
  683. * ```
  684. *
  685. * Form with an "else" block:
  686. *
  687. * ```html
  688. * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
  689. * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
  690. * ```
  691. *
  692. * Shorthand form with "then" and "else" blocks:
  693. *
  694. * ```html
  695. * <div *ngIf="condition; then thenBlock else elseBlock"></div>
  696. * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
  697. * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
  698. * ```
  699. *
  700. * Form with storing the value locally:
  701. *
  702. * ```html
  703. * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
  704. * <ng-template #elseBlock>Content to render when value is null.</ng-template>
  705. * ```
  706. *
  707. * @usageNotes
  708. *
  709. * The `*ngIf` directive is most commonly used to conditionally show an inline template,
  710. * as seen in the following example.
  711. * The default `else` template is blank.
  712. *
  713. * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
  714. *
  715. * ### Showing an alternative template using `else`
  716. *
  717. * To display a template when `expression` evaluates to false, use an `else` template
  718. * binding as shown in the following example.
  719. * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
  720. * The template can be defined anywhere in the component view, but is typically placed right after
  721. * `ngIf` for readability.
  722. *
  723. * {@example common/ngIf/ts/module.ts region='NgIfElse'}
  724. *
  725. * ### Using an external `then` template
  726. *
  727. * In the previous example, the then-clause template is specified inline, as the content of the
  728. * tag that contains the `ngIf` directive. You can also specify a template that is defined
  729. * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
  730. * change which template to use at runtime, as shown in the following example.
  731. *
  732. * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
  733. *
  734. * ### Storing a conditional result in a variable
  735. *
  736. * You might want to show a set of properties from the same object. If you are waiting
  737. * for asynchronous data, the object can be undefined.
  738. * In this case, you can use `ngIf` and store the result of the condition in a local
  739. * variable as shown in the following example.
  740. *
  741. * {@example common/ngIf/ts/module.ts region='NgIfAs'}
  742. *
  743. * This code uses only one `AsyncPipe`, so only one subscription is created.
  744. * The conditional statement stores the result of `userStream|async` in the local variable `user`.
  745. * You can then bind the local `user` repeatedly.
  746. *
  747. * The conditional displays the data only if `userStream` returns a value,
  748. * so you don't need to use the
  749. * safe-navigation-operator (`?.`)
  750. * to guard against null values when accessing properties.
  751. * You can display an alternative template while waiting for the data.
  752. *
  753. * ### Shorthand syntax
  754. *
  755. * The shorthand syntax `*ngIf` expands into two separate template specifications
  756. * for the "then" and "else" clauses. For example, consider the following shorthand statement,
  757. * that is meant to show a loading page while waiting for data to be loaded.
  758. *
  759. * ```html
  760. * <div class="hero-list" *ngIf="heroes else loading">
  761. * ...
  762. * </div>
  763. *
  764. * <ng-template #loading>
  765. * <div>Loading...</div>
  766. * </ng-template>
  767. * ```
  768. *
  769. * You can see that the "else" clause references the `<ng-template>`
  770. * with the `#loading` label, and the template for the "then" clause
  771. * is provided as the content of the anchor element.
  772. *
  773. * However, when Angular expands the shorthand syntax, it creates
  774. * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
  775. * The anchor element containing the template for the "then" clause becomes
  776. * the content of this unlabeled `<ng-template>` tag.
  777. *
  778. * ```html
  779. * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
  780. * <div class="hero-list">
  781. * ...
  782. * </div>
  783. * </ng-template>
  784. *
  785. * <ng-template #loading>
  786. * <div>Loading...</div>
  787. * </ng-template>
  788. * ```
  789. *
  790. * The presence of the implicit template object has implications for the nesting of
  791. * structural directives. For more on this subject, see
  792. * [Structural Directives](guide/directives/structural-directives#one-per-element).
  793. *
  794. * @ngModule CommonModule
  795. * @publicApi
  796. */
  797. declare class NgIf<T = unknown> {
  798. private _viewContainer;
  799. private _context;
  800. private _thenTemplateRef;
  801. private _elseTemplateRef;
  802. private _thenViewRef;
  803. private _elseViewRef;
  804. constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext<T>>);
  805. /**
  806. * The Boolean expression to evaluate as the condition for showing a template.
  807. */
  808. set ngIf(condition: T);
  809. /**
  810. * A template to show if the condition expression evaluates to true.
  811. */
  812. set ngIfThen(templateRef: TemplateRef<NgIfContext<T>> | null);
  813. /**
  814. * A template to show if the condition expression evaluates to false.
  815. */
  816. set ngIfElse(templateRef: TemplateRef<NgIfContext<T>> | null);
  817. private _updateView;
  818. /**
  819. * Assert the correct type of the expression bound to the `ngIf` input within the template.
  820. *
  821. * The presence of this static field is a signal to the Ivy template type check compiler that
  822. * when the `NgIf` structural directive renders its template, the type of the expression bound
  823. * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
  824. * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
  825. */
  826. static ngTemplateGuard_ngIf: 'binding';
  827. /**
  828. * Asserts the correct type of the context for the template that `NgIf` will render.
  829. *
  830. * The presence of this method is a signal to the Ivy template type-check compiler that the
  831. * `NgIf` structural directive renders its template with a specific context type.
  832. */
  833. static ngTemplateContextGuard<T>(dir: NgIf<T>, ctx: any): ctx is NgIfContext<Exclude<T, false | 0 | '' | null | undefined>>;
  834. static ɵfac: i0.ɵɵFactoryDeclaration<NgIf<any>, never>;
  835. static ɵdir: i0.ɵɵDirectiveDeclaration<NgIf<any>, "[ngIf]", never, { "ngIf": { "alias": "ngIf"; "required": false; }; "ngIfThen": { "alias": "ngIfThen"; "required": false; }; "ngIfElse": { "alias": "ngIfElse"; "required": false; }; }, {}, never, never, true, never>;
  836. }
  837. /**
  838. * @publicApi
  839. */
  840. declare class NgIfContext<T = unknown> {
  841. $implicit: T;
  842. ngIf: T;
  843. }
  844. /**
  845. * @ngModule CommonModule
  846. *
  847. * @description
  848. *
  849. * Inserts an embedded view from a prepared `TemplateRef`.
  850. *
  851. * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
  852. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
  853. * by the local template `let` declarations.
  854. *
  855. * @usageNotes
  856. * ```html
  857. * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
  858. * ```
  859. *
  860. * Using the key `$implicit` in the context object will set its value as default.
  861. *
  862. * ### Example
  863. *
  864. * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
  865. *
  866. * @publicApi
  867. */
  868. declare class NgTemplateOutlet<C = unknown> implements OnChanges {
  869. private _viewContainerRef;
  870. private _viewRef;
  871. /**
  872. * A context object to attach to the {@link EmbeddedViewRef}. This should be an
  873. * object, the object's keys will be available for binding by the local template `let`
  874. * declarations.
  875. * Using the key `$implicit` in the context object will set its value as default.
  876. */
  877. ngTemplateOutletContext: C | null;
  878. /**
  879. * A string defining the template reference and optionally the context object for the template.
  880. */
  881. ngTemplateOutlet: TemplateRef<C> | null;
  882. /** Injector to be used within the embedded view. */
  883. ngTemplateOutletInjector: Injector | null;
  884. constructor(_viewContainerRef: ViewContainerRef);
  885. ngOnChanges(changes: SimpleChanges): void;
  886. /**
  887. * We need to re-create existing embedded view if either is true:
  888. * - the outlet changed.
  889. * - the injector changed.
  890. */
  891. private _shouldRecreateView;
  892. /**
  893. * For a given outlet instance, we create a proxy object that delegates
  894. * to the user-specified context. This allows changing, or swapping out
  895. * the context object completely without having to destroy/re-create the view.
  896. */
  897. private _createContextForwardProxy;
  898. static ɵfac: i0.ɵɵFactoryDeclaration<NgTemplateOutlet<any>, never>;
  899. static ɵdir: i0.ɵɵDirectiveDeclaration<NgTemplateOutlet<any>, "[ngTemplateOutlet]", never, { "ngTemplateOutletContext": { "alias": "ngTemplateOutletContext"; "required": false; }; "ngTemplateOutlet": { "alias": "ngTemplateOutlet"; "required": false; }; "ngTemplateOutletInjector": { "alias": "ngTemplateOutletInjector"; "required": false; }; }, {}, never, never, true, never>;
  900. }
  901. /**
  902. * @ngModule CommonModule
  903. *
  904. * @usageNotes
  905. *
  906. * Set the width of the containing element to a pixel value returned by an expression.
  907. *
  908. * ```html
  909. * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
  910. * ```
  911. *
  912. * Set a collection of style values using an expression that returns key-value pairs.
  913. *
  914. * ```html
  915. * <some-element [ngStyle]="objExp">...</some-element>
  916. * ```
  917. *
  918. * For more simple use cases you can use the [style bindings](/guide/templates/binding#css-class-and-style-property-bindings) directly.
  919. * It doesn't require importing a directive.
  920. *
  921. * Set the font of the containing element to the result of an expression.
  922. *
  923. * ```html
  924. * <some-element [style]="{'font-style': styleExp}">...</some-element>
  925. * ```
  926. *
  927. * @description
  928. *
  929. * An attribute directive that updates styles for the containing HTML element.
  930. * Sets one or more style properties, specified as colon-separated key-value pairs.
  931. * The key is a style name, with an optional `.<unit>` suffix
  932. * (such as 'top.px', 'font-style.em').
  933. * The value is an expression to be evaluated.
  934. * The resulting non-null value, expressed in the given unit,
  935. * is assigned to the given style property.
  936. * If the result of evaluation is null, the corresponding style is removed.
  937. *
  938. * @see [Style bindings](/guide/templates/binding#css-class-and-style-property-bindings)
  939. *
  940. * @publicApi
  941. */
  942. declare class NgStyle implements DoCheck {
  943. private _ngEl;
  944. private _differs;
  945. private _renderer;
  946. private _ngStyle;
  947. private _differ;
  948. constructor(_ngEl: ElementRef, _differs: KeyValueDiffers, _renderer: Renderer2);
  949. set ngStyle(values: {
  950. [klass: string]: any;
  951. } | null | undefined);
  952. ngDoCheck(): void;
  953. private _setStyle;
  954. private _applyChanges;
  955. static ɵfac: i0.ɵɵFactoryDeclaration<NgStyle, never>;
  956. static ɵdir: i0.ɵɵDirectiveDeclaration<NgStyle, "[ngStyle]", never, { "ngStyle": { "alias": "ngStyle"; "required": false; }; }, {}, never, never, true, never>;
  957. }
  958. declare class SwitchView {
  959. private _viewContainerRef;
  960. private _templateRef;
  961. private _created;
  962. constructor(_viewContainerRef: ViewContainerRef, _templateRef: TemplateRef<Object>);
  963. create(): void;
  964. destroy(): void;
  965. enforceState(created: boolean): void;
  966. }
  967. /**
  968. * @ngModule CommonModule
  969. *
  970. * @description
  971. * The `[ngSwitch]` directive on a container specifies an expression to match against.
  972. * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
  973. * - Every view that matches is rendered.
  974. * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
  975. * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
  976. * or `ngSwitchDefault` directive are preserved at the location.
  977. *
  978. * @usageNotes
  979. * Define a container element for the directive, and specify the switch expression
  980. * to match against as an attribute:
  981. *
  982. * ```html
  983. * <container-element [ngSwitch]="switch_expression">
  984. * ```
  985. *
  986. * Within the container, `*ngSwitchCase` statements specify the match expressions
  987. * as attributes. Include `*ngSwitchDefault` as the final case.
  988. *
  989. * ```html
  990. * <container-element [ngSwitch]="switch_expression">
  991. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  992. * ...
  993. * <some-element *ngSwitchDefault>...</some-element>
  994. * </container-element>
  995. * ```
  996. *
  997. * ### Usage Examples
  998. *
  999. * The following example shows how to use more than one case to display the same view:
  1000. *
  1001. * ```html
  1002. * <container-element [ngSwitch]="switch_expression">
  1003. * <!-- the same view can be shown in more than one case -->
  1004. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  1005. * <some-element *ngSwitchCase="match_expression_2">...</some-element>
  1006. * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  1007. * <!--default case when there are no matches -->
  1008. * <some-element *ngSwitchDefault>...</some-element>
  1009. * </container-element>
  1010. * ```
  1011. *
  1012. * The following example shows how cases can be nested:
  1013. * ```html
  1014. * <container-element [ngSwitch]="switch_expression">
  1015. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  1016. * <some-element *ngSwitchCase="match_expression_2">...</some-element>
  1017. * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  1018. * <ng-container *ngSwitchCase="match_expression_3">
  1019. * <!-- use a ng-container to group multiple root nodes -->
  1020. * <inner-element></inner-element>
  1021. * <inner-other-element></inner-other-element>
  1022. * </ng-container>
  1023. * <some-element *ngSwitchDefault>...</some-element>
  1024. * </container-element>
  1025. * ```
  1026. *
  1027. * @publicApi
  1028. * @see {@link NgSwitchCase}
  1029. * @see {@link NgSwitchDefault}
  1030. * @see [Structural Directives](guide/directives/structural-directives)
  1031. *
  1032. */
  1033. declare class NgSwitch {
  1034. private _defaultViews;
  1035. private _defaultUsed;
  1036. private _caseCount;
  1037. private _lastCaseCheckIndex;
  1038. private _lastCasesMatched;
  1039. private _ngSwitch;
  1040. set ngSwitch(newValue: any);
  1041. private _updateDefaultCases;
  1042. static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitch, never>;
  1043. static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitch, "[ngSwitch]", never, { "ngSwitch": { "alias": "ngSwitch"; "required": false; }; }, {}, never, never, true, never>;
  1044. }
  1045. /**
  1046. * @ngModule CommonModule
  1047. *
  1048. * @description
  1049. * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
  1050. * When the expressions match, the given `NgSwitchCase` template is rendered.
  1051. * If multiple match expressions match the switch expression value, all of them are displayed.
  1052. *
  1053. * @usageNotes
  1054. *
  1055. * Within a switch container, `*ngSwitchCase` statements specify the match expressions
  1056. * as attributes. Include `*ngSwitchDefault` as the final case.
  1057. *
  1058. * ```html
  1059. * <container-element [ngSwitch]="switch_expression">
  1060. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  1061. * ...
  1062. * <some-element *ngSwitchDefault>...</some-element>
  1063. * </container-element>
  1064. * ```
  1065. *
  1066. * Each switch-case statement contains an in-line HTML template or template reference
  1067. * that defines the subtree to be selected if the value of the match expression
  1068. * matches the value of the switch expression.
  1069. *
  1070. * As of Angular v17 the NgSwitch directive uses strict equality comparison (`===`) instead of
  1071. * loose equality (`==`) to match different cases.
  1072. *
  1073. * @publicApi
  1074. * @see {@link NgSwitch}
  1075. * @see {@link NgSwitchDefault}
  1076. *
  1077. */
  1078. declare class NgSwitchCase implements DoCheck {
  1079. private ngSwitch;
  1080. private _view;
  1081. /**
  1082. * Stores the HTML template to be selected on match.
  1083. */
  1084. ngSwitchCase: any;
  1085. constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
  1086. /**
  1087. * Performs case matching. For internal use only.
  1088. * @docs-private
  1089. */
  1090. ngDoCheck(): void;
  1091. static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchCase, [null, null, { optional: true; host: true; }]>;
  1092. static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchCase, "[ngSwitchCase]", never, { "ngSwitchCase": { "alias": "ngSwitchCase"; "required": false; }; }, {}, never, never, true, never>;
  1093. }
  1094. /**
  1095. * @ngModule CommonModule
  1096. *
  1097. * @description
  1098. *
  1099. * Creates a view that is rendered when no `NgSwitchCase` expressions
  1100. * match the `NgSwitch` expression.
  1101. * This statement should be the final case in an `NgSwitch`.
  1102. *
  1103. * @publicApi
  1104. * @see {@link NgSwitch}
  1105. * @see {@link NgSwitchCase}
  1106. *
  1107. */
  1108. declare class NgSwitchDefault {
  1109. constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
  1110. static ɵfac: i0.ɵɵFactoryDeclaration<NgSwitchDefault, [null, null, { optional: true; host: true; }]>;
  1111. static ɵdir: i0.ɵɵDirectiveDeclaration<NgSwitchDefault, "[ngSwitchDefault]", never, {}, {}, never, never, true, never>;
  1112. }
  1113. /**
  1114. * @ngModule CommonModule
  1115. *
  1116. * @usageNotes
  1117. * ```html
  1118. * <some-element [ngPlural]="value">
  1119. * <ng-template ngPluralCase="=0">there is nothing</ng-template>
  1120. * <ng-template ngPluralCase="=1">there is one</ng-template>
  1121. * <ng-template ngPluralCase="few">there are a few</ng-template>
  1122. * </some-element>
  1123. * ```
  1124. *
  1125. * @description
  1126. *
  1127. * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
  1128. *
  1129. * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
  1130. * that match the switch expression's pluralization category.
  1131. *
  1132. * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
  1133. * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
  1134. * expression:
  1135. * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
  1136. * matches the switch expression exactly,
  1137. * - otherwise, the view will be treated as a "category match", and will only display if exact
  1138. * value matches aren't found and the value maps to its category for the defined locale.
  1139. *
  1140. * See http://cldr.unicode.org/index/cldr-spec/plural-rules
  1141. *
  1142. * @publicApi
  1143. */
  1144. declare class NgPlural {
  1145. private _localization;
  1146. private _activeView?;
  1147. private _caseViews;
  1148. constructor(_localization: NgLocalization);
  1149. set ngPlural(value: number);
  1150. addCase(value: string, switchView: SwitchView): void;
  1151. private _updateView;
  1152. private _clearViews;
  1153. private _activateView;
  1154. static ɵfac: i0.ɵɵFactoryDeclaration<NgPlural, never>;
  1155. static ɵdir: i0.ɵɵDirectiveDeclaration<NgPlural, "[ngPlural]", never, { "ngPlural": { "alias": "ngPlural"; "required": false; }; }, {}, never, never, true, never>;
  1156. }
  1157. /**
  1158. * @ngModule CommonModule
  1159. *
  1160. * @description
  1161. *
  1162. * Creates a view that will be added/removed from the parent {@link NgPlural} when the
  1163. * given expression matches the plural expression according to CLDR rules.
  1164. *
  1165. * @usageNotes
  1166. * ```html
  1167. * <some-element [ngPlural]="value">
  1168. * <ng-template ngPluralCase="=0">...</ng-template>
  1169. * <ng-template ngPluralCase="other">...</ng-template>
  1170. * </some-element>
  1171. *```
  1172. *
  1173. * See {@link NgPlural} for more details and example.
  1174. *
  1175. * @publicApi
  1176. */
  1177. declare class NgPluralCase {
  1178. value: string;
  1179. constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef, ngPlural: NgPlural);
  1180. static ɵfac: i0.ɵɵFactoryDeclaration<NgPluralCase, [{ attribute: "ngPluralCase"; }, null, null, { host: true; }]>;
  1181. static ɵdir: i0.ɵɵDirectiveDeclaration<NgPluralCase, "[ngPluralCase]", never, {}, {}, never, never, true, never>;
  1182. }
  1183. /**
  1184. * @ngModule CommonModule
  1185. * @description
  1186. *
  1187. * Unwraps a value from an asynchronous primitive.
  1188. *
  1189. * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
  1190. * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
  1191. * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
  1192. * potential memory leaks. When the reference of the expression changes, the `async` pipe
  1193. * automatically unsubscribes from the old `Observable` or `Promise` and subscribes to the new one.
  1194. *
  1195. * @usageNotes
  1196. *
  1197. * ### Examples
  1198. *
  1199. * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
  1200. * promise.
  1201. *
  1202. * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
  1203. *
  1204. * It's also possible to use `async` with Observables. The example below binds the `time` Observable
  1205. * to the view. The Observable continuously updates the view with the current time.
  1206. *
  1207. * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
  1208. *
  1209. * @publicApi
  1210. */
  1211. declare class AsyncPipe implements OnDestroy, PipeTransform {
  1212. private _ref;
  1213. private _latestValue;
  1214. private markForCheckOnValueUpdate;
  1215. private _subscription;
  1216. private _obj;
  1217. private _strategy;
  1218. constructor(ref: ChangeDetectorRef);
  1219. ngOnDestroy(): void;
  1220. transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T>): T | null;
  1221. transform<T>(obj: null | undefined): null;
  1222. transform<T>(obj: Observable<T> | Subscribable<T> | Promise<T> | null | undefined): T | null;
  1223. private _subscribe;
  1224. private _selectStrategy;
  1225. private _dispose;
  1226. private _updateLatestValue;
  1227. static ɵfac: i0.ɵɵFactoryDeclaration<AsyncPipe, never>;
  1228. static ɵpipe: i0.ɵɵPipeDeclaration<AsyncPipe, "async", true>;
  1229. }
  1230. /**
  1231. * Transforms text to all lower case.
  1232. *
  1233. * @see {@link UpperCasePipe}
  1234. * @see {@link TitleCasePipe}
  1235. * @usageNotes
  1236. *
  1237. * The following example defines a view that allows the user to enter
  1238. * text, and then uses the pipe to convert the input text to all lower case.
  1239. *
  1240. * {@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe'}
  1241. *
  1242. * @ngModule CommonModule
  1243. * @publicApi
  1244. */
  1245. declare class LowerCasePipe implements PipeTransform {
  1246. /**
  1247. * @param value The string to transform to lower case.
  1248. */
  1249. transform(value: string): string;
  1250. transform(value: null | undefined): null;
  1251. transform(value: string | null | undefined): string | null;
  1252. static ɵfac: i0.ɵɵFactoryDeclaration<LowerCasePipe, never>;
  1253. static ɵpipe: i0.ɵɵPipeDeclaration<LowerCasePipe, "lowercase", true>;
  1254. }
  1255. /**
  1256. * Transforms text to title case.
  1257. * Capitalizes the first letter of each word and transforms the
  1258. * rest of the word to lower case.
  1259. * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
  1260. *
  1261. * @see {@link LowerCasePipe}
  1262. * @see {@link UpperCasePipe}
  1263. *
  1264. * @usageNotes
  1265. * The following example shows the result of transforming various strings into title case.
  1266. *
  1267. * {@example common/pipes/ts/titlecase_pipe.ts region='TitleCasePipe'}
  1268. *
  1269. * @ngModule CommonModule
  1270. * @publicApi
  1271. */
  1272. declare class TitleCasePipe implements PipeTransform {
  1273. /**
  1274. * @param value The string to transform to title case.
  1275. */
  1276. transform(value: string): string;
  1277. transform(value: null | undefined): null;
  1278. transform(value: string | null | undefined): string | null;
  1279. static ɵfac: i0.ɵɵFactoryDeclaration<TitleCasePipe, never>;
  1280. static ɵpipe: i0.ɵɵPipeDeclaration<TitleCasePipe, "titlecase", true>;
  1281. }
  1282. /**
  1283. * Transforms text to all upper case.
  1284. * @see {@link LowerCasePipe}
  1285. * @see {@link TitleCasePipe}
  1286. *
  1287. * @ngModule CommonModule
  1288. * @publicApi
  1289. */
  1290. declare class UpperCasePipe implements PipeTransform {
  1291. /**
  1292. * @param value The string to transform to upper case.
  1293. */
  1294. transform(value: string): string;
  1295. transform(value: null | undefined): null;
  1296. transform(value: string | null | undefined): string | null;
  1297. static ɵfac: i0.ɵɵFactoryDeclaration<UpperCasePipe, never>;
  1298. static ɵpipe: i0.ɵɵPipeDeclaration<UpperCasePipe, "uppercase", true>;
  1299. }
  1300. /**
  1301. * @ngModule CommonModule
  1302. * @description
  1303. *
  1304. * Converts a value into its JSON-format representation. Useful for debugging.
  1305. *
  1306. * @usageNotes
  1307. *
  1308. * The following component uses a JSON pipe to convert an object
  1309. * to JSON format, and displays the string in both formats for comparison.
  1310. *
  1311. * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
  1312. *
  1313. * @publicApi
  1314. */
  1315. declare class JsonPipe implements PipeTransform {
  1316. /**
  1317. * @param value A value of any type to convert into a JSON-format string.
  1318. */
  1319. transform(value: any): string;
  1320. static ɵfac: i0.ɵɵFactoryDeclaration<JsonPipe, never>;
  1321. static ɵpipe: i0.ɵɵPipeDeclaration<JsonPipe, "json", true>;
  1322. }
  1323. /**
  1324. * @ngModule CommonModule
  1325. * @description
  1326. *
  1327. * Creates a new `Array` or `String` containing a subset (slice) of the elements.
  1328. *
  1329. * @usageNotes
  1330. *
  1331. * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
  1332. * and `String.prototype.slice()`.
  1333. *
  1334. * When operating on an `Array`, the returned `Array` is always a copy even when all
  1335. * the elements are being returned.
  1336. *
  1337. * When operating on a blank value, the pipe returns the blank value.
  1338. *
  1339. * ### List Example
  1340. *
  1341. * This `ngFor` example:
  1342. *
  1343. * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
  1344. *
  1345. * produces the following:
  1346. *
  1347. * ```html
  1348. * <li>b</li>
  1349. * <li>c</li>
  1350. * ```
  1351. *
  1352. * ### String Examples
  1353. *
  1354. * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
  1355. *
  1356. * @publicApi
  1357. */
  1358. declare class SlicePipe implements PipeTransform {
  1359. /**
  1360. * @param value a list or a string to be sliced.
  1361. * @param start the starting index of the subset to return:
  1362. * - **a positive integer**: return the item at `start` index and all items after
  1363. * in the list or string expression.
  1364. * - **a negative integer**: return the item at `start` index from the end and all items after
  1365. * in the list or string expression.
  1366. * - **if positive and greater than the size of the expression**: return an empty list or
  1367. * string.
  1368. * - **if negative and greater than the size of the expression**: return entire list or string.
  1369. * @param end the ending index of the subset to return:
  1370. * - **omitted**: return all items until the end.
  1371. * - **if positive**: return all items before `end` index of the list or string.
  1372. * - **if negative**: return all items before `end` index from the end of the list or string.
  1373. */
  1374. transform<T>(value: ReadonlyArray<T>, start: number, end?: number): Array<T>;
  1375. transform(value: null | undefined, start: number, end?: number): null;
  1376. transform<T>(value: ReadonlyArray<T> | null | undefined, start: number, end?: number): Array<T> | null;
  1377. transform(value: string, start: number, end?: number): string;
  1378. transform(value: string | null | undefined, start: number, end?: number): string | null;
  1379. static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
  1380. static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "slice", true>;
  1381. }
  1382. /**
  1383. * @ngModule CommonModule
  1384. * @description
  1385. *
  1386. * Formats a value according to digit options and locale rules.
  1387. * Locale determines group sizing and separator,
  1388. * decimal point character, and other locale-specific configurations.
  1389. *
  1390. * @see {@link formatNumber}
  1391. *
  1392. * @usageNotes
  1393. *
  1394. * ### digitsInfo
  1395. *
  1396. * The value's decimal representation is specified by the `digitsInfo`
  1397. * parameter, written in the following format:<br>
  1398. *
  1399. * ```
  1400. * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
  1401. * ```
  1402. *
  1403. * - `minIntegerDigits`:
  1404. * The minimum number of integer digits before the decimal point.
  1405. * Default is 1.
  1406. *
  1407. * - `minFractionDigits`:
  1408. * The minimum number of digits after the decimal point.
  1409. * Default is 0.
  1410. *
  1411. * - `maxFractionDigits`:
  1412. * The maximum number of digits after the decimal point.
  1413. * Default is 3.
  1414. *
  1415. * If the formatted value is truncated it will be rounded using the "to-nearest" method:
  1416. *
  1417. * ```
  1418. * {{3.6 | number: '1.0-0'}}
  1419. * <!--will output '4'-->
  1420. *
  1421. * {{-3.6 | number:'1.0-0'}}
  1422. * <!--will output '-4'-->
  1423. * ```
  1424. *
  1425. * ### locale
  1426. *
  1427. * `locale` will format a value according to locale rules.
  1428. * Locale determines group sizing and separator,
  1429. * decimal point character, and other locale-specific configurations.
  1430. *
  1431. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  1432. *
  1433. * See [Setting your app locale](guide/i18n/locale-id).
  1434. *
  1435. * ### Example
  1436. *
  1437. * The following code shows how the pipe transforms values
  1438. * according to various format specifications,
  1439. * where the caller's default locale is `en-US`.
  1440. *
  1441. * {@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
  1442. *
  1443. * @publicApi
  1444. */
  1445. declare class DecimalPipe implements PipeTransform {
  1446. private _locale;
  1447. constructor(_locale: string);
  1448. /**
  1449. * @param value The value to be formatted.
  1450. * @param digitsInfo Sets digit and decimal representation.
  1451. * [See more](#digitsinfo).
  1452. * @param locale Specifies what locale format rules to use.
  1453. * [See more](#locale).
  1454. */
  1455. transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
  1456. transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
  1457. transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
  1458. static ɵfac: i0.ɵɵFactoryDeclaration<DecimalPipe, never>;
  1459. static ɵpipe: i0.ɵɵPipeDeclaration<DecimalPipe, "number", true>;
  1460. }
  1461. /**
  1462. * @ngModule CommonModule
  1463. * @description
  1464. *
  1465. * Transforms a number to a percentage
  1466. * string, formatted according to locale rules that determine group sizing and
  1467. * separator, decimal-point character, and other locale-specific
  1468. * configurations.
  1469. *
  1470. * @see {@link formatPercent}
  1471. *
  1472. * @usageNotes
  1473. * The following code shows how the pipe transforms numbers
  1474. * into text strings, according to various format specifications,
  1475. * where the caller's default locale is `en-US`.
  1476. *
  1477. * {@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
  1478. *
  1479. * @publicApi
  1480. */
  1481. declare class PercentPipe implements PipeTransform {
  1482. private _locale;
  1483. constructor(_locale: string);
  1484. transform(value: number | string, digitsInfo?: string, locale?: string): string | null;
  1485. transform(value: null | undefined, digitsInfo?: string, locale?: string): null;
  1486. transform(value: number | string | null | undefined, digitsInfo?: string, locale?: string): string | null;
  1487. static ɵfac: i0.ɵɵFactoryDeclaration<PercentPipe, never>;
  1488. static ɵpipe: i0.ɵɵPipeDeclaration<PercentPipe, "percent", true>;
  1489. }
  1490. /**
  1491. * @ngModule CommonModule
  1492. * @description
  1493. *
  1494. * Transforms a number to a currency string, formatted according to locale rules
  1495. * that determine group sizing and separator, decimal-point character,
  1496. * and other locale-specific configurations.
  1497. *
  1498. *
  1499. * @see {@link getCurrencySymbol}
  1500. * @see {@link formatCurrency}
  1501. *
  1502. * @usageNotes
  1503. * The following code shows how the pipe transforms numbers
  1504. * into text strings, according to various format specifications,
  1505. * where the caller's default locale is `en-US`.
  1506. *
  1507. * {@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
  1508. *
  1509. * @publicApi
  1510. */
  1511. declare class CurrencyPipe implements PipeTransform {
  1512. private _locale;
  1513. private _defaultCurrencyCode;
  1514. constructor(_locale: string, _defaultCurrencyCode?: string);
  1515. /**
  1516. *
  1517. * @param value The number to be formatted as currency.
  1518. * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
  1519. * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
  1520. * configured using the `DEFAULT_CURRENCY_CODE` injection token.
  1521. * @param display The format for the currency indicator. One of the following:
  1522. * - `code`: Show the code (such as `USD`).
  1523. * - `symbol`(default): Show the symbol (such as `$`).
  1524. * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
  1525. * currency.
  1526. * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
  1527. * locale has no narrow symbol, uses the standard symbol for the locale.
  1528. * - String: Use the given string value instead of a code or a symbol.
  1529. * For example, an empty string will suppress the currency & symbol.
  1530. * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
  1531. *
  1532. * @param digitsInfo Decimal representation options, specified by a string
  1533. * in the following format:<br>
  1534. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
  1535. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
  1536. * Default is `1`.
  1537. * - `minFractionDigits`: The minimum number of digits after the decimal point.
  1538. * Default is `2`.
  1539. * - `maxFractionDigits`: The maximum number of digits after the decimal point.
  1540. * Default is `2`.
  1541. * If not provided, the number will be formatted with the proper amount of digits,
  1542. * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
  1543. * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
  1544. * @param locale A locale code for the locale format rules to use.
  1545. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  1546. * See [Setting your app locale](guide/i18n/locale-id).
  1547. */
  1548. transform(value: number | string, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
  1549. transform(value: null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): null;
  1550. transform(value: number | string | null | undefined, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
  1551. static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipe, never>;
  1552. static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPipe, "currency", true>;
  1553. }
  1554. /**
  1555. * An interface that describes the date pipe configuration, which can be provided using the
  1556. * `DATE_PIPE_DEFAULT_OPTIONS` token.
  1557. *
  1558. * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
  1559. *
  1560. * @publicApi
  1561. */
  1562. interface DatePipeConfig {
  1563. dateFormat?: string;
  1564. timezone?: string;
  1565. }
  1566. /**
  1567. * Optionally-provided default timezone to use for all instances of `DatePipe` (such as `'+0430'`).
  1568. * If the value isn't provided, the `DatePipe` will use the end-user's local system timezone.
  1569. *
  1570. * @deprecated use DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe
  1571. */
  1572. declare const DATE_PIPE_DEFAULT_TIMEZONE: InjectionToken<string>;
  1573. /**
  1574. * DI token that allows to provide default configuration for the `DatePipe` instances in an
  1575. * application. The value is an object which can include the following fields:
  1576. * - `dateFormat`: configures the default date format. If not provided, the `DatePipe`
  1577. * will use the 'mediumDate' as a value.
  1578. * - `timezone`: configures the default timezone. If not provided, the `DatePipe` will
  1579. * use the end-user's local system timezone.
  1580. *
  1581. * @see {@link DatePipeConfig}
  1582. *
  1583. * @usageNotes
  1584. *
  1585. * Various date pipe default values can be overwritten by providing this token with
  1586. * the value that has this interface.
  1587. *
  1588. * For example:
  1589. *
  1590. * Override the default date format by providing a value using the token:
  1591. * ```ts
  1592. * providers: [
  1593. * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {dateFormat: 'shortDate'}}
  1594. * ]
  1595. * ```
  1596. *
  1597. * Override the default timezone by providing a value using the token:
  1598. * ```ts
  1599. * providers: [
  1600. * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {timezone: '-1200'}}
  1601. * ]
  1602. * ```
  1603. */
  1604. declare const DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<DatePipeConfig>;
  1605. /**
  1606. * @ngModule CommonModule
  1607. * @description
  1608. *
  1609. * Formats a date value according to locale rules.
  1610. *
  1611. * `DatePipe` is executed only when it detects a pure change to the input value.
  1612. * A pure change is either a change to a primitive input value
  1613. * (such as `String`, `Number`, `Boolean`, or `Symbol`),
  1614. * or a changed object reference (such as `Date`, `Array`, `Function`, or `Object`).
  1615. *
  1616. * Note that mutating a `Date` object does not cause the pipe to be rendered again.
  1617. * To ensure that the pipe is executed, you must create a new `Date` object.
  1618. *
  1619. * Only the `en-US` locale data comes with Angular. To localize dates
  1620. * in another language, you must import the corresponding locale data.
  1621. * See the [I18n guide](guide/i18n/format-data-locale) for more information.
  1622. *
  1623. * The time zone of the formatted value can be specified either by passing it in as the second
  1624. * parameter of the pipe, or by setting the default through the `DATE_PIPE_DEFAULT_OPTIONS`
  1625. * injection token. The value that is passed in as the second parameter takes precedence over
  1626. * the one defined using the injection token.
  1627. *
  1628. * @see {@link formatDate}
  1629. *
  1630. *
  1631. * @usageNotes
  1632. *
  1633. * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
  1634. * reformat the date on every change-detection cycle, treat the date as an immutable object
  1635. * and change the reference when the pipe needs to run again.
  1636. *
  1637. * ### Pre-defined format options
  1638. *
  1639. * | Option | Equivalent to | Examples (given in `en-US` locale) |
  1640. * |---------------|-------------------------------------|-------------------------------------------------|
  1641. * | `'short'` | `'M/d/yy, h:mm a'` | `6/15/15, 9:03 AM` |
  1642. * | `'medium'` | `'MMM d, y, h:mm:ss a'` | `Jun 15, 2015, 9:03:01 AM` |
  1643. * | `'long'` | `'MMMM d, y, h:mm:ss a z'` | `June 15, 2015 at 9:03:01 AM GMT+1` |
  1644. * | `'full'` | `'EEEE, MMMM d, y, h:mm:ss a zzzz'` | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |
  1645. * | `'shortDate'` | `'M/d/yy'` | `6/15/15` |
  1646. * | `'mediumDate'`| `'MMM d, y'` | `Jun 15, 2015` |
  1647. * | `'longDate'` | `'MMMM d, y'` | `June 15, 2015` |
  1648. * | `'fullDate'` | `'EEEE, MMMM d, y'` | `Monday, June 15, 2015` |
  1649. * | `'shortTime'` | `'h:mm a'` | `9:03 AM` |
  1650. * | `'mediumTime'`| `'h:mm:ss a'` | `9:03:01 AM` |
  1651. * | `'longTime'` | `'h:mm:ss a z'` | `9:03:01 AM GMT+1` |
  1652. * | `'fullTime'` | `'h:mm:ss a zzzz'` | `9:03:01 AM GMT+01:00` |
  1653. *
  1654. * ### Custom format options
  1655. *
  1656. * You can construct a format string using symbols to specify the components
  1657. * of a date-time value, as described in the following table.
  1658. * Format details depend on the locale.
  1659. * Fields marked with (*) are only available in the extra data set for the given locale.
  1660. *
  1661. * | Field type | Format | Description | Example Value |
  1662. * |-------------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
  1663. * | Era | G, GG & GGG | Abbreviated | AD |
  1664. * | | GGGG | Wide | Anno Domini |
  1665. * | | GGGGG | Narrow | A |
  1666. * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
  1667. * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
  1668. * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
  1669. * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
  1670. * | ISO Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
  1671. * | | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
  1672. * | | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
  1673. * | | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
  1674. * | Month | M | Numeric: 1 digit | 9, 12 |
  1675. * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
  1676. * | | MMM | Abbreviated | Sep |
  1677. * | | MMMM | Wide | September |
  1678. * | | MMMMM | Narrow | S |
  1679. * | Month standalone | L | Numeric: 1 digit | 9, 12 |
  1680. * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
  1681. * | | LLL | Abbreviated | Sep |
  1682. * | | LLLL | Wide | September |
  1683. * | | LLLLL | Narrow | S |
  1684. * | ISO Week of year | w | Numeric: minimum digits | 1... 53 |
  1685. * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
  1686. * | Week of month | W | Numeric: 1 digit | 1... 5 |
  1687. * | Day of month | d | Numeric: minimum digits | 1 |
  1688. * | | dd | Numeric: 2 digits + zero padded | 01 |
  1689. * | Week day | E, EE & EEE | Abbreviated | Tue |
  1690. * | | EEEE | Wide | Tuesday |
  1691. * | | EEEEE | Narrow | T |
  1692. * | | EEEEEE | Short | Tu |
  1693. * | Week day standalone | c, cc | Numeric: 1 digit | 2 |
  1694. * | | ccc | Abbreviated | Tue |
  1695. * | | cccc | Wide | Tuesday |
  1696. * | | ccccc | Narrow | T |
  1697. * | | cccccc | Short | Tu |
  1698. * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
  1699. * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
  1700. * | | aaaaa | Narrow | a/p |
  1701. * | Period* | B, BB & BBB | Abbreviated | mid. |
  1702. * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  1703. * | | BBBBB | Narrow | md |
  1704. * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
  1705. * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  1706. * | | bbbbb | Narrow | md |
  1707. * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
  1708. * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
  1709. * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
  1710. * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
  1711. * | Minute | m | Numeric: minimum digits | 8, 59 |
  1712. * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
  1713. * | Second | s | Numeric: minimum digits | 0... 59 |
  1714. * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
  1715. * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
  1716. * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
  1717. * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
  1718. * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
  1719. * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
  1720. * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
  1721. * | | ZZZZ | Long localized GMT format | GMT-8:00 |
  1722. * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
  1723. * | | O, OO & OOO | Short localized GMT format | GMT-8 |
  1724. * | | OOOO | Long localized GMT format | GMT-08:00 |
  1725. *
  1726. *
  1727. * ### Format examples
  1728. *
  1729. * These examples transform a date into various formats,
  1730. * assuming that `dateObj` is a JavaScript `Date` object for
  1731. * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
  1732. * given in the local time for the `en-US` locale.
  1733. *
  1734. * ```
  1735. * {{ dateObj | date }} // output is 'Jun 15, 2015'
  1736. * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
  1737. * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
  1738. * {{ dateObj | date:'mm:ss' }} // output is '43:11'
  1739. * {{ dateObj | date:"MMM dd, yyyy 'at' hh:mm a" }} // output is 'Jun 15, 2015 at 09:43 PM'
  1740. * ```
  1741. *
  1742. * ### Usage example
  1743. *
  1744. * The following component uses a date pipe to display the current date in different formats.
  1745. *
  1746. * ```angular-ts
  1747. * @Component({
  1748. * selector: 'date-pipe',
  1749. * template: `<div>
  1750. * <p>Today is {{today | date}}</p>
  1751. * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
  1752. * <p>The time is {{today | date:'h:mm a z'}}</p>
  1753. * </div>`
  1754. * })
  1755. * // Get the current date and time as a date-time value.
  1756. * export class DatePipeComponent {
  1757. * today: number = Date.now();
  1758. * }
  1759. * ```
  1760. *
  1761. * @publicApi
  1762. */
  1763. declare class DatePipe implements PipeTransform {
  1764. private locale;
  1765. private defaultTimezone?;
  1766. private defaultOptions?;
  1767. constructor(locale: string, defaultTimezone?: string | null | undefined, defaultOptions?: (DatePipeConfig | null) | undefined);
  1768. /**
  1769. * @param value The date expression: a `Date` object, a number
  1770. * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
  1771. * @param format The date/time components to include, using predefined options or a
  1772. * custom format string. When not provided, the `DatePipe` looks for the value using the
  1773. * `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads the `dateFormat` property).
  1774. * If the token is not configured, the `mediumDate` is used as a value.
  1775. * @param timezone A timezone offset (such as `'+0430'`). When not provided, the `DatePipe`
  1776. * looks for the value using the `DATE_PIPE_DEFAULT_OPTIONS` injection token (and reads
  1777. * the `timezone` property). If the token is not configured, the end-user's local system
  1778. * timezone is used as a value.
  1779. * @param locale A locale code for the locale format rules to use.
  1780. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  1781. * See [Setting your app locale](guide/i18n/locale-id).
  1782. *
  1783. * @see {@link DATE_PIPE_DEFAULT_OPTIONS}
  1784. *
  1785. * @returns A date string in the desired format.
  1786. */
  1787. transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
  1788. transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
  1789. transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
  1790. static ɵfac: i0.ɵɵFactoryDeclaration<DatePipe, [null, { optional: true; }, { optional: true; }]>;
  1791. static ɵpipe: i0.ɵɵPipeDeclaration<DatePipe, "date", true>;
  1792. }
  1793. /**
  1794. * @ngModule CommonModule
  1795. * @description
  1796. *
  1797. * Maps a value to a string that pluralizes the value according to locale rules.
  1798. *
  1799. * @usageNotes
  1800. *
  1801. * ### Example
  1802. *
  1803. * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
  1804. *
  1805. * @publicApi
  1806. */
  1807. declare class I18nPluralPipe implements PipeTransform {
  1808. private _localization;
  1809. constructor(_localization: NgLocalization);
  1810. /**
  1811. * @param value the number to be formatted
  1812. * @param pluralMap an object that mimics the ICU format, see
  1813. * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
  1814. * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
  1815. * default).
  1816. */
  1817. transform(value: number | null | undefined, pluralMap: {
  1818. [count: string]: string;
  1819. }, locale?: string): string;
  1820. static ɵfac: i0.ɵɵFactoryDeclaration<I18nPluralPipe, never>;
  1821. static ɵpipe: i0.ɵɵPipeDeclaration<I18nPluralPipe, "i18nPlural", true>;
  1822. }
  1823. /**
  1824. * @ngModule CommonModule
  1825. * @description
  1826. *
  1827. * Generic selector that displays the string that matches the current value.
  1828. *
  1829. * If none of the keys of the `mapping` match the `value`, then the content
  1830. * of the `other` key is returned when present, otherwise an empty string is returned.
  1831. *
  1832. * @usageNotes
  1833. *
  1834. * ### Example
  1835. *
  1836. * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
  1837. *
  1838. * @publicApi
  1839. */
  1840. declare class I18nSelectPipe implements PipeTransform {
  1841. /**
  1842. * @param value a string to be internationalized.
  1843. * @param mapping an object that indicates the text that should be displayed
  1844. * for different values of the provided `value`.
  1845. */
  1846. transform(value: string | null | undefined, mapping: {
  1847. [key: string]: string;
  1848. }): string;
  1849. static ɵfac: i0.ɵɵFactoryDeclaration<I18nSelectPipe, never>;
  1850. static ɵpipe: i0.ɵɵPipeDeclaration<I18nSelectPipe, "i18nSelect", true>;
  1851. }
  1852. /**
  1853. * A key value pair.
  1854. * Usually used to represent the key value pairs from a Map or Object.
  1855. *
  1856. * @publicApi
  1857. */
  1858. interface KeyValue<K, V> {
  1859. key: K;
  1860. value: V;
  1861. }
  1862. /**
  1863. * @ngModule CommonModule
  1864. * @description
  1865. *
  1866. * Transforms Object or Map into an array of key value pairs.
  1867. *
  1868. * The output array will be ordered by keys.
  1869. * By default the comparator will be by Unicode point value.
  1870. * You can optionally pass a compareFn if your keys are complex types.
  1871. * Passing `null` as the compareFn will use natural ordering of the input.
  1872. *
  1873. * @usageNotes
  1874. * ### Examples
  1875. *
  1876. * This examples show how an Object or a Map can be iterated by ngFor with the use of this
  1877. * keyvalue pipe.
  1878. *
  1879. * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
  1880. *
  1881. * @publicApi
  1882. */
  1883. declare class KeyValuePipe implements PipeTransform {
  1884. private readonly differs;
  1885. constructor(differs: KeyValueDiffers);
  1886. private differ;
  1887. private keyValues;
  1888. private compareFn;
  1889. transform<K, V>(input: ReadonlyMap<K, V>, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>>;
  1890. transform<K extends number, V>(input: Record<K, V>, compareFn?: ((a: KeyValue<string, V>, b: KeyValue<string, V>) => number) | null): Array<KeyValue<string, V>>;
  1891. transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V>, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>>;
  1892. transform(input: null | undefined, compareFn?: ((a: KeyValue<unknown, unknown>, b: KeyValue<unknown, unknown>) => number) | null): null;
  1893. transform<K, V>(input: ReadonlyMap<K, V> | null | undefined, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>> | null;
  1894. transform<K extends number, V>(input: Record<K, V> | null | undefined, compareFn?: ((a: KeyValue<string, V>, b: KeyValue<string, V>) => number) | null): Array<KeyValue<string, V>> | null;
  1895. transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V> | null | undefined, compareFn?: ((a: KeyValue<K, V>, b: KeyValue<K, V>) => number) | null): Array<KeyValue<K, V>> | null;
  1896. static ɵfac: i0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
  1897. static ɵpipe: i0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue", true>;
  1898. }
  1899. /**
  1900. * Exports all the basic Angular directives and pipes,
  1901. * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
  1902. * Re-exported by `BrowserModule`, which is included automatically in the root
  1903. * `AppModule` when you create a new app with the CLI `new` command.
  1904. *
  1905. * @publicApi
  1906. */
  1907. declare class CommonModule {
  1908. static ɵfac: i0.ɵɵFactoryDeclaration<CommonModule, never>;
  1909. static ɵmod: i0.ɵɵNgModuleDeclaration<CommonModule, never, [typeof NgClass, typeof NgComponentOutlet, typeof NgForOf, typeof NgIf, typeof NgTemplateOutlet, typeof NgStyle, typeof NgSwitch, typeof NgSwitchCase, typeof NgSwitchDefault, typeof NgPlural, typeof NgPluralCase, typeof AsyncPipe, typeof UpperCasePipe, typeof LowerCasePipe, typeof JsonPipe, typeof SlicePipe, typeof DecimalPipe, typeof PercentPipe, typeof TitleCasePipe, typeof CurrencyPipe, typeof DatePipe, typeof I18nPluralPipe, typeof I18nSelectPipe, typeof KeyValuePipe], [typeof NgClass, typeof NgComponentOutlet, typeof NgForOf, typeof NgIf, typeof NgTemplateOutlet, typeof NgStyle, typeof NgSwitch, typeof NgSwitchCase, typeof NgSwitchDefault, typeof NgPlural, typeof NgPluralCase, typeof AsyncPipe, typeof UpperCasePipe, typeof LowerCasePipe, typeof JsonPipe, typeof SlicePipe, typeof DecimalPipe, typeof PercentPipe, typeof TitleCasePipe, typeof CurrencyPipe, typeof DatePipe, typeof I18nPluralPipe, typeof I18nSelectPipe, typeof KeyValuePipe]>;
  1910. static ɵinj: i0.ɵɵInjectorDeclaration<CommonModule>;
  1911. }
  1912. export { APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_OPTIONS, DATE_PIPE_DEFAULT_TIMEZONE, DatePipe, DecimalPipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, KeyValuePipe, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, PathLocationStrategy, PercentPipe, SlicePipe, TitleCasePipe, UpperCasePipe };
  1913. export type { DatePipeConfig, KeyValue, PopStateEvent };