expansion-panel-header.ts (material2-7.3.2) | : | expansion-panel-header.ts (material2-7.3.3) | ||
---|---|---|---|---|
skipping to change at line 79 | skipping to change at line 79 | |||
export class MatExpansionPanelHeader implements OnDestroy, FocusableOption { | export class MatExpansionPanelHeader implements OnDestroy, FocusableOption { | |||
private _parentChangeSubscription = Subscription.EMPTY; | private _parentChangeSubscription = Subscription.EMPTY; | |||
constructor( | constructor( | |||
@Host() public panel: MatExpansionPanel, | @Host() public panel: MatExpansionPanel, | |||
private _element: ElementRef, | private _element: ElementRef, | |||
private _focusMonitor: FocusMonitor, | private _focusMonitor: FocusMonitor, | |||
private _changeDetectorRef: ChangeDetectorRef, | private _changeDetectorRef: ChangeDetectorRef, | |||
@Inject(MAT_EXPANSION_PANEL_DEFAULT_OPTIONS) @Optional() | @Inject(MAT_EXPANSION_PANEL_DEFAULT_OPTIONS) @Optional() | |||
defaultOptions?: MatExpansionPanelDefaultOptions) { | defaultOptions?: MatExpansionPanelDefaultOptions) { | |||
const accordionHideToggleChange = panel.accordion ? | const accordionHideToggleChange = panel.accordion ? | |||
panel.accordion._stateChanges.pipe(filter(changes => !!changes.hideToggle) | panel.accordion._stateChanges.pipe( | |||
) : EMPTY; | filter(changes => !!changes['hideToggle'])) : | |||
EMPTY; | ||||
// Since the toggle state depends on an @Input on the panel, we | // Since the toggle state depends on an @Input on the panel, we | |||
// need to subscribe and trigger change detection manually. | // need to subscribe and trigger change detection manually. | |||
this._parentChangeSubscription = merge( | this._parentChangeSubscription = | |||
panel.opened, | merge( | |||
panel.closed, | panel.opened, panel.closed, accordionHideToggleChange, | |||
accordionHideToggleChange, | panel._inputChanges.pipe(filter( | |||
panel._inputChanges.pipe(filter(changes => !!(changes.hideToggle || change | changes => !!(changes['hideToggle'] || changes['disabled'])))) | |||
s.disabled))) | ||||
) | ||||
.subscribe(() => this._changeDetectorRef.markForCheck()); | .subscribe(() => this._changeDetectorRef.markForCheck()); | |||
// Avoids focus being lost if the panel contained the focused element and wa s closed. | // Avoids focus being lost if the panel contained the focused element and wa s closed. | |||
panel.closed | panel.closed | |||
.pipe(filter(() => panel._containsFocus())) | .pipe(filter(() => panel._containsFocus())) | |||
.subscribe(() => _focusMonitor.focusVia(_element, 'program')); | .subscribe(() => _focusMonitor.focusVia(_element, 'program')); | |||
_focusMonitor.monitor(_element).subscribe(origin => { | _focusMonitor.monitor(_element).subscribe(origin => { | |||
if (origin && panel.accordion) { | if (origin && panel.accordion) { | |||
panel.accordion._handleHeaderFocus(this); | panel.accordion._handleHeaderFocus(this); | |||
End of changes. 3 change blocks. | ||||
10 lines changed or deleted | 8 lines changed or added |