diff --git a/Definitions/backbone-0.9.d.ts b/Definitions/backbone-0.9.d.ts
index 2838f4605..efe5a3734 100644
--- a/Definitions/backbone-0.9.d.ts
+++ b/Definitions/backbone-0.9.d.ts
@@ -1,5 +1,7 @@
// Type definitions for Backbone 0.9
-// https://github.com/borisyankov/DefinitelyTyped
+// Project: http://backbonejs.org/
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
declare module Backbone {
diff --git a/Definitions/jqueryui-1.9.d.ts b/Definitions/jqueryui-1.9.d.ts
index d8dd1d9e4..2153bca04 100644
--- a/Definitions/jqueryui-1.9.d.ts
+++ b/Definitions/jqueryui-1.9.d.ts
@@ -26,9 +26,7 @@ interface Widget {
// Accordion //////////////////////////////////////////////////
-interface Accordion extends Widget {
-
- // Options
+interface AccordionOptions {
active?: any; // bool or number
animate?: any; // bool, number, string or object
collapsible?: bool;
@@ -37,9 +35,11 @@ interface Accordion extends Widget {
header?: any; // TODO: Selector
heightStyle?: string;
icons?: any;
+}
+interface Accordion extends Widget {
// Methods
-
+
// Events
activate(event: Event, ui): void;
beforeActivate(event: Event, ui): void;
@@ -49,9 +49,7 @@ interface Accordion extends Widget {
// Autocomplete //////////////////////////////////////////////////
-interface Autocomplete extends Widget {
-
- // Options
+interface AutocompleteOptions {
appendTo?: any; //Selector;
autoFocus?: bool;
delay?: number;
@@ -59,9 +57,12 @@ interface Autocomplete extends Widget {
minLength?: number;
position?: any; // TODO: JqueryPosition
source?: any; // [], string or ()
+}
+
+interface Autocomplete extends Widget {
// Methods
- close();
+ close();
search(value?: string);
// Events
@@ -78,13 +79,14 @@ interface Autocomplete extends Widget {
// Button //////////////////////////////////////////////////
-interface Button extends Widget {
-
- // Options
+interface ButtonOptions {
disabled?: bool;
icons?: any;
label?: string;
text?: bool;
+}
+
+interface Button extends Widget {
// Methods
refresh();
@@ -96,9 +98,7 @@ interface Button extends Widget {
// Datepicker //////////////////////////////////////////////////
-interface Datepicker extends Widget {
-
- // Options
+interface DatepickerOptions {
altFieldType?: any; // Selecotr, jQuery or Element
altFormat?: string;
appendText?: string;
@@ -149,10 +149,13 @@ interface Datepicker extends Widget {
weekHeader?: string;
yearRange?: string;
yearSuffix?: string;
+}
+
+interface Datepicker extends Widget {
// Methods
destroy();
- dialog(date: any, onSelect?: () => void, settings?: any, pos?: any);
+ dialog(date: any, onSelect?: () => void , settings?: any, pos?: any);
getDate(): Date;
hide(): void;
isDisabled(): bool;
@@ -166,9 +169,7 @@ interface Datepicker extends Widget {
// Dialog //////////////////////////////////////////////////
-interface Dialog extends Widget {
-
- // Options
+interface DialogOptions {
autoOpen?: bool;
buttons?: any; // object or []
closeOnEscape?: bool;
@@ -189,6 +190,9 @@ interface Dialog extends Widget {
title?: string;
width?: number;
zIndex?: number;
+}
+
+interface Dialog extends Widget {
// Methods
close(): void;
@@ -231,9 +235,7 @@ interface DraggableEvent {
(event: Event, ui: DraggableEventUIParam): void;
}
-interface Draggable {
-
- // Options
+interface DraggableOptions {
disabled?: bool;
addClasses?: bool;
appendTo?: any;
@@ -262,6 +264,9 @@ interface Draggable {
snapTolerance?: number;
stack?: string;
zIndex?: number;
+}
+
+interface Draggable extends Widget {
// Events
create?: DraggableEvent;
@@ -284,9 +289,7 @@ interface DroppableEvent {
(event: Event, ui: DroppableEventUIParam): void;
}
-interface Droppable {
-
- // Options
+interface DroppableOptions {
disabled?: bool;
accept?: any;
activeClass?: string;
@@ -294,6 +297,9 @@ interface Droppable {
hoverClass?: string;
scope?: string;
tolerance?: string;
+}
+
+interface Droppable extends Widget {
// Events
create?: DroppableEvent;
@@ -330,14 +336,15 @@ interface JQueryDatePicker {
// Menu //////////////////////////////////////////////////
-interface Menu extends Widget {
-
- // Options
+interface MenuOptions {
disabled?: bool;
icons?: any;
menus?: string;
position?: any; // TODO
role?: string;
+}
+
+interface Menu extends Widget {
// Methods
blur(event?: Event): void;
@@ -357,22 +364,23 @@ interface Menu extends Widget {
blur(event: Event, ui): void;
create(event: Event, ui): void;
focus(event: Event, ui): void;
- select(event: Event, ui): void;
+ select(event: Event, ui): void;
}
// Progressbar //////////////////////////////////////////////////
-interface Progressbar extends Widget {
-
- // Options
+interface ProgressbarOptions {
disabled?: bool;
//value?: number;
+}
+
+interface Progressbar extends Widget {
// Methods
destroy();
disable();
- enable();
+ enable();
option(optionName: string): any;
option(): any;
option(optionName: string, value: any): void;
@@ -390,9 +398,7 @@ interface Progressbar extends Widget {
// Resizable //////////////////////////////////////////////////
-interface Resizable extends Widget {
-
- // Options
+interface ResizableOptions {
alsoResize?: any; // Selector, JQuery or Element
animate?: bool;
animateDuration?: any; // number or string
@@ -412,9 +418,12 @@ interface Resizable extends Widget {
maxWidth?: number;
minHeight?: number;
minWidth?: number;
+}
+
+interface Resizable extends Widget {
// Methods
-
+
// Events
resize(event: Event, ui): void;
start(event: Event, ui): void;
@@ -424,9 +433,7 @@ interface Resizable extends Widget {
// Resizable //////////////////////////////////////////////////
-interface Selectable extends Widget {
-
- // Options
+interface SelectableOptions {
autoRefresh?: bool;
cancel?: any; // TODO Selector
delay?: number;
@@ -434,9 +441,12 @@ interface Selectable extends Widget {
distance?: number;
filter?: any; // TODO Selector
tolerance?: string;
+}
+
+interface Selectable extends Widget {
// Methods
-
+
// Events
selected(event: Event, ui): void;
selecting(event: Event, ui): void;
@@ -448,11 +458,9 @@ interface Selectable extends Widget {
// Slider //////////////////////////////////////////////////
-interface Slider extends Widget {
-
- // Options
+interface SliderOptions {
animate?: any; // bool, string or number
- disabled?: bool;
+ disabled?: bool;
max?: number;
min?: number;
orientation?: string;
@@ -460,6 +468,9 @@ interface Slider extends Widget {
step?: number;
// value?: number;
// values?: number[];
+}
+
+interface Slider extends Widget {
// Methods
value(): number;
@@ -471,8 +482,8 @@ interface Slider extends Widget {
// Events
change(event: Event, ui): void;
- create(event: Event, ui): void;
- slide(event: Event, ui): void;
+ create(event: Event, ui): void;
+ slide(event: Event, ui): void;
start(event: Event, ui): void;
stop(event: Event, ui): void;
}
@@ -480,9 +491,7 @@ interface Slider extends Widget {
// Sortable //////////////////////////////////////////////////
-interface Sortable extends Widget {
-
- // Options
+interface SortableOptions {
appendTo?: any; // jQuery, Element, Selector or string
axis?: string;
// cancel?: any; // TODO Selector
@@ -507,6 +516,9 @@ interface Sortable extends Widget {
scrollSpeed?: number;
tolerance?: string;
zIndex?: number;
+}
+
+interface Sortable extends Widget {
// Methods
cancel(): void;
@@ -530,12 +542,9 @@ interface Sortable extends Widget {
}
-
// Spinner //////////////////////////////////////////////////
-interface Spinner extends Widget {
-
- // Options
+interface SpinnerOptions {
culture?: string;
disabled?: bool;
icons?: any;
@@ -545,6 +554,9 @@ interface Spinner extends Widget {
numberFormat?: string;
page?: number;
step?: any; // number or string
+}
+
+interface Spinner extends Widget {
// Methods
pageDown(pages?: number): void;
@@ -563,9 +575,7 @@ interface Spinner extends Widget {
// Tabs //////////////////////////////////////////////////
-interface Tabs extends Widget {
-
- // Options
+interface TabsOptions {
active?: any; // bool or number
collapsible?: bool;
disabled?: any; // bool or []
@@ -573,6 +583,9 @@ interface Tabs extends Widget {
heightStyle?: string;
hide?: any; // bool, number, string or object
show?: any; // bool, number, string or object
+}
+
+interface Tabs extends Widget {
// Methods
disable(index: any): void;
@@ -589,9 +602,7 @@ interface Tabs extends Widget {
// Tooltip //////////////////////////////////////////////////
-interface Tooltip extends Widget {
-
- // Options
+interface TooltipOptions {
content?: any; // () or string
disabled?: bool;
hide?: any; // bool, number, string or object
@@ -600,6 +611,9 @@ interface Tooltip extends Widget {
show?: any; // bool, number, string or object
tooltipClass?: string;
track?: bool;
+}
+
+interface Tooltip extends Widget {
// Methods
close(event?: Event): void;
@@ -615,49 +629,126 @@ interface Tooltip extends Widget {
interface JQuery {
- accordion(options?: Accordion): void;
+ accordion(): JQuery;
+ accordion(methodName: string): JQuery;
+ accordion(options: DialogOptions): JQuery;
+ accordion(optionLiteral: string, options: DialogOptions): JQuery;
+ accordion(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ accordion(optionLiteral: string, optionName: string): JQuery;
- autocomplete(options?: Autocomplete): void;
+ autocomplete(): JQuery;
+ autocomplete(methodName: string): JQuery;
+ autocomplete(options: AutocompleteOptions): JQuery;
+ autocomplete(optionLiteral: string, options: AutocompleteOptions): JQuery;
+ autocomplete(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ autocomplete(optionLiteral: string, optionName: string): JQuery;
- button(options?: Button): void;
- buttonset(options?: Button): void;
+ button(): JQuery;
+ button(methodName: string): JQuery;
+ button(options: ButtonOptions): JQuery;
+ button(optionLiteral: string, options: ButtonOptions): JQuery;
+ button(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ button(optionLiteral: string, optionName: string): JQuery;
- datepicker(options?: Datepicker): void;
+ buttonset(): JQuery;
+ buttonset(methodName: string): JQuery;
+ buttonset(options: ButtonOptions): JQuery;
+ buttonset(optionLiteral: string, options: ButtonOptions): JQuery;
+ buttonset(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ buttonset(optionLiteral: string, optionName: string): JQuery;
- dialog(options?: Dialog): void;
- dialog(optionLiteral: string): void;
+ datepicker(): JQuery;
+ datepicker(methodName: string): JQuery;
+ datepicker(options: DatepickerOptions): JQuery;
+ datepicker(optionLiteral: string, options: DatepickerOptions): JQuery;
+ datepicker(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ datepicker(optionLiteral: string, optionName: string): JQuery;
- draggable(options?: Draggable): JQuery;
- draggable(optionLiteral: string, options: Draggable): JQuery;
+ dialog(): JQuery;
+ dialog(methodName: string): JQuery;
+ dialog(options: DialogOptions): JQuery;
+ dialog(optionLiteral: string, options: DialogOptions): JQuery;
+ dialog(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ dialog(optionLiteral: string, optionName: string): JQuery;
+
+ draggable(): JQuery;
+ draggable(methodName: string): JQuery;
+ draggable(options: DraggableOptions): JQuery;
+ draggable(optionLiteral: string, options: DraggableOptions): JQuery;
draggable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
- draggable(optionLiteral: string, optionName: string): any;
- // draggable(methodName: string): any;
+ draggable(optionLiteral: string, optionName: string): JQuery;
- droppable(options: Droppable): JQuery;
- droppable(optionLiteral: string, options: Draggable): JQuery;
+ droppable(): JQuery;
+ droppable(methodName: string): JQuery;
+ droppable(options: DroppableOptions): JQuery;
+ droppable(optionLiteral: string, options: DraggableOptions): JQuery;
droppable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
- droppable(optionLiteral: string, optionName: string): any;
- droppable(methodName: string): any;
+ droppable(optionLiteral: string, optionName: string): JQuery;
- menu(options?: Menu): void;
+ menu(): JQuery;
+ menu(methodName: string): JQuery;
+ menu(options: MenuOptions): JQuery;
+ menu(optionLiteral: string, options: MenuOptions): JQuery;
+ menu(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ menu(optionLiteral: string, optionName: string): JQuery;
- progressbar(options?: Progressbar): void;
+ progressbar(): JQuery;
+ progressbar(methodName: string): JQuery;
+ progressbar(options: Progressbar): JQuery;
+ progressbar(optionLiteral: string, options: Progressbar): JQuery;
+ progressbar(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ progressbar(optionLiteral: string, optionName: string): JQuery;
- resizable(options?: Resizable): void;
+ resizable(): JQuery;
+ resizable(methodName: string): JQuery;
+ resizable(options: ResizableOptions): JQuery;
+ resizable(optionLiteral: string, options: ResizableOptions): JQuery;
+ resizable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ resizable(optionLiteral: string, optionName: string): JQuery;
- selectable(options?: Selectable): void;
+ selectable(): JQuery;
+ selectable(methodName: string): JQuery;
+ selectable(options: SelectableOptions): JQuery;
+ selectable(optionLiteral: string, options: SelectableOptions): JQuery;
+ selectable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ selectable(optionLiteral: string, optionName: string): JQuery;
- slider(options?: Slider): void;
+ slider(): JQuery;
+ slider(methodName: string): JQuery;
+ slider(options: SliderOptions): JQuery;
+ slider(optionLiteral: string, options: SliderOptions): JQuery;
+ slider(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ slider(optionLiteral: string, optionName: string): JQuery;
- sortable(options?: Sortable): void;
+ sortable(): JQuery;
+ sortable(methodName: string): JQuery;
+ sortable(options: SortableOptions): JQuery;
+ sortable(optionLiteral: string, options: SortableOptions): JQuery;
+ sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ sortable(optionLiteral: string, optionName: string): JQuery;
- spinner(options?: Spinner): void;
+ spinner(): JQuery;
+ spinner(methodName: string): JQuery;
+ spinner(options: SpinnerOptions): JQuery;
+ spinner(optionLiteral: string, options: SpinnerOptions): JQuery;
+ spinner(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ spinner(optionLiteral: string, optionName: string): JQuery;
- tabs(options?: Tabs): void;
+ tabs(): JQuery;
+ tabs(methodName: string): JQuery;
+ tabs(options: TabsOptions): JQuery;
+ tabs(optionLiteral: string, options: TabsOptions): JQuery;
+ tabs(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ tabs(optionLiteral: string, optionName: string): JQuery;
- tooltip(options?: Tooltip): void;
+ tooltip(): JQuery;
+ tooltip(methodName: string): JQuery;
+ tooltip(options: TooltipOptions): JQuery;
+ tooltip(optionLiteral: string, options: TooltipOptions): JQuery;
+ tooltip(optionLiteral: string, optionName: string, optionValue: any): JQuery;
+ tooltip(optionLiteral: string, optionName: string): JQuery;
}
interface JQueryStatic {
datepicker: JQueryDatePicker;
-}
+}
\ No newline at end of file
diff --git a/Definitions/knockout-2.2.d.ts b/Definitions/knockout-2.2.d.ts
index 598669a24..14a5395d2 100644
--- a/Definitions/knockout-2.2.d.ts
+++ b/Definitions/knockout-2.2.d.ts
@@ -41,18 +41,42 @@ interface KnockoutObservableArray extends KnockoutObservableArrayFunctions {
(value: any[]): KnockoutObservableArray;
}
-interface KnockoutObservable {
+interface KnockoutObservableBase {
fn;
- (): any;
- (value): void;
-
extend(source);
subscribe(func: Function): KnockoutSubscription;
}
-interface KnockoutComputed extends KnockoutObservable {
+interface KnockoutObservableAny extends KnockoutObservableBase {
+
+ (): any;
+ (value): void;
+}
+
+interface KnockoutObservableString extends KnockoutObservableBase {
+ (): string;
+ (value: string): void;
+}
+
+
+interface KnockoutObservableNumber extends KnockoutObservableBase {
+ (): number;
+ (value: number): void;
+}
+
+interface KnockoutObservableBool extends KnockoutObservableBase {
+ (): bool;
+ (value: bool): void;
+}
+
+interface KnockoutObservableDate extends KnockoutObservableBase {
+ (): Date;
+ (value: Date): void;
+}
+
+interface KnockoutComputed extends KnockoutObservableBase {
(): KnockoutComputed;
(func: Function, context?: any): KnockoutComputed;
(def: KnockoutComputedDefine): KnockoutComputed;
@@ -80,11 +104,11 @@ interface KnockoutBindingContext {
interface KnockoutBindingHandler {
// TODO: Work out how to define bindingHandlers when not using all the args
// adding element?: any, etc doesnt work...
- //init(element: any, valueAccessor: any, allBindingsAccessor: any, viewModel: any, bindingContext: KnockoutBindingContext) : void;
- //update(element: any, valueAccessor: any, allBindingsAccessor: any, viewModel: any, bindingContext: KnockoutBindingContext) : void;
- init: any;
- update: any;
- options: any;
+ init(element: any, valueAccessor: () => any, allBindingsAccessor: () => any, viewModel: any, bindingContext: KnockoutBindingContext): void;
+ update(element: any, valueAccessor: () => any, allBindingsAccessor: () => any, viewModel: any, bindingContext: KnockoutBindingContext): void;
+ //init: any;
+ //update: any;
+ options?: any;
}
interface KnockoutBindingHandlers {
@@ -172,7 +196,13 @@ interface KnockoutStatic {
applyBindings(viewModel: any, rootNode?: any): void;
applyBindingsToDescendants(viewModel: any, rootNode: any): void;
- observable(intial? ): KnockoutObservable;
+
+ observable(value: string): KnockoutObservableString;
+ observable(value: Date): KnockoutObservableDate;
+ observable(value: number): KnockoutObservableNumber;
+ observable(value: bool): KnockoutObservableBool;
+ observable(value?: any): KnockoutObservableAny;
+
contextFor(node: any): any;
isSubscribable(instance: any): bool;
subscribable(): void;
diff --git a/Definitions/teechart-1.3.d.ts b/Definitions/teechart-1.3.d.ts
new file mode 100644
index 000000000..af93aa762
--- /dev/null
+++ b/Definitions/teechart-1.3.d.ts
@@ -0,0 +1,681 @@
+/**
+ * TeeChart(tm) for TypeScript
+ *
+ * v1.3 October 2012
+ * Copyright(c) 2012 by Steema Software SL. All Rights Reserved.
+ * http://www.steema.com
+ *
+ * Licensed with commercial and non-commercial attributes,
+ * specifically: http://www.steema.com/licensing/html5
+ *
+ * TypeScript is a Microsoft product: www.typescriptlang.org
+ *
+ */
+
+/**
+ * @author Steema Software
+ * @version 1.3
+ */
+
+
+///
+
+module Tee {
+
+ interface IPoint {
+ x: number;
+ y: number;
+ }
+
+ interface IRectangle {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+
+ contains(point: IPoint): bool;
+ }
+
+ interface ITool {
+ active: bool;
+ chart: IChart;
+
+ mousedown(event): bool;
+ mousemove(event): bool;
+ clicked(p:IPoint): bool;
+ draw(): void;
+ }
+
+ interface IGradient {
+ chart: IChart;
+ visible: bool;
+
+ colors: string[];
+ direction: string;
+ stops: number[];
+ offset: IPoint;
+ }
+
+ interface IShadow {
+ chart: IChart;
+ visible: bool;
+ blur:number;
+ color: string;
+ width:number;
+ height:number;
+ }
+
+ interface IStroke {
+ chart: IChart;
+ fill: string;
+ size: number;
+ join: string;
+ cap: string;
+ dash: number[];
+ gradient: IGradient;
+ }
+
+ interface IFont {
+ chart: IChart;
+ style: string;
+ gradient: IGradient;
+ fill: string;
+ stroke: IStroke;
+ shadow: IShadow;
+ textAlign: string;
+ baseLine: string;
+
+ getSize():number;
+ setSize(size:number):void;
+ }
+
+ interface IImage {
+ url: string;
+ chart: IChart;
+ visible: bool;
+ }
+
+ interface IFormat {
+ font: IFont;
+ gradient: IGradient;
+ shadow: IShadow;
+ stroke: IStroke;
+ round: IPoint;
+ transparency: number;
+ image: IImage;
+ fill: string;
+
+ textHeight(text:string): number;
+ textWidth(text:string): number;
+ drawText(bounds:IRectangle, text:string);
+ rectangle(x:number, y:number, width:number, height:number);
+ poligon(points:IPoint[]);
+ ellipse(x:number, y:number, width:number, height:number);
+ }
+
+ interface IMargins {
+ left: number;
+ top: number;
+ right: number;
+ bottom: number;
+ }
+
+ interface IAnnotation extends ITool {
+ position: IPoint;
+ margins: IMargins;
+ items: IAnnotation[];
+ bounds: IRectangle;
+ visible: bool;
+ transparent: bool;
+ text: string;
+ format: IFormat;
+
+ add(text: string): IAnnotation;
+ resize(): void;
+ clicked(point: IPoint): bool;
+ draw(): void;
+ }
+
+ interface IPanel {
+ format: IFormat;
+ transparent: bool;
+ margins: IMargins;
+ }
+
+ interface ITitle extends IAnnotation {
+ expand: bool;
+ padding: number;
+ transparent: bool;
+ }
+
+ interface IPalette {
+ colors: string[];
+
+ get(index: number): string;
+ }
+
+ interface IArrow extends IFormat {
+ length: number;
+ underline: bool;
+ }
+
+ interface IMarks extends IAnnotation {
+ arrow: IArrow;
+ series: ISeries;
+
+ style: string;
+
+ drawEvery: number;
+ visible: bool;
+ }
+
+ interface ISeriesData {
+ values: number[];
+ labels: string[];
+ source: any;
+ }
+
+ interface ICursor {
+ cursor: string;
+ }
+
+ interface ISeries {
+ data: ISeriesData;
+ marks: IMarks;
+
+ yMandatory: bool;
+ horizAxis: string;
+ vertAxis: string;
+
+ format: IFormat;
+ hover: IFormat;
+
+ visible: bool;
+
+ cursor: ICursor;
+ over: number;
+
+ palette: IPalette;
+ colorEach: string;
+
+ useAxes: bool;
+ decimals: number;
+
+ title: string;
+
+ //refresh(failure: function): void;
+
+ toPercent(index: number): string;
+ markText(index: number): string;
+
+ valueText(index: number): string;
+
+ associatedToAxis(axis: IAxis): bool;
+
+ bounds(rectangle: IRectangle): void;
+
+ calc(index: number, position: IPoint): void;
+
+ clicked(position: IPoint): number;
+
+ minXValue(): number;
+ maxXValue(): number;
+
+ minYValue(): number;
+ maxYValue(): number;
+
+ count(): number;
+
+ addRandom(count: number, range?: number, x?: bool): ISeries;
+
+
+ }
+
+ interface IAxisLabels {
+ chart: IChart;
+ format: IFormat;
+ decimals: number;
+ padding: number;
+ separation: number; // %
+ visible: bool;
+ rotation: number;
+ alternate: bool;
+ maxWidth: number;
+
+ labelStyle: string;
+ dateFormat: string;
+
+ getLabel(value: number): string;
+ width(value: number): number;
+
+ }
+
+ interface IGrid {
+ chart: IChart;
+ format: IFormat;
+ visible: bool;
+ lineDash: bool;
+ }
+
+ interface ITicks {
+ chart: IChart;
+ stroke: IStroke;
+ visible: bool;
+ length: number;
+ }
+
+ interface IMinorTicks extends ITicks {
+ count: number;
+ }
+
+ interface IAxisTitle extends IAnnotation {
+ padding: number;
+ transparent: bool;
+ }
+
+ interface IAxis {
+ chart: IChart;
+ visible: bool;
+ inverted: bool;
+
+ horizontal: bool; // readonly
+ otherSize: bool; // readonly
+ bounds: IRectangle; // readonly?
+
+ position: number;
+ format: IFormat;
+ custom: bool; // readonly
+
+ grid: IGrid;
+ labels: IAxisLabels;
+ ticks: ITicks;
+ minorTicks: IMinorTicks;
+ innerTicks: ITicks;
+
+ title: IAxisTitle;
+
+ automatic: bool;
+ minimum: number;
+ maximum: number;
+ increment: number;
+ log: bool;
+
+ startPos: number;
+ endPos: number;
+
+ start: number; // %
+ end: number; // %
+
+ axisSize: number;
+
+ scale: number;
+ increm: number;
+
+ calc(value: number): number;
+ fromPos(position: number): number;
+ fromSize(size: number): number;
+
+ hasAnySeries(): bool;
+ scroll(delta: number): void;
+ setMinMax(minimum: number, maximum: number): void;
+ }
+
+ interface IAxes {
+ chart: IChart;
+ visible: bool;
+
+ left: IAxis;
+ top: IAxis;
+ right: IAxis;
+ bottom: IAxis;
+
+ items: IAxis[];
+
+ add(horizontal: bool, otherSide: bool): IAxis;
+ //each(f: function): void;
+ }
+
+ interface ISymbol {
+ chart: IChart;
+ format: IFormat;
+ width: number;
+ height: number;
+ padding: number;
+ visible: bool;
+ }
+
+ interface ILegend {
+ chart: IChart;
+
+ transparent: bool;
+
+ format: IFormat;
+ title: IAnnotation;
+
+ bounds: IRectangle;
+ position: string;
+ visible: bool;
+ inverted: bool;
+ padding: number;
+ align: number;
+
+ fontColor: bool;
+
+ dividing: IStroke;
+ over: number;
+ symbol: ISymbol;
+
+ itemHeight: number;
+ innerOff: number;
+
+ legendStyle: string;
+ textStyle: string;
+
+ availRows(): number;
+ itemsCount(): number;
+ totalWidth(): number;
+ showValues(): bool;
+ itemText(series: ISeries, index: number): string;
+ isVertical(): bool;
+ }
+
+ interface IScroll {
+ chart: IChart;
+ active: bool;
+ enabled: bool;
+ direction: string;
+ mouseButton: number;
+
+ position: IPoint;
+ }
+
+ interface ISeriesList {
+ chart: IChart;
+ items: ISeries[];
+
+ anyUsesAxes(): bool;
+ clicked(position: IPoint): bool;
+ //each(f: function): void;
+ firstVisible(): ISeries;
+
+ }
+
+ interface ITools {
+ chart: IChart;
+ items: ITool[];
+
+ add(tool: ITool): ITool;
+ }
+
+ interface IWall {
+ format: IFormat;
+ visible: bool;
+ bounds: IRectangle;
+ }
+
+ interface IWalls {
+ visible: bool;
+ left: IWall;
+ right: IWall;
+ bottom: IWall;
+ back: IWall;
+ }
+
+ interface IZoom {
+ chart: IChart;
+ active: bool;
+ direction: string;
+ enabled: bool;
+ mouseButton: number;
+ format: IFormat;
+
+ reset(): void;
+ }
+
+ interface IChart {
+ addSeries(series:ISeries): ISeries;
+ draw(context?:CanvasRenderingContext2D);
+ }
+
+ // SERIES
+
+ interface ICustomBar extends ISeries {
+ sideMargins: number;
+ useOrigin: bool;
+ origin: number;
+
+ offset: number;
+ barSize: number;
+ barStyle: string;
+
+ stacked: string;
+ }
+
+ interface ISeriesPointer {
+ chart: IChart;
+ format: IFormat;
+ visible: bool;
+ colorEach: bool;
+ style: string;
+ width: number;
+ height: number;
+ }
+
+ interface ICustomSeries extends ISeries {
+ pointer: ISeriesPointer;
+
+ stacked: string;
+ stairs: bool;
+ }
+
+ interface ILine extends ICustomSeries {
+ smooth: number;
+ }
+
+ interface ISmoothLine extends ILine {
+ smooth: number;
+ }
+
+ interface IArea extends ISeries {
+ useOrigin: bool;
+ origin: number;
+ }
+
+ interface IPie extends ISeries {
+ donut: number;
+ rotation: number;
+ sort: string;
+ orderAscending: bool;
+ explode: number[];
+ concentric: bool;
+
+ calcPos(angle: number, position: IPoint): void;
+ }
+
+ interface IBubbleData extends ISeriesData {
+ radius: number[];
+ }
+
+ interface IBubble extends ICustomSeries {
+ data: IBubbleData;
+ }
+
+ interface IGanttData extends ISeriesData {
+ start: number[];
+ x: number[];
+ end: number[];
+ }
+
+ interface IGantt extends ISeries {
+ data: IGanttData;
+ dateFormat: string;
+ colorEach: string;
+ height: number;
+ margin: IPoint;
+
+ add(index: number, label: string, start: number, end: number): void;
+ bounds(index: number, rectangle: IRectangle): void;
+ }
+
+ interface ICandleData extends ISeriesData {
+ open: number[];
+ close: number[];
+ high: number[];
+ low: number[];
+ }
+
+ interface ICandle extends ICustomSeries {
+ data: ICandleData;
+ higher: IFormat;
+ lower: IFormat;
+ style: string;
+ }
+
+ // TOOLS
+
+ interface IDragTool extends ITool {
+ series: ISeries;
+ }
+
+ interface ICursorTool extends ITool {
+ direction: string;
+ size: IPoint;
+
+ followMouse: bool;
+ dragging: number;
+
+ format: IFormat;
+
+ horizAxis: IAxis;
+ vertAxis: IAxis;
+
+ render: string;
+
+ over(point: IPoint): bool;
+ setRender(render: string): void;
+ }
+
+ interface IToolTip extends IAnnotation {
+ animated: number;
+ autoHide: bool;
+ autoRedraw: bool;
+ currentSeries: ISeries;
+ currentIndex: number;
+ delay: number;
+
+ hide(): void;
+ refresh(series: ISeries, index: number): void;
+ }
+
+ declare class Point implements IPoint {
+ public x:number;
+ public y:number;
+ }
+
+ declare class Chart implements IChart {
+ //public aspect: IAspect;
+
+ public axes: IAxes;
+ public footer: ITitle;
+ public legend: ILegend;
+ public panel: IPanel;
+ public scroll: IScroll;
+ public series: ISeriesList;
+ public title: ITitle;
+ public tools: ITools;
+ public walls: IWalls;
+ public zoom: IZoom;
+
+ public bounds: IRectangle;
+ public canvas: HTMLCanvasElement;
+ public chartRect: IRectangle;
+ public palette: IPalette;
+
+ constructor(canvas: string);
+ addSeries(series: ISeries): ISeries;
+ getSeries(index: number): ISeries;
+ removeSeries(series:ISeries): void;
+
+ draw(context?:CanvasRenderingContext2D);
+ toImage(image: HTMLImageElement, format:string, quality:number): void;
+ }
+
+ // SERIES
+
+ declare var Line: {
+ prototype: ILine;
+ new(values?:number[]): ILine;
+ }
+
+ declare var PointXY: {
+ prototype: ICustomSeries;
+ new(values?:number[]): ICustomSeries;
+ }
+
+ declare var Area: {
+ prototype: IArea;
+ new(values?:number[]): IArea;
+ }
+
+ declare var HorizArea: {
+ prototype: IArea;
+ new(values?:number[]): IArea;
+ }
+
+ declare var Bar: {
+ prototype: ICustomBar;
+ new(values?:number[]): ICustomBar;
+ }
+
+ declare var HorizBar: {
+ prototype: ICustomBar;
+ new(values?:number[]): ICustomBar;
+ }
+
+ declare var Pie: {
+ prototype: IPie;
+ new(values?:number[]): IPie;
+ }
+
+ declare var Donut: {
+ prototype: IPie;
+ new(values?:number[]): IPie;
+ }
+
+ declare var Bubble: {
+ prototype: IBubble;
+ new(values?:number[]): IBubble;
+ }
+
+ declare var Gantt: {
+ prototype: IGantt;
+ new(values?:number[]): IGantt;
+ }
+
+ declare var Volume: {
+ prototype: ICustomBar;
+ new(values?:number[]): ICustomBar;
+ }
+
+ declare var Candle: {
+ prototype: ICandle;
+ new(values?:number[]): ICandle;
+ }
+
+ // TOOLS
+
+ declare var CursorTool: {
+ prototype: ICursorTool;
+ new(chart?: Chart): ICursorTool;
+ }
+
+ declare var DragTool: {
+ prototype: IDragTool;
+ new(chart?: Chart): IDragTool;
+ }
+
+ declare var ToolTip: {
+ prototype: IToolTip;
+ new(chart?: Chart): IToolTip;
+ }
+}
diff --git a/README.md b/README.md
index a7318226b..a12079134 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ Complete
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
* [Sammy.js](http://sammyjs.org/)
* [Spin](http://fgnass.github.com/spin.js/)
+* [Teechart](http://www.steema.com) (by [Steema])(http://www.steema.com)
* [Underscore.js](http://underscorejs.org/)
Next
diff --git a/Tests/jqueryui-tests.ts b/Tests/jqueryui-tests.ts
index 896b0f7a4..fe93d3904 100644
--- a/Tests/jqueryui-tests.ts
+++ b/Tests/jqueryui-tests.ts
@@ -2,440 +2,449 @@
declare var $: any;
+function tests_draggable() {
-// Draggable //////////////////////////////////////////////////
-
-$("#draggable").draggable({ axis: "y" });
-$("#draggable2").draggable({ axis: "x" });
-$("#draggable3").draggable({ containment: "#containment-wrapper", scroll: false });
-$("#draggable5").draggable({ containment: "parent" });
-$("#draggable").draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
-$("#draggable2").draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } });
-$("#draggable3").draggable({ cursorAt: { bottom: 0 } });
-$("#draggable").draggable();
-$("#draggable").draggable({ distance: 20 });
-$("#draggable2").draggable({ delay: 1000 });
-$("#draggable").draggable({
- start: () => { },
- drag: () => { },
- stop: () => { }
-});
-$("#draggable").draggable({ handle: "p" });
-$("#draggable2").draggable({ cancel: "p.ui-widget-header" });
-$("#draggable").draggable({ revert: true });
-$("#draggable2").draggable({ revert: true, helper: "clone" });
-$("#draggable").draggable({ scroll: true });
-$("#draggable2").draggable({ scroll: true, scrollSensitivity: 100 });
-$("#draggable3").draggable({ scroll: true, scrollSpeed: 100 });
-$("#draggable").draggable({ snap: true });
-$("#draggable2").draggable({ snap: ".ui-widget-header" });
-$("#draggable3").draggable({ snap: ".ui-widget-header", snapMode: "outer" });
-$("#draggable4").draggable({ grid: [20, 20] });
-$("#draggable5").draggable({ grid: [80, 80] });
-$("#sortable").sortable({ revert: true });
-$("#draggable").draggable({
- connectToSortable: "#sortable",
- helper: "clone",
- revert: "invalid"
-});
-$("#draggable").draggable({ helper: "original" });
-$("#draggable2").draggable({ opacity: 0.7, helper: "clone" });
-$("#draggable3").draggable({
- cursor: "move",
- cursorAt: { top: -12, left: -20 },
- helper: (event) => { return $("
"); }
-});
-$("#set div").draggable({ stack: "#set div" });
-
-
-// Droppable //////////////////////////////////////////////////
-
-$( "#draggable, #draggable-nonvalid" ).draggable();
-$("#droppable").droppable({
- accept: "#draggable",
- activeClass: "ui-state-hover",
- hoverClass: "ui-state-active",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("p")
- .html("Dropped!");
- }
-});
-$( "#draggable" ).draggable();
-$("#droppable").droppable({
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("p")
- .html("Dropped!");
- }
-});
-
-var $gallery = $( "#gallery" ),
- $trash = $( "#trash" );
-$("li", $gallery).draggable({
- cancel: "a.ui-icon",
- revert: "invalid",
- containment: "document",
- helper: "clone",
- cursor: "move"
-});
-
-$trash.droppable({
- accept: "#gallery > li",
- activeClass: "ui-state-highlight",
- drop: ( event, ui ) => { }
-});
-
-$gallery.droppable({
- accept: "#trash li",
- activeClass: "custom-state-active",
- drop: ( event, ui ) => { }
-});
-
-var recycle_icon = "Recycle image";
-function deleteImage($item) {
- $item.fadeOut(() => {
- var $list = $("ul", $trash).length ?
- $("ul", $trash) :
- $("").appendTo($trash);
-
- $item.find("a.ui-icon-trash").remove();
- $item.append(recycle_icon).appendTo($list).fadeIn(() => {
- $item
- .animate({ width: "48px" })
- .find("img")
- .animate({ height: "36px" });
- });
+ $("#draggable").draggable({ axis: "y" });
+ $("#draggable2").draggable({ axis: "x" });
+ $("#draggable3").draggable({ containment: "#containment-wrapper", scroll: false });
+ $("#draggable5").draggable({ containment: "parent" });
+ $("#draggable").draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
+ $("#draggable2").draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } });
+ $("#draggable3").draggable({ cursorAt: { bottom: 0 } });
+ $("#draggable").draggable();
+ $("#draggable").draggable({ distance: 20 });
+ $("#draggable2").draggable({ delay: 1000 });
+ $("#draggable").draggable({
+ start: () => { },
+ drag: () => { },
+ stop: () => { }
});
-}
-
-var trash_icon = "Delete image";
-function recycleImage($item) {
- $item.fadeOut(() => {
- $item
- .find("a.ui-icon-refresh")
- .remove()
- .end()
- .css("width", "96px")
- .append(trash_icon)
- .find("img")
- .css("height", "72px")
- .end()
- .appendTo($gallery)
- .fadeIn();
+ $("#draggable").draggable({ handle: "p" });
+ $("#draggable2").draggable({ cancel: "p.ui-widget-header" });
+ $("#draggable").draggable({ revert: true });
+ $("#draggable2").draggable({ revert: true, helper: "clone" });
+ $("#draggable").draggable({ scroll: true });
+ $("#draggable2").draggable({ scroll: true, scrollSensitivity: 100 });
+ $("#draggable3").draggable({ scroll: true, scrollSpeed: 100 });
+ $("#draggable").draggable({ snap: true });
+ $("#draggable2").draggable({ snap: ".ui-widget-header" });
+ $("#draggable3").draggable({ snap: ".ui-widget-header", snapMode: "outer" });
+ $("#draggable4").draggable({ grid: [20, 20] });
+ $("#draggable5").draggable({ grid: [80, 80] });
+ $("#sortable").sortable({ revert: true });
+ $("#draggable").draggable({
+ connectToSortable: "#sortable",
+ helper: "clone",
+ revert: "invalid"
});
+ $("#draggable").draggable({ helper: "original" });
+ $("#draggable2").draggable({ opacity: 0.7, helper: "clone" });
+ $("#draggable3").draggable({
+ cursor: "move",
+ cursorAt: { top: -12, left: -20 },
+ helper: (event) => { return $(""); }
+ });
+ $("#set div").draggable({ stack: "#set div" });
+
}
-
-function viewLargerImage($link) {
- var src = $link.attr("href"),
- title = $link.siblings("img").attr("alt"),
- $modal = $("img[src$='" + src + "']");
- if ($modal.length) {
- $modal.dialog("open");
- } else {
- var img = $("
")
- .attr("src", src).appendTo("body");
- setTimeout(() => {
- img.dialog({
- title: title,
- width: 400,
- modal: true
- });
- }, 1);
- }
-}
-
-$("ul.gallery > li").click((event) => {
- var $item = $(this),
- $target = $(event.target);
+function tests_droppable() {
- if ($target.is("a.ui-icon-trash")) {
- deleteImage($item);
- } else if ($target.is("a.ui-icon-zoomin")) {
- viewLargerImage($target);
- } else if ($target.is("a.ui-icon-refresh")) {
- recycleImage($item);
- }
-
- return false;
-});
-
-
-$("#draggable").draggable();
-
-$("#droppable, #droppable-inner").droppable({
- activeClass: "ui-state-hover",
- hoverClass: "ui-state-active",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("> p")
+ $("#draggable, #draggable-nonvalid").draggable();
+ $("#droppable").droppable({
+ accept: "#draggable",
+ activeClass: "ui-state-hover",
+ hoverClass: "ui-state-active",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("p")
+ .html("Dropped!");
+ }
+ });
+ $("#draggable").draggable();
+ $("#droppable").droppable({
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("p")
.html("Dropped!");
- return false;
- }
-});
-
-$("#droppable2, #droppable2-inner").droppable({
- greedy: true,
- activeClass: "ui-state-hover",
- hoverClass: "ui-state-active",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("> p")
- .html("Dropped!");
- }
-});
-
-$("#draggable").draggable({ revert: "valid" });
-$("#draggable2").draggable({ revert: "invalid" });
-$("#droppable").droppable({
- activeClass: "ui-state-hover",
- hoverClass: "ui-state-active",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("p")
- .html("Dropped!");
- }
-});
-$("#catalog").accordion();
-$( "#catalog li" ).draggable({
- appendTo: "body",
- helper: "clone"
-});
-$( "#cart ol" ).droppable({
- activeClass: "ui-state-default",
- hoverClass: "ui-state-hover",
- accept: ":not(.ui-sortable-helper)",
- drop: ( event, ui ) => {
- $( this ).find( ".placeholder" ).remove();
- $( "" ).text( ui.draggable.text() ).appendTo( this );
- }
-}).sortable({
- items: "li:not(.placeholder)",
- sort: () => {
- // gets added unintentionally by droppable interacting with sortable
- // using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
- $(this).removeClass("ui-state-default");
- }
-});
-
-$("#draggable").draggable();
-$("#droppable").droppable({
- hoverClass: "ui-state-active",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("p")
- .html("Dropped!");
- }
-});
-
-$( "#draggable2" ).draggable();
-$("#droppable2").droppable({
- accept: "#draggable2",
- activeClass: "ui-state-hover",
- drop: (event, ui) => {
- $(this)
- .addClass("ui-state-highlight")
- .find("p")
- .html("Dropped!");
- }
-});
-
-
-// Resizable //////////////////////////////////////////////////
-
-
-// Selectable //////////////////////////////////////////////////
-
-
-// Sortable //////////////////////////////////////////////////
-
-
-// Accordion //////////////////////////////////////////////////
-
-$("#accordion").accordion({ collapsible: true });
-var icons = {
- header: "ui-icon-circle-arrow-e",
- activeHeader: "ui-icon-circle-arrow-s"
-};
-$("#accordion").accordion({ icons: icons });
-$("#toggle").button().click(() => {
- if ($("#accordion").accordion("option", "icons")) {
- $("#accordion").accordion("option", "icons", null);
- } else {
- $("#accordion").accordion("option", "icons", icons);
- }
-});
-$( "#accordion" ).accordion({ heightStyle: "fill" });
-
-$("#accordion-resizer").resizable({
- minHeight: 140,
- minWidth: 200,
- resize: () => {
- $("#accordion").accordion("refresh");
- }
-});
-$("#accordion").accordion({ event: "click hoverintent" });
-$("#accordion").accordion({ heightStyle: "content" });
-$("#accordion")
- .accordion({
- header: "> div > h3"
- })
- .sortable({
- axis: "y",
- handle: "h3",
- stop: (event, ui) => {
- ui.item.children("h3").triggerHandler("focusout");
}
});
+var $gallery = $("#gallery"),
+ $trash = $("#trash");
+ $("li", $gallery).draggable({
+ cancel: "a.ui-icon",
+ revert: "invalid",
+ containment: "document",
+ helper: "clone",
+ cursor: "move"
+ });
-// Autocomplete //////////////////////////////////////////////////
+ $trash.droppable({
+ accept: "#gallery > li",
+ activeClass: "ui-state-highlight",
+ drop: (event, ui) => { }
+ });
-$.widget("custom.catcomplete", $.ui.autocomplete, {
- _renderMenu: (ul, items) => {
- var that = this,
- currentCategory = "";
- $.each(items, (index, item) => {
- if (item.category != currentCategory) {
- ul.append("" + item.category + "");
- currentCategory = item.category;
- }
- that._renderItemData(ul, item);
+ $gallery.droppable({
+ accept: "#trash li",
+ activeClass: "custom-state-active",
+ drop: (event, ui) => { }
+ });
+
+ var recycle_icon = "Recycle image";
+ function deleteImage($item) {
+ $item.fadeOut(() => {
+ var $list = $("ul", $trash).length ?
+ $("ul", $trash) :
+ $("").appendTo($trash);
+
+ $item.find("a.ui-icon-trash").remove();
+ $item.append(recycle_icon).appendTo($list).fadeIn(() => {
+ $item
+ .animate({ width: "48px" })
+ .find("img")
+ .animate({ height: "36px" });
+ });
});
}
-});
-var data = [
- { label: "anders", category: "" },
- { label: "andreas", category: "" },
- { label: "antal", category: "" },
- { label: "annhhx10", category: "Products" },
- { label: "annk K12", category: "Products" },
- { label: "annttop C13", category: "Products" },
- { label: "anders andersson", category: "People" },
- { label: "andreas andersson", category: "People" },
- { label: "andreas johnson", category: "People" }
- ];
-
-$("#search").catcomplete({
- delay: 0,
- source: data
-});
+ var trash_icon = "Delete image";
+ function recycleImage($item) {
+ $item.fadeOut(() => {
+ $item
+ .find("a.ui-icon-refresh")
+ .remove()
+ .end()
+ .css("width", "96px")
+ .append(trash_icon)
+ .find("img")
+ .css("height", "72px")
+ .end()
+ .appendTo($gallery)
+ .fadeIn();
+ });
+ }
-$.widget( "ui.combobox", {
- _create: () => {
- var input,
- that = this,
- select = this.element.hide(),
- selected = select.children( ":selected" ),
- value = selected.val() ? selected.text() : "",
- wrapper = this.wrapper = $( "" )
- .addClass( "ui-combobox" )
- .insertAfter( select );
-
- function removeIfInvalid(element) {
- var value = $(element).val(),
- matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(value) + "$", "i"),
- valid = false;
- select.children("option").each(() => {
- if ($(this).text().match(matcher)) {
- this.selected = valid = true;
+ function viewLargerImage($link) {
+ var src = $link.attr("href"),
+ title = $link.siblings("img").attr("alt"),
+ $modal = $("img[src$='" + src + "']");
+
+ if ($modal.length) {
+ $modal.dialog("open");
+ } else {
+ var img = $("
")
+ .attr("src", src).appendTo("body");
+ setTimeout(() => {
+ img.dialog({
+ title: title,
+ width: 400,
+ modal: true
+ });
+ }, 1);
+ }
+ }
+
+ $("ul.gallery > li").click((event) => {
+ var $item = $(this),
+ $target = $(event.target);
+
+ if ($target.is("a.ui-icon-trash")) {
+ deleteImage($item);
+ } else if ($target.is("a.ui-icon-zoomin")) {
+ viewLargerImage($target);
+ } else if ($target.is("a.ui-icon-refresh")) {
+ recycleImage($item);
+ }
+
+ return false;
+ });
+
+
+ $("#draggable").draggable();
+
+ $("#droppable, #droppable-inner").droppable({
+ activeClass: "ui-state-hover",
+ hoverClass: "ui-state-active",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("> p")
+ .html("Dropped!");
+ return false;
+ }
+ });
+
+ $("#droppable2, #droppable2-inner").droppable({
+ greedy: true,
+ activeClass: "ui-state-hover",
+ hoverClass: "ui-state-active",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("> p")
+ .html("Dropped!");
+ }
+ });
+
+ $("#draggable").draggable({ revert: "valid" });
+ $("#draggable2").draggable({ revert: "invalid" });
+ $("#droppable").droppable({
+ activeClass: "ui-state-hover",
+ hoverClass: "ui-state-active",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("p")
+ .html("Dropped!");
+ }
+ });
+ $("#catalog").accordion();
+ $("#catalog li").draggable({
+ appendTo: "body",
+ helper: "clone"
+ });
+ $("#cart ol").droppable({
+ activeClass: "ui-state-default",
+ hoverClass: "ui-state-hover",
+ accept: ":not(.ui-sortable-helper)",
+ drop: (event, ui) => {
+ $(this).find(".placeholder").remove();
+ $("").text(ui.draggable.text()).appendTo(this);
+ }
+ }).sortable({
+ items: "li:not(.placeholder)",
+ sort: () => {
+ // gets added unintentionally by droppable interacting with sortable
+ // using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
+ $(this).removeClass("ui-state-default");
+ }
+ });
+
+ $("#draggable").draggable();
+ $("#droppable").droppable({
+ hoverClass: "ui-state-active",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("p")
+ .html("Dropped!");
+ }
+ });
+
+ $("#draggable2").draggable();
+ $("#droppable2").droppable({
+ accept: "#draggable2",
+ activeClass: "ui-state-hover",
+ drop: (event, ui) => {
+ $(this)
+ .addClass("ui-state-highlight")
+ .find("p")
+ .html("Dropped!");
+ }
+ });
+
+}
+
+
+function tests_resizable() {
+
+}
+
+
+function tests_selectable() {
+
+}
+
+
+function tests_sortable() {
+
+}
+
+
+function tests_accordion() {
+
+ $("#accordion").accordion({ collapsible: true });
+ var icons = {
+ header: "ui-icon-circle-arrow-e",
+ activeHeader: "ui-icon-circle-arrow-s"
+ };
+ $("#accordion").accordion({ icons: icons });
+ $("#toggle").button().click(() => {
+ if ($("#accordion").accordion("option", "icons")) {
+ $("#accordion").accordion("option", "icons", null);
+ } else {
+ $("#accordion").accordion("option", "icons", icons);
+ }
+ });
+ $("#accordion").accordion({ heightStyle: "fill" });
+
+ $("#accordion-resizer").resizable({
+ minHeight: 140,
+ minWidth: 200,
+ resize: () => {
+ $("#accordion").accordion("refresh");
+ }
+ });
+ $("#accordion").accordion({ event: "click hoverintent" });
+ $("#accordion").accordion({ heightStyle: "content" });
+ $("#accordion")
+ .accordion({
+ header: "> div > h3"
+ })
+ .sortable({
+ axis: "y",
+ handle: "h3",
+ stop: (event, ui) => {
+ ui.item.children("h3").triggerHandler("focusout");
+ }
+ });
+
+}
+
+function tests_autocomplete() {
+
+ $.widget("custom.catcomplete", $.ui.autocomplete, {
+ _renderMenu: (ul, items) => {
+ var that = this,
+ currentCategory = "";
+ $.each(items, (index, item) => {
+ if (item.category != currentCategory) {
+ ul.append("" + item.category + "");
+ currentCategory = item.category;
+ }
+ that._renderItemData(ul, item);
+ });
+ }
+ });
+
+ var data = [
+ { label: "anders", category: "" },
+ { label: "andreas", category: "" },
+ { label: "antal", category: "" },
+ { label: "annhhx10", category: "Products" },
+ { label: "annk K12", category: "Products" },
+ { label: "annttop C13", category: "Products" },
+ { label: "anders andersson", category: "People" },
+ { label: "andreas andersson", category: "People" },
+ { label: "andreas johnson", category: "People" }
+ ];
+
+ $("#search").catcomplete({
+ delay: 0,
+ source: data
+ });
+
+ $.widget("ui.combobox", {
+ _create: () => {
+ var input,
+ that = this,
+ select = this.element.hide(),
+ selected = select.children(":selected"),
+ value = selected.val() ? selected.text() : "",
+ wrapper = this.wrapper = $("")
+ .addClass("ui-combobox")
+ .insertAfter(select);
+
+ function removeIfInvalid(element) {
+ var value = $(element).val(),
+ matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(value) + "$", "i"),
+ valid = false;
+ select.children("option").each(() => {
+ if ($(this).text().match(matcher)) {
+ this.selected = valid = true;
+ return false;
+ }
+ });
+ if (!valid) {
+ // remove invalid value, as it didn't match anything
+ $(element)
+ .val("")
+ .attr("title", value + " didn't match any item")
+ .tooltip("open");
+ select.val("");
+ setTimeout(() => {
+ input.tooltip("close").attr("title", "");
+ }, 2500);
+ input.data("autocomplete").term = "";
return false;
}
- });
- if (!valid) {
- // remove invalid value, as it didn't match anything
- $(element)
- .val("")
- .attr("title", value + " didn't match any item")
- .tooltip("open");
- select.val("");
- setTimeout(() => {
- input.tooltip("close").attr("title", "");
- }, 2500);
- input.data("autocomplete").term = "";
- return false;
}
- }
-
- input = $("")
- .appendTo(wrapper)
- .val(value)
- .attr("title", "")
- .addClass("ui-state-default ui-combobox-input")
- .autocomplete({
- delay: 0,
- minLength: 0,
- source: (request, response) => {
- var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
- response(select.children("option").map(() => {
- var text = $(this).text();
- if (this.value && (!request.term || matcher.test(text)))
- return {
- label: text.replace(
- new RegExp(
- "(?![^&;]+;)(?!<[^<>]*)(" +
- $.ui.autocomplete.escapeRegex(request.term) +
- ")(?![^<>]*>)(?![^&;]+;)", "gi"
- ), "$1"),
- value: text,
- option: this
- };
- }));
- },
- select: (event, ui) => {
- ui.item.option.selected = true;
- that._trigger("selected", event, {
- item: ui.item.option
- });
- },
- change: (event, ui) => {
- if (!ui.item)
- return removeIfInvalid(this);
- }
- })
- .addClass("ui-widget ui-widget-content ui-corner-left");
-
- input.data( "autocomplete" )._renderItem = ( ul, item ) => {
- return $( "" )
- .data( "item.autocomplete", item )
- .append( "" + item.label + "" )
- .appendTo( ul );
- };
-
- $( "" )
- .attr( "tabIndex", -1 )
- .attr( "title", "Show All Items" )
- .tooltip()
- .appendTo( wrapper )
- .button({
- icons: {
- primary: "ui-icon-triangle-1-s"
- },
- text: false
- })
- .removeClass( "ui-corner-all" )
- .addClass( "ui-corner-right ui-combobox-toggle" )
- .click(() => {
- if (input.autocomplete("widget").is(":visible")) {
- input.autocomplete("close");
- removeIfInvalid(input);
- return;
- }
- $(this).blur();
+ input = $("")
+ .appendTo(wrapper)
+ .val(value)
+ .attr("title", "")
+ .addClass("ui-state-default ui-combobox-input")
+ .autocomplete({
+ delay: 0,
+ minLength: 0,
+ source: (request, response) => {
+ var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
+ response(select.children("option").map(() => {
+ var text = $(this).text();
+ if (this.value && (!request.term || matcher.test(text)))
+ return {
+ label: text.replace(
+ new RegExp(
+ "(?![^&;]+;)(?!<[^<>]*)(" +
+ $.ui.autocomplete.escapeRegex(request.term) +
+ ")(?![^<>]*>)(?![^&;]+;)", "gi"
+ ), "$1"),
+ value: text,
+ option: this
+ };
+ }));
+ },
+ select: (event, ui) => {
+ ui.item.option.selected = true;
+ that._trigger("selected", event, {
+ item: ui.item.option
+ });
+ },
+ change: (event, ui) => {
+ if (!ui.item)
+ return removeIfInvalid(this);
+ }
+ })
+ .addClass("ui-widget ui-widget-content ui-corner-left");
+
+ input.data("autocomplete")._renderItem = (ul, item) => {
+ return $("")
+ .data("item.autocomplete", item)
+ .append("" + item.label + "")
+ .appendTo(ul);
+ };
+
+ $("")
+ .attr("tabIndex", -1)
+ .attr("title", "Show All Items")
+ .tooltip()
+ .appendTo(wrapper)
+ .button({
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ },
+ text: false
+ })
+ .removeClass("ui-corner-all")
+ .addClass("ui-corner-right ui-combobox-toggle")
+ .click(() => {
+ if (input.autocomplete("widget").is(":visible")) {
+ input.autocomplete("close");
+ removeIfInvalid(input);
+ return;
+ }
+
+ $(this).blur();
+
+ input.autocomplete("search", "");
+ input.focus();
+ });
- input.autocomplete("search", "");
- input.focus();
- });
-
input
.tooltip({
position: {
@@ -443,198 +452,202 @@ $.widget( "ui.combobox", {
},
tooltipClass: "ui-state-highlight"
});
- },
-
- destroy: () => {
- this.wrapper.remove();
- this.element.show();
- $.Widget.prototype.destroy.call( this );
- }
-});
-$("#combobox").combobox();
-$("#toggle").click(() => { $("#combobox").toggle(); });
-$("#project").autocomplete({
- minLength: 0,
- source: null,
- focus: (event, ui) => {
- $("#project").val(ui.item.label);
- return false;
- },
- select: (event, ui) => {
- $("#project").val(ui.item.label);
- $("#project-id").val(ui.item.value);
- $("#project-description").html(ui.item.desc);
- $("#project-icon").attr("src", "images/" + ui.item.icon);
- return false;
- }
-})
-.data("autocomplete")._renderItem = (ul, item) => {
- return $("")
- .data("item.autocomplete", item)
- .append("" + item.label + "
" + item.desc + "")
- .appendTo(ul);
-};
+ },
-$("#developer").autocomplete({
- source: (request, response) => {
- var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
- response($.grep(names, (value) => {
- value = value.label || value.value || value;
- return matcher.test(value) || matcher.test(normalize(value));
- }));
- }
-});
-
-var availableTags = [
- "ActionScript",
- "AppleScript",
- "Asp",
- "BASIC",
- "C",
- "C++",
- "Clojure",
- "COBOL",
- "ColdFusion",
- "Erlang",
- "Fortran",
- "Groovy",
- "Haskell",
- "Java",
- "JavaScript",
- "Lisp",
- "Perl",
- "PHP",
- "Python",
- "Ruby",
- "Scala",
- "Scheme"
-];
-$("#tags").autocomplete({ source: availableTags });
-$("#birds")
- .bind("keydown", (event) => {
- if (event.keyCode === $.ui.keyCode.TAB &&
- $(this).data("autocomplete").menu.active) {
- event.preventDefault();
+ destroy: () => {
+ this.wrapper.remove();
+ this.element.show();
+ $.Widget.prototype.destroy.call(this);
+ }
+ });
+ $("#combobox").combobox();
+ $("#toggle").click(() => { $("#combobox").toggle(); });
+ $("#project").autocomplete({
+ minLength: 0,
+ source: null,
+ focus: (event, ui) => {
+ $("#project").val(ui.item.label);
+ return false;
+ },
+ select: (event, ui) => {
+ $("#project").val(ui.item.label);
+ $("#project-id").val(ui.item.value);
+ $("#project-description").html(ui.item.desc);
+ $("#project-icon").attr("src", "images/" + ui.item.icon);
+ return false;
}
})
- .autocomplete({
+ .data("autocomplete")._renderItem = (ul, item) => {
+ return $("")
+ .data("item.autocomplete", item)
+ .append("" + item.label + "
" + item.desc + "")
+ .appendTo(ul);
+ };
+
+ $("#developer").autocomplete({
source: (request, response) => {
- $.getJSON("search.php", {
- term: extractLast(request.term)
- }, response);
- },
- search: () => {
- // custom minLength
- var term = extractLast(this.value);
- if (term.length < 2) {
+ var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
+ response($.grep(names, (value) => {
+ value = value.label || value.value || value;
+ return matcher.test(value) || matcher.test(normalize(value));
+ }));
+ }
+ });
+
+ var availableTags = [
+ "ActionScript",
+ "AppleScript",
+ "Asp",
+ "BASIC",
+ "C",
+ "C++",
+ "Clojure",
+ "COBOL",
+ "ColdFusion",
+ "Erlang",
+ "Fortran",
+ "Groovy",
+ "Haskell",
+ "Java",
+ "JavaScript",
+ "Lisp",
+ "Perl",
+ "PHP",
+ "Python",
+ "Ruby",
+ "Scala",
+ "Scheme"
+ ];
+ $("#tags").autocomplete({ source: availableTags });
+ $("#birds")
+ .bind("keydown", (event) => {
+ if (event.keyCode === $.ui.keyCode.TAB &&
+ $(this).data("autocomplete").menu.active) {
+ event.preventDefault();
+ }
+ })
+ .autocomplete({
+ source: (request, response) => {
+ $.getJSON("search.php", {
+ term: extractLast(request.term)
+ }, response);
+ },
+ search: () => {
+ // custom minLength
+ var term = extractLast(this.value);
+ if (term.length < 2) {
+ return false;
+ }
+ },
+ focus: () => {
+ return false;
+ },
+ select: (event, ui) => {
return false;
}
- },
- focus: () => {
- return false;
- },
- select: (event, ui) => {
- return false;
- }
- });
-$( "#tags" )
- .bind("keydown", (event) => {
- if (event.keyCode === $.ui.keyCode.TAB &&
- $(this).data("autocomplete").menu.active) {
- event.preventDefault();
- }
- })
- .autocomplete({
- minLength: 0,
- source: (request, response) => {
- response($.ui.autocomplete.filter(
- availableTags, extractLast(request.term)));
- },
- focus: () => {
- return false;
- },
- select: (event, ui) => {
- return false;
- }
- });
-$("#city").autocomplete({
- source: (request, response) => {
- $.ajax({
- url: "http://ws.geonames.org/searchJSON",
- dataType: "jsonp",
- data: {
- featureClass: "P",
- style: "full",
- maxRows: 12,
- name_startsWith: request.term
+ });
+ $("#tags")
+ .bind("keydown", (event) => {
+ if (event.keyCode === $.ui.keyCode.TAB &&
+ $(this).data("autocomplete").menu.active) {
+ event.preventDefault();
+ }
+ })
+ .autocomplete({
+ minLength: 0,
+ source: (request, response) => {
+ response($.ui.autocomplete.filter(
+ availableTags, extractLast(request.term)));
},
- success: (data) => {
- response($.map(data.geonames, (item) => {
- return {
- label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
- value: item.name
- }
- }));
+ focus: () => {
+ return false;
+ },
+ select: (event, ui) => {
+ return false;
}
});
- },
- minLength: 2,
- select: (event, ui) => {
- log(ui.item ?
- "Selected: " + ui.item.label :
- "Nothing selected, input was " + this.value);
- },
- open: () => {
- $(this).removeClass("ui-corner-all").addClass("ui-corner-top");
- },
- close: () => {
- $(this).removeClass("ui-corner-top").addClass("ui-corner-all");
- }
-});
-function log( message ) {
- $( "" ).text( message ).prependTo( "#log" );
- $( "#log" ).attr( "scrollTop", 0 );
-}
-var cache = {};
-$("#birds").autocomplete({
- minLength: 2,
- source: (request, response) => {
- var term = request.term;
- if (term in cache) {
- response(cache[term]);
- return;
+ $("#city").autocomplete({
+ source: (request, response) => {
+ $.ajax({
+ url: "http://ws.geonames.org/searchJSON",
+ dataType: "jsonp",
+ data: {
+ featureClass: "P",
+ style: "full",
+ maxRows: 12,
+ name_startsWith: request.term
+ },
+ success: (data) => {
+ response($.map(data.geonames, (item) => {
+ return {
+ label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
+ value: item.name
+ }
+ }));
+ }
+ });
+ },
+ minLength: 2,
+ select: (event, ui) => {
+ log(ui.item ?
+ "Selected: " + ui.item.label :
+ "Nothing selected, input was " + this.value);
+ },
+ open: () => {
+ $(this).removeClass("ui-corner-all").addClass("ui-corner-top");
+ },
+ close: () => {
+ $(this).removeClass("ui-corner-top").addClass("ui-corner-all");
}
-
- $.getJSON("search.php", request, (data, status, xhr) => {
- cache[term] = data;
- response(data);
- });
+ });
+ function log(message) {
+ $("").text(message).prependTo("#log");
+ $("#log").attr("scrollTop", 0);
}
-});
-$("#birds").autocomplete({
- source: "search.php",
- minLength: 2,
- select: (event, ui) => {
- log(ui.item ?
- "Selected: " + ui.item.value + " aka " + ui.item.id :
- "Nothing selected, input was " + this.value);
- }
-});
-$("#birds").autocomplete({
- source: data,
- minLength: 0,
- select: ( event, ui ) => {
- log( ui.item ?
- "Selected: " + ui.item.value + ", geonameId: " + ui.item.id :
- "Nothing selected, input was " + this.value );
- }
-});
+ var cache = {};
+ $("#birds").autocomplete({
+ minLength: 2,
+ source: (request, response) => {
+ var term = request.term;
+ if (term in cache) {
+ response(cache[term]);
+ return;
+ }
+
+ $.getJSON("search.php", request, (data, status, xhr) => {
+ cache[term] = data;
+ response(data);
+ });
+ }
+ });
+ $("#birds").autocomplete({
+ source: "search.php",
+ minLength: 2,
+ select: (event, ui) => {
+ log(ui.item ?
+ "Selected: " + ui.item.value + " aka " + ui.item.id :
+ "Nothing selected, input was " + this.value);
+ }
+ });
+ $("#birds").autocomplete({
+ source: data,
+ minLength: 0,
+ select: (event, ui) => {
+ log(ui.item ?
+ "Selected: " + ui.item.value + ", geonameId: " + ui.item.id :
+ "Nothing selected, input was " + this.value);
+ }
+ });
+
+}
-// Button //////////////////////////////////////////////////
+function tests_button() {
-$("#check").button();
-$("#format").buttonset();
-$("input[type=submit], a, button")
- .button()
- .click((event) => { event.preventDefault(); });
\ No newline at end of file
+ $("#check").button();
+ $("#format").buttonset();
+ $("input[type=submit], a, button")
+ .button()
+ .click((event) => { event.preventDefault(); });
+
+}
\ No newline at end of file