From 7f38cb5a160aa0feb56dc877b17758c6bb52a4a4 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 11 Oct 2016 09:13:56 -0400 Subject: [PATCH] docs(datepicker): improve docs --- src/plugins/datepicker.ts | 77 ++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/src/plugins/datepicker.ts b/src/plugins/datepicker.ts index cb16a453a..4416b6ef2 100644 --- a/src/plugins/datepicker.ts +++ b/src/plugins/datepicker.ts @@ -1,66 +1,104 @@ -import { Cordova, Plugin } from './plugin'; +import {Cordova, Plugin} from './plugin'; export interface DatePickerOptions { /** - * Platforms: iOS, Android, Windows * The mode of the date picker * Values: date | time | datetime */ mode: string; /** - * Platforms: iOS, Android, Windows * Selected date */ date: Date | string | number; /** - * Platforms: iOS, Android, Windows * Minimum date - * Type: Date | empty String * Default: empty String */ minDate?: Date | string | number; /** - * Platforms?: iOS, Android, Windows * Maximum date - * Type?: Date | empty String * Default?: empty String */ maxDate?: Date | string | number; /** - * Platforms?: Android * Label for the dialog title. If empty, uses android default (Set date/Set time). - * Type?: String * Default?: empty String */ titleText?: string; /** - * Platforms?: Android * Label of BUTTON_POSITIVE (done button) on Android */ okText?: string; - - // TODO complete documentation here, and copy params & docs to main plugin docs + /** + * Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel. + */ cancelText?: string; + /** + * Label of today button. If empty, doesn't show the option to select current date. + */ todayText?: string; + /** + * Label of now button. If empty, doesn't show the option to select current time. + */ nowText?: string; + /** + * Shows time dialog in 24 hours format. + */ is24Hour?: boolean; + /** + * Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property. + * Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT + */ androidTheme?: number; + /** + * Shows or hide dates earlier then selected date. + */ allowOldDate?: boolean; + /** + * Shows or hide dates after selected date. + */ allowFutureDates?: boolean; + /** + * Label of done button. + */ doneButtonLabel?: string; + /** + * Hex color of done button. + */ doneButtonColor?: string; + /** + * Label of cancel button. + */ cancelButtonLabel?: string; + /** + * Hex color of cancel button. + */ cancelButtonColor?: string; + /** + * X position of date picker. The position is absolute to the root view of the application. + */ x?: number; + /** + * Y position of date picker. The position is absolute to the root view of the application. + */ y?: number; + /** + * Interval between options in the minute section of the date picker. + */ minuteInterval?: number; + /** + * Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself. + */ popoverArrowDirection?: string; + /** + * Force locale for datePicker. + */ locale?: string; } @@ -86,7 +124,8 @@ export interface DatePickerOptions { * err => console.log('Error occurred while getting date: ', err) * ); * ``` - * + * @interfaces + * DatePickerOptions */ @Plugin({ plugin: 'cordova-plugin-datepicker', @@ -95,12 +134,22 @@ export interface DatePickerOptions { }) export class DatePicker { + static ANDROID_THEMES = { + THEME_TRADITIONAL: 1, + THEME_HOLO_DARK: 2, + THEME_HOLO_LIGHT: 3, + THEME_DEVICE_DEFAULT_DARK: 4, + THEME_DEVICE_DEFAULT_LIGHT: 5 + }; + /** * Shows the date and/or time picker dialog(s) * @param {DatePickerOptions} options Options for the date picker. * @returns {Promise} Returns a promise that resolves with the picked date and/or time, or rejects with an error. */ @Cordova() - static show(options: DatePickerOptions): Promise { return; } + static show(options: DatePickerOptions): Promise { + return; + } }