mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
873 lines
36 KiB
873 lines
36 KiB
import * as i0 from '@angular/core';
|
|
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, InjectionToken, inject, Injector, Injectable, ElementRef, Directive, Input, NgModule } from '@angular/core';
|
|
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
import * as i1 from '@angular/cdk/scrolling';
|
|
import { CdkScrollable } from '@angular/cdk/scrolling';
|
|
import { createBlockScrollStrategy, createGlobalPositionStrategy, OverlayModule } from '@angular/cdk/overlay';
|
|
import { CdkDialogContainer, Dialog, DialogConfig, DialogModule } from '@angular/cdk/dialog';
|
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
import { CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
|
|
import { _animationsDisabled } from './_animation-chunk.mjs';
|
|
import { ReplaySubject, merge, Subject, defer } from 'rxjs';
|
|
import { filter, take, startWith } from 'rxjs/operators';
|
|
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
import { BidiModule } from '@angular/cdk/bidi';
|
|
import '@angular/cdk/layout';
|
|
|
|
class MatDialogConfig {
|
|
viewContainerRef;
|
|
injector;
|
|
id;
|
|
role = 'dialog';
|
|
panelClass = '';
|
|
hasBackdrop = true;
|
|
backdropClass = '';
|
|
disableClose = false;
|
|
closePredicate;
|
|
width = '';
|
|
height = '';
|
|
minWidth;
|
|
minHeight;
|
|
maxWidth;
|
|
maxHeight;
|
|
position;
|
|
data = null;
|
|
direction;
|
|
ariaDescribedBy = null;
|
|
ariaLabelledBy = null;
|
|
ariaLabel = null;
|
|
ariaModal = false;
|
|
autoFocus = 'first-tabbable';
|
|
restoreFocus = true;
|
|
delayFocusTrap = true;
|
|
scrollStrategy;
|
|
closeOnNavigation = true;
|
|
enterAnimationDuration;
|
|
exitAnimationDuration;
|
|
}
|
|
|
|
const OPEN_CLASS = 'mdc-dialog--open';
|
|
const OPENING_CLASS = 'mdc-dialog--opening';
|
|
const CLOSING_CLASS = 'mdc-dialog--closing';
|
|
const OPEN_ANIMATION_DURATION = 150;
|
|
const CLOSE_ANIMATION_DURATION = 75;
|
|
class MatDialogContainer extends CdkDialogContainer {
|
|
_animationStateChanged = new EventEmitter();
|
|
_animationsEnabled = !_animationsDisabled();
|
|
_actionSectionCount = 0;
|
|
_hostElement = this._elementRef.nativeElement;
|
|
_enterAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.enterAnimationDuration) ?? OPEN_ANIMATION_DURATION : 0;
|
|
_exitAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.exitAnimationDuration) ?? CLOSE_ANIMATION_DURATION : 0;
|
|
_animationTimer = null;
|
|
_contentAttached() {
|
|
super._contentAttached();
|
|
this._startOpenAnimation();
|
|
}
|
|
_startOpenAnimation() {
|
|
this._animationStateChanged.emit({
|
|
state: 'opening',
|
|
totalTime: this._enterAnimationDuration
|
|
});
|
|
if (this._animationsEnabled) {
|
|
this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._enterAnimationDuration}ms`);
|
|
this._requestAnimationFrame(() => this._hostElement.classList.add(OPENING_CLASS, OPEN_CLASS));
|
|
this._waitForAnimationToComplete(this._enterAnimationDuration, this._finishDialogOpen);
|
|
} else {
|
|
this._hostElement.classList.add(OPEN_CLASS);
|
|
Promise.resolve().then(() => this._finishDialogOpen());
|
|
}
|
|
}
|
|
_startExitAnimation() {
|
|
this._animationStateChanged.emit({
|
|
state: 'closing',
|
|
totalTime: this._exitAnimationDuration
|
|
});
|
|
this._hostElement.classList.remove(OPEN_CLASS);
|
|
if (this._animationsEnabled) {
|
|
this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._exitAnimationDuration}ms`);
|
|
this._requestAnimationFrame(() => this._hostElement.classList.add(CLOSING_CLASS));
|
|
this._waitForAnimationToComplete(this._exitAnimationDuration, this._finishDialogClose);
|
|
} else {
|
|
Promise.resolve().then(() => this._finishDialogClose());
|
|
}
|
|
}
|
|
_updateActionSectionCount(delta) {
|
|
this._actionSectionCount += delta;
|
|
this._changeDetectorRef.markForCheck();
|
|
}
|
|
_finishDialogOpen = () => {
|
|
this._clearAnimationClasses();
|
|
this._openAnimationDone(this._enterAnimationDuration);
|
|
};
|
|
_finishDialogClose = () => {
|
|
this._clearAnimationClasses();
|
|
this._animationStateChanged.emit({
|
|
state: 'closed',
|
|
totalTime: this._exitAnimationDuration
|
|
});
|
|
};
|
|
_clearAnimationClasses() {
|
|
this._hostElement.classList.remove(OPENING_CLASS, CLOSING_CLASS);
|
|
}
|
|
_waitForAnimationToComplete(duration, callback) {
|
|
if (this._animationTimer !== null) {
|
|
clearTimeout(this._animationTimer);
|
|
}
|
|
this._animationTimer = setTimeout(callback, duration);
|
|
}
|
|
_requestAnimationFrame(callback) {
|
|
this._ngZone.runOutsideAngular(() => {
|
|
if (typeof requestAnimationFrame === 'function') {
|
|
requestAnimationFrame(callback);
|
|
} else {
|
|
callback();
|
|
}
|
|
});
|
|
}
|
|
_captureInitialFocus() {
|
|
if (!this._config.delayFocusTrap) {
|
|
this._trapFocus();
|
|
}
|
|
}
|
|
_openAnimationDone(totalTime) {
|
|
if (this._config.delayFocusTrap) {
|
|
this._trapFocus();
|
|
}
|
|
this._animationStateChanged.next({
|
|
state: 'opened',
|
|
totalTime
|
|
});
|
|
}
|
|
ngOnDestroy() {
|
|
super.ngOnDestroy();
|
|
if (this._animationTimer !== null) {
|
|
clearTimeout(this._animationTimer);
|
|
}
|
|
}
|
|
attachComponentPortal(portal) {
|
|
const ref = super.attachComponentPortal(portal);
|
|
ref.location.nativeElement.classList.add('mat-mdc-dialog-component-host');
|
|
return ref;
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogContainer,
|
|
deps: null,
|
|
target: i0.ɵɵFactoryTarget.Component
|
|
});
|
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogContainer,
|
|
isStandalone: true,
|
|
selector: "mat-dialog-container",
|
|
host: {
|
|
attributes: {
|
|
"tabindex": "-1"
|
|
},
|
|
properties: {
|
|
"attr.aria-modal": "_config.ariaModal",
|
|
"id": "_config.id",
|
|
"attr.role": "_config.role",
|
|
"attr.aria-labelledby": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]",
|
|
"attr.aria-label": "_config.ariaLabel",
|
|
"attr.aria-describedby": "_config.ariaDescribedBy || null",
|
|
"class._mat-animation-noopable": "!_animationsEnabled",
|
|
"class.mat-mdc-dialog-container-with-actions": "_actionSectionCount > 0"
|
|
},
|
|
classAttribute: "mat-mdc-dialog-container mdc-dialog"
|
|
},
|
|
usesInheritance: true,
|
|
ngImport: i0,
|
|
template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n",
|
|
styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"],
|
|
dependencies: [{
|
|
kind: "directive",
|
|
type: CdkPortalOutlet,
|
|
selector: "[cdkPortalOutlet]",
|
|
inputs: ["cdkPortalOutlet"],
|
|
outputs: ["attached"],
|
|
exportAs: ["cdkPortalOutlet"]
|
|
}],
|
|
changeDetection: i0.ChangeDetectionStrategy.Default,
|
|
encapsulation: i0.ViewEncapsulation.None
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogContainer,
|
|
decorators: [{
|
|
type: Component,
|
|
args: [{
|
|
selector: 'mat-dialog-container',
|
|
encapsulation: ViewEncapsulation.None,
|
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
imports: [CdkPortalOutlet],
|
|
host: {
|
|
'class': 'mat-mdc-dialog-container mdc-dialog',
|
|
'tabindex': '-1',
|
|
'[attr.aria-modal]': '_config.ariaModal',
|
|
'[id]': '_config.id',
|
|
'[attr.role]': '_config.role',
|
|
'[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]',
|
|
'[attr.aria-label]': '_config.ariaLabel',
|
|
'[attr.aria-describedby]': '_config.ariaDescribedBy || null',
|
|
'[class._mat-animation-noopable]': '!_animationsEnabled',
|
|
'[class.mat-mdc-dialog-container-with-actions]': '_actionSectionCount > 0'
|
|
},
|
|
template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n",
|
|
styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"]
|
|
}]
|
|
}]
|
|
});
|
|
const TRANSITION_DURATION_PROPERTY = '--mat-dialog-transition-duration';
|
|
function parseCssTime(time) {
|
|
if (time == null) {
|
|
return null;
|
|
}
|
|
if (typeof time === 'number') {
|
|
return time;
|
|
}
|
|
if (time.endsWith('ms')) {
|
|
return coerceNumberProperty(time.substring(0, time.length - 2));
|
|
}
|
|
if (time.endsWith('s')) {
|
|
return coerceNumberProperty(time.substring(0, time.length - 1)) * 1000;
|
|
}
|
|
if (time === '0') {
|
|
return 0;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
var MatDialogState;
|
|
(function (MatDialogState) {
|
|
MatDialogState[MatDialogState["OPEN"] = 0] = "OPEN";
|
|
MatDialogState[MatDialogState["CLOSING"] = 1] = "CLOSING";
|
|
MatDialogState[MatDialogState["CLOSED"] = 2] = "CLOSED";
|
|
})(MatDialogState || (MatDialogState = {}));
|
|
class MatDialogRef {
|
|
_ref;
|
|
_config;
|
|
_containerInstance;
|
|
componentInstance;
|
|
componentRef = null;
|
|
disableClose;
|
|
id;
|
|
_afterOpened = new ReplaySubject(1);
|
|
_beforeClosed = new ReplaySubject(1);
|
|
_result;
|
|
_closeFallbackTimeout;
|
|
_state = MatDialogState.OPEN;
|
|
_closeInteractionType;
|
|
constructor(_ref, _config, _containerInstance) {
|
|
this._ref = _ref;
|
|
this._config = _config;
|
|
this._containerInstance = _containerInstance;
|
|
this.disableClose = _config.disableClose;
|
|
this.id = _ref.id;
|
|
_ref.addPanelClass('mat-mdc-dialog-panel');
|
|
_containerInstance._animationStateChanged.pipe(filter(event => event.state === 'opened'), take(1)).subscribe(() => {
|
|
this._afterOpened.next();
|
|
this._afterOpened.complete();
|
|
});
|
|
_containerInstance._animationStateChanged.pipe(filter(event => event.state === 'closed'), take(1)).subscribe(() => {
|
|
clearTimeout(this._closeFallbackTimeout);
|
|
this._finishDialogClose();
|
|
});
|
|
_ref.overlayRef.detachments().subscribe(() => {
|
|
this._beforeClosed.next(this._result);
|
|
this._beforeClosed.complete();
|
|
this._finishDialogClose();
|
|
});
|
|
merge(this.backdropClick(), this.keydownEvents().pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).subscribe(event => {
|
|
if (!this.disableClose) {
|
|
event.preventDefault();
|
|
_closeDialogVia(this, event.type === 'keydown' ? 'keyboard' : 'mouse');
|
|
}
|
|
});
|
|
}
|
|
close(dialogResult) {
|
|
const closePredicate = this._config.closePredicate;
|
|
if (closePredicate && !closePredicate(dialogResult, this._config, this.componentInstance)) {
|
|
return;
|
|
}
|
|
this._result = dialogResult;
|
|
this._containerInstance._animationStateChanged.pipe(filter(event => event.state === 'closing'), take(1)).subscribe(event => {
|
|
this._beforeClosed.next(dialogResult);
|
|
this._beforeClosed.complete();
|
|
this._ref.overlayRef.detachBackdrop();
|
|
this._closeFallbackTimeout = setTimeout(() => this._finishDialogClose(), event.totalTime + 100);
|
|
});
|
|
this._state = MatDialogState.CLOSING;
|
|
this._containerInstance._startExitAnimation();
|
|
}
|
|
afterOpened() {
|
|
return this._afterOpened;
|
|
}
|
|
afterClosed() {
|
|
return this._ref.closed;
|
|
}
|
|
beforeClosed() {
|
|
return this._beforeClosed;
|
|
}
|
|
backdropClick() {
|
|
return this._ref.backdropClick;
|
|
}
|
|
keydownEvents() {
|
|
return this._ref.keydownEvents;
|
|
}
|
|
updatePosition(position) {
|
|
let strategy = this._ref.config.positionStrategy;
|
|
if (position && (position.left || position.right)) {
|
|
position.left ? strategy.left(position.left) : strategy.right(position.right);
|
|
} else {
|
|
strategy.centerHorizontally();
|
|
}
|
|
if (position && (position.top || position.bottom)) {
|
|
position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
|
|
} else {
|
|
strategy.centerVertically();
|
|
}
|
|
this._ref.updatePosition();
|
|
return this;
|
|
}
|
|
updateSize(width = '', height = '') {
|
|
this._ref.updateSize(width, height);
|
|
return this;
|
|
}
|
|
addPanelClass(classes) {
|
|
this._ref.addPanelClass(classes);
|
|
return this;
|
|
}
|
|
removePanelClass(classes) {
|
|
this._ref.removePanelClass(classes);
|
|
return this;
|
|
}
|
|
getState() {
|
|
return this._state;
|
|
}
|
|
_finishDialogClose() {
|
|
this._state = MatDialogState.CLOSED;
|
|
this._ref.close(this._result, {
|
|
focusOrigin: this._closeInteractionType
|
|
});
|
|
this.componentInstance = null;
|
|
}
|
|
}
|
|
function _closeDialogVia(ref, interactionType, result) {
|
|
ref._closeInteractionType = interactionType;
|
|
return ref.close(result);
|
|
}
|
|
|
|
const MAT_DIALOG_DATA = new InjectionToken('MatMdcDialogData');
|
|
const MAT_DIALOG_DEFAULT_OPTIONS = new InjectionToken('mat-mdc-dialog-default-options');
|
|
const MAT_DIALOG_SCROLL_STRATEGY = new InjectionToken('mat-mdc-dialog-scroll-strategy', {
|
|
providedIn: 'root',
|
|
factory: () => {
|
|
const injector = inject(Injector);
|
|
return () => createBlockScrollStrategy(injector);
|
|
}
|
|
});
|
|
class MatDialog {
|
|
_defaultOptions = inject(MAT_DIALOG_DEFAULT_OPTIONS, {
|
|
optional: true
|
|
});
|
|
_scrollStrategy = inject(MAT_DIALOG_SCROLL_STRATEGY);
|
|
_parentDialog = inject(MatDialog, {
|
|
optional: true,
|
|
skipSelf: true
|
|
});
|
|
_idGenerator = inject(_IdGenerator);
|
|
_injector = inject(Injector);
|
|
_dialog = inject(Dialog);
|
|
_animationsDisabled = _animationsDisabled();
|
|
_openDialogsAtThisLevel = [];
|
|
_afterAllClosedAtThisLevel = new Subject();
|
|
_afterOpenedAtThisLevel = new Subject();
|
|
dialogConfigClass = MatDialogConfig;
|
|
_dialogRefConstructor;
|
|
_dialogContainerType;
|
|
_dialogDataToken;
|
|
get openDialogs() {
|
|
return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
|
|
}
|
|
get afterOpened() {
|
|
return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
|
|
}
|
|
_getAfterAllClosed() {
|
|
const parent = this._parentDialog;
|
|
return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
|
|
}
|
|
afterAllClosed = defer(() => this.openDialogs.length ? this._getAfterAllClosed() : this._getAfterAllClosed().pipe(startWith(undefined)));
|
|
constructor() {
|
|
this._dialogRefConstructor = MatDialogRef;
|
|
this._dialogContainerType = MatDialogContainer;
|
|
this._dialogDataToken = MAT_DIALOG_DATA;
|
|
}
|
|
open(componentOrTemplateRef, config) {
|
|
let dialogRef;
|
|
config = {
|
|
...(this._defaultOptions || new MatDialogConfig()),
|
|
...config
|
|
};
|
|
config.id = config.id || this._idGenerator.getId('mat-mdc-dialog-');
|
|
config.scrollStrategy = config.scrollStrategy || this._scrollStrategy();
|
|
const cdkRef = this._dialog.open(componentOrTemplateRef, {
|
|
...config,
|
|
positionStrategy: createGlobalPositionStrategy(this._injector).centerHorizontally().centerVertically(),
|
|
disableClose: true,
|
|
closePredicate: undefined,
|
|
closeOnDestroy: false,
|
|
closeOnOverlayDetachments: false,
|
|
disableAnimations: this._animationsDisabled || config.enterAnimationDuration?.toLocaleString() === '0' || config.exitAnimationDuration?.toString() === '0',
|
|
container: {
|
|
type: this._dialogContainerType,
|
|
providers: () => [{
|
|
provide: this.dialogConfigClass,
|
|
useValue: config
|
|
}, {
|
|
provide: DialogConfig,
|
|
useValue: config
|
|
}]
|
|
},
|
|
templateContext: () => ({
|
|
dialogRef
|
|
}),
|
|
providers: (ref, cdkConfig, dialogContainer) => {
|
|
dialogRef = new this._dialogRefConstructor(ref, config, dialogContainer);
|
|
dialogRef.updatePosition(config?.position);
|
|
return [{
|
|
provide: this._dialogContainerType,
|
|
useValue: dialogContainer
|
|
}, {
|
|
provide: this._dialogDataToken,
|
|
useValue: cdkConfig.data
|
|
}, {
|
|
provide: this._dialogRefConstructor,
|
|
useValue: dialogRef
|
|
}];
|
|
}
|
|
});
|
|
dialogRef.componentRef = cdkRef.componentRef;
|
|
dialogRef.componentInstance = cdkRef.componentInstance;
|
|
this.openDialogs.push(dialogRef);
|
|
this.afterOpened.next(dialogRef);
|
|
dialogRef.afterClosed().subscribe(() => {
|
|
const index = this.openDialogs.indexOf(dialogRef);
|
|
if (index > -1) {
|
|
this.openDialogs.splice(index, 1);
|
|
if (!this.openDialogs.length) {
|
|
this._getAfterAllClosed().next();
|
|
}
|
|
}
|
|
});
|
|
return dialogRef;
|
|
}
|
|
closeAll() {
|
|
this._closeDialogs(this.openDialogs);
|
|
}
|
|
getDialogById(id) {
|
|
return this.openDialogs.find(dialog => dialog.id === id);
|
|
}
|
|
ngOnDestroy() {
|
|
this._closeDialogs(this._openDialogsAtThisLevel);
|
|
this._afterAllClosedAtThisLevel.complete();
|
|
this._afterOpenedAtThisLevel.complete();
|
|
}
|
|
_closeDialogs(dialogs) {
|
|
let i = dialogs.length;
|
|
while (i--) {
|
|
dialogs[i].close();
|
|
}
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialog,
|
|
deps: [],
|
|
target: i0.ɵɵFactoryTarget.Injectable
|
|
});
|
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialog,
|
|
providedIn: 'root'
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialog,
|
|
decorators: [{
|
|
type: Injectable,
|
|
args: [{
|
|
providedIn: 'root'
|
|
}]
|
|
}],
|
|
ctorParameters: () => []
|
|
});
|
|
|
|
class MatDialogClose {
|
|
dialogRef = inject(MatDialogRef, {
|
|
optional: true
|
|
});
|
|
_elementRef = inject(ElementRef);
|
|
_dialog = inject(MatDialog);
|
|
ariaLabel;
|
|
type = 'button';
|
|
dialogResult;
|
|
_matDialogClose;
|
|
constructor() {}
|
|
ngOnInit() {
|
|
if (!this.dialogRef) {
|
|
this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
|
|
}
|
|
}
|
|
ngOnChanges(changes) {
|
|
const proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
|
|
if (proxiedChange) {
|
|
this.dialogResult = proxiedChange.currentValue;
|
|
}
|
|
}
|
|
_onButtonClick(event) {
|
|
_closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult);
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogClose,
|
|
deps: [],
|
|
target: i0.ɵɵFactoryTarget.Directive
|
|
});
|
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogClose,
|
|
isStandalone: true,
|
|
selector: "[mat-dialog-close], [matDialogClose]",
|
|
inputs: {
|
|
ariaLabel: ["aria-label", "ariaLabel"],
|
|
type: "type",
|
|
dialogResult: ["mat-dialog-close", "dialogResult"],
|
|
_matDialogClose: ["matDialogClose", "_matDialogClose"]
|
|
},
|
|
host: {
|
|
listeners: {
|
|
"click": "_onButtonClick($event)"
|
|
},
|
|
properties: {
|
|
"attr.aria-label": "ariaLabel || null",
|
|
"attr.type": "type"
|
|
}
|
|
},
|
|
exportAs: ["matDialogClose"],
|
|
usesOnChanges: true,
|
|
ngImport: i0
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogClose,
|
|
decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: '[mat-dialog-close], [matDialogClose]',
|
|
exportAs: 'matDialogClose',
|
|
host: {
|
|
'(click)': '_onButtonClick($event)',
|
|
'[attr.aria-label]': 'ariaLabel || null',
|
|
'[attr.type]': 'type'
|
|
}
|
|
}]
|
|
}],
|
|
ctorParameters: () => [],
|
|
propDecorators: {
|
|
ariaLabel: [{
|
|
type: Input,
|
|
args: ['aria-label']
|
|
}],
|
|
type: [{
|
|
type: Input
|
|
}],
|
|
dialogResult: [{
|
|
type: Input,
|
|
args: ['mat-dialog-close']
|
|
}],
|
|
_matDialogClose: [{
|
|
type: Input,
|
|
args: ['matDialogClose']
|
|
}]
|
|
}
|
|
});
|
|
class MatDialogLayoutSection {
|
|
_dialogRef = inject(MatDialogRef, {
|
|
optional: true
|
|
});
|
|
_elementRef = inject(ElementRef);
|
|
_dialog = inject(MatDialog);
|
|
constructor() {}
|
|
ngOnInit() {
|
|
if (!this._dialogRef) {
|
|
this._dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
|
|
}
|
|
if (this._dialogRef) {
|
|
Promise.resolve().then(() => {
|
|
this._onAdd();
|
|
});
|
|
}
|
|
}
|
|
ngOnDestroy() {
|
|
const instance = this._dialogRef?._containerInstance;
|
|
if (instance) {
|
|
Promise.resolve().then(() => {
|
|
this._onRemove();
|
|
});
|
|
}
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogLayoutSection,
|
|
deps: [],
|
|
target: i0.ɵɵFactoryTarget.Directive
|
|
});
|
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogLayoutSection,
|
|
isStandalone: true,
|
|
ngImport: i0
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogLayoutSection,
|
|
decorators: [{
|
|
type: Directive
|
|
}],
|
|
ctorParameters: () => []
|
|
});
|
|
class MatDialogTitle extends MatDialogLayoutSection {
|
|
id = inject(_IdGenerator).getId('mat-mdc-dialog-title-');
|
|
_onAdd() {
|
|
this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id);
|
|
}
|
|
_onRemove() {
|
|
this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id);
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogTitle,
|
|
deps: null,
|
|
target: i0.ɵɵFactoryTarget.Directive
|
|
});
|
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogTitle,
|
|
isStandalone: true,
|
|
selector: "[mat-dialog-title], [matDialogTitle]",
|
|
inputs: {
|
|
id: "id"
|
|
},
|
|
host: {
|
|
properties: {
|
|
"id": "id"
|
|
},
|
|
classAttribute: "mat-mdc-dialog-title mdc-dialog__title"
|
|
},
|
|
exportAs: ["matDialogTitle"],
|
|
usesInheritance: true,
|
|
ngImport: i0
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogTitle,
|
|
decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: '[mat-dialog-title], [matDialogTitle]',
|
|
exportAs: 'matDialogTitle',
|
|
host: {
|
|
'class': 'mat-mdc-dialog-title mdc-dialog__title',
|
|
'[id]': 'id'
|
|
}
|
|
}]
|
|
}],
|
|
propDecorators: {
|
|
id: [{
|
|
type: Input
|
|
}]
|
|
}
|
|
});
|
|
class MatDialogContent {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogContent,
|
|
deps: [],
|
|
target: i0.ɵɵFactoryTarget.Directive
|
|
});
|
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogContent,
|
|
isStandalone: true,
|
|
selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]",
|
|
host: {
|
|
classAttribute: "mat-mdc-dialog-content mdc-dialog__content"
|
|
},
|
|
hostDirectives: [{
|
|
directive: i1.CdkScrollable
|
|
}],
|
|
ngImport: i0
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogContent,
|
|
decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
|
|
host: {
|
|
'class': 'mat-mdc-dialog-content mdc-dialog__content'
|
|
},
|
|
hostDirectives: [CdkScrollable]
|
|
}]
|
|
}]
|
|
});
|
|
class MatDialogActions extends MatDialogLayoutSection {
|
|
align;
|
|
_onAdd() {
|
|
this._dialogRef._containerInstance?._updateActionSectionCount?.(1);
|
|
}
|
|
_onRemove() {
|
|
this._dialogRef._containerInstance?._updateActionSectionCount?.(-1);
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogActions,
|
|
deps: null,
|
|
target: i0.ɵɵFactoryTarget.Directive
|
|
});
|
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
type: MatDialogActions,
|
|
isStandalone: true,
|
|
selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
|
|
inputs: {
|
|
align: "align"
|
|
},
|
|
host: {
|
|
properties: {
|
|
"class.mat-mdc-dialog-actions-align-start": "align === \"start\"",
|
|
"class.mat-mdc-dialog-actions-align-center": "align === \"center\"",
|
|
"class.mat-mdc-dialog-actions-align-end": "align === \"end\""
|
|
},
|
|
classAttribute: "mat-mdc-dialog-actions mdc-dialog__actions"
|
|
},
|
|
usesInheritance: true,
|
|
ngImport: i0
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogActions,
|
|
decorators: [{
|
|
type: Directive,
|
|
args: [{
|
|
selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
|
|
host: {
|
|
'class': 'mat-mdc-dialog-actions mdc-dialog__actions',
|
|
'[class.mat-mdc-dialog-actions-align-start]': 'align === "start"',
|
|
'[class.mat-mdc-dialog-actions-align-center]': 'align === "center"',
|
|
'[class.mat-mdc-dialog-actions-align-end]': 'align === "end"'
|
|
}
|
|
}]
|
|
}],
|
|
propDecorators: {
|
|
align: [{
|
|
type: Input
|
|
}]
|
|
}
|
|
});
|
|
function getClosestDialog(element, openDialogs) {
|
|
let parent = element.nativeElement.parentElement;
|
|
while (parent && !parent.classList.contains('mat-mdc-dialog-container')) {
|
|
parent = parent.parentElement;
|
|
}
|
|
return parent ? openDialogs.find(dialog => dialog.id === parent.id) : null;
|
|
}
|
|
|
|
const DIRECTIVES = [MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent];
|
|
class MatDialogModule {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogModule,
|
|
deps: [],
|
|
target: i0.ɵɵFactoryTarget.NgModule
|
|
});
|
|
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
minVersion: "14.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogModule,
|
|
imports: [DialogModule, OverlayModule, PortalModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent],
|
|
exports: [BidiModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent]
|
|
});
|
|
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogModule,
|
|
providers: [MatDialog],
|
|
imports: [DialogModule, OverlayModule, PortalModule, BidiModule]
|
|
});
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({
|
|
minVersion: "12.0.0",
|
|
version: "21.0.3",
|
|
ngImport: i0,
|
|
type: MatDialogModule,
|
|
decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [DialogModule, OverlayModule, PortalModule, ...DIRECTIVES],
|
|
exports: [BidiModule, ...DIRECTIVES],
|
|
providers: [MatDialog]
|
|
}]
|
|
}]
|
|
});
|
|
|
|
export { MAT_DIALOG_DATA, MAT_DIALOG_DEFAULT_OPTIONS, MAT_DIALOG_SCROLL_STRATEGY, MatDialog, MatDialogActions, MatDialogClose, MatDialogConfig, MatDialogContainer, MatDialogContent, MatDialogModule, MatDialogRef, MatDialogState, MatDialogTitle, _closeDialogVia };
|
|
//# sourceMappingURL=dialog.mjs.map
|
|
|