mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
Merge branch 'add-disable-backdrop-click-dismiss-to-alert' of https://github.com/3dd13/ionic into 3dd13-add-disable-backdrop-click-dismiss-to-alert
This commit is contained in:
@ -132,7 +132,8 @@ export class Alert extends ViewController {
|
|||||||
checked?: boolean,
|
checked?: boolean,
|
||||||
id?: string
|
id?: string
|
||||||
}>,
|
}>,
|
||||||
buttons?: Array<any>
|
buttons?: Array<any>,
|
||||||
|
disableClickBackdropToDismiss?: boolean
|
||||||
} = {}) {
|
} = {}) {
|
||||||
opts.inputs = opts.inputs || [];
|
opts.inputs = opts.inputs || [];
|
||||||
opts.buttons = opts.buttons || [];
|
opts.buttons = opts.buttons || [];
|
||||||
@ -225,7 +226,8 @@ export class Alert extends ViewController {
|
|||||||
checked?: boolean,
|
checked?: boolean,
|
||||||
id?: string
|
id?: string
|
||||||
}>,
|
}>,
|
||||||
buttons?: Array<any>
|
buttons?: Array<any>,
|
||||||
|
disableClickBackdropToDismiss?: boolean
|
||||||
} = {}) {
|
} = {}) {
|
||||||
return new Alert(opts);
|
return new Alert(opts);
|
||||||
}
|
}
|
||||||
@ -430,6 +432,7 @@ class AlertCmp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bdClick() {
|
bdClick() {
|
||||||
|
if (!this.d.disableClickBackdropToDismiss) {
|
||||||
let cancelBtn = this.d.buttons.find(b => b.role === 'cancel');
|
let cancelBtn = this.d.buttons.find(b => b.role === 'cancel');
|
||||||
if (cancelBtn) {
|
if (cancelBtn) {
|
||||||
this.btnClick(cancelBtn, 1);
|
this.btnClick(cancelBtn, 1);
|
||||||
@ -438,6 +441,7 @@ class AlertCmp {
|
|||||||
this.dismiss('backdrop');
|
this.dismiss('backdrop');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dismiss(role): Promise<any> {
|
dismiss(role): Promise<any> {
|
||||||
return this._viewCtrl.dismiss(this.getValues(), role);
|
return this._viewCtrl.dismiss(this.getValues(), role);
|
||||||
|
@ -237,6 +237,23 @@ class E2EPage {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doDisabledBackdropAlert() {
|
||||||
|
let alert = Alert.create({
|
||||||
|
disableClickBackdropToDismiss: true
|
||||||
|
});
|
||||||
|
alert.setTitle('Disabled Backdrop Click'),
|
||||||
|
alert.setSubTitle('Subtitle'),
|
||||||
|
alert.setMessage('This is an alert message.'),
|
||||||
|
alert.addButton({
|
||||||
|
text: 'Cancel',
|
||||||
|
role: 'cancel',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Confirm Cancel');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.nav.present(alert);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<button block class="e2eOpenRadio" (click)="doRadio()">Radio</button>
|
<button block class="e2eOpenRadio" (click)="doRadio()">Radio</button>
|
||||||
<button block class="e2eOpenCheckbox" (click)="doCheckbox()">Checkbox</button>
|
<button block class="e2eOpenCheckbox" (click)="doCheckbox()">Checkbox</button>
|
||||||
<button block class="e2eFastClose" (click)="doFastClose()">Fast Close</button>
|
<button block class="e2eFastClose" (click)="doFastClose()">Fast Close</button>
|
||||||
|
<button block class="e2eDisabledBackdrop" (click)="doDisabledBackdropAlert()">Disabled Backdrop Click</button>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
Confirm Opened: {{testConfirmOpen}}
|
Confirm Opened: {{testConfirmOpen}}
|
||||||
|
Reference in New Issue
Block a user