From 4d233b71518a91c4e65bf03dbe4a8d8709412040 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 25 Apr 2014 09:57:57 +0100 Subject: [PATCH] jQueryUI: Tidy up and up to gotoCurrent --- jqueryui/jqueryui-tests.ts | 27 ++++++++++++ jqueryui/jqueryui.d.ts | 88 +++++++++++++++++++++++++++++--------- 2 files changed, 95 insertions(+), 20 deletions(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index b83006c3a8..79263027fe 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1362,6 +1362,33 @@ function test_datepicker() { $set = $(".selector").datepicker("option", "defaultDate", new Date()); $set = $(".selector").datepicker("option", "defaultDate", "+1m +7d"); } + + function duration() { + $(".selector").datepicker({ duration: "slow" }); + + var duration: string = $(".selector").datepicker("option", "duration"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "duration", "slow"); + } + + function firstDay() { + $(".selector").datepicker({ firstDay: 1 }); + + var firstDay: number = $(".selector").datepicker("option", "firstDay"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "firstDay", 1); + } + + function gotoCurrent() { + $(".selector").datepicker({ gotoCurrent: true }); + + var gotoCurrent: boolean = $(".selector").datepicker("option", "gotoCurrent"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "gotoCurrent", true); + } } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 5019a99504..26492bf200 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1278,14 +1278,14 @@ interface JQuery { * Get the calculateWeek option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'calculateWeek' */ datepicker(methodName: 'option', optionName: 'calculateWeek'): (date: Date) => string; /** * Set the calculateWeek option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'calculateWeek' * @param calculateWeekValue A function to calculate the week of the year for a given date. The default implementation uses the ISO 8601 definition: weeks start on a Monday; the first week of the year contains the first Thursday of the year. */ datepicker(methodName: 'option', optionName: 'calculateWeek', calculateWeekValue: (date: Date) => string): JQuery; @@ -1294,14 +1294,14 @@ interface JQuery { * Get the changeMonth option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'changeMonth' */ datepicker(methodName: 'option', optionName: 'changeMonth'): boolean; /** * Set the changeMonth option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'changeMonth' * @param changeMonthValue Whether the month should be rendered as a dropdown instead of text. */ datepicker(methodName: 'option', optionName: 'changeMonth', changeMonthValue: boolean): JQuery; @@ -1310,14 +1310,14 @@ interface JQuery { * Get the changeYear option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'changeYear' */ datepicker(methodName: 'option', optionName: 'changeYear'): boolean; /** * Set the changeYear option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'changeYear' * @param changeYearValue Whether the year should be rendered as a dropdown instead of text. Use the yearRange option to control which years are made available for selection. */ datepicker(methodName: 'option', optionName: 'changeYear', changeYearValue: boolean): JQuery; @@ -1326,14 +1326,14 @@ interface JQuery { * Get the closeText option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'closeText' */ datepicker(methodName: 'option', optionName: 'closeText'): string; /** * Set the closeText option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'closeText' * @param closeTextValue The text to display for the close link. Use the showButtonPanel option to display this button. */ datepicker(methodName: 'option', optionName: 'closeText', closeTextValue: string): JQuery; @@ -1342,14 +1342,14 @@ interface JQuery { * Get the constrainInput option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'constrainInput' */ datepicker(methodName: 'option', optionName: 'constrainInput'): boolean; /** * Set the constrainInput option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'constrainInput' * @param constrainInputValue When true, entry in the input field is constrained to those characters allowed by the current dateFormat option. */ datepicker(methodName: 'option', optionName: 'constrainInput', constrainInputValue: boolean): JQuery; @@ -1358,14 +1358,14 @@ interface JQuery { * Get the currentText option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'currentText' */ datepicker(methodName: 'option', optionName: 'currentText'): string; /** * Set the currentText option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'currentText' * @param currentTextValue The text to display for the current day link. Use the showButtonPanel option to display this button. */ datepicker(methodName: 'option', optionName: 'currentText', currentTextValue: string): JQuery; @@ -1374,14 +1374,14 @@ interface JQuery { * Get the dateFormat option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dateFormat' */ datepicker(methodName: 'option', optionName: 'dateFormat'): string; /** * Set the dateFormat option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dateFormat' * @param dateFormatValue The format for parsed and displayed dates. For a full list of the possible formats see the formatDate function. */ datepicker(methodName: 'option', optionName: 'dateFormat', dateFormatValue: string): JQuery; @@ -1390,14 +1390,14 @@ interface JQuery { * Get the dayNames option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNames' */ datepicker(methodName: 'option', optionName: 'dayNames'): string[]; /** * Set the dayNames option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNames' * @param dayNamesValue The list of long day names, starting from Sunday, for use as requested via the dateFormat option. */ datepicker(methodName: 'option', optionName: 'dayNames', dayNamesValue: string[]): JQuery; @@ -1406,14 +1406,14 @@ interface JQuery { * Get the dayNamesMin option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNamesMin' */ datepicker(methodName: 'option', optionName: 'dayNamesMin'): string[]; /** * Set the dayNamesMin option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNamesMin' * @param dayNamesMinValue The list of minimised day names, starting from Sunday, for use as column headers within the datepicker. */ datepicker(methodName: 'option', optionName: 'dayNamesMin', dayNamesMinValue: string[]): JQuery; @@ -1422,14 +1422,14 @@ interface JQuery { * Get the dayNamesShort option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNamesShort' */ datepicker(methodName: 'option', optionName: 'dayNamesShort'): string[]; /** * Set the dayNamesShort option, after initialization * * @param methodName 'option' - * @param optionName 'buttonText' + * @param optionName 'dayNamesShort' * @param dayNamesShortValue The list of abbreviated day names, starting from Sunday, for use as requested via the dateFormat option. */ datepicker(methodName: 'option', optionName: 'dayNamesShort', dayNamesShortValue: string[]): JQuery; @@ -1466,6 +1466,54 @@ interface JQuery { */ datepicker(methodName: 'option', optionName: 'defaultDate', defaultDateValue: string): JQuery; + /** + * Get the duration option, after initialization + * + * @param methodName 'option' + * @param optionName 'duration' + */ + datepicker(methodName: 'option', optionName: 'duration'): string; + /** + * Set the duration option, after initialization + * + * @param methodName 'option' + * @param optionName 'duration' + * @param durationValue Control the speed at which the datepicker appears, it may be a time in milliseconds or a string representing one of the three predefined speeds ("slow", "normal", "fast"). + */ + datepicker(methodName: 'option', optionName: 'duration', durationValue: string): JQuery; + + /** + * Get the firstDay option, after initialization + * + * @param methodName 'option' + * @param optionName 'firstDay' + */ + datepicker(methodName: 'option', optionName: 'firstDay'): number; + /** + * Set the firstDay option, after initialization + * + * @param methodName 'option' + * @param optionName 'firstDay' + * @param firstDayValue Set the first day of the week: Sunday is 0, Monday is 1, etc. + */ + datepicker(methodName: 'option', optionName: 'firstDay', firstDayValue: number): JQuery; + + /** + * Get the gotoCurrent option, after initialization + * + * @param methodName 'option' + * @param optionName 'gotoCurrent' + */ + datepicker(methodName: 'option', optionName: 'gotoCurrent'): boolean; + /** + * Set the gotoCurrent option, after initialization + * + * @param methodName 'option' + * @param optionName 'gotoCurrent' + * @param gotoCurrentValue When true, the current day link moves to the currently selected date instead of today. + */ + datepicker(methodName: 'option', optionName: 'gotoCurrent', gotoCurrentValue: boolean): JQuery; + /** * Gets the value currently associated with the specified optionName. *