mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
chore(overlays): generic for present/dismiss options (#26287)
This commit is contained in:
@ -506,7 +506,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
|
||||
writeTask(() => this.el.classList.add('show-modal'));
|
||||
|
||||
this.currentTransition = present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
|
||||
this.currentTransition = present<ModalPresentOptions>(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
|
||||
presentingEl: this.presentingElement,
|
||||
currentBreakpoint: this.initialBreakpoint,
|
||||
backdropBreakpoint: this.backdropBreakpoint,
|
||||
@ -721,11 +721,19 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
||||
|
||||
const enteringAnimation = activeAnimations.get(this) || [];
|
||||
|
||||
this.currentTransition = dismiss(this, data, role, 'modalLeave', iosLeaveAnimation, mdLeaveAnimation, {
|
||||
presentingEl: this.presentingElement,
|
||||
currentBreakpoint: this.currentBreakpoint ?? this.initialBreakpoint,
|
||||
backdropBreakpoint: this.backdropBreakpoint,
|
||||
});
|
||||
this.currentTransition = dismiss<ModalDismissOptions>(
|
||||
this,
|
||||
data,
|
||||
role,
|
||||
'modalLeave',
|
||||
iosLeaveAnimation,
|
||||
mdLeaveAnimation,
|
||||
{
|
||||
presentingEl: this.presentingElement,
|
||||
currentBreakpoint: this.currentBreakpoint ?? this.initialBreakpoint,
|
||||
backdropBreakpoint: this.backdropBreakpoint,
|
||||
}
|
||||
);
|
||||
|
||||
const dismissed = await this.currentTransition;
|
||||
|
||||
@ -953,3 +961,22 @@ const LIFECYCLE_MAP: any = {
|
||||
};
|
||||
|
||||
let modalIds = 0;
|
||||
|
||||
interface ModalOverlayOptions {
|
||||
/**
|
||||
* The element that presented the modal.
|
||||
*/
|
||||
presentingEl?: HTMLElement;
|
||||
/**
|
||||
* The current breakpoint of the sheet modal.
|
||||
*/
|
||||
currentBreakpoint?: number;
|
||||
/**
|
||||
* The point after which the backdrop will being
|
||||
* to fade in when using a sheet modal.
|
||||
*/
|
||||
backdropBreakpoint: number;
|
||||
}
|
||||
|
||||
type ModalPresentOptions = ModalOverlayOptions;
|
||||
type ModalDismissOptions = ModalOverlayOptions;
|
||||
|
||||
Reference in New Issue
Block a user