Merge pull request #5 from ihadeed/add-datepicker

Add datepicker
This commit is contained in:
Tim Lancina 2016-03-04 10:36:49 -06:00
commit 3b06f4cfe6
3 changed files with 67 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules/ node_modules/
.idea

View File

@ -20,6 +20,7 @@ import {Push} from './plugins/push';
import {StatusBar} from './plugins/statusbar'; import {StatusBar} from './plugins/statusbar';
import {Toast} from './plugins/toast'; import {Toast} from './plugins/toast';
import {TouchID} from './plugins/touchid'; import {TouchID} from './plugins/touchid';
import {DatePicker} from './plugins/datepicker';
export { export {
ActionSheet, ActionSheet,
@ -35,7 +36,8 @@ export {
Push, Push,
StatusBar, StatusBar,
Toast, Toast,
TouchID TouchID,
DatePicker
} }
// Window export to use outside of a module loading system // Window export to use outside of a module loading system
@ -52,7 +54,8 @@ window['IonicNative'] = {
Push: Push, Push: Push,
StatusBar: StatusBar, StatusBar: StatusBar,
Toast: Toast, Toast: Toast,
TouchID: TouchID TouchID: TouchID,
DatePicker: DatePicker
} }
// To help developers using cordova, we listen for the device ready event and // To help developers using cordova, we listen for the device ready event and

61
src/plugins/datepicker.ts Normal file
View File

@ -0,0 +1,61 @@
import {Plugin, Cordova} from './plugin';
/**
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
*
* Platforms supported: iOS, Android, Windows
*
* Requires cordova-plugin-datepicker by VitaliiBlagodir that can be [found here](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
*
* Install the plugin by running the following command:
* ```shell
* ionic plugin add cordova-plugin-datepicker
* ```
*
* @usage
* ```js
* DatePicker.
* ```
*
*/
@Plugin({
name: 'DatePicker',
plugin: 'cordova-plugin-datepicker',
pluginRef: 'plugins.datePicker'
})
export class DatePicker {
/**
* Shows the date and/or time picker dialog(s)
* @param options
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova
static show(options? : {
mode : string,
date : string,
minDate : string,
maxDate : string,
titleText : string,
okText : string,
cancelText : string,
todayText : string,
nowText : string,
is24Hour : boolean,
androidTheme : number,
allowOldDate: boolean,
allowFutureDates : boolean,
doneButtonLabel : string,
doneButtonColor : string,
cancelButtonLabel : string,
cancelButtonColor : string,
x : string,
y : string,
minuteInterval : number,
popoverArrowDirection : string,
locale : string
}) : Promise<Date> {
return new Promise<Date>((res, rej) => {});
}
}