From 030121e8b394bb70fad7bd67638beb06a31ade45 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 15 Aug 2013 23:28:36 -0500 Subject: [PATCH 1/2] Update definition and tests for pickadate.js v3.2.0 --- jquery.pickadate/jquery.pickadate-tests.ts | 8 +++++++ jquery.pickadate/jquery.pickadate.d.ts | 26 +++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts index ac6a161c6..75ceafd47 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/jquery.pickadate/jquery.pickadate-tests.ts @@ -99,6 +99,10 @@ $('.datepicker').pickadate({ ] }); +$('.datepicker').pickadate({ + container: '#root-outlet' +}); + $('.datepicker').pickadate({ onStart: function () { console.log('Hello there :)') @@ -189,6 +193,10 @@ $('.timepicker').pickatime({ ] }); +$('.timepicker').pickatime({ + container: '#root-outlet' +}); + $('.timepicker').pickatime({ onStart: function () { console.log('Hello there :)') diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index 03d2f943a..06c5ccdc9 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pickadate.js 3.0.5 +// Type definitions for pickadate.js 3.2.0 // Project: https://github.com/amsul/pickadate.js // Definitions by: Theodore Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -37,6 +37,9 @@ interface pickadateOptions { // Disable dates disable?: any[]; // arrays formatted as [YEAR,MONTH,DATE] or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. + /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ + container?: any; + // Events onStart?: (event: any) => void; onRender?: (event: any) => void; @@ -125,6 +128,9 @@ interface pickatimeOptions { // Disable times disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. + /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ + container?: any; + // Events onStart?: (event: any) => void; onRender?: (event: any) => void; @@ -241,8 +247,13 @@ interface DatePickerObject extends PickerObject { /** Destroy the picker. */ stop(): DatePickerObject; - /** Refresh the picker after adding something to the holder. */ - render(): DatePickerObject; + /** + * Refresh the picker box after adding something to the holder. + * By default, only the "face" of the picker (i.e. the box element) + * has it’s contents re-rendered. To render the entire picker from + * the root up, pass true as the first argument. + */ + render(entirePicker?: boolean): DatePickerObject; /** Clear the value in the picker's input element. */ clear(): DatePickerObject; @@ -307,8 +318,13 @@ interface TimePickerObject extends PickerObject { /** Destroy the picker. */ stop(): TimePickerObject; - /** Refresh the picker after adding something to the holder. */ - render(): TimePickerObject; + /** + * Refresh the picker box after adding something to the holder. + * By default, only the "face" of the picker (i.e. the box element) + * has it’s contents re-rendered. To render the entire picker from + * the root up, pass true as the first argument. + */ + render(entirePicker?: boolean): TimePickerObject; /** Clear the value in the picker's input element. */ clear(): TimePickerObject; From a22692616fa6f04441b08368eb30a960c5add959 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 15 Aug 2013 23:29:51 -0500 Subject: [PATCH 2/2] Reuse shared properties in pickadate.js definition --- jquery.pickadate/jquery.pickadate.d.ts | 46 +++++++++++--------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index 06c5ccdc9..08d789b53 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -5,7 +5,24 @@ /// -interface pickadateOptions { +/** Options shared between date and time pickers */ +interface pickerOptions { + /** Set clear button text */ + clear?: string; // default 'Clear' + + /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ + container?: any; + + // Events + onStart?: (event: any) => void; + onRender?: (event: any) => void; + onOpen?: (event: any) => void; + onClose?: (event: any) => void; + onSet?: (event: any) => void; + onStop?: (event: any) => void; +} + +interface pickadateOptions extends pickerOptions { // Strings and translations monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' @@ -16,7 +33,6 @@ interface pickadateOptions { // Buttons today?: string; // default 'Today' - clear?: string; // default 'Clear' // Formats format?: string; // default 'd mmmm, yyyy' @@ -37,17 +53,6 @@ interface pickadateOptions { // Disable dates disable?: any[]; // arrays formatted as [YEAR,MONTH,DATE] or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. - /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ - container?: any; - - // Events - onStart?: (event: any) => void; - onRender?: (event: any) => void; - onOpen?: (event: any) => void; - onClose?: (event: any) => void; - onSet?: (event: any) => void; - onStop?: (event: any) => void; - // Classes klass?: { @@ -108,9 +113,7 @@ interface pickadateOptions { } } -interface pickatimeOptions { - // Translations and clear button - clear?: string; // default 'Clear' +interface pickatimeOptions extends pickerOptions { // Formats format?: string; // default 'h:i A' @@ -128,17 +131,6 @@ interface pickatimeOptions { // Disable times disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. - /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ - container?: any; - - // Events - onStart?: (event: any) => void; - onRender?: (event: any) => void; - onOpen?: (event: any) => void; - onClose?: (event: any) => void; - onSet?: (event: any) => void; - onStop?: (event: any) => void; - // Classes klass?: {