From 62fca3d19ec99fdc0f9d4214da47f6b342b2e08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mez=C5=91=20Istv=C3=A1n?= Date: Tue, 9 Oct 2018 20:47:00 +0200 Subject: [PATCH] Update pikaday types to 1.7 (#29378) --- types/pikaday/index.d.ts | 33 ++++++++++++++++++++++++++++++++- types/pikaday/pikaday-tests.ts | 8 +++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index 7f2fb7eca4..63967d3169 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -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 // Åke Wivänge +// Istvan Mezo // 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; } } diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 3f77683cd4..14250d0df3 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -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 }); })();