@almoamendev/ngx-md3 0.7.2 → 0.7.3

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.
@@ -6300,6 +6300,8 @@ class DialogService {
6300
6300
  * Opens a dialog that covers the whole screen. Only one can be open at a
6301
6301
  * time, so it replaces whatever is open, and while it is up the side sheet
6302
6302
  * outlets belong to it: side sheets open inside the dialog, not behind it.
6303
+ * `previousDialog` decides what happens to the dialogs it replaces, the
6304
+ * same way it does for a regular dialog.
6303
6305
  */
6304
6306
  openFullScreen(component, config = {}) {
6305
6307
  const dialogConfig = this.mergeConfig(config);
@@ -6312,7 +6314,7 @@ class DialogService {
6312
6314
  if (previousRef) {
6313
6315
  // Everything open belongs to the context being replaced, including
6314
6316
  // a full screen dialog that is already up.
6315
- this.closeAll();
6317
+ this.dismissPreviousContext(dialogConfig.previousDialog);
6316
6318
  }
6317
6319
  let dialogRef;
6318
6320
  const cdkRef = this.cdkDialog.open(component, {
@@ -6450,6 +6452,15 @@ class DialogService {
6450
6452
  previousRef.overlayRef.backdropElement?.classList.add(SCRIM_KEPT_CLASS);
6451
6453
  return behavior === 'hide' ? previousRef.hide() : this.closeRegularDialogs();
6452
6454
  }
6455
+ /**
6456
+ * The same choice for a full screen dialog, applied to everything that is
6457
+ * on screen: what it takes over from is a whole context, a full screen
6458
+ * dialog of its own included. `hide` keeps that context alive, and it comes
6459
+ * back as it was once this dialog closes.
6460
+ */
6461
+ dismissPreviousContext(behavior) {
6462
+ return behavior === 'hide' ? this.hideAll() : this.closeAll();
6463
+ }
6453
6464
  startOpenAnimation(dialogRef) {
6454
6465
  const overlayRef = dialogRef.overlayRef;
6455
6466
  const panel = overlayRef.overlayElement;
@@ -6501,6 +6512,13 @@ class DialogService {
6501
6512
  if (!to) {
6502
6513
  return;
6503
6514
  }
6515
+ // Nothing to hand over either: the dialog leaving carries no scrim, so
6516
+ // the one coming in fades its own in rather than switching it on in a
6517
+ // single frame. This is a full screen dialog closing over a dialog that
6518
+ // was hidden underneath it.
6519
+ if (!from) {
6520
+ return;
6521
+ }
6504
6522
  from?.classList.add(SCRIM_INSTANT_CLASS);
6505
6523
  from?.classList.remove(SCRIM_KEPT_CLASS);
6506
6524
  to?.classList.add(SCRIM_INSTANT_CLASS);
@@ -6560,10 +6578,28 @@ class DialogService {
6560
6578
  if (previousRef.overlayRef.backdropElement) {
6561
6579
  ref.overlayRef.backdropElement?.classList.add(SCRIM_KEPT_CLASS);
6562
6580
  }
6563
- setTimeout(() => this.startRestoringAnimation(ref, previousRef), DIALOG_HANDOVER_DELAY_MS);
6581
+ setTimeout(() => {
6582
+ this.showHostFullScreenDialog(previousRef);
6583
+ this.startRestoringAnimation(ref, previousRef);
6584
+ }, DIALOG_HANDOVER_DELAY_MS);
6564
6585
  return;
6565
6586
  }
6566
6587
  }
6588
+ /**
6589
+ * Brings back the full screen dialog a restored dialog sits in. The two are
6590
+ * hidden together when a full screen dialog takes over with
6591
+ * `previousDialog: 'hide'`, so the context has to be on screen again before
6592
+ * the dialog that sits on top of it, exactly as showAll() puts them back.
6593
+ */
6594
+ showHostFullScreenDialog(ref) {
6595
+ if (ref.isFullScreen) {
6596
+ return;
6597
+ }
6598
+ const hostRef = this.fullScreenDialog;
6599
+ if (hostRef?.isHidden && this.refs.indexOf(hostRef) < this.refs.indexOf(ref)) {
6600
+ hostRef.show();
6601
+ }
6602
+ }
6567
6603
  removeRef(ref) {
6568
6604
  const index = this.refs.indexOf(ref);
6569
6605
  if (index === -1) {