mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-28 18:02:57 +08:00
docs(datepicker): improve docs
This commit is contained in:
parent
5b060345d2
commit
7f38cb5a16
@ -1,66 +1,104 @@
|
|||||||
import { Cordova, Plugin } from './plugin';
|
import {Cordova, Plugin} from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface DatePickerOptions {
|
export interface DatePickerOptions {
|
||||||
/**
|
/**
|
||||||
* Platforms: iOS, Android, Windows
|
|
||||||
* The mode of the date picker
|
* The mode of the date picker
|
||||||
* Values: date | time | datetime
|
* Values: date | time | datetime
|
||||||
*/
|
*/
|
||||||
mode: string;
|
mode: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms: iOS, Android, Windows
|
|
||||||
* Selected date
|
* Selected date
|
||||||
*/
|
*/
|
||||||
date: Date | string | number;
|
date: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms: iOS, Android, Windows
|
|
||||||
* Minimum date
|
* Minimum date
|
||||||
* Type: Date | empty String
|
|
||||||
* Default: empty String
|
* Default: empty String
|
||||||
*/
|
*/
|
||||||
minDate?: Date | string | number;
|
minDate?: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms?: iOS, Android, Windows
|
|
||||||
* Maximum date
|
* Maximum date
|
||||||
* Type?: Date | empty String
|
|
||||||
* Default?: empty String
|
* Default?: empty String
|
||||||
*/
|
*/
|
||||||
maxDate?: Date | string | number;
|
maxDate?: Date | string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms?: Android
|
|
||||||
* Label for the dialog title. If empty, uses android default (Set date/Set time).
|
* Label for the dialog title. If empty, uses android default (Set date/Set time).
|
||||||
* Type?: String
|
|
||||||
* Default?: empty String
|
* Default?: empty String
|
||||||
*/
|
*/
|
||||||
titleText?: string;
|
titleText?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platforms?: Android
|
|
||||||
* Label of BUTTON_POSITIVE (done button) on Android
|
* Label of BUTTON_POSITIVE (done button) on Android
|
||||||
*/
|
*/
|
||||||
okText?: string;
|
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;
|
cancelText?: string;
|
||||||
|
/**
|
||||||
|
* Label of today button. If empty, doesn't show the option to select current date.
|
||||||
|
*/
|
||||||
todayText?: string;
|
todayText?: string;
|
||||||
|
/**
|
||||||
|
* Label of now button. If empty, doesn't show the option to select current time.
|
||||||
|
*/
|
||||||
nowText?: string;
|
nowText?: string;
|
||||||
|
/**
|
||||||
|
* Shows time dialog in 24 hours format.
|
||||||
|
*/
|
||||||
is24Hour?: boolean;
|
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;
|
androidTheme?: number;
|
||||||
|
/**
|
||||||
|
* Shows or hide dates earlier then selected date.
|
||||||
|
*/
|
||||||
allowOldDate?: boolean;
|
allowOldDate?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows or hide dates after selected date.
|
||||||
|
*/
|
||||||
allowFutureDates?: boolean;
|
allowFutureDates?: boolean;
|
||||||
|
/**
|
||||||
|
* Label of done button.
|
||||||
|
*/
|
||||||
doneButtonLabel?: string;
|
doneButtonLabel?: string;
|
||||||
|
/**
|
||||||
|
* Hex color of done button.
|
||||||
|
*/
|
||||||
doneButtonColor?: string;
|
doneButtonColor?: string;
|
||||||
|
/**
|
||||||
|
* Label of cancel button.
|
||||||
|
*/
|
||||||
cancelButtonLabel?: string;
|
cancelButtonLabel?: string;
|
||||||
|
/**
|
||||||
|
* Hex color of cancel button.
|
||||||
|
*/
|
||||||
cancelButtonColor?: string;
|
cancelButtonColor?: string;
|
||||||
|
/**
|
||||||
|
* X position of date picker. The position is absolute to the root view of the application.
|
||||||
|
*/
|
||||||
x?: number;
|
x?: number;
|
||||||
|
/**
|
||||||
|
* Y position of date picker. The position is absolute to the root view of the application.
|
||||||
|
*/
|
||||||
y?: number;
|
y?: number;
|
||||||
|
/**
|
||||||
|
* Interval between options in the minute section of the date picker.
|
||||||
|
*/
|
||||||
minuteInterval?: number;
|
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;
|
popoverArrowDirection?: string;
|
||||||
|
/**
|
||||||
|
* Force locale for datePicker.
|
||||||
|
*/
|
||||||
locale?: string;
|
locale?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +124,8 @@ export interface DatePickerOptions {
|
|||||||
* err => console.log('Error occurred while getting date: ', err)
|
* err => console.log('Error occurred while getting date: ', err)
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*
|
* @interfaces
|
||||||
|
* DatePickerOptions
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'cordova-plugin-datepicker',
|
plugin: 'cordova-plugin-datepicker',
|
||||||
@ -95,12 +134,22 @@ export interface DatePickerOptions {
|
|||||||
})
|
})
|
||||||
export class DatePicker {
|
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)
|
* Shows the date and/or time picker dialog(s)
|
||||||
* @param {DatePickerOptions} options Options for the date picker.
|
* @param {DatePickerOptions} options Options for the date picker.
|
||||||
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
|
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static show(options: DatePickerOptions): Promise<Date> { return; }
|
static show(options: DatePickerOptions): Promise<Date> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user