Skip to content

Commit

Permalink
Updates to jQuery UI definitions and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
borisyankov committed Oct 17, 2012
1 parent 9b3185a commit f9be59c
Show file tree
Hide file tree
Showing 2 changed files with 550 additions and 514 deletions.
217 changes: 161 additions & 56 deletions Definitions/jqueryui-1.9.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/// <reference path="jquery-1.8.d.ts"/>

// Type definitions for jQueryUI 1.9
// Project: http://jqueryui.com/
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="jquery-1.8.d.ts"/>

// Widget //////////////////////////////////////////////////

Expand Down Expand Up @@ -40,16 +39,7 @@ interface Accordion extends Widget {
icons?: any;

// Methods
destroy();
disable();
enable();
option(optionName: string): any;
option(): any;
option(optionName: string, value: any): void;
option(options: any): void;
refresh();
widget(): JQuery;


// Events
activate(event: Event, ui): void;
beforeActivate(event: Event, ui): void;
Expand All @@ -59,7 +49,7 @@ interface Accordion extends Widget {

// Autocomplete //////////////////////////////////////////////////

interface Autocomplete {
interface Autocomplete extends Widget {

// Options
appendTo?: any; //Selector;
Expand All @@ -71,16 +61,8 @@ interface Autocomplete {
source?: any; // [], string or ()

// Methods
close();
destroy();
disable();
enable();
option(optionName: string): any;
option(): any;
option(optionName: string, value: any): void;
option(options: any): void;
close();
search(value?: string);
widget(): JQuery;

// Events
change(event: Event, ui): void;
Expand All @@ -96,24 +78,16 @@ interface Autocomplete {

// Button //////////////////////////////////////////////////

interface Button {
interface Button extends Widget {

// Options
disabled?: bool;
icons?: any;
label?: string;
text?: bool;

// Methods
destroy();
disable();
enable();
option(optionName: string): any;
option(): any;
option(optionName: string, value: any): void;
option(options: any): void;
// Methods
refresh();
widget(): JQuery;

// Events
create(event: Event, ui): void;
Expand All @@ -122,7 +96,7 @@ interface Button {

// Datepicker //////////////////////////////////////////////////

interface Datepicker {
interface Datepicker extends Widget {

// Options
altFieldType?: any; // Selecotr, jQuery or Element
Expand Down Expand Up @@ -178,7 +152,7 @@ interface Datepicker {

// Methods
destroy();
dialog(date: any, onSelect?: (), settings?: any, pos?: any);
dialog(date: any, onSelect?: () => void, settings?: any, pos?: any);
getDate(): Date;
hide(): void;
isDisabled(): bool;
Expand All @@ -192,7 +166,7 @@ interface Datepicker {

// Dialog //////////////////////////////////////////////////

interface Dialog {
interface Dialog extends Widget {

// Options
autoOpen?: bool;
Expand Down Expand Up @@ -356,7 +330,7 @@ interface JQueryDatePicker {

// Menu //////////////////////////////////////////////////

interface Menu {
interface Menu extends Widget {

// Options
disabled?: bool;
Expand All @@ -369,24 +343,15 @@ interface Menu {
blur(event?: Event): void;
collapse(event?: Event): void;
blurAll(event?: Event, all?: bool): void;
destroy();
disable();
enable();
expand(event?: Event): void;
focus(event?: Event, item?: JQuery): void;
isFirstItem(): bool;
isLastItem(): bool;
next(event?: Event): void;
nextPage(event?: Event): void;
option(optionName: string): any;
option(): any;
option(optionName: string, value: any): void;
option(options: any): void;
previous(event?: Event): void;
previousPage(event?: Event): void;
refresh(): void;
select(event?: Event): void;
widget(): JQuery;

// Events
blur(event: Event, ui): void;
Expand All @@ -398,11 +363,11 @@ interface Menu {

// Progressbar //////////////////////////////////////////////////

interface Progressbar {
interface Progressbar extends Widget {

// Options
disabled?: bool;
value?: number;
//value?: number;

// Methods
destroy();
Expand All @@ -423,6 +388,64 @@ interface Progressbar {
}


// Resizable //////////////////////////////////////////////////

interface Resizable extends Widget {

// Options
alsoResize?: any; // Selector, JQuery or Element
animate?: bool;
animateDuration?: any; // number or string
animateEasing?: string;
aspectRatio?: any; // bool or number
autoHide?: bool;
cancel?: any; // TODO Selector
containment?: any; // Selector, Element or string
delay?: number;
disabled?: bool;
distance?: number;
ghost?: bool;
grid?: number[];
handles?: any; // string or object
helper?: string;
maxHeight?: number;
maxWidth?: number;
minHeight?: number;
minWidth?: number;

// Methods

// Events
resize(event: Event, ui): void;
start(event: Event, ui): void;
stop(event: Event, ui): void;
}


// Resizable //////////////////////////////////////////////////

interface Selectable extends Widget {

// Options
autoRefresh?: bool;
cancel?: any; // TODO Selector
delay?: number;
disabled?: bool;
distance?: number;
filter?: any; // TODO Selector
tolerance?: string;

// Methods

// Events
selected(event: Event, ui): void;
selecting(event: Event, ui): void;
start(event: Event, ui): void;
stop(event: Event, ui): void;
unselected(event: Event, ui): void;
unselecting(event: Event, ui): void;
}

// Slider //////////////////////////////////////////////////

interface Slider extends Widget {
Expand All @@ -435,16 +458,16 @@ interface Slider extends Widget {
orientation?: string;
range?: any; // bool or string
step?: number;
value?: number;
values?: number[];
// value?: number;
// values?: number[];

// Methods
value(): number;
value(newValue: number): void;
values(): number[];
values(index: number): number;
values(index: number, newValue: number): void;
values(newValues: numbers[]): void;
values(newValues: number[]): void;

// Events
change(event: Event, ui): void;
Expand All @@ -455,9 +478,62 @@ interface Slider extends Widget {
}


// Sortable //////////////////////////////////////////////////

interface Sortable extends Widget {

// Options
appendTo?: any; // jQuery, Element, Selector or string
axis?: string;
// cancel?: any; // TODO Selector
connectWith?: any; // TODO Selector
containment?: any; // Element, Selector or string
cursor?: string;
cursorAt?: any;
delay?: number;
disabled?: bool;
distance?: number;
dropOnEmpty?: bool;
forceHelperSize?: bool;
forcePlaceholderSize?: bool;
grid?: number[];
handle?: any; // Selector or Element
items?: any; // Selector
opacity?: number;
placeholder?: string;
revert?: any; // bool or number
scroll?: bool;
scrollSensitivity?: number;
scrollSpeed?: number;
tolerance?: string;
zIndex?: number;

// Methods
cancel(): void;
refreshPositions(): void;
serialize(options: any): void; // TODO
toArray(): string[];

// Events
activate(event: Event, ui): void;
beforeStop(event: Event, ui): void;
change(event: Event, ui): void;
deactivate(event: Event, ui): void;
out(event: Event, ui): void;
over(event: Event, ui): void;
receive(event: Event, ui): void;
remove(event: Event, ui): void;
sort(event: Event, ui): void;
start(event: Event, ui): void;
stop(event: Event, ui): void;
update(event: Event, ui): void;
}



// Spinner //////////////////////////////////////////////////

interface Spinner {
interface Spinner extends Widget {

// Options
culture?: string;
Expand Down Expand Up @@ -487,7 +563,7 @@ interface Spinner {

// Tabs //////////////////////////////////////////////////

interface Tabs {
interface Tabs extends Widget {

// Options
active?: any; // bool or number
Expand All @@ -513,7 +589,7 @@ interface Tabs {

// Tooltip //////////////////////////////////////////////////

interface Tooltip {
interface Tooltip extends Widget {

// Options
content?: any; // () or string
Expand All @@ -538,19 +614,48 @@ interface Tooltip {
////////////////////////////////////////////////////////////////////////////////////////////////////

interface JQuery {
draggable(options: Draggable): JQuery;

accordion(options?: Accordion): void;

autocomplete(options?: Autocomplete): void;

button(options?: Button): void;
buttonset(options?: Button): void;

datepicker(options?: Datepicker): void;

dialog(options?: Dialog): void;
dialog(optionLiteral: string): void;

draggable(options?: Draggable): JQuery;
draggable(optionLiteral: string, options: Draggable): JQuery;
draggable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
draggable(optionLiteral: string, optionName: string): any;
// draggable(methodName: string): any;

droppable(options: Droppable): JQuery;
droppable(optionLiteral: string, options: Draggable): JQuery;
droppable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
droppable(optionLiteral: string, optionName: string): any;
droppable(methodName: string): any;

autocomplete(any): void;
datepicker(any): void;
menu(options?: Menu): void;

progressbar(options?: Progressbar): void;

resizable(options?: Resizable): void;

selectable(options?: Selectable): void;

slider(options?: Slider): void;

sortable(options?: Sortable): void;

spinner(options?: Spinner): void;

tabs(options?: Tabs): void;

tooltip(options?: Tooltip): void;
}

interface JQueryStatic {
Expand Down

0 comments on commit f9be59c

Please sign in to comment.