tabs.mjs 168 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260
  1. import { FocusKeyManager, _IdGenerator, CdkMonitorFocus, FocusMonitor } from '@angular/cdk/a11y';
  2. import { Directionality } from '@angular/cdk/bidi';
  3. import { hasModifierKey, SPACE, ENTER } from '@angular/cdk/keycodes';
  4. import { SharedResizeObserver } from '@angular/cdk/observers/private';
  5. import { Platform, _bindEventWithOptions } from '@angular/cdk/platform';
  6. import { ViewportRuler, CdkScrollable } from '@angular/cdk/scrolling';
  7. import * as i0 from '@angular/core';
  8. import { InjectionToken, inject, TemplateRef, Directive, ViewContainerRef, booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ContentChild, ViewChild, ElementRef, ChangeDetectorRef, NgZone, Injector, Renderer2, ANIMATION_MODULE_TYPE, EventEmitter, afterNextRender, numberAttribute, Output, ContentChildren, QueryList, ViewChildren, signal, forwardRef, computed, HostAttributeToken, NgModule } from '@angular/core';
  9. import { Subject, of, merge, EMPTY, Observable, timer, Subscription, BehaviorSubject } from 'rxjs';
  10. import { debounceTime, takeUntil, startWith, switchMap, skip, filter } from 'rxjs/operators';
  11. import { CdkPortal, TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
  12. import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
  13. import { _ as _StructuralStylesLoader } from './structural-styles-BQUT6wsL.mjs';
  14. import { CdkObserveContent } from '@angular/cdk/observers';
  15. import { M as MatRipple, a as MAT_RIPPLE_GLOBAL_OPTIONS } from './ripple-BT3tzh6F.mjs';
  16. import { M as MatCommonModule } from './common-module-WayjW0Pb.mjs';
  17. import '@angular/cdk/coercion';
  18. /**
  19. * Injection token that can be used to reference instances of `MatTabContent`. It serves as
  20. * alternative token to the actual `MatTabContent` class which could cause unnecessary
  21. * retention of the class and its directive metadata.
  22. */
  23. const MAT_TAB_CONTENT = new InjectionToken('MatTabContent');
  24. /** Decorates the `ng-template` tags and reads out the template from it. */
  25. class MatTabContent {
  26. template = inject(TemplateRef);
  27. constructor() { }
  28. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  29. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatTabContent, isStandalone: true, selector: "[matTabContent]", providers: [{ provide: MAT_TAB_CONTENT, useExisting: MatTabContent }], ngImport: i0 });
  30. }
  31. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabContent, decorators: [{
  32. type: Directive,
  33. args: [{
  34. selector: '[matTabContent]',
  35. providers: [{ provide: MAT_TAB_CONTENT, useExisting: MatTabContent }],
  36. }]
  37. }], ctorParameters: () => [] });
  38. /**
  39. * Injection token that can be used to reference instances of `MatTabLabel`. It serves as
  40. * alternative token to the actual `MatTabLabel` class which could cause unnecessary
  41. * retention of the class and its directive metadata.
  42. */
  43. const MAT_TAB_LABEL = new InjectionToken('MatTabLabel');
  44. /**
  45. * Used to provide a tab label to a tab without causing a circular dependency.
  46. * @docs-private
  47. */
  48. const MAT_TAB = new InjectionToken('MAT_TAB');
  49. /** Used to flag tab labels for use with the portal directive */
  50. class MatTabLabel extends CdkPortal {
  51. _closestTab = inject(MAT_TAB, { optional: true });
  52. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLabel, deps: null, target: i0.ɵɵFactoryTarget.Directive });
  53. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatTabLabel, isStandalone: true, selector: "[mat-tab-label], [matTabLabel]", providers: [{ provide: MAT_TAB_LABEL, useExisting: MatTabLabel }], usesInheritance: true, ngImport: i0 });
  54. }
  55. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLabel, decorators: [{
  56. type: Directive,
  57. args: [{
  58. selector: '[mat-tab-label], [matTabLabel]',
  59. providers: [{ provide: MAT_TAB_LABEL, useExisting: MatTabLabel }],
  60. }]
  61. }] });
  62. /**
  63. * Used to provide a tab group to a tab without causing a circular dependency.
  64. * @docs-private
  65. */
  66. const MAT_TAB_GROUP = new InjectionToken('MAT_TAB_GROUP');
  67. class MatTab {
  68. _viewContainerRef = inject(ViewContainerRef);
  69. _closestTabGroup = inject(MAT_TAB_GROUP, { optional: true });
  70. /** whether the tab is disabled. */
  71. disabled = false;
  72. /** Content for the tab label given by `<ng-template mat-tab-label>`. */
  73. get templateLabel() {
  74. return this._templateLabel;
  75. }
  76. set templateLabel(value) {
  77. this._setTemplateLabelInput(value);
  78. }
  79. _templateLabel;
  80. /**
  81. * Template provided in the tab content that will be used if present, used to enable lazy-loading
  82. */
  83. _explicitContent = undefined;
  84. /** Template inside the MatTab view that contains an `<ng-content>`. */
  85. _implicitContent;
  86. /** Plain text label for the tab, used when there is no template label. */
  87. textLabel = '';
  88. /** Aria label for the tab. */
  89. ariaLabel;
  90. /**
  91. * Reference to the element that the tab is labelled by.
  92. * Will be cleared if `aria-label` is set at the same time.
  93. */
  94. ariaLabelledby;
  95. /** Classes to be passed to the tab label inside the mat-tab-header container. */
  96. labelClass;
  97. /** Classes to be passed to the tab mat-tab-body container. */
  98. bodyClass;
  99. /**
  100. * Custom ID for the tab, overriding the auto-generated one by Material.
  101. * Note that when using this input, it's your responsibility to ensure that the ID is unique.
  102. */
  103. id = null;
  104. /** Portal that will be the hosted content of the tab */
  105. _contentPortal = null;
  106. /** @docs-private */
  107. get content() {
  108. return this._contentPortal;
  109. }
  110. /** Emits whenever the internal state of the tab changes. */
  111. _stateChanges = new Subject();
  112. /**
  113. * The relatively indexed position where 0 represents the center, negative is left, and positive
  114. * represents the right.
  115. */
  116. position = null;
  117. // TODO(crisbeto): we no longer use this, but some internal apps appear to rely on it.
  118. /**
  119. * The initial relatively index origin of the tab if it was created and selected after there
  120. * was already a selected tab. Provides context of what position the tab should originate from.
  121. */
  122. origin = null;
  123. /**
  124. * Whether the tab is currently active.
  125. */
  126. isActive = false;
  127. constructor() {
  128. inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
  129. }
  130. ngOnChanges(changes) {
  131. if (changes.hasOwnProperty('textLabel') || changes.hasOwnProperty('disabled')) {
  132. this._stateChanges.next();
  133. }
  134. }
  135. ngOnDestroy() {
  136. this._stateChanges.complete();
  137. }
  138. ngOnInit() {
  139. this._contentPortal = new TemplatePortal(this._explicitContent || this._implicitContent, this._viewContainerRef);
  140. }
  141. /**
  142. * This has been extracted to a util because of TS 4 and VE.
  143. * View Engine doesn't support property rename inheritance.
  144. * TS 4.0 doesn't allow properties to override accessors or vice-versa.
  145. * @docs-private
  146. */
  147. _setTemplateLabelInput(value) {
  148. // Only update the label if the query managed to find one. This works around an issue where a
  149. // user may have manually set `templateLabel` during creation mode, which would then get
  150. // clobbered by `undefined` when the query resolves. Also note that we check that the closest
  151. // tab matches the current one so that we don't pick up labels from nested tabs.
  152. if (value && value._closestTab === this) {
  153. this._templateLabel = value;
  154. }
  155. }
  156. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTab, deps: [], target: i0.ɵɵFactoryTarget.Component });
  157. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatTab, isStandalone: true, selector: "mat-tab", inputs: { disabled: ["disabled", "disabled", booleanAttribute], textLabel: ["label", "textLabel"], ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], labelClass: "labelClass", bodyClass: "bodyClass", id: "id" }, host: { attributes: { "hidden": "" }, properties: { "attr.id": "null" } }, providers: [{ provide: MAT_TAB, useExisting: MatTab }], queries: [{ propertyName: "templateLabel", first: true, predicate: MatTabLabel, descendants: true }, { propertyName: "_explicitContent", first: true, predicate: MatTabContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "_implicitContent", first: true, predicate: TemplateRef, descendants: true, static: true }], exportAs: ["matTab"], usesOnChanges: true, ngImport: i0, template: "<!-- Create a template for the content of the <mat-tab> so that we can grab a reference to this\n TemplateRef and use it in a Portal to render the tab content in the appropriate place in the\n tab-group. -->\n<ng-template><ng-content></ng-content></ng-template>\n", changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
  158. }
  159. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTab, decorators: [{
  160. type: Component,
  161. args: [{ selector: 'mat-tab', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, exportAs: 'matTab', providers: [{ provide: MAT_TAB, useExisting: MatTab }], host: {
  162. // This element will be rendered on the server in order to support hydration.
  163. // Hide it so it doesn't cause a layout shift when it's removed on the client.
  164. 'hidden': '',
  165. // Clear any custom IDs from the tab since they'll be forwarded to the actual tab.
  166. '[attr.id]': 'null',
  167. }, template: "<!-- Create a template for the content of the <mat-tab> so that we can grab a reference to this\n TemplateRef and use it in a Portal to render the tab content in the appropriate place in the\n tab-group. -->\n<ng-template><ng-content></ng-content></ng-template>\n" }]
  168. }], ctorParameters: () => [], propDecorators: { disabled: [{
  169. type: Input,
  170. args: [{ transform: booleanAttribute }]
  171. }], templateLabel: [{
  172. type: ContentChild,
  173. args: [MatTabLabel]
  174. }], _explicitContent: [{
  175. type: ContentChild,
  176. args: [MatTabContent, { read: TemplateRef, static: true }]
  177. }], _implicitContent: [{
  178. type: ViewChild,
  179. args: [TemplateRef, { static: true }]
  180. }], textLabel: [{
  181. type: Input,
  182. args: ['label']
  183. }], ariaLabel: [{
  184. type: Input,
  185. args: ['aria-label']
  186. }], ariaLabelledby: [{
  187. type: Input,
  188. args: ['aria-labelledby']
  189. }], labelClass: [{
  190. type: Input
  191. }], bodyClass: [{
  192. type: Input
  193. }], id: [{
  194. type: Input
  195. }] } });
  196. /** Class that is applied when a tab indicator is active. */
  197. const ACTIVE_CLASS = 'mdc-tab-indicator--active';
  198. /** Class that is applied when the tab indicator should not transition. */
  199. const NO_TRANSITION_CLASS = 'mdc-tab-indicator--no-transition';
  200. /**
  201. * Abstraction around the MDC tab indicator that acts as the tab header's ink bar.
  202. * @docs-private
  203. */
  204. class MatInkBar {
  205. _items;
  206. /** Item to which the ink bar is aligned currently. */
  207. _currentItem;
  208. constructor(_items) {
  209. this._items = _items;
  210. }
  211. /** Hides the ink bar. */
  212. hide() {
  213. this._items.forEach(item => item.deactivateInkBar());
  214. this._currentItem = undefined;
  215. }
  216. /** Aligns the ink bar to a DOM node. */
  217. alignToElement(element) {
  218. const correspondingItem = this._items.find(item => item.elementRef.nativeElement === element);
  219. const currentItem = this._currentItem;
  220. if (correspondingItem === currentItem) {
  221. return;
  222. }
  223. currentItem?.deactivateInkBar();
  224. if (correspondingItem) {
  225. const domRect = currentItem?.elementRef.nativeElement.getBoundingClientRect?.();
  226. // The ink bar won't animate unless we give it the `DOMRect` of the previous item.
  227. correspondingItem.activateInkBar(domRect);
  228. this._currentItem = correspondingItem;
  229. }
  230. }
  231. }
  232. class InkBarItem {
  233. _elementRef = inject(ElementRef);
  234. _inkBarElement;
  235. _inkBarContentElement;
  236. _fitToContent = false;
  237. /** Whether the ink bar should fit to the entire tab or just its content. */
  238. get fitInkBarToContent() {
  239. return this._fitToContent;
  240. }
  241. set fitInkBarToContent(newValue) {
  242. if (this._fitToContent !== newValue) {
  243. this._fitToContent = newValue;
  244. if (this._inkBarElement) {
  245. this._appendInkBarElement();
  246. }
  247. }
  248. }
  249. /** Aligns the ink bar to the current item. */
  250. activateInkBar(previousIndicatorClientRect) {
  251. const element = this._elementRef.nativeElement;
  252. // Early exit if no indicator is present to handle cases where an indicator
  253. // may be activated without a prior indicator state
  254. if (!previousIndicatorClientRect ||
  255. !element.getBoundingClientRect ||
  256. !this._inkBarContentElement) {
  257. element.classList.add(ACTIVE_CLASS);
  258. return;
  259. }
  260. // This animation uses the FLIP approach. You can read more about it at the link below:
  261. // https://aerotwist.com/blog/flip-your-animations/
  262. // Calculate the dimensions based on the dimensions of the previous indicator
  263. const currentClientRect = element.getBoundingClientRect();
  264. const widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
  265. const xPosition = previousIndicatorClientRect.left - currentClientRect.left;
  266. element.classList.add(NO_TRANSITION_CLASS);
  267. this._inkBarContentElement.style.setProperty('transform', `translateX(${xPosition}px) scaleX(${widthDelta})`);
  268. // Force repaint before updating classes and transform to ensure the transform properly takes effect
  269. element.getBoundingClientRect();
  270. element.classList.remove(NO_TRANSITION_CLASS);
  271. element.classList.add(ACTIVE_CLASS);
  272. this._inkBarContentElement.style.setProperty('transform', '');
  273. }
  274. /** Removes the ink bar from the current item. */
  275. deactivateInkBar() {
  276. this._elementRef.nativeElement.classList.remove(ACTIVE_CLASS);
  277. }
  278. /** Initializes the foundation. */
  279. ngOnInit() {
  280. this._createInkBarElement();
  281. }
  282. /** Destroys the foundation. */
  283. ngOnDestroy() {
  284. this._inkBarElement?.remove();
  285. this._inkBarElement = this._inkBarContentElement = null;
  286. }
  287. /** Creates and appends the ink bar element. */
  288. _createInkBarElement() {
  289. const documentNode = this._elementRef.nativeElement.ownerDocument || document;
  290. const inkBarElement = (this._inkBarElement = documentNode.createElement('span'));
  291. const inkBarContentElement = (this._inkBarContentElement = documentNode.createElement('span'));
  292. inkBarElement.className = 'mdc-tab-indicator';
  293. inkBarContentElement.className =
  294. 'mdc-tab-indicator__content mdc-tab-indicator__content--underline';
  295. inkBarElement.appendChild(this._inkBarContentElement);
  296. this._appendInkBarElement();
  297. }
  298. /**
  299. * Appends the ink bar to the tab host element or content, depending on whether
  300. * the ink bar should fit to content.
  301. */
  302. _appendInkBarElement() {
  303. if (!this._inkBarElement && (typeof ngDevMode === 'undefined' || ngDevMode)) {
  304. throw Error('Ink bar element has not been created and cannot be appended');
  305. }
  306. const parentElement = this._fitToContent
  307. ? this._elementRef.nativeElement.querySelector('.mdc-tab__content')
  308. : this._elementRef.nativeElement;
  309. if (!parentElement && (typeof ngDevMode === 'undefined' || ngDevMode)) {
  310. throw Error('Missing element to host the ink bar');
  311. }
  312. parentElement.appendChild(this._inkBarElement);
  313. }
  314. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InkBarItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  315. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: InkBarItem, isStandalone: true, inputs: { fitInkBarToContent: ["fitInkBarToContent", "fitInkBarToContent", booleanAttribute] }, ngImport: i0 });
  316. }
  317. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InkBarItem, decorators: [{
  318. type: Directive
  319. }], propDecorators: { fitInkBarToContent: [{
  320. type: Input,
  321. args: [{ transform: booleanAttribute }]
  322. }] } });
  323. /**
  324. * The default positioner function for the MatInkBar.
  325. * @docs-private
  326. * @deprecated No longer used, will be removed.
  327. * @breaking-change 21.0.0
  328. */
  329. function _MAT_INK_BAR_POSITIONER_FACTORY() {
  330. const method = (element) => ({
  331. left: element ? (element.offsetLeft || 0) + 'px' : '0',
  332. width: element ? (element.offsetWidth || 0) + 'px' : '0',
  333. });
  334. return method;
  335. }
  336. /** Injection token for the MatInkBar's Positioner. */
  337. const _MAT_INK_BAR_POSITIONER = new InjectionToken('MatInkBarPositioner', {
  338. providedIn: 'root',
  339. factory: _MAT_INK_BAR_POSITIONER_FACTORY,
  340. });
  341. /**
  342. * Used in the `mat-tab-group` view to display tab labels.
  343. * @docs-private
  344. */
  345. class MatTabLabelWrapper extends InkBarItem {
  346. elementRef = inject(ElementRef);
  347. /** Whether the tab is disabled. */
  348. disabled = false;
  349. /** Sets focus on the wrapper element */
  350. focus() {
  351. this.elementRef.nativeElement.focus();
  352. }
  353. getOffsetLeft() {
  354. return this.elementRef.nativeElement.offsetLeft;
  355. }
  356. getOffsetWidth() {
  357. return this.elementRef.nativeElement.offsetWidth;
  358. }
  359. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLabelWrapper, deps: null, target: i0.ɵɵFactoryTarget.Directive });
  360. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: MatTabLabelWrapper, isStandalone: true, selector: "[matTabLabelWrapper]", inputs: { disabled: ["disabled", "disabled", booleanAttribute] }, host: { properties: { "class.mat-mdc-tab-disabled": "disabled", "attr.aria-disabled": "!!disabled" } }, usesInheritance: true, ngImport: i0 });
  361. }
  362. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLabelWrapper, decorators: [{
  363. type: Directive,
  364. args: [{
  365. selector: '[matTabLabelWrapper]',
  366. host: {
  367. '[class.mat-mdc-tab-disabled]': 'disabled',
  368. '[attr.aria-disabled]': '!!disabled',
  369. },
  370. }]
  371. }], propDecorators: { disabled: [{
  372. type: Input,
  373. args: [{ transform: booleanAttribute }]
  374. }] } });
  375. /** Config used to bind passive event listeners */
  376. const passiveEventListenerOptions = {
  377. passive: true,
  378. };
  379. /**
  380. * Amount of milliseconds to wait before starting to scroll the header automatically.
  381. * Set a little conservatively in order to handle fake events dispatched on touch devices.
  382. */
  383. const HEADER_SCROLL_DELAY = 650;
  384. /**
  385. * Interval in milliseconds at which to scroll the header
  386. * while the user is holding their pointer.
  387. */
  388. const HEADER_SCROLL_INTERVAL = 100;
  389. /**
  390. * Base class for a tab header that supported pagination.
  391. * @docs-private
  392. */
  393. class MatPaginatedTabHeader {
  394. _elementRef = inject(ElementRef);
  395. _changeDetectorRef = inject(ChangeDetectorRef);
  396. _viewportRuler = inject(ViewportRuler);
  397. _dir = inject(Directionality, { optional: true });
  398. _ngZone = inject(NgZone);
  399. _platform = inject(Platform);
  400. _sharedResizeObserver = inject(SharedResizeObserver);
  401. _injector = inject(Injector);
  402. _renderer = inject(Renderer2);
  403. _animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
  404. _eventCleanups;
  405. /** The distance in pixels that the tab labels should be translated to the left. */
  406. _scrollDistance = 0;
  407. /** Whether the header should scroll to the selected index after the view has been checked. */
  408. _selectedIndexChanged = false;
  409. /** Emits when the component is destroyed. */
  410. _destroyed = new Subject();
  411. /** Whether the controls for pagination should be displayed */
  412. _showPaginationControls = false;
  413. /** Whether the tab list can be scrolled more towards the end of the tab label list. */
  414. _disableScrollAfter = true;
  415. /** Whether the tab list can be scrolled more towards the beginning of the tab label list. */
  416. _disableScrollBefore = true;
  417. /**
  418. * The number of tab labels that are displayed on the header. When this changes, the header
  419. * should re-evaluate the scroll position.
  420. */
  421. _tabLabelCount;
  422. /** Whether the scroll distance has changed and should be applied after the view is checked. */
  423. _scrollDistanceChanged;
  424. /** Used to manage focus between the tabs. */
  425. _keyManager;
  426. /** Cached text content of the header. */
  427. _currentTextContent;
  428. /** Stream that will stop the automated scrolling. */
  429. _stopScrolling = new Subject();
  430. /**
  431. * Whether pagination should be disabled. This can be used to avoid unnecessary
  432. * layout recalculations if it's known that pagination won't be required.
  433. */
  434. disablePagination = false;
  435. /** The index of the active tab. */
  436. get selectedIndex() {
  437. return this._selectedIndex;
  438. }
  439. set selectedIndex(v) {
  440. const value = isNaN(v) ? 0 : v;
  441. if (this._selectedIndex != value) {
  442. this._selectedIndexChanged = true;
  443. this._selectedIndex = value;
  444. if (this._keyManager) {
  445. this._keyManager.updateActiveItem(value);
  446. }
  447. }
  448. }
  449. _selectedIndex = 0;
  450. /** Event emitted when the option is selected. */
  451. selectFocusedIndex = new EventEmitter();
  452. /** Event emitted when a label is focused. */
  453. indexFocused = new EventEmitter();
  454. constructor() {
  455. // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
  456. this._eventCleanups = this._ngZone.runOutsideAngular(() => [
  457. this._renderer.listen(this._elementRef.nativeElement, 'mouseleave', () => this._stopInterval()),
  458. ]);
  459. }
  460. ngAfterViewInit() {
  461. // We need to handle these events manually, because we want to bind passive event listeners.
  462. this._eventCleanups.push(_bindEventWithOptions(this._renderer, this._previousPaginator.nativeElement, 'touchstart', () => this._handlePaginatorPress('before'), passiveEventListenerOptions), _bindEventWithOptions(this._renderer, this._nextPaginator.nativeElement, 'touchstart', () => this._handlePaginatorPress('after'), passiveEventListenerOptions));
  463. }
  464. ngAfterContentInit() {
  465. const dirChange = this._dir ? this._dir.change : of('ltr');
  466. // We need to debounce resize events because the alignment logic is expensive.
  467. // If someone animates the width of tabs, we don't want to realign on every animation frame.
  468. // Once we haven't seen any more resize events in the last 32ms (~2 animaion frames) we can
  469. // re-align.
  470. const resize = this._sharedResizeObserver
  471. .observe(this._elementRef.nativeElement)
  472. .pipe(debounceTime(32), takeUntil(this._destroyed));
  473. // Note: We do not actually need to watch these events for proper functioning of the tabs,
  474. // the resize events above should capture any viewport resize that we care about. However,
  475. // removing this is fairly breaking for screenshot tests, so we're leaving it here for now.
  476. const viewportResize = this._viewportRuler.change(150).pipe(takeUntil(this._destroyed));
  477. const realign = () => {
  478. this.updatePagination();
  479. this._alignInkBarToSelectedTab();
  480. };
  481. this._keyManager = new FocusKeyManager(this._items)
  482. .withHorizontalOrientation(this._getLayoutDirection())
  483. .withHomeAndEnd()
  484. .withWrap()
  485. // Allow focus to land on disabled tabs, as per https://w3c.github.io/aria-practices/#kbd_disabled_controls
  486. .skipPredicate(() => false);
  487. // Fall back to the first link as being active if there isn't a selected one.
  488. // This is relevant primarily for the tab nav bar.
  489. this._keyManager.updateActiveItem(Math.max(this._selectedIndex, 0));
  490. // Note: We do not need to realign after the first render for proper functioning of the tabs
  491. // the resize events above should fire when we first start observing the element. However,
  492. // removing this is fairly breaking for screenshot tests, so we're leaving it here for now.
  493. afterNextRender(realign, { injector: this._injector });
  494. // On dir change or resize, realign the ink bar and update the orientation of
  495. // the key manager if the direction has changed.
  496. merge(dirChange, viewportResize, resize, this._items.changes, this._itemsResized())
  497. .pipe(takeUntil(this._destroyed))
  498. .subscribe(() => {
  499. // We need to defer this to give the browser some time to recalculate
  500. // the element dimensions. The call has to be wrapped in `NgZone.run`,
  501. // because the viewport change handler runs outside of Angular.
  502. this._ngZone.run(() => {
  503. Promise.resolve().then(() => {
  504. // Clamp the scroll distance, because it can change with the number of tabs.
  505. this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), this._scrollDistance));
  506. realign();
  507. });
  508. });
  509. this._keyManager?.withHorizontalOrientation(this._getLayoutDirection());
  510. });
  511. // If there is a change in the focus key manager we need to emit the `indexFocused`
  512. // event in order to provide a public event that notifies about focus changes. Also we realign
  513. // the tabs container by scrolling the new focused tab into the visible section.
  514. this._keyManager.change.subscribe(newFocusIndex => {
  515. this.indexFocused.emit(newFocusIndex);
  516. this._setTabFocus(newFocusIndex);
  517. });
  518. }
  519. /** Sends any changes that could affect the layout of the items. */
  520. _itemsResized() {
  521. if (typeof ResizeObserver !== 'function') {
  522. return EMPTY;
  523. }
  524. return this._items.changes.pipe(startWith(this._items), switchMap((tabItems) => new Observable((observer) => this._ngZone.runOutsideAngular(() => {
  525. const resizeObserver = new ResizeObserver(entries => observer.next(entries));
  526. tabItems.forEach(item => resizeObserver.observe(item.elementRef.nativeElement));
  527. return () => {
  528. resizeObserver.disconnect();
  529. };
  530. }))),
  531. // Skip the first emit since the resize observer emits when an item
  532. // is observed for new items when the tab is already inserted
  533. skip(1),
  534. // Skip emissions where all the elements are invisible since we don't want
  535. // the header to try and re-render with invalid measurements. See #25574.
  536. filter(entries => entries.some(e => e.contentRect.width > 0 && e.contentRect.height > 0)));
  537. }
  538. ngAfterContentChecked() {
  539. // If the number of tab labels have changed, check if scrolling should be enabled
  540. if (this._tabLabelCount != this._items.length) {
  541. this.updatePagination();
  542. this._tabLabelCount = this._items.length;
  543. this._changeDetectorRef.markForCheck();
  544. }
  545. // If the selected index has changed, scroll to the label and check if the scrolling controls
  546. // should be disabled.
  547. if (this._selectedIndexChanged) {
  548. this._scrollToLabel(this._selectedIndex);
  549. this._checkScrollingControls();
  550. this._alignInkBarToSelectedTab();
  551. this._selectedIndexChanged = false;
  552. this._changeDetectorRef.markForCheck();
  553. }
  554. // If the scroll distance has been changed (tab selected, focused, scroll controls activated),
  555. // then translate the header to reflect this.
  556. if (this._scrollDistanceChanged) {
  557. this._updateTabScrollPosition();
  558. this._scrollDistanceChanged = false;
  559. this._changeDetectorRef.markForCheck();
  560. }
  561. }
  562. ngOnDestroy() {
  563. this._eventCleanups.forEach(cleanup => cleanup());
  564. this._keyManager?.destroy();
  565. this._destroyed.next();
  566. this._destroyed.complete();
  567. this._stopScrolling.complete();
  568. }
  569. /** Handles keyboard events on the header. */
  570. _handleKeydown(event) {
  571. // We don't handle any key bindings with a modifier key.
  572. if (hasModifierKey(event)) {
  573. return;
  574. }
  575. switch (event.keyCode) {
  576. case ENTER:
  577. case SPACE:
  578. if (this.focusIndex !== this.selectedIndex) {
  579. const item = this._items.get(this.focusIndex);
  580. if (item && !item.disabled) {
  581. this.selectFocusedIndex.emit(this.focusIndex);
  582. this._itemSelected(event);
  583. }
  584. }
  585. break;
  586. default:
  587. this._keyManager?.onKeydown(event);
  588. }
  589. }
  590. /**
  591. * Callback for when the MutationObserver detects that the content has changed.
  592. */
  593. _onContentChanges() {
  594. const textContent = this._elementRef.nativeElement.textContent;
  595. // We need to diff the text content of the header, because the MutationObserver callback
  596. // will fire even if the text content didn't change which is inefficient and is prone
  597. // to infinite loops if a poorly constructed expression is passed in (see #14249).
  598. if (textContent !== this._currentTextContent) {
  599. this._currentTextContent = textContent || '';
  600. // The content observer runs outside the `NgZone` by default, which
  601. // means that we need to bring the callback back in ourselves.
  602. this._ngZone.run(() => {
  603. this.updatePagination();
  604. this._alignInkBarToSelectedTab();
  605. this._changeDetectorRef.markForCheck();
  606. });
  607. }
  608. }
  609. /**
  610. * Updates the view whether pagination should be enabled or not.
  611. *
  612. * WARNING: Calling this method can be very costly in terms of performance. It should be called
  613. * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
  614. * page.
  615. */
  616. updatePagination() {
  617. this._checkPaginationEnabled();
  618. this._checkScrollingControls();
  619. this._updateTabScrollPosition();
  620. }
  621. /** Tracks which element has focus; used for keyboard navigation */
  622. get focusIndex() {
  623. return this._keyManager ? this._keyManager.activeItemIndex : 0;
  624. }
  625. /** When the focus index is set, we must manually send focus to the correct label */
  626. set focusIndex(value) {
  627. if (!this._isValidIndex(value) || this.focusIndex === value || !this._keyManager) {
  628. return;
  629. }
  630. this._keyManager.setActiveItem(value);
  631. }
  632. /**
  633. * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
  634. * providing a valid index and return true.
  635. */
  636. _isValidIndex(index) {
  637. return this._items ? !!this._items.toArray()[index] : true;
  638. }
  639. /**
  640. * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
  641. * scrolling is enabled.
  642. */
  643. _setTabFocus(tabIndex) {
  644. if (this._showPaginationControls) {
  645. this._scrollToLabel(tabIndex);
  646. }
  647. if (this._items && this._items.length) {
  648. this._items.toArray()[tabIndex].focus();
  649. // Do not let the browser manage scrolling to focus the element, this will be handled
  650. // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width
  651. // should be the full width minus the offset width.
  652. const containerEl = this._tabListContainer.nativeElement;
  653. const dir = this._getLayoutDirection();
  654. if (dir == 'ltr') {
  655. containerEl.scrollLeft = 0;
  656. }
  657. else {
  658. containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth;
  659. }
  660. }
  661. }
  662. /** The layout direction of the containing app. */
  663. _getLayoutDirection() {
  664. return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
  665. }
  666. /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
  667. _updateTabScrollPosition() {
  668. if (this.disablePagination) {
  669. return;
  670. }
  671. const scrollDistance = this.scrollDistance;
  672. const translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;
  673. // Don't use `translate3d` here because we don't want to create a new layer. A new layer
  674. // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar
  675. // and ripples will exceed the boundaries of the visible tab bar.
  676. // See: https://github.com/angular/components/issues/10276
  677. // We round the `transform` here, because transforms with sub-pixel precision cause some
  678. // browsers to blur the content of the element.
  679. this._tabList.nativeElement.style.transform = `translateX(${Math.round(translateX)}px)`;
  680. // Setting the `transform` on IE will change the scroll offset of the parent, causing the
  681. // position to be thrown off in some cases. We have to reset it ourselves to ensure that
  682. // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
  683. // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
  684. if (this._platform.TRIDENT || this._platform.EDGE) {
  685. this._tabListContainer.nativeElement.scrollLeft = 0;
  686. }
  687. }
  688. /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
  689. get scrollDistance() {
  690. return this._scrollDistance;
  691. }
  692. set scrollDistance(value) {
  693. this._scrollTo(value);
  694. }
  695. /**
  696. * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
  697. * the end of the list, respectively). The distance to scroll is computed to be a third of the
  698. * length of the tab list view window.
  699. *
  700. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  701. * should be called sparingly.
  702. */
  703. _scrollHeader(direction) {
  704. const viewLength = this._tabListContainer.nativeElement.offsetWidth;
  705. // Move the scroll distance one-third the length of the tab list's viewport.
  706. const scrollAmount = ((direction == 'before' ? -1 : 1) * viewLength) / 3;
  707. return this._scrollTo(this._scrollDistance + scrollAmount);
  708. }
  709. /** Handles click events on the pagination arrows. */
  710. _handlePaginatorClick(direction) {
  711. this._stopInterval();
  712. this._scrollHeader(direction);
  713. }
  714. /**
  715. * Moves the tab list such that the desired tab label (marked by index) is moved into view.
  716. *
  717. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  718. * should be called sparingly.
  719. */
  720. _scrollToLabel(labelIndex) {
  721. if (this.disablePagination) {
  722. return;
  723. }
  724. const selectedLabel = this._items ? this._items.toArray()[labelIndex] : null;
  725. if (!selectedLabel) {
  726. return;
  727. }
  728. // The view length is the visible width of the tab labels.
  729. const viewLength = this._tabListContainer.nativeElement.offsetWidth;
  730. const { offsetLeft, offsetWidth } = selectedLabel.elementRef.nativeElement;
  731. let labelBeforePos, labelAfterPos;
  732. if (this._getLayoutDirection() == 'ltr') {
  733. labelBeforePos = offsetLeft;
  734. labelAfterPos = labelBeforePos + offsetWidth;
  735. }
  736. else {
  737. labelAfterPos = this._tabListInner.nativeElement.offsetWidth - offsetLeft;
  738. labelBeforePos = labelAfterPos - offsetWidth;
  739. }
  740. const beforeVisiblePos = this.scrollDistance;
  741. const afterVisiblePos = this.scrollDistance + viewLength;
  742. if (labelBeforePos < beforeVisiblePos) {
  743. // Scroll header to move label to the before direction
  744. this.scrollDistance -= beforeVisiblePos - labelBeforePos;
  745. }
  746. else if (labelAfterPos > afterVisiblePos) {
  747. // Scroll header to move label to the after direction
  748. this.scrollDistance += Math.min(labelAfterPos - afterVisiblePos, labelBeforePos - beforeVisiblePos);
  749. }
  750. }
  751. /**
  752. * Evaluate whether the pagination controls should be displayed. If the scroll width of the
  753. * tab list is wider than the size of the header container, then the pagination controls should
  754. * be shown.
  755. *
  756. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  757. * should be called sparingly.
  758. */
  759. _checkPaginationEnabled() {
  760. if (this.disablePagination) {
  761. this._showPaginationControls = false;
  762. }
  763. else {
  764. const scrollWidth = this._tabListInner.nativeElement.scrollWidth;
  765. const containerWidth = this._elementRef.nativeElement.offsetWidth;
  766. // Usually checking that the scroll width is greater than the container width should be
  767. // enough, but on Safari at specific widths the browser ends up rounding up when there's
  768. // no pagination and rounding down once the pagination is added. This can throw the component
  769. // into an infinite loop where the pagination shows up and disappears constantly. We work
  770. // around it by adding a threshold to the calculation. From manual testing the threshold
  771. // can be lowered to 2px and still resolve the issue, but we set a higher one to be safe.
  772. // This shouldn't cause any content to be clipped, because tabs have a 24px horizontal
  773. // padding. See b/316395154 for more information.
  774. const isEnabled = scrollWidth - containerWidth >= 5;
  775. if (!isEnabled) {
  776. this.scrollDistance = 0;
  777. }
  778. if (isEnabled !== this._showPaginationControls) {
  779. this._showPaginationControls = isEnabled;
  780. this._changeDetectorRef.markForCheck();
  781. }
  782. }
  783. }
  784. /**
  785. * Evaluate whether the before and after controls should be enabled or disabled.
  786. * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
  787. * before button. If the header is at the end of the list (scroll distance is equal to the
  788. * maximum distance we can scroll), then disable the after button.
  789. *
  790. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  791. * should be called sparingly.
  792. */
  793. _checkScrollingControls() {
  794. if (this.disablePagination) {
  795. this._disableScrollAfter = this._disableScrollBefore = true;
  796. }
  797. else {
  798. // Check if the pagination arrows should be activated.
  799. this._disableScrollBefore = this.scrollDistance == 0;
  800. this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();
  801. this._changeDetectorRef.markForCheck();
  802. }
  803. }
  804. /**
  805. * Determines what is the maximum length in pixels that can be set for the scroll distance. This
  806. * is equal to the difference in width between the tab list container and tab header container.
  807. *
  808. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  809. * should be called sparingly.
  810. */
  811. _getMaxScrollDistance() {
  812. const lengthOfTabList = this._tabListInner.nativeElement.scrollWidth;
  813. const viewLength = this._tabListContainer.nativeElement.offsetWidth;
  814. return lengthOfTabList - viewLength || 0;
  815. }
  816. /** Tells the ink-bar to align itself to the current label wrapper */
  817. _alignInkBarToSelectedTab() {
  818. const selectedItem = this._items && this._items.length ? this._items.toArray()[this.selectedIndex] : null;
  819. const selectedLabelWrapper = selectedItem ? selectedItem.elementRef.nativeElement : null;
  820. if (selectedLabelWrapper) {
  821. this._inkBar.alignToElement(selectedLabelWrapper);
  822. }
  823. else {
  824. this._inkBar.hide();
  825. }
  826. }
  827. /** Stops the currently-running paginator interval. */
  828. _stopInterval() {
  829. this._stopScrolling.next();
  830. }
  831. /**
  832. * Handles the user pressing down on one of the paginators.
  833. * Starts scrolling the header after a certain amount of time.
  834. * @param direction In which direction the paginator should be scrolled.
  835. */
  836. _handlePaginatorPress(direction, mouseEvent) {
  837. // Don't start auto scrolling for right mouse button clicks. Note that we shouldn't have to
  838. // null check the `button`, but we do it so we don't break tests that use fake events.
  839. if (mouseEvent && mouseEvent.button != null && mouseEvent.button !== 0) {
  840. return;
  841. }
  842. // Avoid overlapping timers.
  843. this._stopInterval();
  844. // Start a timer after the delay and keep firing based on the interval.
  845. timer(HEADER_SCROLL_DELAY, HEADER_SCROLL_INTERVAL)
  846. // Keep the timer going until something tells it to stop or the component is destroyed.
  847. .pipe(takeUntil(merge(this._stopScrolling, this._destroyed)))
  848. .subscribe(() => {
  849. const { maxScrollDistance, distance } = this._scrollHeader(direction);
  850. // Stop the timer if we've reached the start or the end.
  851. if (distance === 0 || distance >= maxScrollDistance) {
  852. this._stopInterval();
  853. }
  854. });
  855. }
  856. /**
  857. * Scrolls the header to a given position.
  858. * @param position Position to which to scroll.
  859. * @returns Information on the current scroll distance and the maximum.
  860. */
  861. _scrollTo(position) {
  862. if (this.disablePagination) {
  863. return { maxScrollDistance: 0, distance: 0 };
  864. }
  865. const maxScrollDistance = this._getMaxScrollDistance();
  866. this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position));
  867. // Mark that the scroll distance has changed so that after the view is checked, the CSS
  868. // transformation can move the header.
  869. this._scrollDistanceChanged = true;
  870. this._checkScrollingControls();
  871. return { maxScrollDistance, distance: this._scrollDistance };
  872. }
  873. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatPaginatedTabHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  874. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: MatPaginatedTabHeader, isStandalone: true, inputs: { disablePagination: ["disablePagination", "disablePagination", booleanAttribute], selectedIndex: ["selectedIndex", "selectedIndex", numberAttribute] }, outputs: { selectFocusedIndex: "selectFocusedIndex", indexFocused: "indexFocused" }, ngImport: i0 });
  875. }
  876. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatPaginatedTabHeader, decorators: [{
  877. type: Directive
  878. }], ctorParameters: () => [], propDecorators: { disablePagination: [{
  879. type: Input,
  880. args: [{ transform: booleanAttribute }]
  881. }], selectedIndex: [{
  882. type: Input,
  883. args: [{ transform: numberAttribute }]
  884. }], selectFocusedIndex: [{
  885. type: Output
  886. }], indexFocused: [{
  887. type: Output
  888. }] } });
  889. /**
  890. * The header of the tab group which displays a list of all the tabs in the tab group. Includes
  891. * an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
  892. * width of the header container, then arrows will be displayed to allow the user to scroll
  893. * left and right across the header.
  894. * @docs-private
  895. */
  896. class MatTabHeader extends MatPaginatedTabHeader {
  897. _items;
  898. _tabListContainer;
  899. _tabList;
  900. _tabListInner;
  901. _nextPaginator;
  902. _previousPaginator;
  903. _inkBar;
  904. /** Aria label of the header. */
  905. ariaLabel;
  906. /** Sets the `aria-labelledby` of the header. */
  907. ariaLabelledby;
  908. /** Whether the ripple effect is disabled or not. */
  909. disableRipple = false;
  910. ngAfterContentInit() {
  911. this._inkBar = new MatInkBar(this._items);
  912. super.ngAfterContentInit();
  913. }
  914. _itemSelected(event) {
  915. event.preventDefault();
  916. }
  917. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabHeader, deps: null, target: i0.ɵɵFactoryTarget.Component });
  918. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatTabHeader, isStandalone: true, selector: "mat-tab-header", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { properties: { "class.mat-mdc-tab-header-pagination-controls-enabled": "_showPaginationControls", "class.mat-mdc-tab-header-rtl": "_getLayoutDirection() == 'rtl'" }, classAttribute: "mat-mdc-tab-header" }, queries: [{ propertyName: "_items", predicate: MatTabLabelWrapper }], viewQueries: [{ propertyName: "_tabListContainer", first: true, predicate: ["tabListContainer"], descendants: true, static: true }, { propertyName: "_tabList", first: true, predicate: ["tabList"], descendants: true, static: true }, { propertyName: "_tabListInner", first: true, predicate: ["tabListInner"], descendants: true, static: true }, { propertyName: "_nextPaginator", first: true, predicate: ["nextPaginator"], descendants: true }, { propertyName: "_previousPaginator", first: true, predicate: ["previousPaginator"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!--\n Note that this intentionally uses a `div` instead of a `button`, because it's not part of\n the regular tabs flow and is only here to support mouse users. It should also not be focusable.\n-->\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-before\"\n #previousPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollBefore || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollBefore\"\n (click)=\"_handlePaginatorClick('before')\"\n (mousedown)=\"_handlePaginatorPress('before', $event)\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n\n<div\n class=\"mat-mdc-tab-label-container\"\n #tabListContainer\n (keydown)=\"_handleKeydown($event)\"\n [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\">\n <div\n #tabList\n class=\"mat-mdc-tab-list\"\n role=\"tablist\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n (cdkObserveContent)=\"_onContentChanges()\">\n <div class=\"mat-mdc-tab-labels\" #tabListInner>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-after\"\n #nextPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollAfter || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollAfter\"\n (mousedown)=\"_handlePaginatorPress('after', $event)\"\n (click)=\"_handlePaginatorClick('after')\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n", styles: [".mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-group-inverted-header .mat-mdc-tab-label-container{border-bottom:none;border-top-style:solid;border-top-width:var(--mat-tab-header-divider-height, 1px);border-top-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-labels{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-labels,.mat-mdc-tab-labels.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab::before{margin:5px}@media(forced-colors: active){.mat-mdc-tab[aria-disabled=true]{color:GrayText}}\n"], dependencies: [{ kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "directive", type: CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
  919. }
  920. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabHeader, decorators: [{
  921. type: Component,
  922. args: [{ selector: 'mat-tab-header', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, host: {
  923. 'class': 'mat-mdc-tab-header',
  924. '[class.mat-mdc-tab-header-pagination-controls-enabled]': '_showPaginationControls',
  925. '[class.mat-mdc-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
  926. }, imports: [MatRipple, CdkObserveContent], template: "<!--\n Note that this intentionally uses a `div` instead of a `button`, because it's not part of\n the regular tabs flow and is only here to support mouse users. It should also not be focusable.\n-->\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-before\"\n #previousPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollBefore || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollBefore\"\n (click)=\"_handlePaginatorClick('before')\"\n (mousedown)=\"_handlePaginatorPress('before', $event)\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n\n<div\n class=\"mat-mdc-tab-label-container\"\n #tabListContainer\n (keydown)=\"_handleKeydown($event)\"\n [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\">\n <div\n #tabList\n class=\"mat-mdc-tab-list\"\n role=\"tablist\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n (cdkObserveContent)=\"_onContentChanges()\">\n <div class=\"mat-mdc-tab-labels\" #tabListInner>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-after\"\n #nextPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollAfter || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollAfter\"\n (mousedown)=\"_handlePaginatorPress('after', $event)\"\n (click)=\"_handlePaginatorClick('after')\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n", styles: [".mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-group-inverted-header .mat-mdc-tab-label-container{border-bottom:none;border-top-style:solid;border-top-width:var(--mat-tab-header-divider-height, 1px);border-top-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-labels{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-labels,.mat-mdc-tab-labels.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab::before{margin:5px}@media(forced-colors: active){.mat-mdc-tab[aria-disabled=true]{color:GrayText}}\n"] }]
  927. }], propDecorators: { _items: [{
  928. type: ContentChildren,
  929. args: [MatTabLabelWrapper, { descendants: false }]
  930. }], _tabListContainer: [{
  931. type: ViewChild,
  932. args: ['tabListContainer', { static: true }]
  933. }], _tabList: [{
  934. type: ViewChild,
  935. args: ['tabList', { static: true }]
  936. }], _tabListInner: [{
  937. type: ViewChild,
  938. args: ['tabListInner', { static: true }]
  939. }], _nextPaginator: [{
  940. type: ViewChild,
  941. args: ['nextPaginator']
  942. }], _previousPaginator: [{
  943. type: ViewChild,
  944. args: ['previousPaginator']
  945. }], ariaLabel: [{
  946. type: Input,
  947. args: ['aria-label']
  948. }], ariaLabelledby: [{
  949. type: Input,
  950. args: ['aria-labelledby']
  951. }], disableRipple: [{
  952. type: Input,
  953. args: [{ transform: booleanAttribute }]
  954. }] } });
  955. /** Injection token that can be used to provide the default options the tabs module. */
  956. const MAT_TABS_CONFIG = new InjectionToken('MAT_TABS_CONFIG');
  957. /**
  958. * The portal host directive for the contents of the tab.
  959. * @docs-private
  960. */
  961. class MatTabBodyPortal extends CdkPortalOutlet {
  962. _host = inject(MatTabBody);
  963. /** Subscription to events for when the tab body begins centering. */
  964. _centeringSub = Subscription.EMPTY;
  965. /** Subscription to events for when the tab body finishes leaving from center position. */
  966. _leavingSub = Subscription.EMPTY;
  967. constructor() {
  968. super();
  969. }
  970. /** Set initial visibility or set up subscription for changing visibility. */
  971. ngOnInit() {
  972. super.ngOnInit();
  973. this._centeringSub = this._host._beforeCentering
  974. .pipe(startWith(this._host._isCenterPosition()))
  975. .subscribe((isCentering) => {
  976. if (this._host._content && isCentering && !this.hasAttached()) {
  977. this.attach(this._host._content);
  978. }
  979. });
  980. this._leavingSub = this._host._afterLeavingCenter.subscribe(() => {
  981. if (!this._host.preserveContent) {
  982. this.detach();
  983. }
  984. });
  985. }
  986. /** Clean up centering subscription. */
  987. ngOnDestroy() {
  988. super.ngOnDestroy();
  989. this._centeringSub.unsubscribe();
  990. this._leavingSub.unsubscribe();
  991. }
  992. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabBodyPortal, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  993. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatTabBodyPortal, isStandalone: true, selector: "[matTabBodyHost]", usesInheritance: true, ngImport: i0 });
  994. }
  995. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabBodyPortal, decorators: [{
  996. type: Directive,
  997. args: [{ selector: '[matTabBodyHost]' }]
  998. }], ctorParameters: () => [] });
  999. /**
  1000. * Wrapper for the contents of a tab.
  1001. * @docs-private
  1002. */
  1003. class MatTabBody {
  1004. _elementRef = inject(ElementRef);
  1005. _dir = inject(Directionality, { optional: true });
  1006. _ngZone = inject(NgZone);
  1007. _injector = inject(Injector);
  1008. _renderer = inject(Renderer2);
  1009. _animationsModule = inject(ANIMATION_MODULE_TYPE, { optional: true });
  1010. _eventCleanups;
  1011. _initialized;
  1012. _fallbackTimer;
  1013. /** Current position of the tab-body in the tab-group. Zero means that the tab is visible. */
  1014. _positionIndex;
  1015. /** Subscription to the directionality change observable. */
  1016. _dirChangeSubscription = Subscription.EMPTY;
  1017. /** Current position of the body within the tab group. */
  1018. _position;
  1019. /** Previous position of the body. */
  1020. _previousPosition;
  1021. /** Event emitted when the tab begins to animate towards the center as the active tab. */
  1022. _onCentering = new EventEmitter();
  1023. /** Event emitted before the centering of the tab begins. */
  1024. _beforeCentering = new EventEmitter();
  1025. /** Event emitted before the centering of the tab begins. */
  1026. _afterLeavingCenter = new EventEmitter();
  1027. /** Event emitted when the tab completes its animation towards the center. */
  1028. _onCentered = new EventEmitter(true);
  1029. /** The portal host inside of this container into which the tab body content will be loaded. */
  1030. _portalHost;
  1031. /** Element in which the content is rendered. */
  1032. _contentElement;
  1033. /** The tab body content to display. */
  1034. _content;
  1035. // Note that the default value will always be overwritten by `MatTabBody`, but we need one
  1036. // anyway to prevent the animations module from throwing an error if the body is used on its own.
  1037. /** Duration for the tab's animation. */
  1038. animationDuration = '500ms';
  1039. /** Whether the tab's content should be kept in the DOM while it's off-screen. */
  1040. preserveContent = false;
  1041. /** The shifted index position of the tab body, where zero represents the active center tab. */
  1042. set position(position) {
  1043. this._positionIndex = position;
  1044. this._computePositionAnimationState();
  1045. }
  1046. constructor() {
  1047. if (this._dir) {
  1048. const changeDetectorRef = inject(ChangeDetectorRef);
  1049. this._dirChangeSubscription = this._dir.change.subscribe((dir) => {
  1050. this._computePositionAnimationState(dir);
  1051. changeDetectorRef.markForCheck();
  1052. });
  1053. }
  1054. }
  1055. ngOnInit() {
  1056. this._bindTransitionEvents();
  1057. if (this._position === 'center') {
  1058. this._setActiveClass(true);
  1059. // Allows for the dynamic height to animate properly on the initial run.
  1060. afterNextRender(() => this._onCentering.emit(this._elementRef.nativeElement.clientHeight), {
  1061. injector: this._injector,
  1062. });
  1063. }
  1064. this._initialized = true;
  1065. }
  1066. ngOnDestroy() {
  1067. clearTimeout(this._fallbackTimer);
  1068. this._eventCleanups?.forEach(cleanup => cleanup());
  1069. this._dirChangeSubscription.unsubscribe();
  1070. }
  1071. /** Sets up the transition events. */
  1072. _bindTransitionEvents() {
  1073. this._ngZone.runOutsideAngular(() => {
  1074. const element = this._elementRef.nativeElement;
  1075. const transitionDone = (event) => {
  1076. if (event.target === this._contentElement?.nativeElement) {
  1077. this._elementRef.nativeElement.classList.remove('mat-tab-body-animating');
  1078. // Only fire the actual callback when a transition is fully finished,
  1079. // otherwise the content can jump around when the next transition starts.
  1080. if (event.type === 'transitionend') {
  1081. this._transitionDone();
  1082. }
  1083. }
  1084. };
  1085. this._eventCleanups = [
  1086. this._renderer.listen(element, 'transitionstart', (event) => {
  1087. if (event.target === this._contentElement?.nativeElement) {
  1088. this._elementRef.nativeElement.classList.add('mat-tab-body-animating');
  1089. this._transitionStarted();
  1090. }
  1091. }),
  1092. this._renderer.listen(element, 'transitionend', transitionDone),
  1093. this._renderer.listen(element, 'transitioncancel', transitionDone),
  1094. ];
  1095. });
  1096. }
  1097. /** Called when a transition has started. */
  1098. _transitionStarted() {
  1099. clearTimeout(this._fallbackTimer);
  1100. const isCentering = this._position === 'center';
  1101. this._beforeCentering.emit(isCentering);
  1102. if (isCentering) {
  1103. this._onCentering.emit(this._elementRef.nativeElement.clientHeight);
  1104. }
  1105. }
  1106. /** Called when a transition is done. */
  1107. _transitionDone() {
  1108. if (this._position === 'center') {
  1109. this._onCentered.emit();
  1110. }
  1111. else if (this._previousPosition === 'center') {
  1112. this._afterLeavingCenter.emit();
  1113. }
  1114. }
  1115. /** Sets the active styling on the tab body based on its current position. */
  1116. _setActiveClass(isActive) {
  1117. this._elementRef.nativeElement.classList.toggle('mat-mdc-tab-body-active', isActive);
  1118. }
  1119. /** The text direction of the containing app. */
  1120. _getLayoutDirection() {
  1121. return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
  1122. }
  1123. /** Whether the provided position state is considered center, regardless of origin. */
  1124. _isCenterPosition() {
  1125. return this._positionIndex === 0;
  1126. }
  1127. /** Computes the position state that will be used for the tab-body animation trigger. */
  1128. _computePositionAnimationState(dir = this._getLayoutDirection()) {
  1129. this._previousPosition = this._position;
  1130. if (this._positionIndex < 0) {
  1131. this._position = dir == 'ltr' ? 'left' : 'right';
  1132. }
  1133. else if (this._positionIndex > 0) {
  1134. this._position = dir == 'ltr' ? 'right' : 'left';
  1135. }
  1136. else {
  1137. this._position = 'center';
  1138. }
  1139. if (this._animationsDisabled()) {
  1140. this._simulateTransitionEvents();
  1141. }
  1142. else if (this._initialized &&
  1143. (this._position === 'center' || this._previousPosition === 'center')) {
  1144. // The transition events are load-bearing and in some cases they might not fire (e.g.
  1145. // tests setting `* {transition: none}` to disable animations). This timeout will simulate
  1146. // them if a transition doesn't start within a certain amount of time.
  1147. clearTimeout(this._fallbackTimer);
  1148. this._fallbackTimer = this._ngZone.runOutsideAngular(() => setTimeout(() => this._simulateTransitionEvents(), 100));
  1149. }
  1150. }
  1151. /** Simulates the body's transition events in an environment where they might not fire. */
  1152. _simulateTransitionEvents() {
  1153. this._transitionStarted();
  1154. afterNextRender(() => this._transitionDone(), { injector: this._injector });
  1155. }
  1156. /** Whether animations are disabled for the tab group. */
  1157. _animationsDisabled() {
  1158. return (this._animationsModule === 'NoopAnimations' ||
  1159. this.animationDuration === '0ms' ||
  1160. this.animationDuration === '0s');
  1161. }
  1162. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
  1163. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: MatTabBody, isStandalone: true, selector: "mat-tab-body", inputs: { _content: ["content", "_content"], animationDuration: "animationDuration", preserveContent: "preserveContent", position: "position" }, outputs: { _onCentering: "_onCentering", _beforeCentering: "_beforeCentering", _onCentered: "_onCentered" }, host: { properties: { "attr.inert": "_position === \"center\" ? null : \"\"" }, classAttribute: "mat-mdc-tab-body" }, viewQueries: [{ propertyName: "_portalHost", first: true, predicate: MatTabBodyPortal, descendants: true }, { propertyName: "_contentElement", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: "<div\n class=\"mat-mdc-tab-body-content\"\n #content\n cdkScrollable\n [class.mat-tab-body-content-left]=\"_position === 'left'\"\n [class.mat-tab-body-content-right]=\"_position === 'right'\"\n [class.mat-tab-body-content-can-animate]=\"_position === 'center' || _previousPosition === 'center'\">\n <ng-template matTabBodyHost></ng-template>\n</div>\n", styles: [".mat-mdc-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;outline:0;flex-basis:100%}.mat-mdc-tab-body.mat-mdc-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-mdc-tab-group.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body.mat-mdc-tab-body-active{overflow-y:hidden}.mat-mdc-tab-body-content{height:100%;overflow:auto;transform:none;visibility:hidden}.mat-tab-body-animating>.mat-mdc-tab-body-content,.mat-mdc-tab-body-active>.mat-mdc-tab-body-content{visibility:visible}.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body-content{overflow:hidden}.mat-tab-body-content-can-animate{transition:transform var(--mat-tab-animation-duration) 1ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable .mat-tab-body-content-can-animate{transition:none}.mat-tab-body-content-left{transform:translate3d(-100%, 0, 0)}.mat-tab-body-content-right{transform:translate3d(100%, 0, 0)}\n"], dependencies: [{ kind: "directive", type: MatTabBodyPortal, selector: "[matTabBodyHost]" }, { kind: "directive", type: CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
  1164. }
  1165. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabBody, decorators: [{
  1166. type: Component,
  1167. args: [{ selector: 'mat-tab-body', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, host: {
  1168. 'class': 'mat-mdc-tab-body',
  1169. // In most cases the `visibility: hidden` that we set on the off-screen content is enough
  1170. // to stop interactions with it, but if a child element sets its own `visibility`, it'll
  1171. // override the one from the parent. This ensures that even those elements will be removed
  1172. // from the accessibility tree.
  1173. '[attr.inert]': '_position === "center" ? null : ""',
  1174. }, imports: [MatTabBodyPortal, CdkScrollable], template: "<div\n class=\"mat-mdc-tab-body-content\"\n #content\n cdkScrollable\n [class.mat-tab-body-content-left]=\"_position === 'left'\"\n [class.mat-tab-body-content-right]=\"_position === 'right'\"\n [class.mat-tab-body-content-can-animate]=\"_position === 'center' || _previousPosition === 'center'\">\n <ng-template matTabBodyHost></ng-template>\n</div>\n", styles: [".mat-mdc-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;outline:0;flex-basis:100%}.mat-mdc-tab-body.mat-mdc-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-mdc-tab-group.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body.mat-mdc-tab-body-active{overflow-y:hidden}.mat-mdc-tab-body-content{height:100%;overflow:auto;transform:none;visibility:hidden}.mat-tab-body-animating>.mat-mdc-tab-body-content,.mat-mdc-tab-body-active>.mat-mdc-tab-body-content{visibility:visible}.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body-content{overflow:hidden}.mat-tab-body-content-can-animate{transition:transform var(--mat-tab-animation-duration) 1ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable .mat-tab-body-content-can-animate{transition:none}.mat-tab-body-content-left{transform:translate3d(-100%, 0, 0)}.mat-tab-body-content-right{transform:translate3d(100%, 0, 0)}\n"] }]
  1175. }], ctorParameters: () => [], propDecorators: { _onCentering: [{
  1176. type: Output
  1177. }], _beforeCentering: [{
  1178. type: Output
  1179. }], _onCentered: [{
  1180. type: Output
  1181. }], _portalHost: [{
  1182. type: ViewChild,
  1183. args: [MatTabBodyPortal]
  1184. }], _contentElement: [{
  1185. type: ViewChild,
  1186. args: ['content']
  1187. }], _content: [{
  1188. type: Input,
  1189. args: ['content']
  1190. }], animationDuration: [{
  1191. type: Input
  1192. }], preserveContent: [{
  1193. type: Input
  1194. }], position: [{
  1195. type: Input
  1196. }] } });
  1197. /**
  1198. * Material design tab-group component. Supports basic tab pairs (label + content) and includes
  1199. * animated ink-bar, keyboard navigation, and screen reader.
  1200. * See: https://material.io/design/components/tabs.html
  1201. */
  1202. class MatTabGroup {
  1203. _elementRef = inject(ElementRef);
  1204. _changeDetectorRef = inject(ChangeDetectorRef);
  1205. _ngZone = inject(NgZone);
  1206. _tabsSubscription = Subscription.EMPTY;
  1207. _tabLabelSubscription = Subscription.EMPTY;
  1208. _tabBodySubscription = Subscription.EMPTY;
  1209. _diAnimationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
  1210. /**
  1211. * All tabs inside the tab group. This includes tabs that belong to groups that are nested
  1212. * inside the current one. We filter out only the tabs that belong to this group in `_tabs`.
  1213. */
  1214. _allTabs;
  1215. _tabBodies;
  1216. _tabBodyWrapper;
  1217. _tabHeader;
  1218. /** All of the tabs that belong to the group. */
  1219. _tabs = new QueryList();
  1220. /** The tab index that should be selected after the content has been checked. */
  1221. _indexToSelect = 0;
  1222. /** Index of the tab that was focused last. */
  1223. _lastFocusedTabIndex = null;
  1224. /** Snapshot of the height of the tab body wrapper before another tab is activated. */
  1225. _tabBodyWrapperHeight = 0;
  1226. /**
  1227. * Theme color of the tab group. This API is supported in M2 themes only, it
  1228. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/tabs/styling.
  1229. *
  1230. * For information on applying color variants in M3, see
  1231. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  1232. */
  1233. color;
  1234. /** Whether the ink bar should fit its width to the size of the tab label content. */
  1235. get fitInkBarToContent() {
  1236. return this._fitInkBarToContent;
  1237. }
  1238. set fitInkBarToContent(value) {
  1239. this._fitInkBarToContent = value;
  1240. this._changeDetectorRef.markForCheck();
  1241. }
  1242. _fitInkBarToContent = false;
  1243. /** Whether tabs should be stretched to fill the header. */
  1244. stretchTabs = true;
  1245. /** Alignment for tabs label. */
  1246. alignTabs = null;
  1247. /** Whether the tab group should grow to the size of the active tab. */
  1248. dynamicHeight = false;
  1249. /** The index of the active tab. */
  1250. get selectedIndex() {
  1251. return this._selectedIndex;
  1252. }
  1253. set selectedIndex(value) {
  1254. this._indexToSelect = isNaN(value) ? null : value;
  1255. }
  1256. _selectedIndex = null;
  1257. /** Position of the tab header. */
  1258. headerPosition = 'above';
  1259. /** Duration for the tab animation. Will be normalized to milliseconds if no units are set. */
  1260. get animationDuration() {
  1261. return this._animationDuration;
  1262. }
  1263. set animationDuration(value) {
  1264. const stringValue = value + '';
  1265. this._animationDuration = /^\d+$/.test(stringValue) ? value + 'ms' : stringValue;
  1266. }
  1267. _animationDuration;
  1268. /**
  1269. * `tabindex` to be set on the inner element that wraps the tab content. Can be used for improved
  1270. * accessibility when the tab does not have focusable elements or if it has scrollable content.
  1271. * The `tabindex` will be removed automatically for inactive tabs.
  1272. * Read more at https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-2/tabs.html
  1273. */
  1274. get contentTabIndex() {
  1275. return this._contentTabIndex;
  1276. }
  1277. set contentTabIndex(value) {
  1278. this._contentTabIndex = isNaN(value) ? null : value;
  1279. }
  1280. _contentTabIndex;
  1281. /**
  1282. * Whether pagination should be disabled. This can be used to avoid unnecessary
  1283. * layout recalculations if it's known that pagination won't be required.
  1284. */
  1285. disablePagination = false;
  1286. /** Whether ripples in the tab group are disabled. */
  1287. disableRipple = false;
  1288. /**
  1289. * By default tabs remove their content from the DOM while it's off-screen.
  1290. * Setting this to `true` will keep it in the DOM which will prevent elements
  1291. * like iframes and videos from reloading next time it comes back into the view.
  1292. */
  1293. preserveContent = false;
  1294. /**
  1295. * Theme color of the background of the tab group. This API is supported in M2 themes only, it
  1296. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/tabs/styling.
  1297. *
  1298. * For information on applying color variants in M3, see
  1299. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  1300. *
  1301. * @deprecated The background color should be customized through Sass theming APIs.
  1302. * @breaking-change 20.0.0 Remove this input
  1303. */
  1304. get backgroundColor() {
  1305. return this._backgroundColor;
  1306. }
  1307. set backgroundColor(value) {
  1308. const classList = this._elementRef.nativeElement.classList;
  1309. classList.remove('mat-tabs-with-background', `mat-background-${this.backgroundColor}`);
  1310. if (value) {
  1311. classList.add('mat-tabs-with-background', `mat-background-${value}`);
  1312. }
  1313. this._backgroundColor = value;
  1314. }
  1315. _backgroundColor;
  1316. /** Aria label of the inner `tablist` of the group. */
  1317. ariaLabel;
  1318. /** Sets the `aria-labelledby` of the inner `tablist` of the group. */
  1319. ariaLabelledby;
  1320. /** Output to enable support for two-way binding on `[(selectedIndex)]` */
  1321. selectedIndexChange = new EventEmitter();
  1322. /** Event emitted when focus has changed within a tab group. */
  1323. focusChange = new EventEmitter();
  1324. /** Event emitted when the body animation has completed */
  1325. animationDone = new EventEmitter();
  1326. /** Event emitted when the tab selection has changed. */
  1327. selectedTabChange = new EventEmitter(true);
  1328. _groupId;
  1329. /** Whether the tab group is rendered on the server. */
  1330. _isServer = !inject(Platform).isBrowser;
  1331. constructor() {
  1332. const defaultConfig = inject(MAT_TABS_CONFIG, { optional: true });
  1333. this._groupId = inject(_IdGenerator).getId('mat-tab-group-');
  1334. this.animationDuration =
  1335. defaultConfig && defaultConfig.animationDuration ? defaultConfig.animationDuration : '500ms';
  1336. this.disablePagination =
  1337. defaultConfig && defaultConfig.disablePagination != null
  1338. ? defaultConfig.disablePagination
  1339. : false;
  1340. this.dynamicHeight =
  1341. defaultConfig && defaultConfig.dynamicHeight != null ? defaultConfig.dynamicHeight : false;
  1342. if (defaultConfig?.contentTabIndex != null) {
  1343. this.contentTabIndex = defaultConfig.contentTabIndex;
  1344. }
  1345. this.preserveContent = !!defaultConfig?.preserveContent;
  1346. this.fitInkBarToContent =
  1347. defaultConfig && defaultConfig.fitInkBarToContent != null
  1348. ? defaultConfig.fitInkBarToContent
  1349. : false;
  1350. this.stretchTabs =
  1351. defaultConfig && defaultConfig.stretchTabs != null ? defaultConfig.stretchTabs : true;
  1352. this.alignTabs =
  1353. defaultConfig && defaultConfig.alignTabs != null ? defaultConfig.alignTabs : null;
  1354. }
  1355. /**
  1356. * After the content is checked, this component knows what tabs have been defined
  1357. * and what the selected index should be. This is where we can know exactly what position
  1358. * each tab should be in according to the new selected index, and additionally we know how
  1359. * a new selected tab should transition in (from the left or right).
  1360. */
  1361. ngAfterContentChecked() {
  1362. // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
  1363. // the amount of tabs changes before the actual change detection runs.
  1364. const indexToSelect = (this._indexToSelect = this._clampTabIndex(this._indexToSelect));
  1365. // If there is a change in selected index, emit a change event. Should not trigger if
  1366. // the selected index has not yet been initialized.
  1367. if (this._selectedIndex != indexToSelect) {
  1368. const isFirstRun = this._selectedIndex == null;
  1369. if (!isFirstRun) {
  1370. this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
  1371. // Preserve the height so page doesn't scroll up during tab change.
  1372. // Fixes https://stackblitz.com/edit/mat-tabs-scroll-page-top-on-tab-change
  1373. const wrapper = this._tabBodyWrapper.nativeElement;
  1374. wrapper.style.minHeight = wrapper.clientHeight + 'px';
  1375. }
  1376. // Changing these values after change detection has run
  1377. // since the checked content may contain references to them.
  1378. Promise.resolve().then(() => {
  1379. this._tabs.forEach((tab, index) => (tab.isActive = index === indexToSelect));
  1380. if (!isFirstRun) {
  1381. this.selectedIndexChange.emit(indexToSelect);
  1382. // Clear the min-height, this was needed during tab change to avoid
  1383. // unnecessary scrolling.
  1384. this._tabBodyWrapper.nativeElement.style.minHeight = '';
  1385. }
  1386. });
  1387. }
  1388. // Setup the position for each tab and optionally setup an origin on the next selected tab.
  1389. this._tabs.forEach((tab, index) => {
  1390. tab.position = index - indexToSelect;
  1391. // If there is already a selected tab, then set up an origin for the next selected tab
  1392. // if it doesn't have one already.
  1393. if (this._selectedIndex != null && tab.position == 0 && !tab.origin) {
  1394. tab.origin = indexToSelect - this._selectedIndex;
  1395. }
  1396. });
  1397. if (this._selectedIndex !== indexToSelect) {
  1398. this._selectedIndex = indexToSelect;
  1399. this._lastFocusedTabIndex = null;
  1400. this._changeDetectorRef.markForCheck();
  1401. }
  1402. }
  1403. ngAfterContentInit() {
  1404. this._subscribeToAllTabChanges();
  1405. this._subscribeToTabLabels();
  1406. // Subscribe to changes in the amount of tabs, in order to be
  1407. // able to re-render the content as new tabs are added or removed.
  1408. this._tabsSubscription = this._tabs.changes.subscribe(() => {
  1409. const indexToSelect = this._clampTabIndex(this._indexToSelect);
  1410. // Maintain the previously-selected tab if a new tab is added or removed and there is no
  1411. // explicit change that selects a different tab.
  1412. if (indexToSelect === this._selectedIndex) {
  1413. const tabs = this._tabs.toArray();
  1414. let selectedTab;
  1415. for (let i = 0; i < tabs.length; i++) {
  1416. if (tabs[i].isActive) {
  1417. // Assign both to the `_indexToSelect` and `_selectedIndex` so we don't fire a changed
  1418. // event, otherwise the consumer may end up in an infinite loop in some edge cases like
  1419. // adding a tab within the `selectedIndexChange` event.
  1420. this._indexToSelect = this._selectedIndex = i;
  1421. this._lastFocusedTabIndex = null;
  1422. selectedTab = tabs[i];
  1423. break;
  1424. }
  1425. }
  1426. // If we haven't found an active tab and a tab exists at the selected index, it means
  1427. // that the active tab was swapped out. Since this won't be picked up by the rendering
  1428. // loop in `ngAfterContentChecked`, we need to sync it up manually.
  1429. if (!selectedTab && tabs[indexToSelect]) {
  1430. Promise.resolve().then(() => {
  1431. tabs[indexToSelect].isActive = true;
  1432. this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
  1433. });
  1434. }
  1435. }
  1436. this._changeDetectorRef.markForCheck();
  1437. });
  1438. }
  1439. ngAfterViewInit() {
  1440. this._tabBodySubscription = this._tabBodies.changes.subscribe(() => this._bodyCentered(true));
  1441. }
  1442. /** Listens to changes in all of the tabs. */
  1443. _subscribeToAllTabChanges() {
  1444. // Since we use a query with `descendants: true` to pick up the tabs, we may end up catching
  1445. // some that are inside of nested tab groups. We filter them out manually by checking that
  1446. // the closest group to the tab is the current one.
  1447. this._allTabs.changes.pipe(startWith(this._allTabs)).subscribe((tabs) => {
  1448. this._tabs.reset(tabs.filter(tab => {
  1449. return tab._closestTabGroup === this || !tab._closestTabGroup;
  1450. }));
  1451. this._tabs.notifyOnChanges();
  1452. });
  1453. }
  1454. ngOnDestroy() {
  1455. this._tabs.destroy();
  1456. this._tabsSubscription.unsubscribe();
  1457. this._tabLabelSubscription.unsubscribe();
  1458. this._tabBodySubscription.unsubscribe();
  1459. }
  1460. /** Re-aligns the ink bar to the selected tab element. */
  1461. realignInkBar() {
  1462. if (this._tabHeader) {
  1463. this._tabHeader._alignInkBarToSelectedTab();
  1464. }
  1465. }
  1466. /**
  1467. * Recalculates the tab group's pagination dimensions.
  1468. *
  1469. * WARNING: Calling this method can be very costly in terms of performance. It should be called
  1470. * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
  1471. * page.
  1472. */
  1473. updatePagination() {
  1474. if (this._tabHeader) {
  1475. this._tabHeader.updatePagination();
  1476. }
  1477. }
  1478. /**
  1479. * Sets focus to a particular tab.
  1480. * @param index Index of the tab to be focused.
  1481. */
  1482. focusTab(index) {
  1483. const header = this._tabHeader;
  1484. if (header) {
  1485. header.focusIndex = index;
  1486. }
  1487. }
  1488. _focusChanged(index) {
  1489. this._lastFocusedTabIndex = index;
  1490. this.focusChange.emit(this._createChangeEvent(index));
  1491. }
  1492. _createChangeEvent(index) {
  1493. const event = new MatTabChangeEvent();
  1494. event.index = index;
  1495. if (this._tabs && this._tabs.length) {
  1496. event.tab = this._tabs.toArray()[index];
  1497. }
  1498. return event;
  1499. }
  1500. /**
  1501. * Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
  1502. * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
  1503. * binding to be updated, we need to subscribe to changes in it and trigger change detection
  1504. * manually.
  1505. */
  1506. _subscribeToTabLabels() {
  1507. if (this._tabLabelSubscription) {
  1508. this._tabLabelSubscription.unsubscribe();
  1509. }
  1510. this._tabLabelSubscription = merge(...this._tabs.map(tab => tab._stateChanges)).subscribe(() => this._changeDetectorRef.markForCheck());
  1511. }
  1512. /** Clamps the given index to the bounds of 0 and the tabs length. */
  1513. _clampTabIndex(index) {
  1514. // Note the `|| 0`, which ensures that values like NaN can't get through
  1515. // and which would otherwise throw the component into an infinite loop
  1516. // (since Math.max(NaN, 0) === NaN).
  1517. return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
  1518. }
  1519. /** Returns a unique id for each tab label element */
  1520. _getTabLabelId(tab, index) {
  1521. return tab.id || `${this._groupId}-label-${index}`;
  1522. }
  1523. /** Returns a unique id for each tab content element */
  1524. _getTabContentId(index) {
  1525. return `${this._groupId}-content-${index}`;
  1526. }
  1527. /**
  1528. * Sets the height of the body wrapper to the height of the activating tab if dynamic
  1529. * height property is true.
  1530. */
  1531. _setTabBodyWrapperHeight(tabHeight) {
  1532. if (!this.dynamicHeight || !this._tabBodyWrapperHeight) {
  1533. this._tabBodyWrapperHeight = tabHeight;
  1534. return;
  1535. }
  1536. const wrapper = this._tabBodyWrapper.nativeElement;
  1537. wrapper.style.height = this._tabBodyWrapperHeight + 'px';
  1538. // This conditional forces the browser to paint the height so that
  1539. // the animation to the new height can have an origin.
  1540. if (this._tabBodyWrapper.nativeElement.offsetHeight) {
  1541. wrapper.style.height = tabHeight + 'px';
  1542. }
  1543. }
  1544. /** Removes the height of the tab body wrapper. */
  1545. _removeTabBodyWrapperHeight() {
  1546. const wrapper = this._tabBodyWrapper.nativeElement;
  1547. this._tabBodyWrapperHeight = wrapper.clientHeight;
  1548. wrapper.style.height = '';
  1549. this._ngZone.run(() => this.animationDone.emit());
  1550. }
  1551. /** Handle click events, setting new selected index if appropriate. */
  1552. _handleClick(tab, tabHeader, index) {
  1553. tabHeader.focusIndex = index;
  1554. if (!tab.disabled) {
  1555. this.selectedIndex = index;
  1556. }
  1557. }
  1558. /** Retrieves the tabindex for the tab. */
  1559. _getTabIndex(index) {
  1560. const targetIndex = this._lastFocusedTabIndex ?? this.selectedIndex;
  1561. return index === targetIndex ? 0 : -1;
  1562. }
  1563. /** Callback for when the focused state of a tab has changed. */
  1564. _tabFocusChanged(focusOrigin, index) {
  1565. // Mouse/touch focus happens during the `mousedown`/`touchstart` phase which
  1566. // can cause the tab to be moved out from under the pointer, interrupting the
  1567. // click sequence (see #21898). We don't need to scroll the tab into view for
  1568. // such cases anyway, because it will be done when the tab becomes selected.
  1569. if (focusOrigin && focusOrigin !== 'mouse' && focusOrigin !== 'touch') {
  1570. this._tabHeader.focusIndex = index;
  1571. }
  1572. }
  1573. /**
  1574. * Callback invoked when the centered state of a tab body changes.
  1575. * @param isCenter Whether the tab will be in the center.
  1576. */
  1577. _bodyCentered(isCenter) {
  1578. // Marks all the existing tabs as inactive and the center tab as active. Note that this can
  1579. // be achieved much easier by using a class binding on each body. The problem with
  1580. // doing so is that we can't control the timing of when the class is removed from the
  1581. // previously-active element and added to the newly-active one. If there's a tick between
  1582. // removing the class and adding the new one, the content will jump in a very jarring way.
  1583. // We go through the trouble of setting the classes ourselves to guarantee that they're
  1584. // swapped out at the same time.
  1585. if (isCenter) {
  1586. this._tabBodies?.forEach((body, i) => body._setActiveClass(i === this._selectedIndex));
  1587. }
  1588. }
  1589. _animationsDisabled() {
  1590. return (this._diAnimationsDisabled ||
  1591. this.animationDuration === '0' ||
  1592. this.animationDuration === '0ms');
  1593. }
  1594. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
  1595. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.6", type: MatTabGroup, isStandalone: true, selector: "mat-tab-group", inputs: { color: "color", fitInkBarToContent: ["fitInkBarToContent", "fitInkBarToContent", booleanAttribute], stretchTabs: ["mat-stretch-tabs", "stretchTabs", booleanAttribute], alignTabs: ["mat-align-tabs", "alignTabs"], dynamicHeight: ["dynamicHeight", "dynamicHeight", booleanAttribute], selectedIndex: ["selectedIndex", "selectedIndex", numberAttribute], headerPosition: "headerPosition", animationDuration: "animationDuration", contentTabIndex: ["contentTabIndex", "contentTabIndex", numberAttribute], disablePagination: ["disablePagination", "disablePagination", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute], preserveContent: ["preserveContent", "preserveContent", booleanAttribute], backgroundColor: "backgroundColor", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { selectedIndexChange: "selectedIndexChange", focusChange: "focusChange", animationDone: "animationDone", selectedTabChange: "selectedTabChange" }, host: { properties: { "class": "\"mat-\" + (color || \"primary\")", "class.mat-mdc-tab-group-dynamic-height": "dynamicHeight", "class.mat-mdc-tab-group-inverted-header": "headerPosition === \"below\"", "class.mat-mdc-tab-group-stretch-tabs": "stretchTabs", "attr.mat-align-tabs": "alignTabs", "style.--mat-tab-animation-duration": "animationDuration" }, classAttribute: "mat-mdc-tab-group" }, providers: [
  1596. {
  1597. provide: MAT_TAB_GROUP,
  1598. useExisting: MatTabGroup,
  1599. },
  1600. ], queries: [{ propertyName: "_allTabs", predicate: MatTab, descendants: true }], viewQueries: [{ propertyName: "_tabBodyWrapper", first: true, predicate: ["tabBodyWrapper"], descendants: true }, { propertyName: "_tabHeader", first: true, predicate: ["tabHeader"], descendants: true }, { propertyName: "_tabBodies", predicate: MatTabBody, descendants: true }], exportAs: ["matTabGroup"], ngImport: i0, template: "<mat-tab-header #tabHeader\n [selectedIndex]=\"selectedIndex || 0\"\n [disableRipple]=\"disableRipple\"\n [disablePagination]=\"disablePagination\"\n [aria-label]=\"ariaLabel\"\n [aria-labelledby]=\"ariaLabelledby\"\n (indexFocused)=\"_focusChanged($event)\"\n (selectFocusedIndex)=\"selectedIndex = $event\">\n\n @for (tab of _tabs; track tab) {\n <div class=\"mdc-tab mat-mdc-tab mat-focus-indicator\"\n #tabNode\n role=\"tab\"\n matTabLabelWrapper\n cdkMonitorElementFocus\n [id]=\"_getTabLabelId(tab, $index)\"\n [attr.tabIndex]=\"_getTabIndex($index)\"\n [attr.aria-posinset]=\"$index + 1\"\n [attr.aria-setsize]=\"_tabs.length\"\n [attr.aria-controls]=\"_getTabContentId($index)\"\n [attr.aria-selected]=\"selectedIndex === $index\"\n [attr.aria-label]=\"tab.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null\"\n [class.mdc-tab--active]=\"selectedIndex === $index\"\n [class]=\"tab.labelClass\"\n [disabled]=\"tab.disabled\"\n [fitInkBarToContent]=\"fitInkBarToContent\"\n (click)=\"_handleClick(tab, tabHeader, $index)\"\n (cdkFocusChange)=\"_tabFocusChanged($event, $index)\">\n <span class=\"mdc-tab__ripple\"></span>\n\n <!-- Needs to be a separate element, because we can't put\n `overflow: hidden` on tab due to the ink bar. -->\n <div\n class=\"mat-mdc-tab-ripple\"\n mat-ripple\n [matRippleTrigger]=\"tabNode\"\n [matRippleDisabled]=\"tab.disabled || disableRipple\"></div>\n\n <span class=\"mdc-tab__content\">\n <span class=\"mdc-tab__text-label\">\n <!--\n If there is a label template, use it, otherwise fall back to the text label.\n Note that we don't have indentation around the text label, because it adds\n whitespace around the text which breaks some internal tests.\n -->\n @if (tab.templateLabel) {\n <ng-template [cdkPortalOutlet]=\"tab.templateLabel\"></ng-template>\n } @else {{{tab.textLabel}}}\n </span>\n </span>\n </div>\n }\n</mat-tab-header>\n\n<!--\n We need to project the content somewhere to avoid hydration errors. Some observations:\n 1. This is only necessary on the server.\n 2. We get a hydration error if there aren't any nodes after the `ng-content`.\n 3. We get a hydration error if `ng-content` is wrapped in another element.\n-->\n@if (_isServer) {\n <ng-content/>\n}\n\n<div\n class=\"mat-mdc-tab-body-wrapper\"\n [class._mat-animation-noopable]=\"_animationsDisabled()\"\n #tabBodyWrapper>\n @for (tab of _tabs; track tab;) {\n <mat-tab-body role=\"tabpanel\"\n [id]=\"_getTabContentId($index)\"\n [attr.tabindex]=\"(contentTabIndex != null && selectedIndex === $index) ? contentTabIndex : null\"\n [attr.aria-labelledby]=\"_getTabLabelId(tab, $index)\"\n [attr.aria-hidden]=\"selectedIndex !== $index\"\n [class]=\"tab.bodyClass\"\n [content]=\"tab.content!\"\n [position]=\"tab.position!\"\n [animationDuration]=\"animationDuration\"\n [preserveContent]=\"preserveContent\"\n (_onCentered)=\"_removeTabBodyWrapperHeight()\"\n (_onCentering)=\"_setTabBodyWrapperHeight($event)\"\n (_beforeCentering)=\"_bodyCentered($event)\"/>\n }\n</div>\n", styles: [".mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab.mdc-tab{flex-grow:0}.mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab .mdc-tab__ripple::before{content:\"\";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-group.mat-mdc-tab-group-stretch-tabs>.mat-mdc-tab-header .mat-mdc-tab{flex-grow:1}.mat-mdc-tab-group{display:flex;flex-direction:column;max-width:100%}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-focus-indicator::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mdc-tab__ripple::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header{flex-direction:column-reverse}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header .mdc-tab-indicator__content--underline{align-self:flex-start}.mat-mdc-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height 500ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable{transition:none !important;animation:none !important}\n"], dependencies: [{ kind: "component", type: MatTabHeader, selector: "mat-tab-header", inputs: ["aria-label", "aria-labelledby", "disableRipple"] }, { kind: "directive", type: MatTabLabelWrapper, selector: "[matTabLabelWrapper]", inputs: ["disabled"] }, { kind: "directive", type: CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: MatTabBody, selector: "mat-tab-body", inputs: ["content", "animationDuration", "preserveContent", "position"], outputs: ["_onCentering", "_beforeCentering", "_onCentered"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
  1601. }
  1602. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabGroup, decorators: [{
  1603. type: Component,
  1604. args: [{ selector: 'mat-tab-group', exportAs: 'matTabGroup', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [
  1605. {
  1606. provide: MAT_TAB_GROUP,
  1607. useExisting: MatTabGroup,
  1608. },
  1609. ], host: {
  1610. 'class': 'mat-mdc-tab-group',
  1611. '[class]': '"mat-" + (color || "primary")',
  1612. '[class.mat-mdc-tab-group-dynamic-height]': 'dynamicHeight',
  1613. '[class.mat-mdc-tab-group-inverted-header]': 'headerPosition === "below"',
  1614. '[class.mat-mdc-tab-group-stretch-tabs]': 'stretchTabs',
  1615. '[attr.mat-align-tabs]': 'alignTabs',
  1616. '[style.--mat-tab-animation-duration]': 'animationDuration',
  1617. }, imports: [
  1618. MatTabHeader,
  1619. MatTabLabelWrapper,
  1620. CdkMonitorFocus,
  1621. MatRipple,
  1622. CdkPortalOutlet,
  1623. MatTabBody,
  1624. ], template: "<mat-tab-header #tabHeader\n [selectedIndex]=\"selectedIndex || 0\"\n [disableRipple]=\"disableRipple\"\n [disablePagination]=\"disablePagination\"\n [aria-label]=\"ariaLabel\"\n [aria-labelledby]=\"ariaLabelledby\"\n (indexFocused)=\"_focusChanged($event)\"\n (selectFocusedIndex)=\"selectedIndex = $event\">\n\n @for (tab of _tabs; track tab) {\n <div class=\"mdc-tab mat-mdc-tab mat-focus-indicator\"\n #tabNode\n role=\"tab\"\n matTabLabelWrapper\n cdkMonitorElementFocus\n [id]=\"_getTabLabelId(tab, $index)\"\n [attr.tabIndex]=\"_getTabIndex($index)\"\n [attr.aria-posinset]=\"$index + 1\"\n [attr.aria-setsize]=\"_tabs.length\"\n [attr.aria-controls]=\"_getTabContentId($index)\"\n [attr.aria-selected]=\"selectedIndex === $index\"\n [attr.aria-label]=\"tab.ariaLabel || null\"\n [attr.aria-labelledby]=\"(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null\"\n [class.mdc-tab--active]=\"selectedIndex === $index\"\n [class]=\"tab.labelClass\"\n [disabled]=\"tab.disabled\"\n [fitInkBarToContent]=\"fitInkBarToContent\"\n (click)=\"_handleClick(tab, tabHeader, $index)\"\n (cdkFocusChange)=\"_tabFocusChanged($event, $index)\">\n <span class=\"mdc-tab__ripple\"></span>\n\n <!-- Needs to be a separate element, because we can't put\n `overflow: hidden` on tab due to the ink bar. -->\n <div\n class=\"mat-mdc-tab-ripple\"\n mat-ripple\n [matRippleTrigger]=\"tabNode\"\n [matRippleDisabled]=\"tab.disabled || disableRipple\"></div>\n\n <span class=\"mdc-tab__content\">\n <span class=\"mdc-tab__text-label\">\n <!--\n If there is a label template, use it, otherwise fall back to the text label.\n Note that we don't have indentation around the text label, because it adds\n whitespace around the text which breaks some internal tests.\n -->\n @if (tab.templateLabel) {\n <ng-template [cdkPortalOutlet]=\"tab.templateLabel\"></ng-template>\n } @else {{{tab.textLabel}}}\n </span>\n </span>\n </div>\n }\n</mat-tab-header>\n\n<!--\n We need to project the content somewhere to avoid hydration errors. Some observations:\n 1. This is only necessary on the server.\n 2. We get a hydration error if there aren't any nodes after the `ng-content`.\n 3. We get a hydration error if `ng-content` is wrapped in another element.\n-->\n@if (_isServer) {\n <ng-content/>\n}\n\n<div\n class=\"mat-mdc-tab-body-wrapper\"\n [class._mat-animation-noopable]=\"_animationsDisabled()\"\n #tabBodyWrapper>\n @for (tab of _tabs; track tab;) {\n <mat-tab-body role=\"tabpanel\"\n [id]=\"_getTabContentId($index)\"\n [attr.tabindex]=\"(contentTabIndex != null && selectedIndex === $index) ? contentTabIndex : null\"\n [attr.aria-labelledby]=\"_getTabLabelId(tab, $index)\"\n [attr.aria-hidden]=\"selectedIndex !== $index\"\n [class]=\"tab.bodyClass\"\n [content]=\"tab.content!\"\n [position]=\"tab.position!\"\n [animationDuration]=\"animationDuration\"\n [preserveContent]=\"preserveContent\"\n (_onCentered)=\"_removeTabBodyWrapperHeight()\"\n (_onCentering)=\"_setTabBodyWrapperHeight($event)\"\n (_beforeCentering)=\"_bodyCentered($event)\"/>\n }\n</div>\n", styles: [".mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab.mdc-tab{flex-grow:0}.mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab .mdc-tab__ripple::before{content:\"\";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-group.mat-mdc-tab-group-stretch-tabs>.mat-mdc-tab-header .mat-mdc-tab{flex-grow:1}.mat-mdc-tab-group{display:flex;flex-direction:column;max-width:100%}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-focus-indicator::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mdc-tab__ripple::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header{flex-direction:column-reverse}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header .mdc-tab-indicator__content--underline{align-self:flex-start}.mat-mdc-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height 500ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable{transition:none !important;animation:none !important}\n"] }]
  1625. }], ctorParameters: () => [], propDecorators: { _allTabs: [{
  1626. type: ContentChildren,
  1627. args: [MatTab, { descendants: true }]
  1628. }], _tabBodies: [{
  1629. type: ViewChildren,
  1630. args: [MatTabBody]
  1631. }], _tabBodyWrapper: [{
  1632. type: ViewChild,
  1633. args: ['tabBodyWrapper']
  1634. }], _tabHeader: [{
  1635. type: ViewChild,
  1636. args: ['tabHeader']
  1637. }], color: [{
  1638. type: Input
  1639. }], fitInkBarToContent: [{
  1640. type: Input,
  1641. args: [{ transform: booleanAttribute }]
  1642. }], stretchTabs: [{
  1643. type: Input,
  1644. args: [{ alias: 'mat-stretch-tabs', transform: booleanAttribute }]
  1645. }], alignTabs: [{
  1646. type: Input,
  1647. args: [{ alias: 'mat-align-tabs' }]
  1648. }], dynamicHeight: [{
  1649. type: Input,
  1650. args: [{ transform: booleanAttribute }]
  1651. }], selectedIndex: [{
  1652. type: Input,
  1653. args: [{ transform: numberAttribute }]
  1654. }], headerPosition: [{
  1655. type: Input
  1656. }], animationDuration: [{
  1657. type: Input
  1658. }], contentTabIndex: [{
  1659. type: Input,
  1660. args: [{ transform: numberAttribute }]
  1661. }], disablePagination: [{
  1662. type: Input,
  1663. args: [{ transform: booleanAttribute }]
  1664. }], disableRipple: [{
  1665. type: Input,
  1666. args: [{ transform: booleanAttribute }]
  1667. }], preserveContent: [{
  1668. type: Input,
  1669. args: [{ transform: booleanAttribute }]
  1670. }], backgroundColor: [{
  1671. type: Input
  1672. }], ariaLabel: [{
  1673. type: Input,
  1674. args: ['aria-label']
  1675. }], ariaLabelledby: [{
  1676. type: Input,
  1677. args: ['aria-labelledby']
  1678. }], selectedIndexChange: [{
  1679. type: Output
  1680. }], focusChange: [{
  1681. type: Output
  1682. }], animationDone: [{
  1683. type: Output
  1684. }], selectedTabChange: [{
  1685. type: Output
  1686. }] } });
  1687. /** A simple change event emitted on focus or selection changes. */
  1688. class MatTabChangeEvent {
  1689. /** Index of the currently-selected tab. */
  1690. index;
  1691. /** Reference to the currently-selected tab. */
  1692. tab;
  1693. }
  1694. /**
  1695. * Navigation component matching the styles of the tab group header.
  1696. * Provides anchored navigation with animated ink bar.
  1697. */
  1698. class MatTabNav extends MatPaginatedTabHeader {
  1699. _focusedItem = signal(null);
  1700. /** Whether the ink bar should fit its width to the size of the tab label content. */
  1701. get fitInkBarToContent() {
  1702. return this._fitInkBarToContent.value;
  1703. }
  1704. set fitInkBarToContent(value) {
  1705. this._fitInkBarToContent.next(value);
  1706. this._changeDetectorRef.markForCheck();
  1707. }
  1708. _fitInkBarToContent = new BehaviorSubject(false);
  1709. /** Whether tabs should be stretched to fill the header. */
  1710. stretchTabs = true;
  1711. get animationDuration() {
  1712. return this._animationDuration;
  1713. }
  1714. set animationDuration(value) {
  1715. const stringValue = value + '';
  1716. this._animationDuration = /^\d+$/.test(stringValue) ? value + 'ms' : stringValue;
  1717. }
  1718. _animationDuration;
  1719. /** Query list of all tab links of the tab navigation. */
  1720. _items;
  1721. /**
  1722. * Theme color of the background of the tab nav. This API is supported in M2 themes only, it
  1723. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/tabs/styling.
  1724. *
  1725. * For information on applying color variants in M3, see
  1726. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  1727. */
  1728. get backgroundColor() {
  1729. return this._backgroundColor;
  1730. }
  1731. set backgroundColor(value) {
  1732. const classList = this._elementRef.nativeElement.classList;
  1733. classList.remove('mat-tabs-with-background', `mat-background-${this.backgroundColor}`);
  1734. if (value) {
  1735. classList.add('mat-tabs-with-background', `mat-background-${value}`);
  1736. }
  1737. this._backgroundColor = value;
  1738. }
  1739. _backgroundColor;
  1740. /** Whether the ripple effect is disabled or not. */
  1741. disableRipple = false;
  1742. /**
  1743. * Theme color of the nav bar. This API is supported in M2 themes only, it has
  1744. * no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/tabs/styling.
  1745. *
  1746. * For information on applying color variants in M3, see
  1747. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  1748. */
  1749. color = 'primary';
  1750. /**
  1751. * Associated tab panel controlled by the nav bar. If not provided, then the nav bar
  1752. * follows the ARIA link / navigation landmark pattern. If provided, it follows the
  1753. * ARIA tabs design pattern.
  1754. */
  1755. tabPanel;
  1756. _tabListContainer;
  1757. _tabList;
  1758. _tabListInner;
  1759. _nextPaginator;
  1760. _previousPaginator;
  1761. _inkBar;
  1762. constructor() {
  1763. const elementRef = inject(ElementRef);
  1764. const dir = inject(Directionality, { optional: true });
  1765. const ngZone = inject(NgZone);
  1766. const changeDetectorRef = inject(ChangeDetectorRef);
  1767. const viewportRuler = inject(ViewportRuler);
  1768. const platform = inject(Platform);
  1769. const animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
  1770. const defaultConfig = inject(MAT_TABS_CONFIG, { optional: true });
  1771. super(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform, animationMode);
  1772. this.disablePagination =
  1773. defaultConfig && defaultConfig.disablePagination != null
  1774. ? defaultConfig.disablePagination
  1775. : false;
  1776. this.fitInkBarToContent =
  1777. defaultConfig && defaultConfig.fitInkBarToContent != null
  1778. ? defaultConfig.fitInkBarToContent
  1779. : false;
  1780. this.stretchTabs =
  1781. defaultConfig && defaultConfig.stretchTabs != null ? defaultConfig.stretchTabs : true;
  1782. }
  1783. _itemSelected() {
  1784. // noop
  1785. }
  1786. ngAfterContentInit() {
  1787. this._inkBar = new MatInkBar(this._items);
  1788. // We need this to run before the `changes` subscription in parent to ensure that the
  1789. // selectedIndex is up-to-date by the time the super class starts looking for it.
  1790. this._items.changes
  1791. .pipe(startWith(null), takeUntil(this._destroyed))
  1792. .subscribe(() => this.updateActiveLink());
  1793. super.ngAfterContentInit();
  1794. // Turn the `change` stream into a signal to try and avoid "changed after checked" errors.
  1795. this._keyManager.change.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => this._focusedItem.set(this._keyManager?.activeItem || null));
  1796. }
  1797. ngAfterViewInit() {
  1798. if (!this.tabPanel && (typeof ngDevMode === 'undefined' || ngDevMode)) {
  1799. throw new Error('A mat-tab-nav-panel must be specified via [tabPanel].');
  1800. }
  1801. super.ngAfterViewInit();
  1802. }
  1803. /** Notifies the component that the active link has been changed. */
  1804. updateActiveLink() {
  1805. if (!this._items) {
  1806. return;
  1807. }
  1808. const items = this._items.toArray();
  1809. for (let i = 0; i < items.length; i++) {
  1810. if (items[i].active) {
  1811. this.selectedIndex = i;
  1812. if (this.tabPanel) {
  1813. this.tabPanel._activeTabId = items[i].id;
  1814. }
  1815. // Updating the `selectedIndex` won't trigger the `change` event on
  1816. // the key manager so we need to set the signal from here.
  1817. this._focusedItem.set(items[i]);
  1818. this._changeDetectorRef.markForCheck();
  1819. return;
  1820. }
  1821. }
  1822. this.selectedIndex = -1;
  1823. }
  1824. _getRole() {
  1825. return this.tabPanel ? 'tablist' : this._elementRef.nativeElement.getAttribute('role');
  1826. }
  1827. _hasFocus(link) {
  1828. return this._keyManager?.activeItem === link;
  1829. }
  1830. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabNav, deps: [], target: i0.ɵɵFactoryTarget.Component });
  1831. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatTabNav, isStandalone: true, selector: "[mat-tab-nav-bar]", inputs: { fitInkBarToContent: ["fitInkBarToContent", "fitInkBarToContent", booleanAttribute], stretchTabs: ["mat-stretch-tabs", "stretchTabs", booleanAttribute], animationDuration: "animationDuration", backgroundColor: "backgroundColor", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], color: "color", tabPanel: "tabPanel" }, host: { properties: { "attr.role": "_getRole()", "class.mat-mdc-tab-header-pagination-controls-enabled": "_showPaginationControls", "class.mat-mdc-tab-header-rtl": "_getLayoutDirection() == 'rtl'", "class.mat-mdc-tab-nav-bar-stretch-tabs": "stretchTabs", "class.mat-primary": "color !== \"warn\" && color !== \"accent\"", "class.mat-accent": "color === \"accent\"", "class.mat-warn": "color === \"warn\"", "class._mat-animation-noopable": "_animationMode === \"NoopAnimations\"", "style.--mat-tab-animation-duration": "animationDuration" }, classAttribute: "mat-mdc-tab-nav-bar mat-mdc-tab-header" }, queries: [{ propertyName: "_items", predicate: i0.forwardRef(() => MatTabLink), descendants: true }], viewQueries: [{ propertyName: "_tabListContainer", first: true, predicate: ["tabListContainer"], descendants: true, static: true }, { propertyName: "_tabList", first: true, predicate: ["tabList"], descendants: true, static: true }, { propertyName: "_tabListInner", first: true, predicate: ["tabListInner"], descendants: true, static: true }, { propertyName: "_nextPaginator", first: true, predicate: ["nextPaginator"], descendants: true }, { propertyName: "_previousPaginator", first: true, predicate: ["previousPaginator"], descendants: true }], exportAs: ["matTabNavBar", "matTabNav"], usesInheritance: true, ngImport: i0, template: "<!--\n Note that this intentionally uses a `div` instead of a `button`, because it's not part of\n the regular tabs flow and is only here to support mouse users. It should also not be focusable.\n-->\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-before\"\n #previousPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollBefore || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollBefore\"\n (click)=\"_handlePaginatorClick('before')\"\n (mousedown)=\"_handlePaginatorPress('before', $event)\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n\n<div class=\"mat-mdc-tab-link-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\">\n <div class=\"mat-mdc-tab-list\" #tabList (cdkObserveContent)=\"_onContentChanges()\">\n <div class=\"mat-mdc-tab-links\" #tabListInner>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-after\"\n #nextPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollAfter || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollAfter\"\n (mousedown)=\"_handlePaginatorPress('after', $event)\"\n (click)=\"_handlePaginatorClick('after')\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n", styles: [".mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-links{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-link-container .mat-mdc-tab-links{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-link-container .mat-mdc-tab-links{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-links,.mat-mdc-tab-links.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab-link-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background.mat-primary>.mat-mdc-tab-link-container .mat-mdc-tab-link .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background.mat-primary>.mat-mdc-tab-link-container .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-link-container .mat-mdc-tab-link:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-link-container .mat-mdc-tab-link:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-focus-indicator::before,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-ripple-element,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mdc-tab__ripple::before,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}\n"], dependencies: [{ kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "directive", type: CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
  1832. }
  1833. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabNav, decorators: [{
  1834. type: Component,
  1835. args: [{ selector: '[mat-tab-nav-bar]', exportAs: 'matTabNavBar, matTabNav', host: {
  1836. '[attr.role]': '_getRole()',
  1837. 'class': 'mat-mdc-tab-nav-bar mat-mdc-tab-header',
  1838. '[class.mat-mdc-tab-header-pagination-controls-enabled]': '_showPaginationControls',
  1839. '[class.mat-mdc-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
  1840. '[class.mat-mdc-tab-nav-bar-stretch-tabs]': 'stretchTabs',
  1841. '[class.mat-primary]': 'color !== "warn" && color !== "accent"',
  1842. '[class.mat-accent]': 'color === "accent"',
  1843. '[class.mat-warn]': 'color === "warn"',
  1844. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  1845. '[style.--mat-tab-animation-duration]': 'animationDuration',
  1846. }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [MatRipple, CdkObserveContent], template: "<!--\n Note that this intentionally uses a `div` instead of a `button`, because it's not part of\n the regular tabs flow and is only here to support mouse users. It should also not be focusable.\n-->\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-before\"\n #previousPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollBefore || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollBefore\"\n (click)=\"_handlePaginatorClick('before')\"\n (mousedown)=\"_handlePaginatorPress('before', $event)\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n\n<div class=\"mat-mdc-tab-link-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\">\n <div class=\"mat-mdc-tab-list\" #tabList (cdkObserveContent)=\"_onContentChanges()\">\n <div class=\"mat-mdc-tab-links\" #tabListInner>\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n\n<div class=\"mat-mdc-tab-header-pagination mat-mdc-tab-header-pagination-after\"\n #nextPaginator\n mat-ripple\n [matRippleDisabled]=\"_disableScrollAfter || disableRipple\"\n [class.mat-mdc-tab-header-pagination-disabled]=\"_disableScrollAfter\"\n (mousedown)=\"_handlePaginatorPress('after', $event)\"\n (click)=\"_handlePaginatorClick('after')\"\n (touchend)=\"_stopInterval()\">\n <div class=\"mat-mdc-tab-header-pagination-chevron\"></div>\n</div>\n", styles: [".mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-links{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-link-container .mat-mdc-tab-links{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-link-container .mat-mdc-tab-links{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-links,.mat-mdc-tab-links.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab-link-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background.mat-primary>.mat-mdc-tab-link-container .mat-mdc-tab-link .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background.mat-primary>.mat-mdc-tab-link-container .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-link-container .mat-mdc-tab-link:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-link-container .mat-mdc-tab-link:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-focus-indicator::before,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-ripple-element,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mdc-tab__ripple::before,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-link-container .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-nav-bar.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}\n"] }]
  1847. }], ctorParameters: () => [], propDecorators: { fitInkBarToContent: [{
  1848. type: Input,
  1849. args: [{ transform: booleanAttribute }]
  1850. }], stretchTabs: [{
  1851. type: Input,
  1852. args: [{ alias: 'mat-stretch-tabs', transform: booleanAttribute }]
  1853. }], animationDuration: [{
  1854. type: Input
  1855. }], _items: [{
  1856. type: ContentChildren,
  1857. args: [forwardRef(() => MatTabLink), { descendants: true }]
  1858. }], backgroundColor: [{
  1859. type: Input
  1860. }], disableRipple: [{
  1861. type: Input,
  1862. args: [{ transform: booleanAttribute }]
  1863. }], color: [{
  1864. type: Input
  1865. }], tabPanel: [{
  1866. type: Input
  1867. }], _tabListContainer: [{
  1868. type: ViewChild,
  1869. args: ['tabListContainer', { static: true }]
  1870. }], _tabList: [{
  1871. type: ViewChild,
  1872. args: ['tabList', { static: true }]
  1873. }], _tabListInner: [{
  1874. type: ViewChild,
  1875. args: ['tabListInner', { static: true }]
  1876. }], _nextPaginator: [{
  1877. type: ViewChild,
  1878. args: ['nextPaginator']
  1879. }], _previousPaginator: [{
  1880. type: ViewChild,
  1881. args: ['previousPaginator']
  1882. }] } });
  1883. /**
  1884. * Link inside a `mat-tab-nav-bar`.
  1885. */
  1886. class MatTabLink extends InkBarItem {
  1887. _tabNavBar = inject(MatTabNav);
  1888. elementRef = inject(ElementRef);
  1889. _focusMonitor = inject(FocusMonitor);
  1890. _destroyed = new Subject();
  1891. /** Whether the tab link is active or not. */
  1892. _isActive = false;
  1893. _tabIndex = computed(() => this._tabNavBar._focusedItem() === this ? this.tabIndex : -1);
  1894. /** Whether the link is active. */
  1895. get active() {
  1896. return this._isActive;
  1897. }
  1898. set active(value) {
  1899. if (value !== this._isActive) {
  1900. this._isActive = value;
  1901. this._tabNavBar.updateActiveLink();
  1902. }
  1903. }
  1904. /** Whether the tab link is disabled. */
  1905. disabled = false;
  1906. /** Whether ripples are disabled on the tab link. */
  1907. disableRipple = false;
  1908. tabIndex = 0;
  1909. /**
  1910. * Ripple configuration for ripples that are launched on pointer down. The ripple config
  1911. * is set to the global ripple options since we don't have any configurable options for
  1912. * the tab link ripples.
  1913. * @docs-private
  1914. */
  1915. rippleConfig;
  1916. /**
  1917. * Whether ripples are disabled on interaction.
  1918. * @docs-private
  1919. */
  1920. get rippleDisabled() {
  1921. return (this.disabled ||
  1922. this.disableRipple ||
  1923. this._tabNavBar.disableRipple ||
  1924. !!this.rippleConfig.disabled);
  1925. }
  1926. /** Unique id for the tab. */
  1927. id = inject(_IdGenerator).getId('mat-tab-link-');
  1928. constructor() {
  1929. super();
  1930. inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
  1931. const globalRippleOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, {
  1932. optional: true,
  1933. });
  1934. const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
  1935. const animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
  1936. this.rippleConfig = globalRippleOptions || {};
  1937. this.tabIndex = tabIndex == null ? 0 : parseInt(tabIndex) || 0;
  1938. if (animationMode === 'NoopAnimations') {
  1939. this.rippleConfig.animation = { enterDuration: 0, exitDuration: 0 };
  1940. }
  1941. this._tabNavBar._fitInkBarToContent
  1942. .pipe(takeUntil(this._destroyed))
  1943. .subscribe(fitInkBarToContent => {
  1944. this.fitInkBarToContent = fitInkBarToContent;
  1945. });
  1946. }
  1947. /** Focuses the tab link. */
  1948. focus() {
  1949. this.elementRef.nativeElement.focus();
  1950. }
  1951. ngAfterViewInit() {
  1952. this._focusMonitor.monitor(this.elementRef);
  1953. }
  1954. ngOnDestroy() {
  1955. this._destroyed.next();
  1956. this._destroyed.complete();
  1957. super.ngOnDestroy();
  1958. this._focusMonitor.stopMonitoring(this.elementRef);
  1959. }
  1960. _handleFocus() {
  1961. // Since we allow navigation through tabbing in the nav bar, we
  1962. // have to update the focused index whenever the link receives focus.
  1963. this._tabNavBar.focusIndex = this._tabNavBar._items.toArray().indexOf(this);
  1964. }
  1965. _handleKeydown(event) {
  1966. if (event.keyCode === SPACE || event.keyCode === ENTER) {
  1967. if (this.disabled) {
  1968. event.preventDefault();
  1969. }
  1970. else if (this._tabNavBar.tabPanel) {
  1971. // Only prevent the default action on space since it can scroll the page.
  1972. // Don't prevent enter since it can break link navigation.
  1973. if (event.keyCode === SPACE) {
  1974. event.preventDefault();
  1975. }
  1976. this.elementRef.nativeElement.click();
  1977. }
  1978. }
  1979. }
  1980. _getAriaControls() {
  1981. return this._tabNavBar.tabPanel
  1982. ? this._tabNavBar.tabPanel?.id
  1983. : this.elementRef.nativeElement.getAttribute('aria-controls');
  1984. }
  1985. _getAriaSelected() {
  1986. if (this._tabNavBar.tabPanel) {
  1987. return this.active ? 'true' : 'false';
  1988. }
  1989. else {
  1990. return this.elementRef.nativeElement.getAttribute('aria-selected');
  1991. }
  1992. }
  1993. _getAriaCurrent() {
  1994. return this.active && !this._tabNavBar.tabPanel ? 'page' : null;
  1995. }
  1996. _getRole() {
  1997. return this._tabNavBar.tabPanel ? 'tab' : this.elementRef.nativeElement.getAttribute('role');
  1998. }
  1999. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLink, deps: [], target: i0.ɵɵFactoryTarget.Component });
  2000. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatTabLink, isStandalone: true, selector: "[mat-tab-link], [matTabLink]", inputs: { active: ["active", "active", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute], tabIndex: ["tabIndex", "tabIndex", (value) => (value == null ? 0 : numberAttribute(value))], id: "id" }, host: { listeners: { "focus": "_handleFocus()", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-controls": "_getAriaControls()", "attr.aria-current": "_getAriaCurrent()", "attr.aria-disabled": "disabled", "attr.aria-selected": "_getAriaSelected()", "attr.id": "id", "attr.tabIndex": "_tabIndex()", "attr.role": "_getRole()", "class.mat-mdc-tab-disabled": "disabled", "class.mdc-tab--active": "active" }, classAttribute: "mdc-tab mat-mdc-tab-link mat-focus-indicator" }, exportAs: ["matTabLink"], usesInheritance: true, ngImport: i0, template: "<span class=\"mdc-tab__ripple\"></span>\n\n<div\n class=\"mat-mdc-tab-ripple\"\n mat-ripple\n [matRippleTrigger]=\"elementRef.nativeElement\"\n [matRippleDisabled]=\"rippleDisabled\"></div>\n\n<span class=\"mdc-tab__content\">\n <span class=\"mdc-tab__text-label\">\n <ng-content></ng-content>\n </span>\n</span>\n\n", styles: [".mat-mdc-tab-link{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab-link.mdc-tab{flex-grow:0}.mat-mdc-tab-link .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab-link:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab-link.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab-link.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab-link.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab-link.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab-link.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab-link.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab-link .mdc-tab__ripple::before{content:\"\";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab-link .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab-link:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab-link.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab-link.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab-link .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header.mat-mdc-tab-nav-bar-stretch-tabs .mat-mdc-tab-link{flex-grow:1}.mat-mdc-tab-link::before{margin:5px}@media(max-width: 599px){.mat-mdc-tab-link{min-width:72px}}\n"], dependencies: [{ kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  2001. }
  2002. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabLink, decorators: [{
  2003. type: Component,
  2004. args: [{ selector: '[mat-tab-link], [matTabLink]', exportAs: 'matTabLink', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
  2005. 'class': 'mdc-tab mat-mdc-tab-link mat-focus-indicator',
  2006. '[attr.aria-controls]': '_getAriaControls()',
  2007. '[attr.aria-current]': '_getAriaCurrent()',
  2008. '[attr.aria-disabled]': 'disabled',
  2009. '[attr.aria-selected]': '_getAriaSelected()',
  2010. '[attr.id]': 'id',
  2011. '[attr.tabIndex]': '_tabIndex()',
  2012. '[attr.role]': '_getRole()',
  2013. '[class.mat-mdc-tab-disabled]': 'disabled',
  2014. '[class.mdc-tab--active]': 'active',
  2015. '(focus)': '_handleFocus()',
  2016. '(keydown)': '_handleKeydown($event)',
  2017. }, imports: [MatRipple], template: "<span class=\"mdc-tab__ripple\"></span>\n\n<div\n class=\"mat-mdc-tab-ripple\"\n mat-ripple\n [matRippleTrigger]=\"elementRef.nativeElement\"\n [matRippleDisabled]=\"rippleDisabled\"></div>\n\n<span class=\"mdc-tab__content\">\n <span class=\"mdc-tab__text-label\">\n <ng-content></ng-content>\n </span>\n</span>\n\n", styles: [".mat-mdc-tab-link{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab-link.mdc-tab{flex-grow:0}.mat-mdc-tab-link .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab-link:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab-link.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab-link.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab-link.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab-link.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab-link.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab-link.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab-link .mdc-tab__ripple::before{content:\"\";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-link .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab-link .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab-link:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab-link.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab-link.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab-link .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header.mat-mdc-tab-nav-bar-stretch-tabs .mat-mdc-tab-link{flex-grow:1}.mat-mdc-tab-link::before{margin:5px}@media(max-width: 599px){.mat-mdc-tab-link{min-width:72px}}\n"] }]
  2018. }], ctorParameters: () => [], propDecorators: { active: [{
  2019. type: Input,
  2020. args: [{ transform: booleanAttribute }]
  2021. }], disabled: [{
  2022. type: Input,
  2023. args: [{ transform: booleanAttribute }]
  2024. }], disableRipple: [{
  2025. type: Input,
  2026. args: [{ transform: booleanAttribute }]
  2027. }], tabIndex: [{
  2028. type: Input,
  2029. args: [{
  2030. transform: (value) => (value == null ? 0 : numberAttribute(value)),
  2031. }]
  2032. }], id: [{
  2033. type: Input
  2034. }] } });
  2035. /**
  2036. * Tab panel component associated with MatTabNav.
  2037. */
  2038. class MatTabNavPanel {
  2039. /** Unique id for the tab panel. */
  2040. id = inject(_IdGenerator).getId('mat-tab-nav-panel-');
  2041. /** Id of the active tab in the nav bar. */
  2042. _activeTabId;
  2043. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabNavPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
  2044. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: MatTabNavPanel, isStandalone: true, selector: "mat-tab-nav-panel", inputs: { id: "id" }, host: { attributes: { "role": "tabpanel" }, properties: { "attr.aria-labelledby": "_activeTabId", "attr.id": "id" }, classAttribute: "mat-mdc-tab-nav-panel" }, exportAs: ["matTabNavPanel"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  2045. }
  2046. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabNavPanel, decorators: [{
  2047. type: Component,
  2048. args: [{
  2049. selector: 'mat-tab-nav-panel',
  2050. exportAs: 'matTabNavPanel',
  2051. template: '<ng-content></ng-content>',
  2052. host: {
  2053. '[attr.aria-labelledby]': '_activeTabId',
  2054. '[attr.id]': 'id',
  2055. 'class': 'mat-mdc-tab-nav-panel',
  2056. 'role': 'tabpanel',
  2057. },
  2058. encapsulation: ViewEncapsulation.None,
  2059. changeDetection: ChangeDetectionStrategy.OnPush,
  2060. }]
  2061. }], propDecorators: { id: [{
  2062. type: Input
  2063. }] } });
  2064. class MatTabsModule {
  2065. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  2066. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: MatTabsModule, imports: [MatCommonModule,
  2067. MatTabContent,
  2068. MatTabLabel,
  2069. MatTab,
  2070. MatTabGroup,
  2071. MatTabNav,
  2072. MatTabNavPanel,
  2073. MatTabLink], exports: [MatCommonModule,
  2074. MatTabContent,
  2075. MatTabLabel,
  2076. MatTab,
  2077. MatTabGroup,
  2078. MatTabNav,
  2079. MatTabNavPanel,
  2080. MatTabLink] });
  2081. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabsModule, imports: [MatCommonModule, MatCommonModule] });
  2082. }
  2083. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatTabsModule, decorators: [{
  2084. type: NgModule,
  2085. args: [{
  2086. imports: [
  2087. MatCommonModule,
  2088. MatTabContent,
  2089. MatTabLabel,
  2090. MatTab,
  2091. MatTabGroup,
  2092. MatTabNav,
  2093. MatTabNavPanel,
  2094. MatTabLink,
  2095. ],
  2096. exports: [
  2097. MatCommonModule,
  2098. MatTabContent,
  2099. MatTabLabel,
  2100. MatTab,
  2101. MatTabGroup,
  2102. MatTabNav,
  2103. MatTabNavPanel,
  2104. MatTabLink,
  2105. ],
  2106. }]
  2107. }] });
  2108. /**
  2109. * Animations used by the Material tabs.
  2110. * @docs-private
  2111. * @deprecated No longer used, will be removed.
  2112. * @breaking-change 21.0.0.
  2113. */
  2114. const matTabsAnimations = {
  2115. // Represents:
  2116. // trigger('translateTab', [
  2117. // // Transitions to `none` instead of 0, because some browsers might blur the content.
  2118. // state(
  2119. // 'center, void, left-origin-center, right-origin-center',
  2120. // style({transform: 'none', visibility: 'visible'}),
  2121. // ),
  2122. // // If the tab is either on the left or right, we additionally add a `min-height` of 1px
  2123. // // in order to ensure that the element has a height before its state changes. This is
  2124. // // necessary because Chrome does seem to skip the transition in RTL mode if the element does
  2125. // // not have a static height and is not rendered. See related issue: #9465
  2126. // state(
  2127. // 'left',
  2128. // style({
  2129. // transform: 'translate3d(-100%, 0, 0)',
  2130. // minHeight: '1px',
  2131. // // Normally this is redundant since we detach the content from the DOM, but if the user
  2132. // // opted into keeping the content in the DOM, we have to hide it so it isn't focusable.
  2133. // visibility: 'hidden',
  2134. // }),
  2135. // ),
  2136. // state(
  2137. // 'right',
  2138. // style({
  2139. // transform: 'translate3d(100%, 0, 0)',
  2140. // minHeight: '1px',
  2141. // visibility: 'hidden',
  2142. // }),
  2143. // ),
  2144. // transition(
  2145. // '* => left, * => right, left => center, right => center',
  2146. // animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)'),
  2147. // ),
  2148. // transition('void => left-origin-center', [
  2149. // style({transform: 'translate3d(-100%, 0, 0)', visibility: 'hidden'}),
  2150. // animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)'),
  2151. // ]),
  2152. // transition('void => right-origin-center', [
  2153. // style({transform: 'translate3d(100%, 0, 0)', visibility: 'hidden'}),
  2154. // animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)'),
  2155. // ]),
  2156. // ])
  2157. /** Animation translates a tab along the X axis. */
  2158. translateTab: {
  2159. type: 7,
  2160. name: 'translateTab',
  2161. definitions: [
  2162. {
  2163. type: 0,
  2164. name: 'center, void, left-origin-center, right-origin-center',
  2165. styles: {
  2166. type: 6,
  2167. styles: { transform: 'none', visibility: 'visible' },
  2168. offset: null,
  2169. },
  2170. },
  2171. {
  2172. type: 0,
  2173. name: 'left',
  2174. styles: {
  2175. type: 6,
  2176. styles: {
  2177. transform: 'translate3d(-100%, 0, 0)',
  2178. minHeight: '1px',
  2179. visibility: 'hidden',
  2180. },
  2181. offset: null,
  2182. },
  2183. },
  2184. {
  2185. type: 0,
  2186. name: 'right',
  2187. styles: {
  2188. type: 6,
  2189. styles: {
  2190. transform: 'translate3d(100%, 0, 0)',
  2191. minHeight: '1px',
  2192. visibility: 'hidden',
  2193. },
  2194. offset: null,
  2195. },
  2196. },
  2197. {
  2198. type: 1,
  2199. expr: '* => left, * => right, left => center, right => center',
  2200. animation: {
  2201. type: 4,
  2202. styles: null,
  2203. timings: '{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)',
  2204. },
  2205. options: null,
  2206. },
  2207. {
  2208. type: 1,
  2209. expr: 'void => left-origin-center',
  2210. animation: [
  2211. {
  2212. type: 6,
  2213. styles: { transform: 'translate3d(-100%, 0, 0)', visibility: 'hidden' },
  2214. offset: null,
  2215. },
  2216. {
  2217. type: 4,
  2218. styles: null,
  2219. timings: '{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)',
  2220. },
  2221. ],
  2222. options: null,
  2223. },
  2224. {
  2225. type: 1,
  2226. expr: 'void => right-origin-center',
  2227. animation: [
  2228. {
  2229. type: 6,
  2230. styles: { transform: 'translate3d(100%, 0, 0)', visibility: 'hidden' },
  2231. offset: null,
  2232. },
  2233. {
  2234. type: 4,
  2235. styles: null,
  2236. timings: '{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)',
  2237. },
  2238. ],
  2239. options: null,
  2240. },
  2241. ],
  2242. options: {},
  2243. },
  2244. };
  2245. export { MAT_TAB, MAT_TABS_CONFIG, MAT_TAB_CONTENT, MAT_TAB_GROUP, MAT_TAB_LABEL, MatInkBar, MatPaginatedTabHeader, MatTab, MatTabBody, MatTabBodyPortal, MatTabChangeEvent, MatTabContent, MatTabGroup, MatTabHeader, MatTabLabel, MatTabLabelWrapper, MatTabLink, MatTabNav, MatTabNavPanel, MatTabsModule, _MAT_INK_BAR_POSITIONER, _MAT_INK_BAR_POSITIONER_FACTORY, matTabsAnimations };
  2246. //# sourceMappingURL=tabs.mjs.map