MCPcopy Index your code
hub / github.com/angular/components / constructor

Method constructor

src/material/dialog/dialog-ref.ts:67–117  ·  view source on GitHub ↗
(
    private _ref: DialogRef<R, T>,
    private _config: MatDialogConfig,
    public _containerInstance: MatDialogContainer,
  )

Source from the content-addressed store, hash-verified

65 private _closeInteractionType: FocusOrigin | undefined;
66
67 constructor(
68 private _ref: DialogRef<R, T>,
69 private _config: MatDialogConfig,
70 public _containerInstance: MatDialogContainer,
71 ) {
72 this.disableClose = _config.disableClose;
73 this.id = _ref.id;
74
75 // Used to target panels specifically tied to dialogs.
76 _ref.addPanelClass('mat-mdc-dialog-panel');
77
78 // Emit when opening animation completes
79 _containerInstance._animationStateChanged
80 .pipe(
81 filter(event => event.state === 'opened'),
82 take(1),
83 )
84 .subscribe(() => {
85 this._afterOpened.next();
86 this._afterOpened.complete();
87 });
88
89 // Dispose overlay when closing animation is complete
90 _containerInstance._animationStateChanged
91 .pipe(
92 filter(event => event.state === 'closed'),
93 take(1),
94 )
95 .subscribe(() => {
96 clearTimeout(this._closeFallbackTimeout);
97 this._finishDialogClose();
98 });
99
100 _ref.overlayRef.detachments().subscribe(() => {
101 this._beforeClosed.next(this._result);
102 this._beforeClosed.complete();
103 this._finishDialogClose();
104 });
105
106 merge(
107 this.backdropClick(),
108 this.keydownEvents().pipe(
109 filter(event => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)),
110 ),
111 ).subscribe(event => {
112 if (!this.disableClose) {
113 event.preventDefault();
114 _closeDialogVia(this, event.type === 'keydown' ? 'keyboard' : 'mouse');
115 }
116 });
117 }
118
119 /**
120 * Close the dialog.

Callers

nothing calls this directly

Calls 8

_finishDialogCloseMethod · 0.95
backdropClickMethod · 0.95
keydownEventsMethod · 0.95
hasModifierKeyFunction · 0.90
_closeDialogViaFunction · 0.85
detachmentsMethod · 0.80
addPanelClassMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected