Update pikaday types to 1.7 (#29378)

This commit is contained in:
Mező István
2018-10-09 20:47:00 +02:00
committed by Andy
parent c1105c72dc
commit 62fca3d19e
2 changed files with 39 additions and 2 deletions

View File

@@ -1,7 +1,8 @@
// Type definitions for pikaday 1.6
// Type definitions for pikaday 1.7
// Project: https://github.com/dbushell/Pikaday
// Definitions by: Rudolph Gottesheim <https://github.com/MidnightDesign>
// Åke Wivänge <https://github.com/wake42>
// Istvan Mezo <https://github.com/mezoistvan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -173,6 +174,11 @@ declare namespace Pikaday {
*/
bound?: boolean;
/**
* Data-attribute on the input field with an aria assistance test (only applied when bound is set)
*/
ariaLabel?: string;
/**
* Preferred position of the datepicker relative to the form field
* (e.g. 'top right'). Automatic adjustment may occur to avoid
@@ -241,6 +247,11 @@ declare namespace Pikaday {
*/
showWeekNumber?: boolean;
/**
* Select a whole week instead of a day (default false)
*/
pickWholeWeek?: boolean;
/**
* Reverse the calendar for right-to-left languages. Default: false.
*/
@@ -266,6 +277,11 @@ declare namespace Pikaday {
*/
showDaysInNextAndPreviousMonths?: boolean;
/**
* Allows user to select date that is in the next or previous months (default: false)
*/
enableSelectionDaysInNextAndPreviousMonths?: boolean;
/**
* Number of visible calendars.
*/
@@ -278,12 +294,22 @@ declare namespace Pikaday {
*/
mainCalendar?: string;
/**
* Array of dates that you would like to differentiate from regular days (e.g. ['Sat Jun 28 2017', 'Sun Jun 29 2017', 'Tue Jul 01 2017',])
*/
events?: string[];
/**
* Define a class name that can be used as a hook for styling different
* themes. Default: null.
*/
theme?: string;
/**
* Defines if the field is blurred when a date is selected (default true)
*/
blurFieldOnSelect?: boolean;
/**
* The default flag for moment's strict date parsing (requires Moment.js for custom formatting). Default: false
*/
@@ -320,5 +346,10 @@ declare namespace Pikaday {
* Callback function for when the picker draws a new month.
*/
onDraw?(): void;
/**
* Enable keyboard input support. Default: true
*/
keyboardInput?: boolean;
}
}

View File

@@ -67,6 +67,7 @@ new Pikaday({field: $('#datepicker')[0]});
format: 'YYYY-MM-DD',
trigger: document.getElementById('datepicker'),
bound: false,
ariaLabel: 'myLabel',
position: 'top right',
reposition: false,
container: document.getElementById('myTag'),
@@ -79,20 +80,25 @@ new Pikaday({field: $('#datepicker')[0]});
disableDayFn: (date) => true,
yearRange: [2000, 2020],
showWeekNumber: true,
pickWholeWeek: true,
isRTL: true,
yearSuffix: 'r',
showMonthAfterYear: false,
showDaysInNextAndPreviousMonths: true,
enableSelectionDaysInNextAndPreviousMonths: true,
numberOfMonths: 2,
mainCalendar: 'right',
events: ['Sat Jun 28 2017'],
theme: 'myTheme',
blurFieldOnSelect: false,
formatStrict: true,
toString: (date) => '2017-08-23',
parse: () => new Date('2017-08-23'),
onSelect: () => {},
onOpen: () => {},
onClose: () => {},
onDraw: () => {}
onDraw: () => {},
keyboardInput: false
});
})();