@almoamendev/ngx-md3 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -559,7 +559,7 @@ class SideSheet {
|
|
|
559
559
|
return this.portalOutlet.attachComponentPortal(portal);
|
|
560
560
|
}
|
|
561
561
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: SideSheet, deps: [{ token: LayoutService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
562
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: SideSheet, isStandalone: true, selector: "md3-side-sheet", host: { properties: { "class.md3-active": "isActive()", "class.md3-hidden": "isHidden()", "class.md3-start": "side() === \"start\"", "class.md3-end": "side() === \"end\"", "class.md3-inset": "isInset()", "class.md3-show-divider": "showDivider()" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], ngImport: i0, template: "<div class=\"md3-side-sheet-scrim\" (click)=\"close()\"></div>\n<div class=\"md3-side-sheet-container\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n", styles: [":host{--background-color: rgb(var(--md-scheme-surface-container-low));--foreground-color: rgb(var(--md-scheme-on-surface));--border-radius: var(--md-border-radius-large);--elevation: var(--md-shadow-0dp);--hidden-offset: 80%;position:relative;height:100%;width:100%;min-height:0;pointer-events:none;z-index:1}:host .md3-side-sheet-scrim{position:fixed;inset:0;width:100vw;height:100vh;z-index:-1;pointer-events:none;display:none;background-color:rgb(var(--md-scheme-scrim));opacity:0;transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container{flex:1 1 auto;position:relative;max-width:
|
|
562
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: SideSheet, isStandalone: true, selector: "md3-side-sheet", host: { properties: { "class.md3-active": "isActive()", "class.md3-hidden": "isHidden()", "class.md3-start": "side() === \"start\"", "class.md3-end": "side() === \"end\"", "class.md3-inset": "isInset()", "class.md3-show-divider": "showDivider()" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], ngImport: i0, template: "<div class=\"md3-side-sheet-scrim\" (click)=\"close()\"></div>\n<div class=\"md3-side-sheet-container\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n", styles: [":host{--background-color: rgb(var(--md-scheme-surface-container-low));--foreground-color: rgb(var(--md-scheme-on-surface));--border-radius: var(--md-border-radius-large);--elevation: var(--md-shadow-0dp);--hidden-offset: 80%;position:relative;height:100%;width:100%;min-height:0;pointer-events:none;z-index:1}:host .md3-side-sheet-scrim{position:fixed;inset:0;width:100vw;height:100vh;z-index:-1;pointer-events:none;display:none;background-color:rgb(var(--md-scheme-scrim));opacity:0;transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container{flex:1 1 auto;position:relative;max-width:16em;min-width:16em;height:100%;overflow:hidden;pointer-events:all;background-color:var(--background-color);color:var(--foreground-color);box-shadow:var(--elevation);opacity:0;transform:translate(var(--hidden-offset));transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container>::ng-deep *{display:grid;grid-template-areas:\"header\" \"body\" \"actions\";grid-template-rows:auto minmax(0,1fr) auto;height:100%;overflow:hidden}:host.md3-hidden .md3-side-sheet-container{pointer-events:none;opacity:0;transform:translate(var(--hidden-offset))}:host.md3-active .md3-side-sheet-container{pointer-events:all;opacity:1;transform:translate(0)}:host.md3-show-divider .md3-side-sheet-container:before{content:\"\";position:absolute;height:100%;width:.0625em;top:0;bottom:0;opacity:0;background-color:rgb(var(--md-scheme-outline));pointer-events:none}:host.md3-start{--hidden-offset: -80%}:host.md3-start.md3-style-modal{inset-inline-start:0}:host.md3-start .md3-side-sheet-container{border-start-end-radius:var(--border-radius);border-end-end-radius:var(--border-radius)}:host.md3-start.md3-show-divider .md3-side-sheet-container:before{inset-inline-end:0}:host.md3-end{--hidden-offset: 80%}:host.md3-end.md3-style-modal{inset-inline-end:0}:host.md3-end .md3-side-sheet-container{border-start-start-radius:var(--border-radius);border-end-start-radius:var(--border-radius)}:host.md3-end.md3-show-divider .md3-side-sheet-container:before{inset-inline-start:0}:host.md3-style-standard .md3-side-sheet-container{--background-color: rgb(var(--md-scheme-surface));--border-radius: var(--md-border-radius-none)}:host.md3-style-standard.md3-show-divider .md3-side-sheet-container:before{opacity:1}:host.md3-style-default.md3-inset{padding:1em}:host.md3-style-default.md3-inset .md3-side-sheet-container{border-radius:var(--border-radius)}:host.md3-style-modal{--elevation: var(--md-shadow-1dp);position:fixed;top:0;bottom:0;z-index:500}:host.md3-style-modal .md3-side-sheet-container{max-width:25em}:host.md3-style-modal .md3-side-sheet-scrim{display:block}:host.md3-style-modal.md3-active .md3-side-sheet-scrim{pointer-events:all;opacity:.32}:host.md3-style-modal.md3-inset{padding:1em}:host.md3-style-modal.md3-inset .md3-side-sheet-container{border-radius:var(--border-radius)}:host.md3-style-modal.md3-end .md3-side-sheet-container{margin-inline-start:auto}:host ::ng-deep md3-nav-group [md3-nav-item]{padding-inline:1.25em;margin-bottom:.5em}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container{padding:0 1em;flex-direction:row;align-items:center;justify-content:start;width:fit-content;height:3.5em}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container:before,:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container:after{inset:0;height:auto;width:auto;border-radius:var(--md-border-radius-xlarge)}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-icon-container{padding:0}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-label{font-size:.875em;line-height:1.428571em;letter-spacing:.007143em;max-height:2.857143em;padding-inline:0}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-badge-container{position:relative;inset:auto}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-badge-container.md3-small{position:absolute;height:1.875em;width:1.625em}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] });
|
|
563
563
|
}
|
|
564
564
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: SideSheet, decorators: [{
|
|
565
565
|
type: Component,
|
|
@@ -572,7 +572,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
572
572
|
'[class.md3-end]': 'side() === "end"',
|
|
573
573
|
'[class.md3-inset]': 'isInset()',
|
|
574
574
|
'[class.md3-show-divider]': 'showDivider()',
|
|
575
|
-
}, template: "<div class=\"md3-side-sheet-scrim\" (click)=\"close()\"></div>\n<div class=\"md3-side-sheet-container\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n", styles: [":host{--background-color: rgb(var(--md-scheme-surface-container-low));--foreground-color: rgb(var(--md-scheme-on-surface));--border-radius: var(--md-border-radius-large);--elevation: var(--md-shadow-0dp);--hidden-offset: 80%;position:relative;height:100%;width:100%;min-height:0;pointer-events:none;z-index:1}:host .md3-side-sheet-scrim{position:fixed;inset:0;width:100vw;height:100vh;z-index:-1;pointer-events:none;display:none;background-color:rgb(var(--md-scheme-scrim));opacity:0;transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container{flex:1 1 auto;position:relative;max-width:
|
|
575
|
+
}, template: "<div class=\"md3-side-sheet-scrim\" (click)=\"close()\"></div>\n<div class=\"md3-side-sheet-container\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n", styles: [":host{--background-color: rgb(var(--md-scheme-surface-container-low));--foreground-color: rgb(var(--md-scheme-on-surface));--border-radius: var(--md-border-radius-large);--elevation: var(--md-shadow-0dp);--hidden-offset: 80%;position:relative;height:100%;width:100%;min-height:0;pointer-events:none;z-index:1}:host .md3-side-sheet-scrim{position:fixed;inset:0;width:100vw;height:100vh;z-index:-1;pointer-events:none;display:none;background-color:rgb(var(--md-scheme-scrim));opacity:0;transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container{flex:1 1 auto;position:relative;max-width:16em;min-width:16em;height:100%;overflow:hidden;pointer-events:all;background-color:var(--background-color);color:var(--foreground-color);box-shadow:var(--elevation);opacity:0;transform:translate(var(--hidden-offset));transition:all var(--md-motion-standard-default-spatial-duration) var(--md-motion-standard-default-spatial-easing)}:host .md3-side-sheet-container>::ng-deep *{display:grid;grid-template-areas:\"header\" \"body\" \"actions\";grid-template-rows:auto minmax(0,1fr) auto;height:100%;overflow:hidden}:host.md3-hidden .md3-side-sheet-container{pointer-events:none;opacity:0;transform:translate(var(--hidden-offset))}:host.md3-active .md3-side-sheet-container{pointer-events:all;opacity:1;transform:translate(0)}:host.md3-show-divider .md3-side-sheet-container:before{content:\"\";position:absolute;height:100%;width:.0625em;top:0;bottom:0;opacity:0;background-color:rgb(var(--md-scheme-outline));pointer-events:none}:host.md3-start{--hidden-offset: -80%}:host.md3-start.md3-style-modal{inset-inline-start:0}:host.md3-start .md3-side-sheet-container{border-start-end-radius:var(--border-radius);border-end-end-radius:var(--border-radius)}:host.md3-start.md3-show-divider .md3-side-sheet-container:before{inset-inline-end:0}:host.md3-end{--hidden-offset: 80%}:host.md3-end.md3-style-modal{inset-inline-end:0}:host.md3-end .md3-side-sheet-container{border-start-start-radius:var(--border-radius);border-end-start-radius:var(--border-radius)}:host.md3-end.md3-show-divider .md3-side-sheet-container:before{inset-inline-start:0}:host.md3-style-standard .md3-side-sheet-container{--background-color: rgb(var(--md-scheme-surface));--border-radius: var(--md-border-radius-none)}:host.md3-style-standard.md3-show-divider .md3-side-sheet-container:before{opacity:1}:host.md3-style-default.md3-inset{padding:1em}:host.md3-style-default.md3-inset .md3-side-sheet-container{border-radius:var(--border-radius)}:host.md3-style-modal{--elevation: var(--md-shadow-1dp);position:fixed;top:0;bottom:0;z-index:500}:host.md3-style-modal .md3-side-sheet-container{max-width:25em}:host.md3-style-modal .md3-side-sheet-scrim{display:block}:host.md3-style-modal.md3-active .md3-side-sheet-scrim{pointer-events:all;opacity:.32}:host.md3-style-modal.md3-inset{padding:1em}:host.md3-style-modal.md3-inset .md3-side-sheet-container{border-radius:var(--border-radius)}:host.md3-style-modal.md3-end .md3-side-sheet-container{margin-inline-start:auto}:host ::ng-deep md3-nav-group [md3-nav-item]{padding-inline:1.25em;margin-bottom:.5em}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container{padding:0 1em;flex-direction:row;align-items:center;justify-content:start;width:fit-content;height:3.5em}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container:before,:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container:after{inset:0;height:auto;width:auto;border-radius:var(--md-border-radius-xlarge)}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-icon-container{padding:0}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-label{font-size:.875em;line-height:1.428571em;letter-spacing:.007143em;max-height:2.857143em;padding-inline:0}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-badge-container{position:relative;inset:auto}:host ::ng-deep md3-nav-group [md3-nav-item] .md3-item-container .md3-badge-container.md3-small{position:absolute;height:1.875em;width:1.625em}\n"] }]
|
|
576
576
|
}], ctorParameters: () => [{ type: LayoutService }, { type: i0.ElementRef }], propDecorators: { portalOutlet: [{
|
|
577
577
|
type: ViewChild,
|
|
578
578
|
args: [CdkPortalOutlet, { static: true }]
|
|
@@ -605,37 +605,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
605
605
|
|
|
606
606
|
class SheetsService {
|
|
607
607
|
injector = inject(Injector);
|
|
608
|
+
/**
|
|
609
|
+
* Outlets registered per side, from the page scaffold up to whatever took
|
|
610
|
+
* them over last. Sheets always open in the outlet on top, so a full screen
|
|
611
|
+
* dialog can host them while it is up and hand them back when it closes.
|
|
612
|
+
*/
|
|
608
613
|
states = new Map();
|
|
609
614
|
registerSideSheetOutlet(side, outlet) {
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
615
|
+
const stack = this.getOutletStack(side);
|
|
616
|
+
if (stack.some((state) => state.outlet === outlet)) {
|
|
612
617
|
return;
|
|
613
618
|
}
|
|
614
|
-
if (currentState) {
|
|
615
|
-
this.disposeOutletState(currentState);
|
|
616
|
-
}
|
|
617
619
|
if (outlet.hasAttached()) {
|
|
618
620
|
outlet.detach();
|
|
619
621
|
}
|
|
620
622
|
const stackPortal = new ComponentPortal(SideSheetStack, null, this.injector);
|
|
621
623
|
const stackComponentRef = outlet.attachComponentPortal(stackPortal);
|
|
622
|
-
|
|
624
|
+
stack.push({
|
|
623
625
|
outlet,
|
|
624
626
|
stackComponentRef,
|
|
625
627
|
refs: [],
|
|
626
628
|
});
|
|
627
629
|
}
|
|
628
630
|
unregisterSideSheetOutlet(side, outlet) {
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
+
const stack = this.states.get(side);
|
|
632
|
+
const index = stack?.findIndex((state) => state.outlet === outlet) ?? -1;
|
|
633
|
+
if (!stack || index === -1) {
|
|
631
634
|
return;
|
|
632
635
|
}
|
|
633
|
-
this
|
|
634
|
-
|
|
636
|
+
// Sheets opened in this outlet go with it, and the outlet underneath
|
|
637
|
+
// becomes the one new sheets open in.
|
|
638
|
+
this.disposeOutletState(stack[index]);
|
|
639
|
+
stack.splice(index, 1);
|
|
640
|
+
if (stack.length === 0) {
|
|
641
|
+
this.states.delete(side);
|
|
642
|
+
}
|
|
635
643
|
}
|
|
636
644
|
openSideSheet(component, config = {}) {
|
|
637
645
|
const sheetConfig = this.mergeConfig(config);
|
|
638
|
-
const state = this.
|
|
646
|
+
const state = this.activeState(sheetConfig.side);
|
|
639
647
|
if (!state) {
|
|
640
648
|
throw new Error(`No ${sheetConfig.side} side sheet outlet is registered.`);
|
|
641
649
|
}
|
|
@@ -655,7 +663,19 @@ class SheetsService {
|
|
|
655
663
|
return sheetRef;
|
|
656
664
|
}
|
|
657
665
|
closeSideSheet(side = 'end', result) {
|
|
658
|
-
this.getVisibleRef(this.
|
|
666
|
+
this.getVisibleRef(this.activeState(side))?.close(result);
|
|
667
|
+
}
|
|
668
|
+
/** Outlet that sheets currently open in: the last one that registered. */
|
|
669
|
+
activeState(side) {
|
|
670
|
+
const stack = this.states.get(side);
|
|
671
|
+
return stack?.[stack.length - 1];
|
|
672
|
+
}
|
|
673
|
+
getOutletStack(side) {
|
|
674
|
+
const stack = this.states.get(side) ?? [];
|
|
675
|
+
if (!this.states.has(side)) {
|
|
676
|
+
this.states.set(side, stack);
|
|
677
|
+
}
|
|
678
|
+
return stack;
|
|
659
679
|
}
|
|
660
680
|
mergeConfig(config) {
|
|
661
681
|
return {
|
|
@@ -3092,12 +3112,14 @@ const DIALOG_EXIT_ANIMATION_FALLBACK_MS = 300;
|
|
|
3092
3112
|
const HIDDEN_CLASS = 'md3-dialog-hidden';
|
|
3093
3113
|
class DialogRef {
|
|
3094
3114
|
cdkRef;
|
|
3115
|
+
isFullScreen;
|
|
3095
3116
|
closed = new Subject();
|
|
3096
3117
|
closing = new Subject();
|
|
3097
3118
|
closePromise = null;
|
|
3098
3119
|
closeStarted = false;
|
|
3099
3120
|
closeSettled = false;
|
|
3100
3121
|
hidden = false;
|
|
3122
|
+
/** Shell hosting the dialog: the regular dialog or the full screen one. */
|
|
3101
3123
|
dialogInstance;
|
|
3102
3124
|
/**
|
|
3103
3125
|
* Filled by DialogService after the user component is attached. Keeping the
|
|
@@ -3116,8 +3138,11 @@ class DialogRef {
|
|
|
3116
3138
|
get isHidden() {
|
|
3117
3139
|
return this.hidden;
|
|
3118
3140
|
}
|
|
3119
|
-
constructor(cdkRef, disableCloseEvents
|
|
3141
|
+
constructor(cdkRef, disableCloseEvents,
|
|
3142
|
+
/** Whether this reference belongs to a full screen dialog. */
|
|
3143
|
+
isFullScreen = false) {
|
|
3120
3144
|
this.cdkRef = cdkRef;
|
|
3145
|
+
this.isFullScreen = isFullScreen;
|
|
3121
3146
|
// Closing always goes through this reference so the exit animation can
|
|
3122
3147
|
// run before the CDK disposes the overlay. Detachments triggered from
|
|
3123
3148
|
// the outside (navigation, scroll strategy) still settle this ref.
|
|
@@ -3146,7 +3171,7 @@ class DialogRef {
|
|
|
3146
3171
|
}
|
|
3147
3172
|
this.hidden = true;
|
|
3148
3173
|
this.toggleHiddenState(true);
|
|
3149
|
-
this.dialogInstance?.
|
|
3174
|
+
this.dialogInstance?.setActive(false);
|
|
3150
3175
|
return this.waitForSurfaceAnimation();
|
|
3151
3176
|
}
|
|
3152
3177
|
/**
|
|
@@ -3161,9 +3186,9 @@ class DialogRef {
|
|
|
3161
3186
|
if (this.hidden) {
|
|
3162
3187
|
this.hidden = false;
|
|
3163
3188
|
this.toggleHiddenState(false);
|
|
3164
|
-
this.dialogInstance?.
|
|
3189
|
+
this.dialogInstance?.setActive(true);
|
|
3165
3190
|
}
|
|
3166
|
-
this.dialogInstance?.
|
|
3191
|
+
this.dialogInstance?.recaptureFocus();
|
|
3167
3192
|
}
|
|
3168
3193
|
/** Emits when the dialog starts closing, before the exit animation runs. */
|
|
3169
3194
|
beforeClosed() {
|
|
@@ -3213,7 +3238,7 @@ class DialogRef {
|
|
|
3213
3238
|
const wasVisible = !this.hidden;
|
|
3214
3239
|
overlayRef.overlayElement.classList.add('md3-dialog-closing');
|
|
3215
3240
|
overlayRef.backdropElement?.classList.add('md3-dialog-closing');
|
|
3216
|
-
this.dialogInstance?.
|
|
3241
|
+
this.dialogInstance?.setActive(false);
|
|
3217
3242
|
// A hidden dialog already played the exit animation, so there is
|
|
3218
3243
|
// nothing left to transition and it can be disposed right away.
|
|
3219
3244
|
return wasVisible ? this.waitForSurfaceAnimation() : Promise.resolve();
|
|
@@ -3221,7 +3246,7 @@ class DialogRef {
|
|
|
3221
3246
|
/** Resolves when the surface finished animating, with a timeout as a safety net. */
|
|
3222
3247
|
waitForSurfaceAnimation() {
|
|
3223
3248
|
const panel = this.cdkRef.overlayRef.overlayElement;
|
|
3224
|
-
const surface =
|
|
3249
|
+
const surface = this.dialogInstance?.surfaceElement ?? panel;
|
|
3225
3250
|
return new Promise((resolve) => {
|
|
3226
3251
|
let isResolved = false;
|
|
3227
3252
|
let timeoutId = setTimeout(done, DIALOG_EXIT_ANIMATION_FALLBACK_MS);
|
|
@@ -3262,36 +3287,104 @@ class DialogRef {
|
|
|
3262
3287
|
* while this component only owns the MD3 surface and its animation.
|
|
3263
3288
|
*/
|
|
3264
3289
|
class Dialog extends CdkDialogContainer {
|
|
3290
|
+
surface = viewChild('surface', /* @ts-ignore */
|
|
3291
|
+
...(ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []));
|
|
3265
3292
|
isActive = signal(false, /* @ts-ignore */
|
|
3266
3293
|
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
3267
3294
|
config = inject(DIALOG_CONFIG, { optional: true }) ?? {};
|
|
3295
|
+
get surfaceElement() {
|
|
3296
|
+
return this.surface()?.nativeElement ?? null;
|
|
3297
|
+
}
|
|
3268
3298
|
/**
|
|
3269
3299
|
* Started by DialogService, either right after the dialog is created or
|
|
3270
|
-
* once the dialog it replaces has
|
|
3271
|
-
*
|
|
3300
|
+
* once the dialog it replaces has had its head start. The animation runs on
|
|
3301
|
+
* the next frame so the surface has a real from/to state.
|
|
3272
3302
|
*/
|
|
3273
3303
|
startEnterAnimation() {
|
|
3274
3304
|
requestAnimationFrame(() => {
|
|
3275
3305
|
this.isActive.set(true);
|
|
3276
3306
|
});
|
|
3277
3307
|
}
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
return this.attachComponentPortal(new ComponentPortal(component, null, injector));
|
|
3308
|
+
setActive(value) {
|
|
3309
|
+
this.isActive.set(value);
|
|
3310
|
+
}
|
|
3311
|
+
recaptureFocus() {
|
|
3312
|
+
this._recaptureFocus();
|
|
3284
3313
|
}
|
|
3285
3314
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3286
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
3315
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: Dialog, isStandalone: true, selector: "md3-dialog", viewQueries: [{ propertyName: "surface", first: true, predicate: ["surface"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<!-- The role and aria attributes live on the host element, applied by the CDK dialog container. -->\n<section\n #surface\n class=\"md3-dialog-container\"\n [class.md3-active]=\"isActive()\"\n [class.md-scheme-dark]=\"config.scheme == 'dark'\"\n [class.md-scheme-light]=\"config.scheme == 'light'\"\n [attr.dir]=\"config.direction ?? null\">\n <ng-template cdkPortalOutlet></ng-template>\n</section>\n", styles: ["::ng-deep .cdk-overlay-container{position:fixed;z-index:1000;inset:0;pointer-events:none;font-size:1rem}::ng-deep .cdk-overlay-container .md3-dialog-scrim{position:absolute;inset:0;pointer-events:auto;background-color:rgb(var(--md-scheme-scrim));transition:all var(--md-motion-expressive-slow-spatial-duration) var(--md-motion-expressive-slow-spatial-easing);opacity:.32}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-opening{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-closing{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-hidden{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-kept{opacity:.32;transition:none}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-instant{transition:none}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper{position:absolute;display:flex;inset:0;pointer-events:none;padding:3.5rem 1.5rem;overflow:hidden}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel{position:absolute;pointer-events:auto;max-width:35em}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-closing,::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-hidden{pointer-events:none}:host{display:block;max-width:100%;min-width:17.5em;outline:0}:host .md3-dialog-container{display:block;width:100%;max-height:inherit;overflow:auto;color:rgb(var(--md-scheme-on-surface));background-color:rgb(var(--md-scheme-surface-container-high));border-radius:var(--md-border-radius-xlarge);box-shadow:var(--md-shadow-6dp);transform-origin:center;transition:all var(--md-motion-expressive-default-spatial-duration) var(--md-motion-expressive-default-spatial-easing);opacity:0;transform:scaleY(.8);margin-top:-8rem}:host .md3-dialog-container.md3-active{opacity:1;transform:scaleY(1);margin-top:0}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] });
|
|
3287
3316
|
}
|
|
3288
3317
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: Dialog, decorators: [{
|
|
3289
3318
|
type: Component,
|
|
3290
3319
|
args: [{ selector: 'md3-dialog', imports: [
|
|
3291
3320
|
CdkPortalOutlet,
|
|
3292
|
-
], template: "<!-- The role and aria attributes live on the host element, applied by the CDK dialog container. -->\n<section\n class=\"md3-dialog-container\"\n [class.md3-active]=\"isActive()\"\n [class.md-scheme-dark]=\"config.scheme == 'dark'\"\n [class.md-scheme-light]=\"config.scheme == 'light'\"\n [attr.dir]=\"config.direction ?? null\">\n <ng-template cdkPortalOutlet></ng-template>\n</section>\n", styles: ["::ng-deep .cdk-overlay-container{position:fixed;z-index:1000;inset:0;pointer-events:none;font-size:1rem}::ng-deep .cdk-overlay-container .md3-dialog-scrim{position:absolute;inset:0;pointer-events:auto;background-color:rgb(var(--md-scheme-scrim));transition:all var(--md-motion-expressive-slow-spatial-duration) var(--md-motion-expressive-slow-spatial-easing);opacity:.32}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-opening{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-closing{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-hidden{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-kept{opacity:.32;transition:none}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-instant{transition:none}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper{position:absolute;display:flex;inset:0;pointer-events:none;padding:3.5rem 1.5rem;overflow:hidden}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel{position:absolute;pointer-events:auto;max-width:35em}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-closing,::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-hidden{pointer-events:none}:host{display:block;max-width:100%;min-width:17.5em;outline:0}:host .md3-dialog-container{display:block;width:100%;max-height:inherit;overflow:auto;color:rgb(var(--md-scheme-on-surface));background-color:rgb(var(--md-scheme-surface-container-high));border-radius:var(--md-border-radius-xlarge);box-shadow:var(--md-shadow-6dp);transform-origin:center;transition:all var(--md-motion-expressive-default-spatial-duration) var(--md-motion-expressive-default-spatial-easing);opacity:0;transform:scaleY(.8);margin-top:-8rem}:host .md3-dialog-container.md3-active{opacity:1;transform:scaleY(1);margin-top:0}\n"] }]
|
|
3293
|
-
}] });
|
|
3321
|
+
], template: "<!-- The role and aria attributes live on the host element, applied by the CDK dialog container. -->\n<section\n #surface\n class=\"md3-dialog-container\"\n [class.md3-active]=\"isActive()\"\n [class.md-scheme-dark]=\"config.scheme == 'dark'\"\n [class.md-scheme-light]=\"config.scheme == 'light'\"\n [attr.dir]=\"config.direction ?? null\">\n <ng-template cdkPortalOutlet></ng-template>\n</section>\n", styles: ["::ng-deep .cdk-overlay-container{position:fixed;z-index:1000;inset:0;pointer-events:none;font-size:1rem}::ng-deep .cdk-overlay-container .md3-dialog-scrim{position:absolute;inset:0;pointer-events:auto;background-color:rgb(var(--md-scheme-scrim));transition:all var(--md-motion-expressive-slow-spatial-duration) var(--md-motion-expressive-slow-spatial-easing);opacity:.32}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-opening{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-closing{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-hidden{opacity:0}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-kept{opacity:.32;transition:none}::ng-deep .cdk-overlay-container .md3-dialog-scrim.md3-dialog-scrim-instant{transition:none}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper{position:absolute;display:flex;inset:0;pointer-events:none;padding:3.5rem 1.5rem;overflow:hidden}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel{position:absolute;pointer-events:auto;max-width:35em}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-closing,::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-dialog-panel.md3-dialog-hidden{pointer-events:none}:host{display:block;max-width:100%;min-width:17.5em;outline:0}:host .md3-dialog-container{display:block;width:100%;max-height:inherit;overflow:auto;color:rgb(var(--md-scheme-on-surface));background-color:rgb(var(--md-scheme-surface-container-high));border-radius:var(--md-border-radius-xlarge);box-shadow:var(--md-shadow-6dp);transform-origin:center;transition:all var(--md-motion-expressive-default-spatial-duration) var(--md-motion-expressive-default-spatial-easing);opacity:0;transform:scaleY(.8);margin-top:-8rem}:host .md3-dialog-container.md3-active{opacity:1;transform:scaleY(1);margin-top:0}\n"] }]
|
|
3322
|
+
}], propDecorators: { surface: [{ type: i0.ViewChild, args: ['surface', { isSignal: true }] }] } });
|
|
3294
3323
|
|
|
3324
|
+
/**
|
|
3325
|
+
* Material 3 full screen dialog shell. It covers the viewport and lays its
|
|
3326
|
+
* content out like the scaffold does, with a main pane and a side sheet outlet
|
|
3327
|
+
* on each side, so side sheets opened while it is up land inside the dialog
|
|
3328
|
+
* instead of behind it.
|
|
3329
|
+
*/
|
|
3330
|
+
class FullScreenDialog extends CdkDialogContainer {
|
|
3331
|
+
surface = viewChild('surface', /* @ts-ignore */
|
|
3332
|
+
...(ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []));
|
|
3333
|
+
startOutlet = viewChild('startOutlet', { ...(ngDevMode ? { debugName: "startOutlet" } : /* istanbul ignore next */ {}), read: CdkPortalOutlet });
|
|
3334
|
+
endOutlet = viewChild('endOutlet', { ...(ngDevMode ? { debugName: "endOutlet" } : /* istanbul ignore next */ {}), read: CdkPortalOutlet });
|
|
3335
|
+
sheets = inject(SheetsService);
|
|
3336
|
+
isActive = signal(false, /* @ts-ignore */
|
|
3337
|
+
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
3338
|
+
config = inject(DIALOG_CONFIG, { optional: true }) ?? {};
|
|
3339
|
+
get surfaceElement() {
|
|
3340
|
+
return this.surface()?.nativeElement ?? null;
|
|
3341
|
+
}
|
|
3342
|
+
ngAfterViewInit() {
|
|
3343
|
+
const startOutlet = this.startOutlet();
|
|
3344
|
+
const endOutlet = this.endOutlet();
|
|
3345
|
+
// Taking the outlets over is what sends the next side sheet inside the
|
|
3346
|
+
// dialog. The scaffold gets them back when this dialog is destroyed.
|
|
3347
|
+
if (startOutlet) {
|
|
3348
|
+
this.sheets.registerSideSheetOutlet('start', startOutlet);
|
|
3349
|
+
}
|
|
3350
|
+
if (endOutlet) {
|
|
3351
|
+
this.sheets.registerSideSheetOutlet('end', endOutlet);
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
ngOnDestroy() {
|
|
3355
|
+
const startOutlet = this.startOutlet();
|
|
3356
|
+
const endOutlet = this.endOutlet();
|
|
3357
|
+
if (startOutlet) {
|
|
3358
|
+
this.sheets.unregisterSideSheetOutlet('start', startOutlet);
|
|
3359
|
+
}
|
|
3360
|
+
if (endOutlet) {
|
|
3361
|
+
this.sheets.unregisterSideSheetOutlet('end', endOutlet);
|
|
3362
|
+
}
|
|
3363
|
+
super.ngOnDestroy();
|
|
3364
|
+
}
|
|
3365
|
+
startEnterAnimation() {
|
|
3366
|
+
requestAnimationFrame(() => {
|
|
3367
|
+
this.isActive.set(true);
|
|
3368
|
+
});
|
|
3369
|
+
}
|
|
3370
|
+
setActive(value) {
|
|
3371
|
+
this.isActive.set(value);
|
|
3372
|
+
}
|
|
3373
|
+
recaptureFocus() {
|
|
3374
|
+
this._recaptureFocus();
|
|
3375
|
+
}
|
|
3376
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FullScreenDialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3377
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: FullScreenDialog, isStandalone: true, selector: "md3-fullscreen-dialog", viewQueries: [{ propertyName: "surface", first: true, predicate: ["surface"], descendants: true, isSignal: true }, { propertyName: "startOutlet", first: true, predicate: ["startOutlet"], descendants: true, read: CdkPortalOutlet, isSignal: true }, { propertyName: "endOutlet", first: true, predicate: ["endOutlet"], descendants: true, read: CdkPortalOutlet, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<!-- The role and aria attributes live on the host element, applied by the CDK dialog container. -->\n<section\n #surface\n class=\"md3-fullscreen-dialog-container\"\n [class.md3-active]=\"isActive()\"\n [class.md-scheme-dark]=\"config.scheme == 'dark'\"\n [class.md-scheme-light]=\"config.scheme == 'light'\"\n [attr.dir]=\"config.direction ?? null\">\n <div class=\"md3-panes-container md3-scrollable\">\n <!--\n The CDK attaches the dialog content to the first portal outlet of\n this template, so the main pane has to come first. The panes are\n placed by grid area, which makes the DOM order irrelevant visually.\n -->\n <div class=\"md3-pane md3-pane-main\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n <div class=\"md3-pane md3-pane-start\">\n <ng-template #startOutlet cdkPortalOutlet></ng-template>\n </div>\n <div class=\"md3-pane md3-pane-end\">\n <ng-template #endOutlet cdkPortalOutlet></ng-template>\n </div>\n </div>\n</section>\n", styles: ["::ng-deep .cdk-overlay-container{position:fixed;z-index:1000;inset:0;pointer-events:none;font-size:1rem}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper{position:absolute;display:flex;inset:0;pointer-events:none;overflow:hidden}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper:has(>.md3-fullscreen-dialog-panel){padding:0}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel{width:100%;height:100%;max-width:none;pointer-events:auto}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel.md3-dialog-closing,::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel.md3-dialog-hidden{pointer-events:none}:host{display:block;height:100%;width:100%;outline:0}:host .md3-fullscreen-dialog-container{display:grid;grid-template-rows:minmax(0,1fr);height:100%;min-height:0;overflow:hidden;color:rgb(var(--md-scheme-on-surface));background-color:rgb(var(--md-scheme-surface));transition:all var(--md-motion-expressive-default-spatial-duration) var(--md-motion-expressive-default-spatial-easing);opacity:0;transform:translateY(1.5em)}:host .md3-fullscreen-dialog-container.md3-active{opacity:1;transform:none}:host .md3-panes-container{display:grid;grid-template-areas:\"start main end\";grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);min-width:0;min-height:0;overflow:hidden}:host .md3-panes-container .md3-pane{justify-self:stretch;align-self:stretch;min-width:0;min-height:0;height:100%;overflow:hidden}:host .md3-panes-container .md3-pane.md3-pane-start{grid-area:start}:host .md3-panes-container .md3-pane.md3-pane-main{position:relative;grid-area:main;z-index:1;display:grid;grid-template-rows:minmax(0,1fr)}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *{display:grid;grid-template-areas:\"header\" \"body\";grid-template-rows:auto minmax(0,1fr) auto;min-height:0;height:100%;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgb(var(--md-scheme-outline-variant)) transparent}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *::-webkit-scrollbar{width:.5rem;height:.5rem}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *::-webkit-scrollbar-track{background:transparent}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *>md3-dialog-body{grid-area:body;margin:0;padding:1em 1.5em;overflow-y:visible;height:auto}:host .md3-panes-container .md3-pane.md3-pane-end{grid-area:end}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] });
|
|
3378
|
+
}
|
|
3379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FullScreenDialog, decorators: [{
|
|
3380
|
+
type: Component,
|
|
3381
|
+
args: [{ selector: 'md3-fullscreen-dialog', imports: [
|
|
3382
|
+
CdkPortalOutlet,
|
|
3383
|
+
], template: "<!-- The role and aria attributes live on the host element, applied by the CDK dialog container. -->\n<section\n #surface\n class=\"md3-fullscreen-dialog-container\"\n [class.md3-active]=\"isActive()\"\n [class.md-scheme-dark]=\"config.scheme == 'dark'\"\n [class.md-scheme-light]=\"config.scheme == 'light'\"\n [attr.dir]=\"config.direction ?? null\">\n <div class=\"md3-panes-container md3-scrollable\">\n <!--\n The CDK attaches the dialog content to the first portal outlet of\n this template, so the main pane has to come first. The panes are\n placed by grid area, which makes the DOM order irrelevant visually.\n -->\n <div class=\"md3-pane md3-pane-main\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n <div class=\"md3-pane md3-pane-start\">\n <ng-template #startOutlet cdkPortalOutlet></ng-template>\n </div>\n <div class=\"md3-pane md3-pane-end\">\n <ng-template #endOutlet cdkPortalOutlet></ng-template>\n </div>\n </div>\n</section>\n", styles: ["::ng-deep .cdk-overlay-container{position:fixed;z-index:1000;inset:0;pointer-events:none;font-size:1rem}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper{position:absolute;display:flex;inset:0;pointer-events:none;overflow:hidden}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper:has(>.md3-fullscreen-dialog-panel){padding:0}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel{width:100%;height:100%;max-width:none;pointer-events:auto}::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel.md3-dialog-closing,::ng-deep .cdk-overlay-container .cdk-global-overlay-wrapper .md3-fullscreen-dialog-panel.md3-dialog-hidden{pointer-events:none}:host{display:block;height:100%;width:100%;outline:0}:host .md3-fullscreen-dialog-container{display:grid;grid-template-rows:minmax(0,1fr);height:100%;min-height:0;overflow:hidden;color:rgb(var(--md-scheme-on-surface));background-color:rgb(var(--md-scheme-surface));transition:all var(--md-motion-expressive-default-spatial-duration) var(--md-motion-expressive-default-spatial-easing);opacity:0;transform:translateY(1.5em)}:host .md3-fullscreen-dialog-container.md3-active{opacity:1;transform:none}:host .md3-panes-container{display:grid;grid-template-areas:\"start main end\";grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);min-width:0;min-height:0;overflow:hidden}:host .md3-panes-container .md3-pane{justify-self:stretch;align-self:stretch;min-width:0;min-height:0;height:100%;overflow:hidden}:host .md3-panes-container .md3-pane.md3-pane-start{grid-area:start}:host .md3-panes-container .md3-pane.md3-pane-main{position:relative;grid-area:main;z-index:1;display:grid;grid-template-rows:minmax(0,1fr)}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *{display:grid;grid-template-areas:\"header\" \"body\";grid-template-rows:auto minmax(0,1fr) auto;min-height:0;height:100%;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgb(var(--md-scheme-outline-variant)) transparent}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *::-webkit-scrollbar{width:.5rem;height:.5rem}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *::-webkit-scrollbar-track{background:transparent}:host .md3-panes-container .md3-pane.md3-pane-main>::ng-deep *>md3-dialog-body{grid-area:body;margin:0;padding:1em 1.5em;overflow-y:visible;height:auto}:host .md3-panes-container .md3-pane.md3-pane-end{grid-area:end}\n"] }]
|
|
3384
|
+
}], propDecorators: { surface: [{ type: i0.ViewChild, args: ['surface', { isSignal: true }] }], startOutlet: [{ type: i0.ViewChild, args: ['startOutlet', { ...{ read: CdkPortalOutlet }, isSignal: true }] }], endOutlet: [{ type: i0.ViewChild, args: ['endOutlet', { ...{ read: CdkPortalOutlet }, isSignal: true }] }] } });
|
|
3385
|
+
|
|
3386
|
+
const PANEL_CLASS = 'md3-dialog-panel';
|
|
3387
|
+
const FULL_SCREEN_PANEL_CLASS = 'md3-fullscreen-dialog-panel';
|
|
3295
3388
|
const OPENING_CLASS = 'md3-dialog-opening';
|
|
3296
3389
|
const SCRIM_KEPT_CLASS = 'md3-dialog-scrim-kept';
|
|
3297
3390
|
const SCRIM_INSTANT_CLASS = 'md3-dialog-scrim-instant';
|
|
@@ -3318,16 +3411,21 @@ class DialogService {
|
|
|
3318
3411
|
get openDialogs() {
|
|
3319
3412
|
return this.refs;
|
|
3320
3413
|
}
|
|
3414
|
+
/** The full screen dialog that is open, if there is one. */
|
|
3415
|
+
get fullScreenDialog() {
|
|
3416
|
+
return this.refs.find((ref) => ref.isFullScreen && !ref.isClosing);
|
|
3417
|
+
}
|
|
3321
3418
|
open(component, config = {}) {
|
|
3322
3419
|
const dialogConfig = this.mergeConfig(config);
|
|
3323
3420
|
if (this.refs.length === 0) {
|
|
3324
3421
|
this.rootTrigger = this.getFocusedElement();
|
|
3325
3422
|
}
|
|
3326
3423
|
// The dialog that is on screen starts leaving first, so the two dialogs
|
|
3327
|
-
// never animate on top of each other.
|
|
3328
|
-
|
|
3424
|
+
// never animate on top of each other. A full screen dialog is not part
|
|
3425
|
+
// of this: regular dialogs open on top of it and leave it alone.
|
|
3426
|
+
const previousRef = this.topRegularRef();
|
|
3329
3427
|
if (previousRef) {
|
|
3330
|
-
this.dismissPrevious(previousRef, dialogConfig);
|
|
3428
|
+
this.dismissPrevious(previousRef, dialogConfig.previousDialog);
|
|
3331
3429
|
}
|
|
3332
3430
|
let dialogRef;
|
|
3333
3431
|
const cdkRef = this.cdkDialog.open(component, {
|
|
@@ -3362,7 +3460,7 @@ class DialogService {
|
|
|
3362
3460
|
injector: dialogConfig.injector,
|
|
3363
3461
|
hasBackdrop: true,
|
|
3364
3462
|
backdropClass: ['md3-dialog-scrim', OPENING_CLASS],
|
|
3365
|
-
panelClass: [
|
|
3463
|
+
panelClass: [PANEL_CLASS, OPENING_CLASS],
|
|
3366
3464
|
positionStrategy: this.overlay.position()
|
|
3367
3465
|
.global()
|
|
3368
3466
|
.centerHorizontally()
|
|
@@ -3376,6 +3474,72 @@ class DialogService {
|
|
|
3376
3474
|
// play its exit animation before the overlay is disposed.
|
|
3377
3475
|
disableClose: true,
|
|
3378
3476
|
});
|
|
3477
|
+
this.registerDialog(dialogRef, cdkRef, dialogConfig, previousRef);
|
|
3478
|
+
return dialogRef;
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* Opens a dialog that covers the whole screen. Only one can be open at a
|
|
3482
|
+
* time, so it replaces whatever is open, and while it is up the side sheet
|
|
3483
|
+
* outlets belong to it: side sheets open inside the dialog, not behind it.
|
|
3484
|
+
*/
|
|
3485
|
+
openFullScreen(component, config = {}) {
|
|
3486
|
+
const dialogConfig = this.mergeConfig(config);
|
|
3487
|
+
if (this.refs.length === 0) {
|
|
3488
|
+
this.rootTrigger = this.getFocusedElement();
|
|
3489
|
+
}
|
|
3490
|
+
// A full screen dialog is a context of its own: the dialog it replaces
|
|
3491
|
+
// and anything stacked on that dialog goes with it.
|
|
3492
|
+
const previousRef = this.topRef();
|
|
3493
|
+
if (previousRef) {
|
|
3494
|
+
// Everything open belongs to the context being replaced, including
|
|
3495
|
+
// a full screen dialog that is already up.
|
|
3496
|
+
this.closeAll();
|
|
3497
|
+
}
|
|
3498
|
+
let dialogRef;
|
|
3499
|
+
const cdkRef = this.cdkDialog.open(component, {
|
|
3500
|
+
container: {
|
|
3501
|
+
type: FullScreenDialog,
|
|
3502
|
+
providers: () => [
|
|
3503
|
+
{ provide: DIALOG_CONFIG, useValue: dialogConfig },
|
|
3504
|
+
],
|
|
3505
|
+
},
|
|
3506
|
+
providers: (cdkDialogRef) => {
|
|
3507
|
+
dialogRef = new DialogRef(cdkDialogRef, dialogConfig.disableCloseEvents, true);
|
|
3508
|
+
return [
|
|
3509
|
+
{ provide: DialogRef, useValue: dialogRef },
|
|
3510
|
+
{ provide: DIALOG_DATA, useValue: dialogConfig.data },
|
|
3511
|
+
{ provide: DIALOG_CONFIG, useValue: dialogConfig },
|
|
3512
|
+
{ provide: DIALOG_COMPONENT, useValue: component },
|
|
3513
|
+
];
|
|
3514
|
+
},
|
|
3515
|
+
data: dialogConfig.data,
|
|
3516
|
+
role: dialogConfig.role,
|
|
3517
|
+
ariaModal: true,
|
|
3518
|
+
ariaLabel: dialogConfig.ariaLabel || null,
|
|
3519
|
+
ariaLabelledBy: dialogConfig.ariaLabelledBy || null,
|
|
3520
|
+
ariaDescribedBy: dialogConfig.ariaDescribedBy || null,
|
|
3521
|
+
direction: dialogConfig.direction ?? undefined,
|
|
3522
|
+
viewContainerRef: dialogConfig.viewContainerRef,
|
|
3523
|
+
injector: dialogConfig.injector,
|
|
3524
|
+
// The dialog covers the page on its own, so there is nothing left
|
|
3525
|
+
// for a scrim to dim.
|
|
3526
|
+
hasBackdrop: false,
|
|
3527
|
+
panelClass: [FULL_SCREEN_PANEL_CLASS, OPENING_CLASS],
|
|
3528
|
+
// The CDK writes the size on the panel and the global strategy then
|
|
3529
|
+
// drops its centering margins, which is how the panel ends up
|
|
3530
|
+
// covering the whole wrapper.
|
|
3531
|
+
width: '100%',
|
|
3532
|
+
height: '100%',
|
|
3533
|
+
positionStrategy: this.overlay.position().global(),
|
|
3534
|
+
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
3535
|
+
restoreFocus: this.rootTrigger ?? true,
|
|
3536
|
+
disableClose: true,
|
|
3537
|
+
});
|
|
3538
|
+
this.registerDialog(dialogRef, cdkRef, dialogConfig, previousRef);
|
|
3539
|
+
return dialogRef;
|
|
3540
|
+
}
|
|
3541
|
+
/** Wires a freshly created dialog into the stack and starts its animation. */
|
|
3542
|
+
registerDialog(dialogRef, cdkRef, dialogConfig, previousRef) {
|
|
3379
3543
|
dialogRef.dialogInstance = cdkRef.containerInstance;
|
|
3380
3544
|
dialogRef.componentInstance = cdkRef.componentInstance ?? undefined;
|
|
3381
3545
|
if (cdkRef.componentRef) {
|
|
@@ -3393,14 +3557,20 @@ class DialogService {
|
|
|
3393
3557
|
// already coming back while this one is fading out.
|
|
3394
3558
|
dialogRef.beforeClosed().subscribe(() => this.restorePreviousDialog(dialogRef));
|
|
3395
3559
|
dialogRef.afterClosed().subscribe(() => this.removeRef(dialogRef));
|
|
3396
|
-
return dialogRef;
|
|
3397
3560
|
}
|
|
3398
|
-
/** Closes every open dialog, including the hidden ones. */
|
|
3561
|
+
/** Closes every open dialog, including the hidden and the full screen ones. */
|
|
3399
3562
|
closeAll() {
|
|
3400
3563
|
// Closed from the bottom up so a closing dialog never brings back a
|
|
3401
3564
|
// hidden dialog that is about to close as well.
|
|
3402
3565
|
return Promise.all([...this.refs].map((ref) => ref.close())).then(() => undefined);
|
|
3403
3566
|
}
|
|
3567
|
+
/** Closes the regular dialogs and leaves a full screen dialog alone. */
|
|
3568
|
+
closeRegularDialogs() {
|
|
3569
|
+
const closing = this.refs
|
|
3570
|
+
.filter((ref) => !ref.isFullScreen)
|
|
3571
|
+
.map((ref) => ref.close());
|
|
3572
|
+
return Promise.all(closing).then(() => undefined);
|
|
3573
|
+
}
|
|
3404
3574
|
mergeConfig(config) {
|
|
3405
3575
|
return {
|
|
3406
3576
|
data: config.data,
|
|
@@ -3422,9 +3592,9 @@ class DialogService {
|
|
|
3422
3592
|
* the dialog taking over is ready for it, so the page behind never
|
|
3423
3593
|
* brightens between the two dialogs.
|
|
3424
3594
|
*/
|
|
3425
|
-
dismissPrevious(previousRef,
|
|
3595
|
+
dismissPrevious(previousRef, behavior) {
|
|
3426
3596
|
previousRef.overlayRef.backdropElement?.classList.add(SCRIM_KEPT_CLASS);
|
|
3427
|
-
return
|
|
3597
|
+
return behavior === 'hide' ? previousRef.hide() : this.closeRegularDialogs();
|
|
3428
3598
|
}
|
|
3429
3599
|
startOpenAnimation(dialogRef) {
|
|
3430
3600
|
const overlayRef = dialogRef.overlayRef;
|
|
@@ -3472,6 +3642,11 @@ class DialogService {
|
|
|
3472
3642
|
beginScrimHandover(fromRef, toRef) {
|
|
3473
3643
|
const from = fromRef.overlayRef.backdropElement;
|
|
3474
3644
|
const to = toRef.overlayRef.backdropElement;
|
|
3645
|
+
// Nothing to hand the scrim over to, e.g. a full screen dialog: the
|
|
3646
|
+
// outgoing scrim fades out on its own instead.
|
|
3647
|
+
if (!to) {
|
|
3648
|
+
return;
|
|
3649
|
+
}
|
|
3475
3650
|
from?.classList.add(SCRIM_INSTANT_CLASS);
|
|
3476
3651
|
from?.classList.remove(SCRIM_KEPT_CLASS);
|
|
3477
3652
|
to?.classList.add(SCRIM_INSTANT_CLASS);
|
|
@@ -3507,6 +3682,14 @@ class DialogService {
|
|
|
3507
3682
|
}
|
|
3508
3683
|
return undefined;
|
|
3509
3684
|
}
|
|
3685
|
+
/**
|
|
3686
|
+
* Same, without the full screen dialog: it hosts the dialogs opened on top
|
|
3687
|
+
* of it, so it is never the one that gets hidden or closed to make room.
|
|
3688
|
+
*/
|
|
3689
|
+
topRegularRef() {
|
|
3690
|
+
const ref = this.topRef();
|
|
3691
|
+
return ref?.isFullScreen ? undefined : ref;
|
|
3692
|
+
}
|
|
3510
3693
|
restorePreviousDialog(ref) {
|
|
3511
3694
|
const index = this.refs.indexOf(ref);
|
|
3512
3695
|
if (index < 1) {
|
|
@@ -3518,8 +3701,11 @@ class DialogService {
|
|
|
3518
3701
|
continue;
|
|
3519
3702
|
}
|
|
3520
3703
|
// The closing dialog gets the same head start it was given when it
|
|
3521
|
-
// took the screen, and keeps the scrim until then.
|
|
3522
|
-
|
|
3704
|
+
// took the screen, and keeps the scrim until then. Nothing to keep
|
|
3705
|
+
// when the dialog underneath has no scrim of its own.
|
|
3706
|
+
if (previousRef.overlayRef.backdropElement) {
|
|
3707
|
+
ref.overlayRef.backdropElement?.classList.add(SCRIM_KEPT_CLASS);
|
|
3708
|
+
}
|
|
3523
3709
|
setTimeout(() => this.startRestoringAnimation(ref, previousRef), DIALOG_HANDOVER_DELAY_MS);
|
|
3524
3710
|
return;
|
|
3525
3711
|
}
|
|
@@ -3570,13 +3756,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
3570
3756
|
|
|
3571
3757
|
class DialogBody {
|
|
3572
3758
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: DialogBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3573
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: DialogBody, isStandalone: true, selector: "md3-dialog-body", ngImport: i0, template: "<md3-type-body size=\"medium\">\n <ng-content></ng-content>\n</md3-type-body>", styles: [":host{display:block;margin:1em 1.5em 1.5em;color:rgb(var(--md-scheme-on-surface-variant))}:host .md3-text-body.md3-text-medium{letter-spacing:.017857em}\n"], dependencies: [{ kind: "directive", type: TypeBody, selector: "md3-type-body, [md3-type-body]", inputs: ["size", "color", "emphasized"] }] });
|
|
3759
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: DialogBody, isStandalone: true, selector: "md3-dialog-body", host: { classAttribute: "md3-scrollable" }, ngImport: i0, template: "<md3-type-body size=\"medium\">\n <ng-content></ng-content>\n</md3-type-body>", styles: [":host{display:block;margin:1em 1.5em 1.5em;color:rgb(var(--md-scheme-on-surface-variant))}:host .md3-text-body.md3-text-medium{letter-spacing:.017857em}\n"], dependencies: [{ kind: "directive", type: TypeBody, selector: "md3-type-body, [md3-type-body]", inputs: ["size", "color", "emphasized"] }] });
|
|
3574
3760
|
}
|
|
3575
3761
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: DialogBody, decorators: [{
|
|
3576
3762
|
type: Component,
|
|
3577
3763
|
args: [{ selector: 'md3-dialog-body', imports: [
|
|
3578
3764
|
TypeBody
|
|
3579
|
-
],
|
|
3765
|
+
], host: {
|
|
3766
|
+
'class': 'md3-scrollable',
|
|
3767
|
+
}, template: "<md3-type-body size=\"medium\">\n <ng-content></ng-content>\n</md3-type-body>", styles: [":host{display:block;margin:1em 1.5em 1.5em;color:rgb(var(--md-scheme-on-surface-variant))}:host .md3-text-body.md3-text-medium{letter-spacing:.017857em}\n"] }]
|
|
3580
3768
|
}] });
|
|
3581
3769
|
|
|
3582
3770
|
class DialogActions {
|
|
@@ -3588,6 +3776,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
3588
3776
|
args: [{ selector: 'md3-dialog-actions', imports: [], template: "<div class=\"md3-actions\">\n <ng-content></ng-content>\n</div>", styles: [":host{display:block;margin:1.5em}:host .md3-actions{display:flex;gap:1em;flex-direction:row-reverse}\n"] }]
|
|
3589
3777
|
}] });
|
|
3590
3778
|
|
|
3779
|
+
/**
|
|
3780
|
+
* Header of a full screen dialog: a leading icon button to leave the dialog,
|
|
3781
|
+
* the headline, and a trailing action. It sticks to the top of the dialog while
|
|
3782
|
+
* the content scrolls underneath.
|
|
3783
|
+
*/
|
|
3784
|
+
class FullScreenDialogHeader {
|
|
3785
|
+
// context values
|
|
3786
|
+
buttonContextSize = signal('small', /* @ts-ignore */
|
|
3787
|
+
...(ngDevMode ? [{ debugName: "buttonContextSize" }] : /* istanbul ignore next */ []));
|
|
3788
|
+
buttonContextWidth = signal('default', /* @ts-ignore */
|
|
3789
|
+
...(ngDevMode ? [{ debugName: "buttonContextWidth" }] : /* istanbul ignore next */ []));
|
|
3790
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FullScreenDialogHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3791
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: FullScreenDialogHeader, isStandalone: true, selector: "md3-fullscreen-dialog-header", providers: [
|
|
3792
|
+
{
|
|
3793
|
+
provide: MD3_BUTTON_CONTEXT,
|
|
3794
|
+
useExisting: FullScreenDialogHeader,
|
|
3795
|
+
},
|
|
3796
|
+
], ngImport: i0, template: "<ng-content select=\"[md3-icon-button][md3-header-leading]\"></ng-content>\n<div class=\"md3-title-container\">\n <ng-content></ng-content>\n</div>\n<div class=\"md3-actions-container\">\n <ng-content select=\"[md3-header-trailing]\"></ng-content>\n</div>\n", styles: [":host{--foreground-color: rgb(var(--md-scheme-on-surface));position:sticky;top:0;z-index:3;grid-area:header;display:flex;align-items:center;gap:.5em;height:4em;padding:0 1em;color:var(--foreground-color);background-color:rgb(var(--md-scheme-surface))}:host ::ng-deep [md3-header-leading]:first-child{margin-inline-start:-.5em}:host .md3-title-container{flex:1 1 auto;min-width:0;color:inherit}:host .md3-title-container:first-child{padding-inline-start:.5em}:host .md3-actions-container{display:flex;flex:0 0 auto;align-items:center;gap:.5em}\n"] });
|
|
3797
|
+
}
|
|
3798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FullScreenDialogHeader, decorators: [{
|
|
3799
|
+
type: Component,
|
|
3800
|
+
args: [{ selector: 'md3-fullscreen-dialog-header', imports: [], providers: [
|
|
3801
|
+
{
|
|
3802
|
+
provide: MD3_BUTTON_CONTEXT,
|
|
3803
|
+
useExisting: FullScreenDialogHeader,
|
|
3804
|
+
},
|
|
3805
|
+
], template: "<ng-content select=\"[md3-icon-button][md3-header-leading]\"></ng-content>\n<div class=\"md3-title-container\">\n <ng-content></ng-content>\n</div>\n<div class=\"md3-actions-container\">\n <ng-content select=\"[md3-header-trailing]\"></ng-content>\n</div>\n", styles: [":host{--foreground-color: rgb(var(--md-scheme-on-surface));position:sticky;top:0;z-index:3;grid-area:header;display:flex;align-items:center;gap:.5em;height:4em;padding:0 1em;color:var(--foreground-color);background-color:rgb(var(--md-scheme-surface))}:host ::ng-deep [md3-header-leading]:first-child{margin-inline-start:-.5em}:host .md3-title-container{flex:1 1 auto;min-width:0;color:inherit}:host .md3-title-container:first-child{padding-inline-start:.5em}:host .md3-actions-container{display:flex;flex:0 0 auto;align-items:center;gap:.5em}\n"] }]
|
|
3806
|
+
}] });
|
|
3807
|
+
|
|
3591
3808
|
const MENU_DATA = new InjectionToken('MD3_MENU_DATA');
|
|
3592
3809
|
const MENU_CONFIG = new InjectionToken('MD3_MENU_CONFIG');
|
|
3593
3810
|
const MENU_COMPONENT = new InjectionToken('MD3_MENU_COMPONENT');
|
|
@@ -4618,5 +4835,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
|
|
|
4618
4835
|
* Generated bundle index. Do not edit.
|
|
4619
4836
|
*/
|
|
4620
4837
|
|
|
4621
|
-
export { AppBar, AppBarLogo, Avatar, Badge, Button, ButtonGroup, Card, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, Grid, GridItem, IconButton, IconElement, InputElement, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StateComponent, SupportingText, Switch, TextField, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle };
|
|
4838
|
+
export { AppBar, AppBarLogo, Avatar, Badge, Button, ButtonGroup, Card, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, FullScreenDialog, FullScreenDialogHeader, Grid, GridItem, IconButton, IconElement, InputElement, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StateComponent, SupportingText, Switch, TextField, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle };
|
|
4622
4839
|
//# sourceMappingURL=almoamendev-ngx-md3.mjs.map
|