From beb5e1df56f729f25085920951abaf3e0b4c41a8 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 16 Apr 2014 17:06:57 +0100 Subject: [PATCH 1/2] jQuery UI: continued on option getters / setters --- jqueryui/jqueryui-tests.ts | 20 +++++++++++++++++++- jqueryui/jqueryui.d.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index cc0fb4f72..987b48c4f 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1165,7 +1165,6 @@ function test_datepicker() { var $set: JQuery = $(".selector").datepicker("option", "altField", "#actualDate"); } - // Options function altFormat() { $(".selector").datepicker({ altFormat: "yy-mm-dd" }); @@ -1176,6 +1175,25 @@ function test_datepicker() { var $set: JQuery = $(".selector").datepicker("option", "altFormat", "yy-mm-dd"); } + function appendText() { + $(".selector").datepicker({ appendText: "(yyyy-mm-dd)" }); + + // getter + var appendText: string = $(".selector").datepicker("option", "appendText"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "appendText", "(yyyy-mm-dd)"); + } + + function autoSize() { + $(".selector").datepicker({ autoSize: true }); + + // getter + var autoSize: boolean = $(".selector").datepicker("option", "autoSize"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "autoSize", true); + } } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 4bd2e433f..e2b6d1fb8 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -986,6 +986,38 @@ interface JQuery { */ datepicker(methodName: 'option', optionName: 'altFormat', altFormatValue: string): JQuery; + /** + * Get the appendText option, after initialization + * + * @param methodName 'option' + * @param optionName 'appendText' + */ + datepicker(methodName: 'option', optionName: 'appendText'): string; + /** + * Set the appendText option, after initialization + * + * @param methodName 'option' + * @param optionName 'appendText' + * @param appendTextValue The text to display after each date field, e.g., to show the required format. + */ + datepicker(methodName: 'option', optionName: 'appendText', appendTextValue: string): JQuery; + + /** + * Get the autoSize option, after initialization + * + * @param methodName 'option' + * @param optionName 'autoSize' + */ + datepicker(methodName: 'option', optionName: 'autoSize'): boolean; + /** + * Set the autoSize option, after initialization + * + * @param methodName 'option' + * @param optionName 'autoSize' + * @param autoSizeValue Set to true to automatically resize the input field to accommodate dates in the current dateFormat. + */ + datepicker(methodName: 'option', optionName: 'autoSize', autoSizeValue: string): JQuery; + /** * Gets the value currently associated with the specified optionName. * From 3458bc6328c6a674eb0ec6f3475e262865bf9f15 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 16 Apr 2014 17:25:58 +0100 Subject: [PATCH 2/2] jQuery UI: button option getters / setters --- jqueryui/jqueryui-tests.ts | 29 ++++++++++++++++++++++ jqueryui/jqueryui.d.ts | 50 +++++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 987b48c4f..dc3e80856 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1194,6 +1194,35 @@ function test_datepicker() { // setter var $set: JQuery = $(".selector").datepicker("option", "autoSize", true); } + + function buttonImage() { + $(".selector").datepicker({ buttonImage: "/images/datepicker.gif" }); + + // getter + var buttonImage: string = $(".selector").datepicker("option", "buttonImage"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonImage", "/images/datepicker.gif"); + } + + function buttonImageOnly() { + $(".selector").datepicker({ buttonImageOnly: true }); + + // getter + var buttonImageOnly: boolean = $(".selector").datepicker("option", "buttonImageOnly"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonImageOnly", true); + } + + function buttonText() { + $(".selector").datepicker({ buttonText: "Choose" }); + + var buttonText: string = $(".selector").datepicker("option", "buttonText"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "buttonText", "Choose"); + } } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index e2b6d1fb8..52b9169e4 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1016,7 +1016,55 @@ interface JQuery { * @param optionName 'autoSize' * @param autoSizeValue Set to true to automatically resize the input field to accommodate dates in the current dateFormat. */ - datepicker(methodName: 'option', optionName: 'autoSize', autoSizeValue: string): JQuery; + datepicker(methodName: 'option', optionName: 'autoSize', autoSizeValue: boolean): JQuery; + + /** + * Get the buttonImage option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImage' + */ + datepicker(methodName: 'option', optionName: 'buttonImage'): string; + /** + * Set the buttonImage option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImage' + * @param buttonImageValue A URL of an image to use to display the datepicker when the showOn option is set to "button" or "both". If set, the buttonText option becomes the alt value and is not directly displayed. + */ + datepicker(methodName: 'option', optionName: 'buttonImage', buttonImageValue: string): JQuery; + + /** + * Get the buttonImageOnly option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImageOnly' + */ + datepicker(methodName: 'option', optionName: 'buttonImageOnly'): boolean; + /** + * Set the buttonImageOnly option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonImageOnly' + * @param buttonImageOnlyValue Whether the button image should be rendered by itself instead of inside a button element. This option is only relevant if the buttonImage option has also been set. + */ + datepicker(methodName: 'option', optionName: 'buttonImageOnly', buttonImageOnlyValue: boolean): JQuery; + + /** + * Get the buttonText option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonText' + */ + datepicker(methodName: 'option', optionName: 'buttonText'): string; + /** + * Set the buttonText option, after initialization + * + * @param methodName 'option' + * @param optionName 'buttonText' + * @param buttonTextValue The text to display on the trigger button. Use in conjunction with the showOn option set to "button" or "both". + */ + datepicker(methodName: 'option', optionName: 'buttonText', buttonTextValue: string): JQuery; /** * Gets the value currently associated with the specified optionName.