From 9480db26457fbc39cfa6b50398eeb0dfb2da68cc Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 16 Apr 2014 13:59:31 +0100 Subject: [PATCH 1/2] jQueryUI: started adding option overloads --- jqueryui/jqueryui-tests.ts | 12 ++++++++++ jqueryui/jqueryui.d.ts | 49 ++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 213156fef..ae8038b05 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1153,6 +1153,18 @@ function test_datepicker() { var $setDate2: JQuery = $(".selector").datepicker("setDate", new Date()); var $shown: JQuery = $(".selector").datepicker("show"); var $widget: JQuery = $(".selector").datepicker("widget"); + + // Options + function altField() { + $(".selector").datepicker({ altField: "#actualDate" }); + + // getter + var altField = $(".selector").datepicker("option", "altField"); + + // setter + $(".selector").datepicker("option", "altField", "#actualDate"); + } + } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index e87f09695..a44c24bc4 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -905,13 +905,6 @@ interface JQuery { * @param methodName 'isDisabled' */ datepicker(methodName: 'isDisabled'): boolean; - /** - * Gets the value currently associated with the specified optionName. - * - * @param methodName 'option' - * @param optionName The name of the option to get. - */ - datepicker(methodName: 'option', optionName: string): any; /** * Redraw the date picker, after having made some external modifications. * @@ -945,6 +938,48 @@ interface JQuery { */ datepicker(methodName: 'widget'): JQuery; + /** + * Get the altField option, after initialization + * + * @param methodName 'option' + * @param optionName 'altField' + */ + datepicker(methodName: 'option', optionName: 'altField'): any; + /** + * Set the altField option, after initialization + * + * @param methodName 'option' + * @param optionName 'altField' + * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. + */ + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: string): any; + /** + * Set the altField option, after initialization + * + * @param methodName 'option' + * @param optionName 'altField' + * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. + */ + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: JQuery): any; + /** + * Set the altField option, after initialization + * + * @param methodName 'option' + * @param optionName 'altField' + * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. + */ + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: Element): any; + + /** + * Gets the value currently associated with the specified optionName. + * + * @param methodName 'option' + * @param optionName The name of the option to get. + */ + datepicker(methodName: 'option', optionName: string): any; + + datepicker(methodName: 'option', optionName: string, ...otherParams: any[]): any; // Used for getting and setting options + datepicker(methodName: string, ...otherParams: any[]): any; /** From 042c9c7346c28b29112392e200adb9c63a49a5b8 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 16 Apr 2014 16:20:59 +0100 Subject: [PATCH 2/2] jQuery UI: started on option getters / setters --- jqueryui/jqueryui-tests.ts | 15 +++++++++++++-- jqueryui/jqueryui.d.ts | 22 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index ae8038b05..cc0fb4f72 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1159,10 +1159,21 @@ function test_datepicker() { $(".selector").datepicker({ altField: "#actualDate" }); // getter - var altField = $(".selector").datepicker("option", "altField"); + var altField: any = $(".selector").datepicker("option", "altField"); // setter - $(".selector").datepicker("option", "altField", "#actualDate"); + var $set: JQuery = $(".selector").datepicker("option", "altField", "#actualDate"); + } + + // Options + function altFormat() { + $(".selector").datepicker({ altFormat: "yy-mm-dd" }); + + // getter + var altFormat: string = $(".selector").datepicker("option", "altFormat"); + + // setter + var $set: JQuery = $(".selector").datepicker("option", "altFormat", "yy-mm-dd"); } } diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index a44c24bc4..4bd2e433f 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -952,7 +952,7 @@ interface JQuery { * @param optionName 'altField' * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. */ - datepicker(methodName: 'option', optionName: 'altField', altFieldValue: string): any; + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: string): JQuery; /** * Set the altField option, after initialization * @@ -960,7 +960,7 @@ interface JQuery { * @param optionName 'altField' * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. */ - datepicker(methodName: 'option', optionName: 'altField', altFieldValue: JQuery): any; + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: JQuery): JQuery; /** * Set the altField option, after initialization * @@ -968,7 +968,23 @@ interface JQuery { * @param optionName 'altField' * @param altFieldValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. */ - datepicker(methodName: 'option', optionName: 'altField', altFieldValue: Element): any; + datepicker(methodName: 'option', optionName: 'altField', altFieldValue: Element): JQuery; + + /** + * Get the altFormat option, after initialization + * + * @param methodName 'option' + * @param optionName 'altFormat' + */ + datepicker(methodName: 'option', optionName: 'altFormat'): string; + /** + * Set the altFormat option, after initialization + * + * @param methodName 'option' + * @param optionName 'altFormat' + * @param altFormatValue An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field. Leave as blank for no alternate field. + */ + datepicker(methodName: 'option', optionName: 'altFormat', altFormatValue: string): JQuery; /** * Gets the value currently associated with the specified optionName.