refactor(): added default items interface (#1725)

This commit is contained in:
jasonmamy 2017-07-10 06:55:40 -07:00 committed by Ibby Hadeed
parent cdb99a74cc
commit 12a83831c8

View File

@ -5,6 +5,11 @@ export interface WheelSelectorItem {
description?: string; description?: string;
} }
export interface DefaultItem {
index: number;
value: string;
}
export interface WheelSelectorOptions { export interface WheelSelectorOptions {
/** /**
* The title of the selector's input box * The title of the selector's input box
@ -17,9 +22,9 @@ export interface WheelSelectorOptions {
items: Array<Array<WheelSelectorItem>>; items: Array<Array<WheelSelectorItem>>;
/** /**
* Which items to display by default, example ["2","Apple"] (if items.length is 2 for instance) * Which items to display by default.
*/ */
defaultItems?: Array<WheelSelectorItem>; defaultItems?: Array<DefaultItem>;
/** /**
* The 'ok' button text * The 'ok' button text
@ -127,9 +132,9 @@ export interface WheelSelectorData {
* positiveButtonText: "Ok", * positiveButtonText: "Ok",
* negativeButtonText: "Nope", * negativeButtonText: "Nope",
* defaultItems: [ * defaultItems: [
* this.jsonData.numbers[2], // '3' * {index:0, value: this.jsonData.numbers[2].description},
* this.jsonData.fruits[3] // 'Banana' * {index: 1, value: this.jsonData.fruits[3].description}
* ] * ]
* }).then( * }).then(
* result => { * result => {
* console.log(result[0].description + ' ' + result[1].description); * console.log(result[0].description + ' ' + result[1].description);
@ -150,8 +155,8 @@ export interface WheelSelectorData {
* ], * ],
* displayKey: 'name', * displayKey: 'name',
* defaultItems: [ * defaultItems: [
* this.jsonData.firstNames[2], * {index:0, value: this.jsonData.firstNames[2].name},
* this.jsonData.lastNames[3] * {index: 0, value: this.jsonData.lastNames[3].name}
* ] * ]
* }).then( * }).then(
* result => { * result => {