expansion.mjs 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. import * as i0 from '@angular/core';
  2. import { InjectionToken, inject, TemplateRef, Directive, ViewContainerRef, ANIMATION_MODULE_TYPE, NgZone, ElementRef, Renderer2, EventEmitter, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ContentChild, ViewChild, ChangeDetectorRef, HostAttributeToken, numberAttribute, QueryList, ContentChildren, NgModule } from '@angular/core';
  3. import { CdkAccordionItem, CdkAccordion, CdkAccordionModule } from '@angular/cdk/accordion';
  4. import { TemplatePortal, CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
  5. import { _IdGenerator, FocusMonitor, FocusKeyManager } from '@angular/cdk/a11y';
  6. import { startWith, filter, take } from 'rxjs/operators';
  7. import { ENTER, hasModifierKey, SPACE } from '@angular/cdk/keycodes';
  8. import { Subject, Subscription, EMPTY, merge } from 'rxjs';
  9. import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
  10. import { DOCUMENT } from '@angular/common';
  11. import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
  12. import { _ as _StructuralStylesLoader } from './structural-styles-BQUT6wsL.mjs';
  13. import { M as MatCommonModule } from './common-module-WayjW0Pb.mjs';
  14. import '@angular/cdk/bidi';
  15. /**
  16. * Token used to provide a `MatAccordion` to `MatExpansionPanel`.
  17. * Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`.
  18. */
  19. const MAT_ACCORDION = new InjectionToken('MAT_ACCORDION');
  20. /**
  21. * Token used to provide a `MatExpansionPanel` to `MatExpansionPanelContent`.
  22. * Used to avoid circular imports between `MatExpansionPanel` and `MatExpansionPanelContent`.
  23. */
  24. const MAT_EXPANSION_PANEL = new InjectionToken('MAT_EXPANSION_PANEL');
  25. /**
  26. * Expansion panel content that will be rendered lazily
  27. * after the panel is opened for the first time.
  28. */
  29. class MatExpansionPanelContent {
  30. _template = inject(TemplateRef);
  31. _expansionPanel = inject(MAT_EXPANSION_PANEL, { optional: true });
  32. constructor() { }
  33. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  34. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatExpansionPanelContent, isStandalone: true, selector: "ng-template[matExpansionPanelContent]", ngImport: i0 });
  35. }
  36. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelContent, decorators: [{
  37. type: Directive,
  38. args: [{
  39. selector: 'ng-template[matExpansionPanelContent]',
  40. }]
  41. }], ctorParameters: () => [] });
  42. /**
  43. * Injection token that can be used to configure the default
  44. * options for the expansion panel component.
  45. */
  46. const MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = new InjectionToken('MAT_EXPANSION_PANEL_DEFAULT_OPTIONS');
  47. /**
  48. * This component can be used as a single element to show expandable content, or as one of
  49. * multiple children of an element with the MatAccordion directive attached.
  50. */
  51. class MatExpansionPanel extends CdkAccordionItem {
  52. _viewContainerRef = inject(ViewContainerRef);
  53. _animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
  54. _document = inject(DOCUMENT);
  55. _ngZone = inject(NgZone);
  56. _elementRef = inject(ElementRef);
  57. _renderer = inject(Renderer2);
  58. _cleanupTransitionEnd;
  59. /** Whether the toggle indicator should be hidden. */
  60. get hideToggle() {
  61. return this._hideToggle || (this.accordion && this.accordion.hideToggle);
  62. }
  63. set hideToggle(value) {
  64. this._hideToggle = value;
  65. }
  66. _hideToggle = false;
  67. /** The position of the expansion indicator. */
  68. get togglePosition() {
  69. return this._togglePosition || (this.accordion && this.accordion.togglePosition);
  70. }
  71. set togglePosition(value) {
  72. this._togglePosition = value;
  73. }
  74. _togglePosition;
  75. /** An event emitted after the body's expansion animation happens. */
  76. afterExpand = new EventEmitter();
  77. /** An event emitted after the body's collapse animation happens. */
  78. afterCollapse = new EventEmitter();
  79. /** Stream that emits for changes in `@Input` properties. */
  80. _inputChanges = new Subject();
  81. /** Optionally defined accordion the expansion panel belongs to. */
  82. accordion = inject(MAT_ACCORDION, { optional: true, skipSelf: true });
  83. /** Content that will be rendered lazily. */
  84. _lazyContent;
  85. /** Element containing the panel's user-provided content. */
  86. _body;
  87. /** Element wrapping the panel body. */
  88. _bodyWrapper;
  89. /** Portal holding the user's content. */
  90. _portal;
  91. /** ID for the associated header element. Used for a11y labelling. */
  92. _headerId = inject(_IdGenerator).getId('mat-expansion-panel-header-');
  93. constructor() {
  94. super();
  95. const defaultOptions = inject(MAT_EXPANSION_PANEL_DEFAULT_OPTIONS, { optional: true });
  96. this._expansionDispatcher = inject(UniqueSelectionDispatcher);
  97. if (defaultOptions) {
  98. this.hideToggle = defaultOptions.hideToggle;
  99. }
  100. }
  101. /** Determines whether the expansion panel should have spacing between it and its siblings. */
  102. _hasSpacing() {
  103. if (this.accordion) {
  104. return this.expanded && this.accordion.displayMode === 'default';
  105. }
  106. return false;
  107. }
  108. /** Gets the expanded state string. */
  109. _getExpandedState() {
  110. return this.expanded ? 'expanded' : 'collapsed';
  111. }
  112. /** Toggles the expanded state of the expansion panel. */
  113. toggle() {
  114. this.expanded = !this.expanded;
  115. }
  116. /** Sets the expanded state of the expansion panel to false. */
  117. close() {
  118. this.expanded = false;
  119. }
  120. /** Sets the expanded state of the expansion panel to true. */
  121. open() {
  122. this.expanded = true;
  123. }
  124. ngAfterContentInit() {
  125. if (this._lazyContent && this._lazyContent._expansionPanel === this) {
  126. // Render the content as soon as the panel becomes open.
  127. this.opened
  128. .pipe(startWith(null), filter(() => this.expanded && !this._portal), take(1))
  129. .subscribe(() => {
  130. this._portal = new TemplatePortal(this._lazyContent._template, this._viewContainerRef);
  131. });
  132. }
  133. this._setupAnimationEvents();
  134. }
  135. ngOnChanges(changes) {
  136. this._inputChanges.next(changes);
  137. }
  138. ngOnDestroy() {
  139. super.ngOnDestroy();
  140. this._cleanupTransitionEnd?.();
  141. this._inputChanges.complete();
  142. }
  143. /** Checks whether the expansion panel's content contains the currently-focused element. */
  144. _containsFocus() {
  145. if (this._body) {
  146. const focusedElement = this._document.activeElement;
  147. const bodyElement = this._body.nativeElement;
  148. return focusedElement === bodyElement || bodyElement.contains(focusedElement);
  149. }
  150. return false;
  151. }
  152. _transitionEndListener = ({ target, propertyName }) => {
  153. if (target === this._bodyWrapper?.nativeElement && propertyName === 'grid-template-rows') {
  154. this._ngZone.run(() => {
  155. if (this.expanded) {
  156. this.afterExpand.emit();
  157. }
  158. else {
  159. this.afterCollapse.emit();
  160. }
  161. });
  162. }
  163. };
  164. _setupAnimationEvents() {
  165. // This method is defined separately, because we need to
  166. // disable this logic in some internal components.
  167. this._ngZone.runOutsideAngular(() => {
  168. if (this._animationsDisabled) {
  169. this.opened.subscribe(() => this._ngZone.run(() => this.afterExpand.emit()));
  170. this.closed.subscribe(() => this._ngZone.run(() => this.afterCollapse.emit()));
  171. }
  172. else {
  173. setTimeout(() => {
  174. const element = this._elementRef.nativeElement;
  175. this._cleanupTransitionEnd = this._renderer.listen(element, 'transitionend', this._transitionEndListener);
  176. element.classList.add('mat-expansion-panel-animations-enabled');
  177. }, 200);
  178. }
  179. });
  180. }
  181. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
  182. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.6", type: MatExpansionPanel, isStandalone: true, selector: "mat-expansion-panel", inputs: { hideToggle: ["hideToggle", "hideToggle", booleanAttribute], togglePosition: "togglePosition" }, outputs: { afterExpand: "afterExpand", afterCollapse: "afterCollapse" }, host: { properties: { "class.mat-expanded": "expanded", "class.mat-expansion-panel-spacing": "_hasSpacing()" }, classAttribute: "mat-expansion-panel" }, providers: [
  183. // Provide MatAccordion as undefined to prevent nested expansion panels from registering
  184. // to the same accordion.
  185. { provide: MAT_ACCORDION, useValue: undefined },
  186. { provide: MAT_EXPANSION_PANEL, useExisting: MatExpansionPanel },
  187. ], queries: [{ propertyName: "_lazyContent", first: true, predicate: MatExpansionPanelContent, descendants: true }], viewQueries: [{ propertyName: "_body", first: true, predicate: ["body"], descendants: true }, { propertyName: "_bodyWrapper", first: true, predicate: ["bodyWrapper"], descendants: true }], exportAs: ["matExpansionPanel"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-content select=\"mat-expansion-panel-header\"></ng-content>\n<div class=\"mat-expansion-panel-content-wrapper\" [attr.inert]=\"expanded ? null : ''\" #bodyWrapper>\n <div class=\"mat-expansion-panel-content\"\n role=\"region\"\n [attr.aria-labelledby]=\"_headerId\"\n [id]=\"id\"\n #body>\n <div class=\"mat-expansion-panel-body\">\n <ng-content></ng-content>\n <ng-template [cdkPortalOutlet]=\"_portal\"></ng-template>\n </div>\n <ng-content select=\"mat-action-row\"></ng-content>\n </div>\n</div>\n", styles: [".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;overflow:hidden;position:relative;background:var(--mat-expansion-container-background-color, var(--mat-sys-surface));color:var(--mat-expansion-container-text-color, var(--mat-sys-on-surface));border-radius:var(--mat-expansion-container-shape, 12px)}.mat-expansion-panel.mat-expansion-panel-animations-enabled{transition:margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:var(--mat-expansion-container-shape, 12px);border-top-left-radius:var(--mat-expansion-container-shape, 12px)}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:var(--mat-expansion-container-shape, 12px);border-bottom-left-radius:var(--mat-expansion-container-shape, 12px)}@media(forced-colors: active){.mat-expansion-panel{outline:solid 1px}}.mat-expansion-panel-content-wrapper{display:grid;grid-template-rows:0fr;grid-template-columns:100%}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content-wrapper{transition:grid-template-rows 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{grid-template-rows:1fr}@supports not (grid-template-rows: 0fr){.mat-expansion-panel-content-wrapper{height:0}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{height:auto}}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible;min-height:0;visibility:hidden;font-family:var(--mat-expansion-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-expansion-container-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-expansion-container-text-weight, var(--mat-sys-body-large-weight));line-height:var(--mat-expansion-container-text-line-height, var(--mat-sys-body-large-line-height));letter-spacing:var(--mat-expansion-container-text-tracking, var(--mat-sys-body-large-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content{transition:visibility 190ms linear}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper>.mat-expansion-panel-content{visibility:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>*:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>*:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px;border-top-color:var(--mat-expansion-actions-divider-color, var(--mat-sys-outline))}.mat-action-row .mat-button-base,.mat-action-row .mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-action-row .mat-button-base,[dir=rtl] .mat-action-row .mat-mdc-button-base{margin-left:0;margin-right:8px}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  188. }
  189. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanel, decorators: [{
  190. type: Component,
  191. args: [{ selector: 'mat-expansion-panel', exportAs: 'matExpansionPanel', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
  192. // Provide MatAccordion as undefined to prevent nested expansion panels from registering
  193. // to the same accordion.
  194. { provide: MAT_ACCORDION, useValue: undefined },
  195. { provide: MAT_EXPANSION_PANEL, useExisting: MatExpansionPanel },
  196. ], host: {
  197. 'class': 'mat-expansion-panel',
  198. '[class.mat-expanded]': 'expanded',
  199. '[class.mat-expansion-panel-spacing]': '_hasSpacing()',
  200. }, imports: [CdkPortalOutlet], template: "<ng-content select=\"mat-expansion-panel-header\"></ng-content>\n<div class=\"mat-expansion-panel-content-wrapper\" [attr.inert]=\"expanded ? null : ''\" #bodyWrapper>\n <div class=\"mat-expansion-panel-content\"\n role=\"region\"\n [attr.aria-labelledby]=\"_headerId\"\n [id]=\"id\"\n #body>\n <div class=\"mat-expansion-panel-body\">\n <ng-content></ng-content>\n <ng-template [cdkPortalOutlet]=\"_portal\"></ng-template>\n </div>\n <ng-content select=\"mat-action-row\"></ng-content>\n </div>\n</div>\n", styles: [".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;overflow:hidden;position:relative;background:var(--mat-expansion-container-background-color, var(--mat-sys-surface));color:var(--mat-expansion-container-text-color, var(--mat-sys-on-surface));border-radius:var(--mat-expansion-container-shape, 12px)}.mat-expansion-panel.mat-expansion-panel-animations-enabled{transition:margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:var(--mat-expansion-container-shape, 12px);border-top-left-radius:var(--mat-expansion-container-shape, 12px)}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:var(--mat-expansion-container-shape, 12px);border-bottom-left-radius:var(--mat-expansion-container-shape, 12px)}@media(forced-colors: active){.mat-expansion-panel{outline:solid 1px}}.mat-expansion-panel-content-wrapper{display:grid;grid-template-rows:0fr;grid-template-columns:100%}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content-wrapper{transition:grid-template-rows 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{grid-template-rows:1fr}@supports not (grid-template-rows: 0fr){.mat-expansion-panel-content-wrapper{height:0}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{height:auto}}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible;min-height:0;visibility:hidden;font-family:var(--mat-expansion-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-expansion-container-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-expansion-container-text-weight, var(--mat-sys-body-large-weight));line-height:var(--mat-expansion-container-text-line-height, var(--mat-sys-body-large-line-height));letter-spacing:var(--mat-expansion-container-text-tracking, var(--mat-sys-body-large-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content{transition:visibility 190ms linear}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper>.mat-expansion-panel-content{visibility:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>*:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>*:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px;border-top-color:var(--mat-expansion-actions-divider-color, var(--mat-sys-outline))}.mat-action-row .mat-button-base,.mat-action-row .mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-action-row .mat-button-base,[dir=rtl] .mat-action-row .mat-mdc-button-base{margin-left:0;margin-right:8px}\n"] }]
  201. }], ctorParameters: () => [], propDecorators: { hideToggle: [{
  202. type: Input,
  203. args: [{ transform: booleanAttribute }]
  204. }], togglePosition: [{
  205. type: Input
  206. }], afterExpand: [{
  207. type: Output
  208. }], afterCollapse: [{
  209. type: Output
  210. }], _lazyContent: [{
  211. type: ContentChild,
  212. args: [MatExpansionPanelContent]
  213. }], _body: [{
  214. type: ViewChild,
  215. args: ['body']
  216. }], _bodyWrapper: [{
  217. type: ViewChild,
  218. args: ['bodyWrapper']
  219. }] } });
  220. /**
  221. * Actions of a `<mat-expansion-panel>`.
  222. */
  223. class MatExpansionPanelActionRow {
  224. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelActionRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  225. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatExpansionPanelActionRow, isStandalone: true, selector: "mat-action-row", host: { classAttribute: "mat-action-row" }, ngImport: i0 });
  226. }
  227. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelActionRow, decorators: [{
  228. type: Directive,
  229. args: [{
  230. selector: 'mat-action-row',
  231. host: {
  232. class: 'mat-action-row',
  233. },
  234. }]
  235. }] });
  236. /**
  237. * Header element of a `<mat-expansion-panel>`.
  238. */
  239. class MatExpansionPanelHeader {
  240. panel = inject(MatExpansionPanel, { host: true });
  241. _element = inject(ElementRef);
  242. _focusMonitor = inject(FocusMonitor);
  243. _changeDetectorRef = inject(ChangeDetectorRef);
  244. _parentChangeSubscription = Subscription.EMPTY;
  245. constructor() {
  246. inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
  247. const panel = this.panel;
  248. const defaultOptions = inject(MAT_EXPANSION_PANEL_DEFAULT_OPTIONS, { optional: true });
  249. const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
  250. const accordionHideToggleChange = panel.accordion
  251. ? panel.accordion._stateChanges.pipe(filter(changes => !!(changes['hideToggle'] || changes['togglePosition'])))
  252. : EMPTY;
  253. this.tabIndex = parseInt(tabIndex || '') || 0;
  254. // Since the toggle state depends on an @Input on the panel, we
  255. // need to subscribe and trigger change detection manually.
  256. this._parentChangeSubscription = merge(panel.opened, panel.closed, accordionHideToggleChange, panel._inputChanges.pipe(filter(changes => {
  257. return !!(changes['hideToggle'] || changes['disabled'] || changes['togglePosition']);
  258. }))).subscribe(() => this._changeDetectorRef.markForCheck());
  259. // Avoids focus being lost if the panel contained the focused element and was closed.
  260. panel.closed
  261. .pipe(filter(() => panel._containsFocus()))
  262. .subscribe(() => this._focusMonitor.focusVia(this._element, 'program'));
  263. if (defaultOptions) {
  264. this.expandedHeight = defaultOptions.expandedHeight;
  265. this.collapsedHeight = defaultOptions.collapsedHeight;
  266. }
  267. }
  268. /** Height of the header while the panel is expanded. */
  269. expandedHeight;
  270. /** Height of the header while the panel is collapsed. */
  271. collapsedHeight;
  272. /** Tab index of the header. */
  273. tabIndex = 0;
  274. /**
  275. * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
  276. * @docs-private
  277. */
  278. get disabled() {
  279. return this.panel.disabled;
  280. }
  281. /** Toggles the expanded state of the panel. */
  282. _toggle() {
  283. if (!this.disabled) {
  284. this.panel.toggle();
  285. }
  286. }
  287. /** Gets whether the panel is expanded. */
  288. _isExpanded() {
  289. return this.panel.expanded;
  290. }
  291. /** Gets the expanded state string of the panel. */
  292. _getExpandedState() {
  293. return this.panel._getExpandedState();
  294. }
  295. /** Gets the panel id. */
  296. _getPanelId() {
  297. return this.panel.id;
  298. }
  299. /** Gets the toggle position for the header. */
  300. _getTogglePosition() {
  301. return this.panel.togglePosition;
  302. }
  303. /** Gets whether the expand indicator should be shown. */
  304. _showToggle() {
  305. return !this.panel.hideToggle && !this.panel.disabled;
  306. }
  307. /**
  308. * Gets the current height of the header. Null if no custom height has been
  309. * specified, and if the default height from the stylesheet should be used.
  310. */
  311. _getHeaderHeight() {
  312. const isExpanded = this._isExpanded();
  313. if (isExpanded && this.expandedHeight) {
  314. return this.expandedHeight;
  315. }
  316. else if (!isExpanded && this.collapsedHeight) {
  317. return this.collapsedHeight;
  318. }
  319. return null;
  320. }
  321. /** Handle keydown event calling to toggle() if appropriate. */
  322. _keydown(event) {
  323. switch (event.keyCode) {
  324. // Toggle for space and enter keys.
  325. case SPACE:
  326. case ENTER:
  327. if (!hasModifierKey(event)) {
  328. event.preventDefault();
  329. this._toggle();
  330. }
  331. break;
  332. default:
  333. if (this.panel.accordion) {
  334. this.panel.accordion._handleHeaderKeydown(event);
  335. }
  336. return;
  337. }
  338. }
  339. /**
  340. * Focuses the panel header. Implemented as a part of `FocusableOption`.
  341. * @param origin Origin of the action that triggered the focus.
  342. * @docs-private
  343. */
  344. focus(origin, options) {
  345. if (origin) {
  346. this._focusMonitor.focusVia(this._element, origin, options);
  347. }
  348. else {
  349. this._element.nativeElement.focus(options);
  350. }
  351. }
  352. ngAfterViewInit() {
  353. this._focusMonitor.monitor(this._element).subscribe(origin => {
  354. if (origin && this.panel.accordion) {
  355. this.panel.accordion._handleHeaderFocus(this);
  356. }
  357. });
  358. }
  359. ngOnDestroy() {
  360. this._parentChangeSubscription.unsubscribe();
  361. this._focusMonitor.stopMonitoring(this._element);
  362. }
  363. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
  364. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.6", type: MatExpansionPanelHeader, isStandalone: true, selector: "mat-expansion-panel-header", inputs: { expandedHeight: "expandedHeight", collapsedHeight: "collapsedHeight", tabIndex: ["tabIndex", "tabIndex", (value) => (value == null ? 0 : numberAttribute(value))] }, host: { attributes: { "role": "button" }, listeners: { "click": "_toggle()", "keydown": "_keydown($event)" }, properties: { "attr.id": "panel._headerId", "attr.tabindex": "disabled ? -1 : tabIndex", "attr.aria-controls": "_getPanelId()", "attr.aria-expanded": "_isExpanded()", "attr.aria-disabled": "panel.disabled", "class.mat-expanded": "_isExpanded()", "class.mat-expansion-toggle-indicator-after": "_getTogglePosition() === 'after'", "class.mat-expansion-toggle-indicator-before": "_getTogglePosition() === 'before'", "style.height": "_getHeaderHeight()" }, classAttribute: "mat-expansion-panel-header mat-focus-indicator" }, ngImport: i0, template: "<span class=\"mat-content\" [class.mat-content-hide-toggle]=\"!_showToggle()\">\n <ng-content select=\"mat-panel-title\"></ng-content>\n <ng-content select=\"mat-panel-description\"></ng-content>\n <ng-content></ng-content>\n</span>\n\n@if (_showToggle()) {\n <span class=\"mat-expansion-indicator\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n aria-hidden=\"true\"\n focusable=\"false\">\n <path d=\"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z\"/>\n </svg>\n </span>\n}\n", styles: [".mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit;height:var(--mat-expansion-header-collapsed-state-height, 48px);font-family:var(--mat-expansion-header-text-font, var(--mat-sys-title-medium-font));font-size:var(--mat-expansion-header-text-size, var(--mat-sys-title-medium-size));font-weight:var(--mat-expansion-header-text-weight, var(--mat-sys-title-medium-weight));line-height:var(--mat-expansion-header-text-line-height, var(--mat-sys-title-medium-line-height));letter-spacing:var(--mat-expansion-header-text-tracking, var(--mat-sys-title-medium-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-header{transition:height 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header::before{border-radius:inherit}.mat-expansion-panel-header.mat-expanded{height:var(--mat-expansion-header-expanded-state-height, 64px)}.mat-expansion-panel-header[aria-disabled=true]{color:var(--mat-expansion-header-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-header-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}@media(hover: none){.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-container-background-color, var(--mat-sys-surface))}}.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-keyboard-focused,.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-program-focused{background:var(--mat-expansion-header-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}.mat-expansion-panel-header._mat-animation-noopable{transition:none}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:none}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-content.mat-content-hide-toggle{margin-right:8px}[dir=rtl] .mat-content.mat-content-hide-toggle{margin-right:0;margin-left:8px}.mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-left:24px;margin-right:0}[dir=rtl] .mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-right:24px;margin-left:0}.mat-expansion-panel-header-title{color:var(--mat-expansion-header-text-color, var(--mat-sys-on-surface))}.mat-expansion-panel-header-title,.mat-expansion-panel-header-description{display:flex;flex-grow:1;flex-basis:0;margin-right:16px;align-items:center}[dir=rtl] .mat-expansion-panel-header-title,[dir=rtl] .mat-expansion-panel-header-description{margin-right:0;margin-left:16px}.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-title,.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-description{color:inherit}.mat-expansion-panel-header-description{flex-grow:2;color:var(--mat-expansion-header-description-color, var(--mat-sys-on-surface-variant))}.mat-expansion-panel-animations-enabled .mat-expansion-indicator{transition:transform 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header.mat-expanded .mat-expansion-indicator{transform:rotate(180deg)}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:\"\";display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle;color:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-legacy-header-indicator-display, none)}.mat-expansion-indicator svg{width:24px;height:24px;margin:0 -8px;vertical-align:middle;fill:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-header-indicator-display, inline-block)}@media(forced-colors: active){.mat-expansion-panel-content{border-top:1px solid;border-top-left-radius:0;border-top-right-radius:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  365. }
  366. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelHeader, decorators: [{
  367. type: Component,
  368. args: [{ selector: 'mat-expansion-panel-header', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
  369. 'class': 'mat-expansion-panel-header mat-focus-indicator',
  370. 'role': 'button',
  371. '[attr.id]': 'panel._headerId',
  372. '[attr.tabindex]': 'disabled ? -1 : tabIndex',
  373. '[attr.aria-controls]': '_getPanelId()',
  374. '[attr.aria-expanded]': '_isExpanded()',
  375. '[attr.aria-disabled]': 'panel.disabled',
  376. '[class.mat-expanded]': '_isExpanded()',
  377. '[class.mat-expansion-toggle-indicator-after]': `_getTogglePosition() === 'after'`,
  378. '[class.mat-expansion-toggle-indicator-before]': `_getTogglePosition() === 'before'`,
  379. '[style.height]': '_getHeaderHeight()',
  380. '(click)': '_toggle()',
  381. '(keydown)': '_keydown($event)',
  382. }, template: "<span class=\"mat-content\" [class.mat-content-hide-toggle]=\"!_showToggle()\">\n <ng-content select=\"mat-panel-title\"></ng-content>\n <ng-content select=\"mat-panel-description\"></ng-content>\n <ng-content></ng-content>\n</span>\n\n@if (_showToggle()) {\n <span class=\"mat-expansion-indicator\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n aria-hidden=\"true\"\n focusable=\"false\">\n <path d=\"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z\"/>\n </svg>\n </span>\n}\n", styles: [".mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit;height:var(--mat-expansion-header-collapsed-state-height, 48px);font-family:var(--mat-expansion-header-text-font, var(--mat-sys-title-medium-font));font-size:var(--mat-expansion-header-text-size, var(--mat-sys-title-medium-size));font-weight:var(--mat-expansion-header-text-weight, var(--mat-sys-title-medium-weight));line-height:var(--mat-expansion-header-text-line-height, var(--mat-sys-title-medium-line-height));letter-spacing:var(--mat-expansion-header-text-tracking, var(--mat-sys-title-medium-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-header{transition:height 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header::before{border-radius:inherit}.mat-expansion-panel-header.mat-expanded{height:var(--mat-expansion-header-expanded-state-height, 64px)}.mat-expansion-panel-header[aria-disabled=true]{color:var(--mat-expansion-header-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-header-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}@media(hover: none){.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-container-background-color, var(--mat-sys-surface))}}.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-keyboard-focused,.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-program-focused{background:var(--mat-expansion-header-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}.mat-expansion-panel-header._mat-animation-noopable{transition:none}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:none}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-content.mat-content-hide-toggle{margin-right:8px}[dir=rtl] .mat-content.mat-content-hide-toggle{margin-right:0;margin-left:8px}.mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-left:24px;margin-right:0}[dir=rtl] .mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-right:24px;margin-left:0}.mat-expansion-panel-header-title{color:var(--mat-expansion-header-text-color, var(--mat-sys-on-surface))}.mat-expansion-panel-header-title,.mat-expansion-panel-header-description{display:flex;flex-grow:1;flex-basis:0;margin-right:16px;align-items:center}[dir=rtl] .mat-expansion-panel-header-title,[dir=rtl] .mat-expansion-panel-header-description{margin-right:0;margin-left:16px}.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-title,.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-description{color:inherit}.mat-expansion-panel-header-description{flex-grow:2;color:var(--mat-expansion-header-description-color, var(--mat-sys-on-surface-variant))}.mat-expansion-panel-animations-enabled .mat-expansion-indicator{transition:transform 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header.mat-expanded .mat-expansion-indicator{transform:rotate(180deg)}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:\"\";display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle;color:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-legacy-header-indicator-display, none)}.mat-expansion-indicator svg{width:24px;height:24px;margin:0 -8px;vertical-align:middle;fill:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-header-indicator-display, inline-block)}@media(forced-colors: active){.mat-expansion-panel-content{border-top:1px solid;border-top-left-radius:0;border-top-right-radius:0}}\n"] }]
  383. }], ctorParameters: () => [], propDecorators: { expandedHeight: [{
  384. type: Input
  385. }], collapsedHeight: [{
  386. type: Input
  387. }], tabIndex: [{
  388. type: Input,
  389. args: [{
  390. transform: (value) => (value == null ? 0 : numberAttribute(value)),
  391. }]
  392. }] } });
  393. /**
  394. * Description element of a `<mat-expansion-panel-header>`.
  395. */
  396. class MatExpansionPanelDescription {
  397. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  398. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatExpansionPanelDescription, isStandalone: true, selector: "mat-panel-description", host: { classAttribute: "mat-expansion-panel-header-description" }, ngImport: i0 });
  399. }
  400. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelDescription, decorators: [{
  401. type: Directive,
  402. args: [{
  403. selector: 'mat-panel-description',
  404. host: {
  405. class: 'mat-expansion-panel-header-description',
  406. },
  407. }]
  408. }] });
  409. /**
  410. * Title element of a `<mat-expansion-panel-header>`.
  411. */
  412. class MatExpansionPanelTitle {
  413. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  414. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: MatExpansionPanelTitle, isStandalone: true, selector: "mat-panel-title", host: { classAttribute: "mat-expansion-panel-header-title" }, ngImport: i0 });
  415. }
  416. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionPanelTitle, decorators: [{
  417. type: Directive,
  418. args: [{
  419. selector: 'mat-panel-title',
  420. host: {
  421. class: 'mat-expansion-panel-header-title',
  422. },
  423. }]
  424. }] });
  425. /**
  426. * Directive for a Material Design Accordion.
  427. */
  428. class MatAccordion extends CdkAccordion {
  429. _keyManager;
  430. /** Headers belonging to this accordion. */
  431. _ownHeaders = new QueryList();
  432. /** All headers inside the accordion. Includes headers inside nested accordions. */
  433. _headers;
  434. /** Whether the expansion indicator should be hidden. */
  435. hideToggle = false;
  436. /**
  437. * Display mode used for all expansion panels in the accordion. Currently two display
  438. * modes exist:
  439. * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
  440. * panel at a different elevation from the rest of the accordion.
  441. * flat - no spacing is placed around expanded panels, showing all panels at the same
  442. * elevation.
  443. */
  444. displayMode = 'default';
  445. /** The position of the expansion indicator. */
  446. togglePosition = 'after';
  447. ngAfterContentInit() {
  448. this._headers.changes
  449. .pipe(startWith(this._headers))
  450. .subscribe((headers) => {
  451. this._ownHeaders.reset(headers.filter(header => header.panel.accordion === this));
  452. this._ownHeaders.notifyOnChanges();
  453. });
  454. this._keyManager = new FocusKeyManager(this._ownHeaders).withWrap().withHomeAndEnd();
  455. }
  456. /** Handles keyboard events coming in from the panel headers. */
  457. _handleHeaderKeydown(event) {
  458. this._keyManager.onKeydown(event);
  459. }
  460. _handleHeaderFocus(header) {
  461. this._keyManager.updateActiveItem(header);
  462. }
  463. ngOnDestroy() {
  464. super.ngOnDestroy();
  465. this._keyManager?.destroy();
  466. this._ownHeaders.destroy();
  467. }
  468. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatAccordion, deps: null, target: i0.ɵɵFactoryTarget.Directive });
  469. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.6", type: MatAccordion, isStandalone: true, selector: "mat-accordion", inputs: { hideToggle: ["hideToggle", "hideToggle", booleanAttribute], displayMode: "displayMode", togglePosition: "togglePosition" }, host: { properties: { "class.mat-accordion-multi": "this.multi" }, classAttribute: "mat-accordion" }, providers: [
  470. {
  471. provide: MAT_ACCORDION,
  472. useExisting: MatAccordion,
  473. },
  474. ], queries: [{ propertyName: "_headers", predicate: MatExpansionPanelHeader, descendants: true }], exportAs: ["matAccordion"], usesInheritance: true, ngImport: i0 });
  475. }
  476. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatAccordion, decorators: [{
  477. type: Directive,
  478. args: [{
  479. selector: 'mat-accordion',
  480. exportAs: 'matAccordion',
  481. providers: [
  482. {
  483. provide: MAT_ACCORDION,
  484. useExisting: MatAccordion,
  485. },
  486. ],
  487. host: {
  488. class: 'mat-accordion',
  489. // Class binding which is only used by the test harness as there is no other
  490. // way for the harness to detect if multiple panel support is enabled.
  491. '[class.mat-accordion-multi]': 'this.multi',
  492. },
  493. }]
  494. }], propDecorators: { _headers: [{
  495. type: ContentChildren,
  496. args: [MatExpansionPanelHeader, { descendants: true }]
  497. }], hideToggle: [{
  498. type: Input,
  499. args: [{ transform: booleanAttribute }]
  500. }], displayMode: [{
  501. type: Input
  502. }], togglePosition: [{
  503. type: Input
  504. }] } });
  505. class MatExpansionModule {
  506. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  507. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionModule, imports: [MatCommonModule,
  508. CdkAccordionModule,
  509. PortalModule,
  510. MatAccordion,
  511. MatExpansionPanel,
  512. MatExpansionPanelActionRow,
  513. MatExpansionPanelHeader,
  514. MatExpansionPanelTitle,
  515. MatExpansionPanelDescription,
  516. MatExpansionPanelContent], exports: [MatAccordion,
  517. MatExpansionPanel,
  518. MatExpansionPanelActionRow,
  519. MatExpansionPanelHeader,
  520. MatExpansionPanelTitle,
  521. MatExpansionPanelDescription,
  522. MatExpansionPanelContent] });
  523. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionModule, imports: [MatCommonModule,
  524. CdkAccordionModule,
  525. PortalModule] });
  526. }
  527. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MatExpansionModule, decorators: [{
  528. type: NgModule,
  529. args: [{
  530. imports: [
  531. MatCommonModule,
  532. CdkAccordionModule,
  533. PortalModule,
  534. MatAccordion,
  535. MatExpansionPanel,
  536. MatExpansionPanelActionRow,
  537. MatExpansionPanelHeader,
  538. MatExpansionPanelTitle,
  539. MatExpansionPanelDescription,
  540. MatExpansionPanelContent,
  541. ],
  542. exports: [
  543. MatAccordion,
  544. MatExpansionPanel,
  545. MatExpansionPanelActionRow,
  546. MatExpansionPanelHeader,
  547. MatExpansionPanelTitle,
  548. MatExpansionPanelDescription,
  549. MatExpansionPanelContent,
  550. ],
  551. }]
  552. }] });
  553. /**
  554. * Time and timing curve for expansion panel animations.
  555. * @deprecated No longer used. Will be removed.
  556. * @breaking-change 21.0.0
  557. */
  558. const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,1)';
  559. /**
  560. * Animations used by the Material expansion panel.
  561. *
  562. * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
  563. * causes the animation state of moved components to become `void` upon exit, and not update again
  564. * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
  565. * of the panel is `expanded` or `collapsed` but the animation state is `void`.
  566. *
  567. * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
  568. * are defined to have the same styles. Since angular animates from the current styles to the
  569. * destination state's style definition, in situations where we are moving from `void`'s styles to
  570. * `collapsed` this acts a noop since no style values change.
  571. *
  572. * In the case where angular's animation state is out of sync with the expansion panel's state, the
  573. * expansion panel being `expanded` and angular animations being `void`, the animation from the
  574. * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
  575. * occur as expected.
  576. *
  577. * Angular Bug: https://github.com/angular/angular/issues/18847
  578. *
  579. * @docs-private
  580. * @deprecated No longer being used, to be removed.
  581. * @breaking-change 21.0.0
  582. */
  583. const matExpansionAnimations = {
  584. // Represents:
  585. // trigger('indicatorRotate', [
  586. // state('collapsed, void', style({transform: 'rotate(0deg)'})),
  587. // state('expanded', style({transform: 'rotate(180deg)'})),
  588. // transition(
  589. // 'expanded <=> collapsed, void => collapsed',
  590. // animate(EXPANSION_PANEL_ANIMATION_TIMING),
  591. // ),
  592. // ])
  593. /** Animation that rotates the indicator arrow. */
  594. indicatorRotate: {
  595. type: 7,
  596. name: 'indicatorRotate',
  597. definitions: [
  598. {
  599. type: 0,
  600. name: 'collapsed, void',
  601. styles: { type: 6, styles: { transform: 'rotate(0deg)' }, offset: null },
  602. },
  603. {
  604. type: 0,
  605. name: 'expanded',
  606. styles: { type: 6, styles: { transform: 'rotate(180deg)' }, offset: null },
  607. },
  608. {
  609. type: 1,
  610. expr: 'expanded <=> collapsed, void => collapsed',
  611. animation: { type: 4, styles: null, timings: '225ms cubic-bezier(0.4,0.0,0.2,1)' },
  612. options: null,
  613. },
  614. ],
  615. options: {},
  616. },
  617. // Represents:
  618. // trigger('bodyExpansion', [
  619. // state('collapsed, void', style({height: '0px', visibility: 'hidden'})),
  620. // // Clear the `visibility` while open, otherwise the content will be visible when placed in
  621. // // a parent that's `visibility: hidden`, because `visibility` doesn't apply to descendants
  622. // // that have a `visibility` of their own (see #27436).
  623. // state('expanded', style({height: '*', visibility: ''})),
  624. // transition(
  625. // 'expanded <=> collapsed, void => collapsed',
  626. // animate(EXPANSION_PANEL_ANIMATION_TIMING),
  627. // ),
  628. // ])
  629. /** Animation that expands and collapses the panel content. */
  630. bodyExpansion: {
  631. type: 7,
  632. name: 'bodyExpansion',
  633. definitions: [
  634. {
  635. type: 0,
  636. name: 'collapsed, void',
  637. styles: { type: 6, styles: { 'height': '0px', 'visibility': 'hidden' }, offset: null },
  638. },
  639. {
  640. type: 0,
  641. name: 'expanded',
  642. styles: { type: 6, styles: { 'height': '*', 'visibility': '' }, offset: null },
  643. },
  644. {
  645. type: 1,
  646. expr: 'expanded <=> collapsed, void => collapsed',
  647. animation: { type: 4, styles: null, timings: '225ms cubic-bezier(0.4,0.0,0.2,1)' },
  648. options: null,
  649. },
  650. ],
  651. options: {},
  652. },
  653. };
  654. export { EXPANSION_PANEL_ANIMATION_TIMING, MAT_ACCORDION, MAT_EXPANSION_PANEL, MAT_EXPANSION_PANEL_DEFAULT_OPTIONS, MatAccordion, MatExpansionModule, MatExpansionPanel, MatExpansionPanelActionRow, MatExpansionPanelContent, MatExpansionPanelDescription, MatExpansionPanelHeader, MatExpansionPanelTitle, matExpansionAnimations };
  655. //# sourceMappingURL=expansion.mjs.map