index.d.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. import * as i0 from '@angular/core';
  2. import { InjectionToken, TemplateRef, AfterContentInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, ElementRef, AfterViewInit, QueryList } from '@angular/core';
  3. import { M as MatCommonModule } from '../common-module.d-C8xzHJDr.js';
  4. import * as i2 from '@angular/cdk/accordion';
  5. import { CdkAccordion, CdkAccordionItem } from '@angular/cdk/accordion';
  6. import * as i3 from '@angular/cdk/portal';
  7. import { TemplatePortal } from '@angular/cdk/portal';
  8. import { FocusableOption, FocusOrigin } from '@angular/cdk/a11y';
  9. import { Subject } from 'rxjs';
  10. import '@angular/cdk/bidi';
  11. /** MatAccordion's display modes. */
  12. type MatAccordionDisplayMode = 'default' | 'flat';
  13. /** MatAccordion's toggle positions. */
  14. type MatAccordionTogglePosition = 'before' | 'after';
  15. /**
  16. * Base interface for a `MatAccordion`.
  17. * @docs-private
  18. */
  19. interface MatAccordionBase extends CdkAccordion {
  20. /** Whether the expansion indicator should be hidden. */
  21. hideToggle: boolean;
  22. /** Display mode used for all expansion panels in the accordion. */
  23. displayMode: MatAccordionDisplayMode;
  24. /** The position of the expansion indicator. */
  25. togglePosition: MatAccordionTogglePosition;
  26. /** Handles keyboard events coming in from the panel headers. */
  27. _handleHeaderKeydown: (event: KeyboardEvent) => void;
  28. /** Handles focus events on the panel headers. */
  29. _handleHeaderFocus: (header: any) => void;
  30. }
  31. /**
  32. * Token used to provide a `MatAccordion` to `MatExpansionPanel`.
  33. * Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`.
  34. */
  35. declare const MAT_ACCORDION: InjectionToken<MatAccordionBase>;
  36. /**
  37. * Base interface for a `MatExpansionPanel`.
  38. * @docs-private
  39. */
  40. interface MatExpansionPanelBase extends CdkAccordionItem {
  41. /** Whether the toggle indicator should be hidden. */
  42. hideToggle: boolean;
  43. }
  44. /**
  45. * Token used to provide a `MatExpansionPanel` to `MatExpansionPanelContent`.
  46. * Used to avoid circular imports between `MatExpansionPanel` and `MatExpansionPanelContent`.
  47. */
  48. declare const MAT_EXPANSION_PANEL: InjectionToken<MatExpansionPanelBase>;
  49. /**
  50. * Expansion panel content that will be rendered lazily
  51. * after the panel is opened for the first time.
  52. */
  53. declare class MatExpansionPanelContent {
  54. _template: TemplateRef<any>;
  55. _expansionPanel: MatExpansionPanelBase | null;
  56. constructor(...args: unknown[]);
  57. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanelContent, never>;
  58. static ɵdir: i0.ɵɵDirectiveDeclaration<MatExpansionPanelContent, "ng-template[matExpansionPanelContent]", never, {}, {}, never, never, true, never>;
  59. }
  60. /** MatExpansionPanel's states. */
  61. type MatExpansionPanelState = 'expanded' | 'collapsed';
  62. /**
  63. * Object that can be used to override the default options
  64. * for all of the expansion panels in a module.
  65. */
  66. interface MatExpansionPanelDefaultOptions {
  67. /** Height of the header while the panel is expanded. */
  68. expandedHeight: string;
  69. /** Height of the header while the panel is collapsed. */
  70. collapsedHeight: string;
  71. /** Whether the toggle indicator should be hidden. */
  72. hideToggle: boolean;
  73. }
  74. /**
  75. * Injection token that can be used to configure the default
  76. * options for the expansion panel component.
  77. */
  78. declare const MAT_EXPANSION_PANEL_DEFAULT_OPTIONS: InjectionToken<MatExpansionPanelDefaultOptions>;
  79. /**
  80. * This component can be used as a single element to show expandable content, or as one of
  81. * multiple children of an element with the MatAccordion directive attached.
  82. */
  83. declare class MatExpansionPanel extends CdkAccordionItem implements AfterContentInit, OnChanges, OnDestroy {
  84. private _viewContainerRef;
  85. private readonly _animationsDisabled;
  86. private _document;
  87. private _ngZone;
  88. private _elementRef;
  89. private _renderer;
  90. private _cleanupTransitionEnd;
  91. /** Whether the toggle indicator should be hidden. */
  92. get hideToggle(): boolean;
  93. set hideToggle(value: boolean);
  94. private _hideToggle;
  95. /** The position of the expansion indicator. */
  96. get togglePosition(): MatAccordionTogglePosition;
  97. set togglePosition(value: MatAccordionTogglePosition);
  98. private _togglePosition;
  99. /** An event emitted after the body's expansion animation happens. */
  100. readonly afterExpand: EventEmitter<void>;
  101. /** An event emitted after the body's collapse animation happens. */
  102. readonly afterCollapse: EventEmitter<void>;
  103. /** Stream that emits for changes in `@Input` properties. */
  104. readonly _inputChanges: Subject<SimpleChanges>;
  105. /** Optionally defined accordion the expansion panel belongs to. */
  106. accordion: MatAccordionBase;
  107. /** Content that will be rendered lazily. */
  108. _lazyContent: MatExpansionPanelContent;
  109. /** Element containing the panel's user-provided content. */
  110. _body: ElementRef<HTMLElement>;
  111. /** Element wrapping the panel body. */
  112. protected _bodyWrapper: ElementRef<HTMLElement> | undefined;
  113. /** Portal holding the user's content. */
  114. _portal: TemplatePortal;
  115. /** ID for the associated header element. Used for a11y labelling. */
  116. _headerId: string;
  117. constructor(...args: unknown[]);
  118. /** Determines whether the expansion panel should have spacing between it and its siblings. */
  119. _hasSpacing(): boolean;
  120. /** Gets the expanded state string. */
  121. _getExpandedState(): MatExpansionPanelState;
  122. /** Toggles the expanded state of the expansion panel. */
  123. toggle(): void;
  124. /** Sets the expanded state of the expansion panel to false. */
  125. close(): void;
  126. /** Sets the expanded state of the expansion panel to true. */
  127. open(): void;
  128. ngAfterContentInit(): void;
  129. ngOnChanges(changes: SimpleChanges): void;
  130. ngOnDestroy(): void;
  131. /** Checks whether the expansion panel's content contains the currently-focused element. */
  132. _containsFocus(): boolean;
  133. private _transitionEndListener;
  134. protected _setupAnimationEvents(): void;
  135. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanel, never>;
  136. static ɵcmp: i0.ɵɵComponentDeclaration<MatExpansionPanel, "mat-expansion-panel", ["matExpansionPanel"], { "hideToggle": { "alias": "hideToggle"; "required": false; }; "togglePosition": { "alias": "togglePosition"; "required": false; }; }, { "afterExpand": "afterExpand"; "afterCollapse": "afterCollapse"; }, ["_lazyContent"], ["mat-expansion-panel-header", "*", "mat-action-row"], true, never>;
  137. static ngAcceptInputType_hideToggle: unknown;
  138. }
  139. /**
  140. * Actions of a `<mat-expansion-panel>`.
  141. */
  142. declare class MatExpansionPanelActionRow {
  143. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanelActionRow, never>;
  144. static ɵdir: i0.ɵɵDirectiveDeclaration<MatExpansionPanelActionRow, "mat-action-row", never, {}, {}, never, never, true, never>;
  145. }
  146. /**
  147. * Header element of a `<mat-expansion-panel>`.
  148. */
  149. declare class MatExpansionPanelHeader implements AfterViewInit, OnDestroy, FocusableOption {
  150. panel: MatExpansionPanel;
  151. private _element;
  152. private _focusMonitor;
  153. private _changeDetectorRef;
  154. private _parentChangeSubscription;
  155. constructor(...args: unknown[]);
  156. /** Height of the header while the panel is expanded. */
  157. expandedHeight: string;
  158. /** Height of the header while the panel is collapsed. */
  159. collapsedHeight: string;
  160. /** Tab index of the header. */
  161. tabIndex: number;
  162. /**
  163. * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
  164. * @docs-private
  165. */
  166. get disabled(): boolean;
  167. /** Toggles the expanded state of the panel. */
  168. _toggle(): void;
  169. /** Gets whether the panel is expanded. */
  170. _isExpanded(): boolean;
  171. /** Gets the expanded state string of the panel. */
  172. _getExpandedState(): string;
  173. /** Gets the panel id. */
  174. _getPanelId(): string;
  175. /** Gets the toggle position for the header. */
  176. _getTogglePosition(): MatAccordionTogglePosition;
  177. /** Gets whether the expand indicator should be shown. */
  178. _showToggle(): boolean;
  179. /**
  180. * Gets the current height of the header. Null if no custom height has been
  181. * specified, and if the default height from the stylesheet should be used.
  182. */
  183. _getHeaderHeight(): string | null;
  184. /** Handle keydown event calling to toggle() if appropriate. */
  185. _keydown(event: KeyboardEvent): void;
  186. /**
  187. * Focuses the panel header. Implemented as a part of `FocusableOption`.
  188. * @param origin Origin of the action that triggered the focus.
  189. * @docs-private
  190. */
  191. focus(origin?: FocusOrigin, options?: FocusOptions): void;
  192. ngAfterViewInit(): void;
  193. ngOnDestroy(): void;
  194. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanelHeader, never>;
  195. static ɵcmp: i0.ɵɵComponentDeclaration<MatExpansionPanelHeader, "mat-expansion-panel-header", never, { "expandedHeight": { "alias": "expandedHeight"; "required": false; }; "collapsedHeight": { "alias": "collapsedHeight"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; }, {}, never, ["mat-panel-title", "mat-panel-description", "*"], true, never>;
  196. static ngAcceptInputType_tabIndex: unknown;
  197. }
  198. /**
  199. * Description element of a `<mat-expansion-panel-header>`.
  200. */
  201. declare class MatExpansionPanelDescription {
  202. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanelDescription, never>;
  203. static ɵdir: i0.ɵɵDirectiveDeclaration<MatExpansionPanelDescription, "mat-panel-description", never, {}, {}, never, never, true, never>;
  204. }
  205. /**
  206. * Title element of a `<mat-expansion-panel-header>`.
  207. */
  208. declare class MatExpansionPanelTitle {
  209. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionPanelTitle, never>;
  210. static ɵdir: i0.ɵɵDirectiveDeclaration<MatExpansionPanelTitle, "mat-panel-title", never, {}, {}, never, never, true, never>;
  211. }
  212. /**
  213. * Directive for a Material Design Accordion.
  214. */
  215. declare class MatAccordion extends CdkAccordion implements MatAccordionBase, AfterContentInit, OnDestroy {
  216. private _keyManager;
  217. /** Headers belonging to this accordion. */
  218. private _ownHeaders;
  219. /** All headers inside the accordion. Includes headers inside nested accordions. */
  220. _headers: QueryList<MatExpansionPanelHeader>;
  221. /** Whether the expansion indicator should be hidden. */
  222. hideToggle: boolean;
  223. /**
  224. * Display mode used for all expansion panels in the accordion. Currently two display
  225. * modes exist:
  226. * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
  227. * panel at a different elevation from the rest of the accordion.
  228. * flat - no spacing is placed around expanded panels, showing all panels at the same
  229. * elevation.
  230. */
  231. displayMode: MatAccordionDisplayMode;
  232. /** The position of the expansion indicator. */
  233. togglePosition: MatAccordionTogglePosition;
  234. ngAfterContentInit(): void;
  235. /** Handles keyboard events coming in from the panel headers. */
  236. _handleHeaderKeydown(event: KeyboardEvent): void;
  237. _handleHeaderFocus(header: MatExpansionPanelHeader): void;
  238. ngOnDestroy(): void;
  239. static ɵfac: i0.ɵɵFactoryDeclaration<MatAccordion, never>;
  240. static ɵdir: i0.ɵɵDirectiveDeclaration<MatAccordion, "mat-accordion", ["matAccordion"], { "hideToggle": { "alias": "hideToggle"; "required": false; }; "displayMode": { "alias": "displayMode"; "required": false; }; "togglePosition": { "alias": "togglePosition"; "required": false; }; }, {}, ["_headers"], never, true, never>;
  241. static ngAcceptInputType_hideToggle: unknown;
  242. }
  243. declare class MatExpansionModule {
  244. static ɵfac: i0.ɵɵFactoryDeclaration<MatExpansionModule, never>;
  245. static ɵmod: i0.ɵɵNgModuleDeclaration<MatExpansionModule, never, [typeof MatCommonModule, typeof i2.CdkAccordionModule, typeof i3.PortalModule, typeof MatAccordion, typeof MatExpansionPanel, typeof MatExpansionPanelActionRow, typeof MatExpansionPanelHeader, typeof MatExpansionPanelTitle, typeof MatExpansionPanelDescription, typeof MatExpansionPanelContent], [typeof MatAccordion, typeof MatExpansionPanel, typeof MatExpansionPanelActionRow, typeof MatExpansionPanelHeader, typeof MatExpansionPanelTitle, typeof MatExpansionPanelDescription, typeof MatExpansionPanelContent]>;
  246. static ɵinj: i0.ɵɵInjectorDeclaration<MatExpansionModule>;
  247. }
  248. /**
  249. * Time and timing curve for expansion panel animations.
  250. * @deprecated No longer used. Will be removed.
  251. * @breaking-change 21.0.0
  252. */
  253. declare const EXPANSION_PANEL_ANIMATION_TIMING = "225ms cubic-bezier(0.4,0.0,0.2,1)";
  254. /**
  255. * Animations used by the Material expansion panel.
  256. *
  257. * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
  258. * causes the animation state of moved components to become `void` upon exit, and not update again
  259. * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
  260. * of the panel is `expanded` or `collapsed` but the animation state is `void`.
  261. *
  262. * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
  263. * are defined to have the same styles. Since angular animates from the current styles to the
  264. * destination state's style definition, in situations where we are moving from `void`'s styles to
  265. * `collapsed` this acts a noop since no style values change.
  266. *
  267. * In the case where angular's animation state is out of sync with the expansion panel's state, the
  268. * expansion panel being `expanded` and angular animations being `void`, the animation from the
  269. * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
  270. * occur as expected.
  271. *
  272. * Angular Bug: https://github.com/angular/angular/issues/18847
  273. *
  274. * @docs-private
  275. * @deprecated No longer being used, to be removed.
  276. * @breaking-change 21.0.0
  277. */
  278. declare const matExpansionAnimations: {
  279. readonly indicatorRotate: any;
  280. readonly bodyExpansion: any;
  281. };
  282. export { EXPANSION_PANEL_ANIMATION_TIMING, MAT_ACCORDION, MAT_EXPANSION_PANEL, MAT_EXPANSION_PANEL_DEFAULT_OPTIONS, MatAccordion, MatExpansionModule, MatExpansionPanel, MatExpansionPanelActionRow, MatExpansionPanelContent, MatExpansionPanelDescription, MatExpansionPanelHeader, MatExpansionPanelTitle, matExpansionAnimations };
  283. export type { MatAccordionBase, MatAccordionDisplayMode, MatAccordionTogglePosition, MatExpansionPanelDefaultOptions, MatExpansionPanelState };