2015-11-30 06:30:15 +08:00
|
|
|
import {Plugin, Cordova} from './plugin';
|
|
|
|
|
2016-02-07 05:56:38 +08:00
|
|
|
/**
|
2016-03-14 03:45:07 +08:00
|
|
|
* @name Action Sheet
|
2016-02-23 05:20:00 +08:00
|
|
|
* @description
|
2016-02-07 05:56:38 +08:00
|
|
|
* The ActionSheet plugin shows a native list of options the user can choose from.
|
2016-02-19 02:01:27 +08:00
|
|
|
*
|
2016-03-07 16:04:33 +08:00
|
|
|
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
|
2016-02-19 02:01:27 +08:00
|
|
|
*
|
2016-03-13 07:30:16 +08:00
|
|
|
* @usage
|
2016-02-23 05:20:00 +08:00
|
|
|
* ```ts
|
2016-02-19 02:01:27 +08:00
|
|
|
* import {ActionSheet} from 'ionic-native';
|
|
|
|
*
|
|
|
|
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
|
|
|
* ActionSheet.show({
|
|
|
|
* 'title': 'What do you want with this image?',
|
|
|
|
* 'buttonLabels': buttonLabels,
|
|
|
|
* 'addCancelButtonWithLabel': 'Cancel',
|
|
|
|
* 'addDestructiveButtonWithLabel' : 'Delete'
|
|
|
|
* }).then(buttonIndex => {
|
|
|
|
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
|
|
|
|
* });
|
|
|
|
* ```
|
|
|
|
*
|
2016-02-07 05:56:38 +08:00
|
|
|
*/
|
2015-11-30 06:30:15 +08:00
|
|
|
@Plugin({
|
|
|
|
plugin: 'cordova-plugin-actionsheet',
|
|
|
|
pluginRef: 'plugins.actionsheet',
|
2016-03-15 01:38:35 +08:00
|
|
|
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
|
|
|
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
2015-11-30 06:30:15 +08:00
|
|
|
})
|
|
|
|
export class ActionSheet {
|
2016-02-06 09:22:23 +08:00
|
|
|
|
|
|
|
/**
|
2016-02-25 05:20:16 +08:00
|
|
|
* Show the ActionSheet. The ActionSheet's options is an object with the following propterties.
|
|
|
|
*
|
|
|
|
* | Option | Type | Description |
|
|
|
|
* |-------------------------------|-----------|----------------------------------------------|
|
|
|
|
* | title |`string` | The title for the actionsheet |
|
|
|
|
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
|
2016-04-07 21:26:46 +08:00
|
|
|
* | androidTheme |`number` | Theme to be used on Android |
|
2016-02-25 05:20:16 +08:00
|
|
|
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
|
2016-04-07 21:26:46 +08:00
|
|
|
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
|
|
|
|
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
|
2016-02-25 05:20:16 +08:00
|
|
|
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
|
|
|
|
* | position |`number[]` | On an iPad, set the X,Y position |
|
|
|
|
*
|
2016-03-05 04:04:38 +08:00
|
|
|
* @param {options} Options See table above
|
2016-02-19 02:01:27 +08:00
|
|
|
* @returns {Promise} Returns a Promise that resolves with the index of the
|
2016-02-07 05:56:38 +08:00
|
|
|
* button pressed (1 based, so 1, 2, 3, etc.)
|
2016-02-06 09:22:23 +08:00
|
|
|
*/
|
2015-11-30 09:54:45 +08:00
|
|
|
@Cordova()
|
2016-02-06 09:22:23 +08:00
|
|
|
static show(options?: {
|
|
|
|
buttonLabels: string[],
|
|
|
|
title?: string,
|
|
|
|
androidTheme?: number,
|
|
|
|
androidEnableCancelButton?: boolean,
|
|
|
|
winphoneEnableCancelButton?: boolean,
|
|
|
|
addCancelButtonWithLabel?: string,
|
|
|
|
addDestructiveButtonWithLabel?: string,
|
|
|
|
position?: number[]
|
2016-04-30 11:56:49 +08:00
|
|
|
}): Promise<any> { return; }
|
2016-02-06 09:22:23 +08:00
|
|
|
|
2015-11-30 06:30:15 +08:00
|
|
|
|
2016-02-06 09:22:23 +08:00
|
|
|
/**
|
|
|
|
* Hide the ActionSheet.
|
|
|
|
*/
|
2015-11-30 09:54:45 +08:00
|
|
|
@Cordova()
|
2016-04-30 11:56:49 +08:00
|
|
|
static hide(): Promise<any> { return; }
|
2015-11-30 06:30:15 +08:00
|
|
|
}
|