@@ -31,6 +31,7 @@ import {
31
31
ViewContainerRef ,
32
32
ViewEncapsulation ,
33
33
ViewChild ,
34
+ InjectionToken ,
34
35
} from '@angular/core' ;
35
36
import { DOCUMENT } from '@angular/common' ;
36
37
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations' ;
@@ -46,6 +47,28 @@ export type MatExpansionPanelState = 'expanded' | 'collapsed';
46
47
/** Counter for generating unique element ids. */
47
48
let uniqueId = 0 ;
48
49
50
+ /**
51
+ * Object that can be used to override the default options
52
+ * for all of the expansion panels in a module.
53
+ */
54
+ export interface MatExpansionPanelDefaultOptions {
55
+ /** Height of the header while the panel is expanded. */
56
+ expandedHeight : string ;
57
+
58
+ /** Height of the header while the panel is collapsed. */
59
+ collapsedHeight : string ;
60
+
61
+ /** Whether the toggle indicator should be hidden. */
62
+ hideToggle : boolean ;
63
+ }
64
+
65
+ /**
66
+ * Injection token that can be used to configure the defalt
67
+ * options for the expansion panel component.
68
+ */
69
+ export const MAT_EXPANSION_PANEL_DEFAULT_OPTIONS =
70
+ new InjectionToken < MatExpansionPanelDefaultOptions > ( 'MAT_EXPANSION_PANEL_DEFAULT_OPTIONS' ) ;
71
+
49
72
/**
50
73
* `<mat-expansion-panel>`
51
74
*
@@ -125,7 +148,9 @@ export class MatExpansionPanel extends CdkAccordionItem implements AfterContentI
125
148
private _viewContainerRef : ViewContainerRef ,
126
149
// @breaking -change 8.0.0 _document and _animationMode to be made required
127
150
@Inject ( DOCUMENT ) _document ?: any ,
128
- @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ) {
151
+ @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ,
152
+ @Inject ( MAT_EXPANSION_PANEL_DEFAULT_OPTIONS ) @Optional ( )
153
+ defaultOptions ?: MatExpansionPanelDefaultOptions ) {
129
154
super ( accordion , _changeDetectorRef , _uniqueSelectionDispatcher ) ;
130
155
this . accordion = accordion ;
131
156
this . _document = _document ;
@@ -143,6 +168,10 @@ export class MatExpansionPanel extends CdkAccordionItem implements AfterContentI
143
168
}
144
169
}
145
170
} ) ;
171
+
172
+ if ( defaultOptions ) {
173
+ this . hideToggle = defaultOptions . hideToggle ;
174
+ }
146
175
}
147
176
148
177
/** Determines whether the expansion panel should have spacing between it and its siblings. */
0 commit comments