refactor(wheel-selector): fixes & enhancements

This commit is contained in:
Ibby Hadeed 2017-05-09 18:12:56 -04:00
parent 235f51a351
commit af66a0dbec

View File

@ -1,6 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface WheelSelectorItem {
description: string;
}
export interface WheelSelectorOptions { export interface WheelSelectorOptions {
/** /**
* The title of the selector's input box * The title of the selector's input box
@ -9,16 +13,13 @@ export interface WheelSelectorOptions {
/** /**
* The items to display (array of items). * The items to display (array of items).
* Example, 2 wheels:
* [{description: "1", description: "2", description: "3"},
* {description: "Apple", description: "Pear", description: "Banana"}]
*/ */
items: {}; items: WheelSelectorItem[];
/** /**
* Which items to display by default, example ["2","Apple"] (if items.length is 2 for instance) * Which items to display by default, example ["2","Apple"] (if items.length is 2 for instance)
*/ */
defaultItems?: any; defaultItems?: WheelSelectorItem[];
/** /**
* The 'ok' button text * The 'ok' button text
@ -53,17 +54,17 @@ export interface WheelSelectorOptions {
} }
export interface WheelSelectorData { export interface WheelSelectorData {
data: any; data: any;
} }
/** /**
* @beta
* @name WheelSelector Plugin * @name WheelSelector Plugin
* @description Native wheel selector for Cordova (Android/iOS). * @description Native wheel selector for Cordova (Android/iOS).
* *
* @usage * @usage
* ``` * ```
* import { WheelSelector } from 'ionic-native'; * import { WheelSelector } from '@ionic-native/wheel-selector';
* *
* *
* constructor(private selector: WheelSelector) { } * constructor(private selector: WheelSelector) { }
@ -123,4 +124,13 @@ export class WheelSelector extends IonicNativePlugin {
return; return;
} }
/**
* Hide the selector
* @returns {Promise<void>}
*/
@Cordova({
platforms: ['iOS']
})
hideSelector(): Promise<void> { return; }
} }