From 50e4b795e934f933e24a22a509d1bcc709f234a3 Mon Sep 17 00:00:00 2001 From: David Berneda Date: Tue, 30 Oct 2012 09:43:02 +0100 Subject: [PATCH 1/6] TeeChart definitions for TypeScript --- Definitions/teechart.d.ts | 681 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 681 insertions(+) create mode 100644 Definitions/teechart.d.ts diff --git a/Definitions/teechart.d.ts b/Definitions/teechart.d.ts new file mode 100644 index 000000000..e4aba5b45 --- /dev/null +++ b/Definitions/teechart.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; + } +} From 0ecfdee637bc3c5b50ad2df5a8a787175503a4bf Mon Sep 17 00:00:00 2001 From: BreeeZe Date: Tue, 30 Oct 2012 11:40:24 +0100 Subject: [PATCH 2/6] Defined different KnockoutObservable types for primitive types. --- Definitions/knockout-2.2.d.ts | 52 +++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 11 deletions(-) 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; From c90059bdb2b768b2b8411ab486b7a08e857f03a3 Mon Sep 17 00:00:00 2001 From: Boris Yankov Date: Tue, 30 Oct 2012 13:21:00 +0200 Subject: [PATCH 3/6] Update Backbone definitions --- Definitions/backbone-0.9.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Definitions/backbone-0.9.d.ts b/Definitions/backbone-0.9.d.ts index f44034690..119b5584b 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 { From 1adf8d7cd90199ce882a218a3df74e3697d23d36 Mon Sep 17 00:00:00 2001 From: Boris Yankov Date: Tue, 30 Oct 2012 13:26:46 +0200 Subject: [PATCH 4/6] Update Teechart files --- .../{teechart.d.ts => teechart-1.3.d.ts} | 1362 ++++++++--------- README.md | 1 + 2 files changed, 682 insertions(+), 681 deletions(-) rename Definitions/{teechart.d.ts => teechart-1.3.d.ts} (94%) diff --git a/Definitions/teechart.d.ts b/Definitions/teechart-1.3.d.ts similarity index 94% rename from Definitions/teechart.d.ts rename to Definitions/teechart-1.3.d.ts index e4aba5b45..af93aa762 100644 --- a/Definitions/teechart.d.ts +++ b/Definitions/teechart-1.3.d.ts @@ -1,681 +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; - } -} +/** + * 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 From 57247534b628bac0ff04724fc70b81e18e7a6c99 Mon Sep 17 00:00:00 2001 From: Boris Yankov Date: Tue, 30 Oct 2012 14:24:05 +0200 Subject: [PATCH 5/6] Update jQuery UI definitions and tests --- Definitions/jqueryui-1.9.d.ts | 141 +++- Tests/jqueryui-tests.ts | 1201 +++++++++++++++++---------------- 2 files changed, 716 insertions(+), 626 deletions(-) diff --git a/Definitions/jqueryui-1.9.d.ts b/Definitions/jqueryui-1.9.d.ts index d8dd1d9e4..2d49a15e2 100644 --- a/Definitions/jqueryui-1.9.d.ts +++ b/Definitions/jqueryui-1.9.d.ts @@ -39,7 +39,7 @@ interface Accordion extends Widget { icons?: any; // Methods - + // Events activate(event: Event, ui): void; beforeActivate(event: Event, ui): void; @@ -61,7 +61,7 @@ interface Autocomplete extends Widget { source?: any; // [], string or () // Methods - close(); + close(); search(value?: string); // Events @@ -78,7 +78,7 @@ interface Autocomplete extends Widget { // Button ////////////////////////////////////////////////// -interface Button extends Widget { +interface Button extends Widget { // Options disabled?: bool; @@ -152,7 +152,7 @@ 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; @@ -357,7 +357,7 @@ 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; } @@ -372,7 +372,7 @@ interface Progressbar extends Widget { // Methods destroy(); disable(); - enable(); + enable(); option(optionName: string): any; option(): any; option(optionName: string, value: any): void; @@ -414,7 +414,7 @@ interface Resizable extends Widget { minWidth?: number; // Methods - + // Events resize(event: Event, ui): void; start(event: Event, ui): void; @@ -436,7 +436,7 @@ interface Selectable extends Widget { tolerance?: string; // Methods - + // Events selected(event: Event, ui): void; selecting(event: Event, ui): void; @@ -452,7 +452,7 @@ interface Slider extends Widget { // Options animate?: any; // bool, string or number - disabled?: bool; + disabled?: bool; max?: number; min?: number; orientation?: string; @@ -471,8 +471,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; } @@ -615,47 +615,124 @@ interface Tooltip extends Widget { interface JQuery { - accordion(options?: Accordion): void; + accordion(): JQuery; + accordion(methodName: string): JQuery; + accordion(options: Dialog): JQuery; + accordion(optionLiteral: string, options: Dialog): 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: Autocomplete): JQuery; + autocomplete(optionLiteral: string, options: Autocomplete): 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: Button): JQuery; + button(optionLiteral: string, options: Button): 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: Button): JQuery; + buttonset(optionLiteral: string, options: Button): 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: Datepicker): JQuery; + datepicker(optionLiteral: string, options: Datepicker): JQuery; + datepicker(optionLiteral: string, optionName: string, optionValue: any): JQuery; + datepicker(optionLiteral: string, optionName: string): JQuery; - draggable(options?: Draggable): JQuery; + dialog(): JQuery; + dialog(methodName: string): JQuery; + dialog(options: Dialog): JQuery; + dialog(optionLiteral: string, options: Dialog): JQuery; + dialog(optionLiteral: string, optionName: string, optionValue: any): JQuery; + dialog(optionLiteral: string, optionName: string): JQuery; + + draggable(): JQuery; + draggable(methodName: string): JQuery; + 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; + draggable(optionLiteral: string, optionName: string): JQuery; + droppable(): JQuery; + droppable(methodName: string): JQuery; 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; + droppable(optionLiteral: string, optionName: string): JQuery; - menu(options?: Menu): void; + menu(): JQuery; + menu(methodName: string): JQuery; + menu(options: Menu): JQuery; + menu(optionLiteral: string, options: Menu): 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: Resizable): JQuery; + resizable(optionLiteral: string, options: Resizable): 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: Selectable): JQuery; + selectable(optionLiteral: string, options: Selectable): 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: Slider): JQuery; + slider(optionLiteral: string, options: Slider): 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: Sortable): JQuery; + sortable(optionLiteral: string, options: Sortable): 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: Spinner): JQuery; + spinner(optionLiteral: string, options: Spinner): 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: Tabs): JQuery; + tabs(optionLiteral: string, options: Tabs): 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: Tooltip): JQuery; + tooltip(optionLiteral: string, options: Tooltip): JQuery; + tooltip(optionLiteral: string, optionName: string, optionValue: any): JQuery; + tooltip(optionLiteral: string, optionName: string): JQuery; } interface JQueryStatic { diff --git a/Tests/jqueryui-tests.ts b/Tests/jqueryui-tests.ts index 896b0f7a4..7ef12853a 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 $("
I'm a custom helper
"); } -}); -$("#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) : - $("