mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-07 01:39:07 +00:00
Merge pull request #6769 from jacqueskang/master
add definitions for ng-Cordova datepicker
This commit is contained in:
31
ng-cordova/datepicker-tests.ts
Normal file
31
ng-cordova/datepicker-tests.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/// <reference path="datepicker.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
module ngCordova {
|
||||
function smoketest($cordovaDatePicker: IDatePickerService, isIos: boolean) {
|
||||
|
||||
// minDate is a Date object for iOS and a millisecond precision unix timestamp
|
||||
// for Android, so you need to account for that when using the plugin. Also,
|
||||
// on Android, only the date is enforced (time is not).
|
||||
// - from https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
|
||||
var minDate = isIos ? new Date() : (new Date()).valueOf();
|
||||
|
||||
var options: DatePickerOptions = {
|
||||
date: new Date(),
|
||||
mode: 'date',
|
||||
minDate: minDate,
|
||||
maxDate: '',
|
||||
allowOldDates: true,
|
||||
allowFutureDates: false,
|
||||
doneButtonLabel: 'DONE',
|
||||
doneButtonColor: '#F2F3F4',
|
||||
cancelButtonLabel: 'CANCEL',
|
||||
cancelButtonColor: '#000000',
|
||||
androidTheme: AndroidTheme.HoloDark
|
||||
};
|
||||
|
||||
$cordovaDatePicker.show(options).then(function(date) {
|
||||
alert(date);
|
||||
});
|
||||
};
|
||||
}
|
||||
46
ng-cordova/datepicker.d.ts
vendored
Normal file
46
ng-cordova/datepicker.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Type definitions for ngCordova datepicker plugin
|
||||
// Project: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
|
||||
// Definitions by: Jacques Kang <https://www.linkedin.com/in/jacqueskang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ngCordova {
|
||||
|
||||
export enum AndroidTheme {
|
||||
Traditional = 1,
|
||||
HoloDark = 2,
|
||||
HoloLight = 3,
|
||||
DeviceDefaultDark = 4,
|
||||
DeviceDefaultLight = 5
|
||||
}
|
||||
|
||||
export interface DatePickerOptions {
|
||||
mode?: string;
|
||||
date?: Date | string | number;
|
||||
minDate?: Date | string | number;
|
||||
maxDate?: Date | string | number;
|
||||
titleText?: string;
|
||||
okText?: string;
|
||||
cancelText?: string;
|
||||
todayText?: string;
|
||||
nowText?: string;
|
||||
is24Hour?: boolean;
|
||||
androidTheme?: AndroidTheme;
|
||||
allowOldDates?: boolean;
|
||||
allowFutureDates?: boolean;
|
||||
doneButtonLabel?: string;
|
||||
doneButtonColor?: string;
|
||||
cancelButtonLabel?: string;
|
||||
cancelButtonColor?: string;
|
||||
x?: number;
|
||||
y?: number;
|
||||
minuteInterval?: number;
|
||||
popoverArrowDirection?: string;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface IDatePickerService {
|
||||
show(options?: DatePickerOptions): ng.IPromise<Date>;
|
||||
}
|
||||
}
|
||||
1
ng-cordova/tsd.d.ts
vendored
1
ng-cordova/tsd.d.ts
vendored
@@ -12,3 +12,4 @@
|
||||
/// <reference path="deviceMotion.d.ts"/>
|
||||
/// <reference path="deviceOrientation.d.ts"/>
|
||||
/// <reference path="appAvailability.d.ts"/>
|
||||
/// <reference path="datepicker.d.ts"/>
|
||||
|
||||
Reference in New Issue
Block a user