mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
chore(): update events for popover and action-sheet
This commit is contained in:
@ -43,7 +43,7 @@ export class ActionSheetController implements IonicControllerApi {
|
|||||||
|
|
||||||
|
|
||||||
@Listen('body:ionActionSheetDidLoad')
|
@Listen('body:ionActionSheetDidLoad')
|
||||||
viewDidLoad(ev) {
|
viewDidLoad(ev: ActionSheetEvent) {
|
||||||
const actionsheet = ev.detail.actionsheet;
|
const actionsheet = ev.detail.actionsheet;
|
||||||
const actionsheetResolve = this.actionsheetResolves[actionsheet.id];
|
const actionsheetResolve = this.actionsheetResolves[actionsheet.id];
|
||||||
if (actionsheetResolve) {
|
if (actionsheetResolve) {
|
||||||
@ -55,13 +55,13 @@ export class ActionSheetController implements IonicControllerApi {
|
|||||||
|
|
||||||
@Listen('body:ionActionSheetWillPresent')
|
@Listen('body:ionActionSheetWillPresent')
|
||||||
willPresent(ev: ActionSheetEvent) {
|
willPresent(ev: ActionSheetEvent) {
|
||||||
this.actionsheets.push(ev.actionsheet);
|
this.actionsheets.push(ev.detail.actionsheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Listen('body:ionActionSheetWillDismiss, body:ionActionSheetDidUnload')
|
@Listen('body:ionActionSheetWillDismiss, body:ionActionSheetDidUnload')
|
||||||
willDismiss(ev: ActionSheetEvent) {
|
willDismiss(ev: ActionSheetEvent) {
|
||||||
const index = this.actionsheets.indexOf(ev.actionsheet);
|
const index = this.actionsheets.indexOf(ev.detail.actionsheet);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.actionsheets.splice(index, 1);
|
this.actionsheets.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,9 +70,7 @@ export class ActionSheet {
|
|||||||
// this.animation.destroy();
|
// this.animation.destroy();
|
||||||
// this.animation = null;
|
// this.animation = null;
|
||||||
// }
|
// }
|
||||||
this.ionActionSheetWillPresent.emit(
|
this.ionActionSheetWillPresent.emit({ actionsheet: this });
|
||||||
{ actionsheet: this } as ActionSheetEvent
|
|
||||||
);
|
|
||||||
|
|
||||||
// let animationBuilder = this.enterAnimation
|
// let animationBuilder = this.enterAnimation
|
||||||
// ? this.enterAnimation
|
// ? this.enterAnimation
|
||||||
@ -96,12 +94,8 @@ export class ActionSheet {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
return new Promise<void>(resolve => {
|
return new Promise<void>(resolve => {
|
||||||
this.ionActionSheetWillDismiss.emit(
|
this.ionActionSheetWillDismiss.emit({ actionsheet: this });
|
||||||
{ actionsheet: this } as ActionSheetEvent
|
|
||||||
);
|
|
||||||
|
|
||||||
// get the user's animation fn if one was provided
|
|
||||||
let animationBuilder = this.exitAnimation;
|
|
||||||
|
|
||||||
// let animationBuilder = this.exitAnimation
|
// let animationBuilder = this.exitAnimation
|
||||||
// ? this.exitAnimation
|
// ? this.exitAnimation
|
||||||
@ -111,9 +105,7 @@ export class ActionSheet {
|
|||||||
// this.animation = animationBuilder(this.el);
|
// this.animation = animationBuilder(this.el);
|
||||||
// this.animation.onFinish((a: any) => {
|
// this.animation.onFinish((a: any) => {
|
||||||
// a.destroy();
|
// a.destroy();
|
||||||
this.ionActionSheetDidDismiss.emit(
|
this.ionActionSheetDidDismiss.emit({ actionsheet: this });
|
||||||
{ actionsheet: this } as ActionSheetEvent
|
|
||||||
);
|
|
||||||
|
|
||||||
Core.dom.write(() => {
|
Core.dom.write(() => {
|
||||||
this.el.parentNode.removeChild(this.el);
|
this.el.parentNode.removeChild(this.el);
|
||||||
@ -125,9 +117,7 @@ export class ActionSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidUnload() {
|
ionViewDidUnload() {
|
||||||
this.ionActionSheetDidUnload.emit(
|
this.ionActionSheetDidUnload.emit({ actionsheet: this });
|
||||||
{ actionsheet: this } as ActionSheetEvent
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
backdropClick() {
|
backdropClick() {
|
||||||
@ -175,7 +165,7 @@ export interface ActionSheetOptions {
|
|||||||
title?: string;
|
title?: string;
|
||||||
subTitle?: string;
|
subTitle?: string;
|
||||||
cssClass?: string;
|
cssClass?: string;
|
||||||
buttons?: (ActionSheetButton | string)[];
|
buttons?: (ActionSheetButtons | string)[];
|
||||||
enableBackdropDismiss?: boolean;
|
enableBackdropDismiss?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,5 +178,7 @@ export interface ActionSheetButtons {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ActionSheetEvent {
|
export interface ActionSheetEvent {
|
||||||
actionsheet: ActionSheet;
|
detail: {
|
||||||
|
actionsheet: ActionSheet;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ export class PopoverController implements IonicControllerApi {
|
|||||||
|
|
||||||
|
|
||||||
@Listen('body:ionPopoverDidLoad')
|
@Listen('body:ionPopoverDidLoad')
|
||||||
viewDidLoad(ev) {
|
viewDidLoad(ev: PopoverEvent) {
|
||||||
const popover = ev.detail.popover;
|
const popover = ev.detail.popover;
|
||||||
const popoverResolve = this.popoverResolves[popover.id];
|
const popoverResolve = this.popoverResolves[popover.id];
|
||||||
if (popoverResolve) {
|
if (popoverResolve) {
|
||||||
@ -55,13 +55,13 @@ export class PopoverController implements IonicControllerApi {
|
|||||||
|
|
||||||
@Listen('body:ionPopoverWillPresent')
|
@Listen('body:ionPopoverWillPresent')
|
||||||
willPresent(ev: PopoverEvent) {
|
willPresent(ev: PopoverEvent) {
|
||||||
this.popovers.push(ev.popover);
|
this.popovers.push(ev.detail.popover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Listen('body:ionPopoverWillDismiss, body:ionPopoverDidUnload')
|
@Listen('body:ionPopoverWillDismiss, body:ionPopoverDidUnload')
|
||||||
willDismiss(ev: PopoverEvent) {
|
willDismiss(ev: PopoverEvent) {
|
||||||
const index = this.popovers.indexOf(ev.popover);
|
const index = this.popovers.indexOf(ev.detail.popover);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.popovers.splice(index, 1);
|
this.popovers.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,5 +176,7 @@ export interface PopoverOptions {
|
|||||||
|
|
||||||
|
|
||||||
export interface PopoverEvent {
|
export interface PopoverEvent {
|
||||||
popover: Popover;
|
detail: {
|
||||||
|
popover: Popover;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user