mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
@ -4,6 +4,7 @@ import { Animation, AnimationBuilder, ComponentProps, ComponentRef, Config, Fram
|
|||||||
import { attachComponent, detachComponent } from '../../utils/framework-delegate';
|
import { attachComponent, detachComponent } from '../../utils/framework-delegate';
|
||||||
import { BACKDROP, dismiss, eventMethod, present } from '../../utils/overlays';
|
import { BACKDROP, dismiss, eventMethod, present } from '../../utils/overlays';
|
||||||
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
||||||
|
import { deepReady } from '../../utils/transition';
|
||||||
|
|
||||||
import { iosEnterAnimation } from './animations/ios.enter';
|
import { iosEnterAnimation } from './animations/ios.enter';
|
||||||
import { iosLeaveAnimation } from './animations/ios.leave';
|
import { iosLeaveAnimation } from './animations/ios.leave';
|
||||||
@ -134,12 +135,12 @@ export class Modal implements OverlayInterface {
|
|||||||
const el = this.usersElement;
|
const el = this.usersElement;
|
||||||
const name = LIFECYCLE_MAP[modalEvent.type];
|
const name = LIFECYCLE_MAP[modalEvent.type];
|
||||||
if (el && name) {
|
if (el && name) {
|
||||||
const event = new CustomEvent(name, {
|
const ev = new CustomEvent(name, {
|
||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: modalEvent.detail
|
detail: modalEvent.detail
|
||||||
});
|
});
|
||||||
el.dispatchEvent(event);
|
el.dispatchEvent(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +161,7 @@ export class Modal implements OverlayInterface {
|
|||||||
modal: this.el
|
modal: this.el
|
||||||
};
|
};
|
||||||
this.usersElement = await attachComponent(this.delegate, container, this.component, ['ion-page'], componentProps);
|
this.usersElement = await attachComponent(this.delegate, container, this.component, ['ion-page'], componentProps);
|
||||||
|
await deepReady(this.usersElement);
|
||||||
return present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation);
|
return present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import { ComponentRef, FrameworkDelegate } from '../interface';
|
import { ComponentRef, FrameworkDelegate } from '../interface';
|
||||||
|
|
||||||
export async function attachComponent(delegate: FrameworkDelegate | undefined, container: Element, component: ComponentRef, cssClasses?: string[], componentProps?: {[key: string]: any}): Promise<HTMLElement> {
|
export async function attachComponent(
|
||||||
|
delegate: FrameworkDelegate | undefined,
|
||||||
|
container: Element,
|
||||||
|
component: ComponentRef,
|
||||||
|
cssClasses?: string[],
|
||||||
|
componentProps?: {[key: string]: any}
|
||||||
|
): Promise<HTMLElement> {
|
||||||
if (delegate) {
|
if (delegate) {
|
||||||
return delegate.attachViewToDom(container, component, componentProps, cssClasses);
|
return delegate.attachViewToDom(container, component, componentProps, cssClasses);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ function shallowReady(el: Element | undefined): Promise<any> {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deepReady(el: Element | undefined): Promise<void> {
|
export async function deepReady(el: Element | undefined): Promise<void> {
|
||||||
const element = el as HTMLStencilElement;
|
const element = el as HTMLStencilElement;
|
||||||
if (element) {
|
if (element) {
|
||||||
if (element.componentOnReady) {
|
if (element.componentOnReady) {
|
||||||
|
Reference in New Issue
Block a user