mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
@ -1,10 +1,8 @@
|
||||
import { EventEmitter } from '@stencil/core';
|
||||
|
||||
import { Animation, AnimationBuilder, Config, Mode } from '../interface';
|
||||
import { AnimationBuilder, HTMLIonOverlayElement, OverlayInterface, OverlayMap } from '../interface';
|
||||
|
||||
let lastId = 1;
|
||||
|
||||
export function createOverlay<T extends HTMLIonOverlayElement, B>(element: T, opts: B): Promise<T> {
|
||||
export function createOverlay<T extends HTMLIonOverlayElement & Required<B>, B>(element: T, opts: B): Promise<T> {
|
||||
// convert the passed in overlay options into props
|
||||
// that get passed down into the new overlay
|
||||
Object.assign(element, opts);
|
||||
@ -160,45 +158,4 @@ export function isCancel(role: string | undefined): boolean {
|
||||
return role === 'cancel' || role === BACKDROP;
|
||||
}
|
||||
|
||||
export interface OverlayEventDetail<T = any> {
|
||||
data?: T;
|
||||
role?: string;
|
||||
}
|
||||
|
||||
export interface OverlayInterface {
|
||||
mode: Mode;
|
||||
el: HTMLElement;
|
||||
willAnimate: boolean;
|
||||
keyboardClose: boolean;
|
||||
config: Config;
|
||||
overlayId: number;
|
||||
presented: boolean;
|
||||
animation?: Animation;
|
||||
animationCtrl: HTMLIonAnimationControllerElement;
|
||||
|
||||
enterAnimation?: AnimationBuilder;
|
||||
leaveAnimation?: AnimationBuilder;
|
||||
|
||||
didPresent: EventEmitter<void>;
|
||||
willPresent: EventEmitter<void>;
|
||||
willDismiss: EventEmitter<OverlayEventDetail>;
|
||||
didDismiss: EventEmitter<OverlayEventDetail>;
|
||||
|
||||
present(): Promise<void>;
|
||||
dismiss(data?: any, role?: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface OverlayController {
|
||||
create(opts?: any): Promise<HTMLElement>;
|
||||
dismiss(data?: any, role?: string, alertId?: number): Promise<void>;
|
||||
getTop(): HTMLElement;
|
||||
}
|
||||
|
||||
export interface HTMLIonOverlayElement extends HTMLStencilElement {
|
||||
overlayId: number;
|
||||
dismiss(data?: any, role?: string): Promise<void>;
|
||||
}
|
||||
|
||||
export type OverlayMap = Map<number, HTMLIonOverlayElement>;
|
||||
|
||||
export const BACKDROP = 'backdrop';
|
||||
|
Reference in New Issue
Block a user