mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' of https://github.com/borisyankov/DefinitelyTyped into moment-set-object
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/// <reference path="angular-loading-bar.d.ts" />
|
||||
|
||||
var app = angular.module('testModule', ['angular-loading-bar']);
|
||||
|
||||
class TestController {
|
||||
|
||||
constructor($http: ng.IHttpService) {
|
||||
|
||||
$http.get("http://xyz.com", { ignoreLoadingBar: true })
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.controller('TestController', TestController);
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for angular-loading-bar
|
||||
// Project: https://github.com/chieffancypants/angular-loading-bar
|
||||
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
|
||||
declare module angular {
|
||||
|
||||
interface IRequestShortcutConfig {
|
||||
/**
|
||||
* Indicates that the loading bar should be hidden.
|
||||
*/
|
||||
ignoreLoadingBar?: boolean;
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+12
-12
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Async 1.4.2
|
||||
// Project: https://github.com/caolan/async
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
@@ -10,7 +10,7 @@ interface AsyncResultCallback<T> { (err: Error, result: T): void; }
|
||||
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
|
||||
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
|
||||
|
||||
interface AsyncFunction<T> { (callback: (err: Error, result?: T) => void): void; }
|
||||
interface AsyncFunction<T> { (callback: (err?: Error, result?: T) => void): void; }
|
||||
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
|
||||
interface AsyncForEachOfIterator<T> { (item: T, key: number, callback: ErrorCallback): void; }
|
||||
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
|
||||
@@ -85,15 +85,15 @@ interface Async {
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
filter<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
select<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
filterSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
selectSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
filterLimit<T>(arr: T[], limit: number, iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
selectLimit<T>(arr: T[], limit: number, iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
reject<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
rejectLimit<T>(arr: T[], limit: number, iterator: AsyncResultIterator<T, boolean>, callback?: (results: T[]) => any): any;
|
||||
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
select<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
filterSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
selectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
selectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
reject<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
rejectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (results: T[]) => any): any;
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
@@ -126,7 +126,7 @@ interface Async {
|
||||
during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void;
|
||||
forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void;
|
||||
waterfall(tasks: Function[], callback?: (err: Error, result: any) => void): void;
|
||||
waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void;
|
||||
compose(...fns: Function[]): void;
|
||||
seq(...fns: Function[]): void;
|
||||
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
|
||||
+2
-2
@@ -1450,7 +1450,7 @@ function quadtree() {
|
||||
// Collapse the quadtree into an array of rectangles.
|
||||
function nodes(quadtree: d3.geom.quadtree.Quadtree<[number, number]>) {
|
||||
var nodes: Array<{x: number; y: number; width: number; height: number}> = [];
|
||||
quadtree.visit(function (node, x1, y1, x2, y2) {
|
||||
quadtree.visit(function (node: d3.geom.quadtree.Node<[number, number]>, x1: number, y1: number, x2:number, y2: number) {
|
||||
nodes.push({ x: x1, y: y1, width: x2 - x1, height: y2 - y1 });
|
||||
} );
|
||||
return nodes;
|
||||
@@ -1458,7 +1458,7 @@ function quadtree() {
|
||||
|
||||
// Find the nodes within the specified rectangle.
|
||||
function search(quadtree: d3.geom.quadtree.Quadtree<{ scanned?: boolean; selected?: boolean; 0: number; 1: number }>, x0: number, y0: number, x3: number, y3: number) {
|
||||
quadtree.visit(function (node, x1, y1, x2, y2) {
|
||||
quadtree.visit(function (node: d3.geom.quadtree.Node<{ scanned?: boolean; selected?: boolean; 0: number; 1: number }>, x1: number, y1: number, x2:number, y2: number) {
|
||||
var p = node.point;
|
||||
if (p) {
|
||||
p.scanned = true;
|
||||
|
||||
Vendored
+1
-1
@@ -3251,7 +3251,7 @@ declare module d3 {
|
||||
export function delaunay(vertices: Array<[number, number]>): Array<[[number, number], [number, number], [number, number]]>;
|
||||
|
||||
export function quadtree(): Quadtree<[number, number]>;
|
||||
export function quadtree<T>(): Quadtree<T>;
|
||||
export function quadtree<T>(nodes: T[], x1?: number, y1?: number, x2?: number, y2?: number): quadtree.Quadtree<T>;
|
||||
|
||||
module quadtree {
|
||||
interface Node<T> {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="easy-table.d.ts" />
|
||||
|
||||
import EasyTable = require('easy-table');
|
||||
|
||||
var table = new EasyTable();
|
||||
|
||||
table.cell('aa', 1);
|
||||
table.cell('bb',1);
|
||||
table.newRow();
|
||||
|
||||
table.cell('aa', 1);
|
||||
table.cell('bb',1);
|
||||
|
||||
table.print();
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for easy-table 0.2.0
|
||||
// Project: https://github.com/eldargab/easy-table
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "easy-table" {
|
||||
class EasyTable {
|
||||
constructor();
|
||||
|
||||
cell(label: string, value: any, printer?: EasyTable.CellPrinter, width?: number):void;
|
||||
newRow(): void;
|
||||
toString(): string;
|
||||
printTransposed(): string;
|
||||
print(): string;
|
||||
sort(fields: string): void;
|
||||
sort(comparer: (a: any, b: any) => number): void;
|
||||
total(label: string, accumulator: EasyTable.Accumulator, totalPrinter: EasyTable.CellPrinter): void;
|
||||
}
|
||||
|
||||
module EasyTable {
|
||||
function printArray(array: any[], cellPrinter?: CellPrinter, tablePrinter?: Printer): string;
|
||||
function printObject(object: any, cellPrinter?: CellPrinter, tablePrinter?: Printer): string;
|
||||
|
||||
//printer helpers
|
||||
function Number(length: number): CellPrinter;
|
||||
function RightPadder(char: string): CellPrinter;
|
||||
function LeftPadder(char: string): CellPrinter;
|
||||
|
||||
interface CellPrinter extends Function {
|
||||
(obj: any, cell: (label: string, value: any, width?: number) => void):string;
|
||||
}
|
||||
interface Printer extends Function {
|
||||
(table: EasyTable):string;
|
||||
}
|
||||
interface Accumulator extends Function {
|
||||
(sum: number, val: number, index: number, length: number):number;
|
||||
}
|
||||
}
|
||||
|
||||
export = EasyTable;
|
||||
}
|
||||
@@ -1,15 +1,103 @@
|
||||
/// <reference path="easy-table.d.ts" />
|
||||
///<reference path="easy-table.d.ts" />
|
||||
|
||||
import EasyTable = require('easy-table');
|
||||
import Table = require("easy-table");
|
||||
|
||||
var table = new EasyTable();
|
||||
let data = [
|
||||
{ id: 123123, desc: 'Something awesome', price: 1000.00 },
|
||||
{ id: 245452, desc: 'Very interesting book', price: 11.45 },
|
||||
{ id: 232323, desc: 'Yet another product', price: 555.55 }
|
||||
];
|
||||
|
||||
table.cell('aa', 1);
|
||||
table.cell('bb',1);
|
||||
table.newRow();
|
||||
interface Data {
|
||||
id: number;
|
||||
desc: string;
|
||||
price: number;
|
||||
}
|
||||
|
||||
table.cell('aa', 1);
|
||||
table.cell('bb',1);
|
||||
function sample_test() {
|
||||
let t = new Table();
|
||||
data.forEach(function(product) {
|
||||
t.cell('Product Id', product.id);
|
||||
t.cell('Description', product.desc);
|
||||
t.cell('Price, USD', product.price, Table.number(2));
|
||||
t.newRow();
|
||||
});
|
||||
console.log(t.toString());
|
||||
}
|
||||
|
||||
table.print();
|
||||
function static_print() {
|
||||
console.log(Table.print(data));
|
||||
}
|
||||
|
||||
function currency(val: number, width?: number) {
|
||||
var str = val.toFixed(2);
|
||||
return width ? str : Table.padLeft(str, width);
|
||||
}
|
||||
|
||||
function sample_2() {
|
||||
Table.print<Data>(data, {
|
||||
desc: { name: 'description' },
|
||||
price: { printer: Table.number(2) }
|
||||
});
|
||||
}
|
||||
|
||||
function sample_3() {
|
||||
Table.print(data, function(item, cell) {
|
||||
cell('Product id', item.id)
|
||||
cell('Price, USD', item.price)
|
||||
}, function(table) {
|
||||
return table.print()
|
||||
})
|
||||
}
|
||||
|
||||
function sample_4() {
|
||||
Table.print(data[0]);
|
||||
}
|
||||
|
||||
function sort_strings() {
|
||||
let t = new Table();
|
||||
t.sort(['Price, USD|des']) // will sort in descending order
|
||||
t.sort(['Price, USD|asc']) // will sort in ascending order
|
||||
t.sort(['Price, USD']) // sorts in ascending order by default
|
||||
}
|
||||
|
||||
function totalling() {
|
||||
let t = new Table();
|
||||
t.total('Price, USD');
|
||||
t.total('Price, USD', {
|
||||
printer: Table.aggr.printer('Avg: ', currency),
|
||||
reduce: Table.aggr.avg,
|
||||
init: 0
|
||||
})
|
||||
|
||||
// or alternatively
|
||||
t.total('Price, USD', {
|
||||
printer: (val, width) => {
|
||||
return Table.padLeft('Avg: ' + currency(val), width);
|
||||
},
|
||||
reduce: (acc: number, val: number, idx: number, len: number) => {
|
||||
acc = acc + val;
|
||||
return idx + 1 == len ? acc / len : acc;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function other_samples() {
|
||||
var t = new Table();
|
||||
|
||||
data.forEach(product => {
|
||||
t.cell('Product Id', product.id)
|
||||
t.cell('Description', product.desc)
|
||||
t.cell('Price, USD', product.price, Table.number(2))
|
||||
t.newRow()
|
||||
})
|
||||
|
||||
t.sort(['Price, USD'])
|
||||
t.total('Price, USD', {
|
||||
printer: Table.number(2)
|
||||
})
|
||||
|
||||
t.log()
|
||||
Table.log(data, { price: { printer: Table.number(2) } })
|
||||
Table.log(data[0])
|
||||
}
|
||||
|
||||
Vendored
+210
-28
@@ -1,40 +1,222 @@
|
||||
// Type definitions for easy-table 0.2.0
|
||||
// Type definitions for easy-table
|
||||
// Project: https://github.com/eldargab/easy-table
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "easy-table" {
|
||||
declare module "easy-table"
|
||||
{
|
||||
class EasyTable {
|
||||
constructor();
|
||||
|
||||
cell(label: string, value: any, printer?: EasyTable.CellPrinter, width?: number):void;
|
||||
newRow(): void;
|
||||
toString(): string;
|
||||
printTransposed(): string;
|
||||
print(): string;
|
||||
sort(fields: string): void;
|
||||
sort(comparer: (a: any, b: any) => number): void;
|
||||
total(label: string, accumulator: EasyTable.Accumulator, totalPrinter: EasyTable.CellPrinter): void;
|
||||
/**
|
||||
* String to separate columns
|
||||
*/
|
||||
public separator: string;
|
||||
|
||||
/**
|
||||
* Default printer
|
||||
*/
|
||||
public static string(value: any): string;
|
||||
|
||||
/**
|
||||
* Create a printer which right aligns the content by padding with `ch` on the left
|
||||
*
|
||||
* @param {String} ch
|
||||
* @returns {Function}
|
||||
*/
|
||||
public static leftPadder<T>(ch: string): CellPrinter<T>;
|
||||
|
||||
public static padLeft: CellPrinter<string>;
|
||||
|
||||
/**
|
||||
* Create a printer which pads with `ch` on the right
|
||||
*
|
||||
* @param {String} ch
|
||||
* @returns {Function}
|
||||
*/
|
||||
public static rightPadder<T>(ch: string): CellPrinter<T>;
|
||||
|
||||
// public static padRight: CellPrinter<string>;
|
||||
|
||||
/**
|
||||
* Create a printer for numbers
|
||||
*
|
||||
* Will do right alignment and optionally fix the number of digits after decimal point
|
||||
*
|
||||
* @param {Number} [digits] - Number of digits for fixpoint notation
|
||||
* @returns {Function}
|
||||
*/
|
||||
public static number(digits?: number): CellPrinter<number>;
|
||||
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* Push the current row to the table and start a new one
|
||||
*
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public newRow(): EasyTable;
|
||||
|
||||
/**
|
||||
* Write cell in the current row
|
||||
*
|
||||
* @param {String} col - Column name
|
||||
* @param {Any} val - Cell value
|
||||
* @param {Function} [printer] - Printer function to format the value
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public cell<T>(col: string, val: T, printer?: CellPrinter<T>): EasyTable;
|
||||
|
||||
/**
|
||||
* Get list of columns in printing order
|
||||
*
|
||||
* @returns {string[]}
|
||||
*/
|
||||
public columns(): string[];
|
||||
|
||||
/**
|
||||
* Format just rows, i.e. print the table without headers and totals
|
||||
*
|
||||
* @returns {String} String representaion of the table
|
||||
*/
|
||||
public print(): string;
|
||||
|
||||
/**
|
||||
* Format the table
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
public toString(): string;
|
||||
|
||||
/**
|
||||
* Push delimeter row to the table (with each cell filled with dashs during printing)
|
||||
*
|
||||
* @param {String[]} [cols]
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public pushDelimeter(cols?: string[]): EasyTable;
|
||||
|
||||
/**
|
||||
* Compute all totals and yield the results to `cb`
|
||||
*
|
||||
* @param {Function} cb - Callback function with signature `(column, value, printer)`
|
||||
*/
|
||||
public forEachTotal<T>(cb: (column: string, value: T, printer: CellPrinter<T>) => void): void;
|
||||
|
||||
/**
|
||||
* Format the table so that each row represents column and each column represents row
|
||||
*
|
||||
* @param {IPrintColumnOptions} [opts]
|
||||
* @returns {String}
|
||||
*/
|
||||
public printTransposed<T>(opts?: PrintColumnOptions<T>): string;
|
||||
|
||||
/**
|
||||
* Sort the table
|
||||
*
|
||||
* @param {Function|string[]} [cmp] - Either compare function or a list of columns to sort on
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public sort(cmp?: string[]): EasyTable;
|
||||
/**
|
||||
* Sort the table
|
||||
*
|
||||
* @param {Function|string[]} [cmp] - Either compare function or a list of columns to sort on
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public sort<T>(cmp?: CompareFunction<T>): EasyTable;
|
||||
|
||||
/**
|
||||
* Add a total for the column
|
||||
*
|
||||
* @param {String} col - column name
|
||||
* @param {Object} [opts]
|
||||
* @returns {Table} `this`
|
||||
*/
|
||||
public total<T>(col: string, opts?: TotalOptions<T>): EasyTable;
|
||||
/**
|
||||
* Predefined helpers for totals
|
||||
*/
|
||||
public static aggr: Aggregators;
|
||||
|
||||
/**
|
||||
* Print the array or object
|
||||
*
|
||||
* @param {Array|Object} obj - Object to print
|
||||
* @param {Function|Object} [format] - Format options
|
||||
* @param {Function} [cb] - Table post processing and formating
|
||||
* @returns {String}
|
||||
*/
|
||||
public static print<T>(obj: T | T[], format?: FormatFunction<T> | FormatObject, cb?: TablePostProcessing): string;
|
||||
|
||||
/**
|
||||
* Same as `Table.print()` but yields the result to `console.log()`
|
||||
*/
|
||||
public static log<T>(obj: T | T[], format?: FormatFunction<T> | FormatObject, cb?: TablePostProcessing): void;
|
||||
/**
|
||||
* Same as `.toString()` but yields the result to `console.log()`
|
||||
*/
|
||||
public log(): void;
|
||||
}
|
||||
|
||||
module EasyTable {
|
||||
function printArray(array: any[], cellPrinter?: CellPrinter, tablePrinter?: Printer): string;
|
||||
function printObject(object: any, cellPrinter?: CellPrinter, tablePrinter?: Printer): string;
|
||||
type CellPrinter<T> = (val: T, width: number) => string;
|
||||
type CompareFunction<T> = (a: T, b: T) => number;
|
||||
type ReduceFunction<T> = (acc: T, val: T, idx: number, length: number) => T;
|
||||
type FormatFunction<T> = (obj: T, cell: (name: string, val: any) => void) => void;
|
||||
type TablePostProcessing = (result: EasyTable) => string;
|
||||
|
||||
//printer helpers
|
||||
function Number(length: number): CellPrinter;
|
||||
function RightPadder(char: string): CellPrinter;
|
||||
function LeftPadder(char: string): CellPrinter;
|
||||
interface PrintColumnOptions<T> {
|
||||
/**
|
||||
* Column separation string
|
||||
*/
|
||||
separator?: string;
|
||||
/**
|
||||
* Printer to format column names
|
||||
*/
|
||||
namePrinter?: CellPrinter<T>;
|
||||
}
|
||||
|
||||
interface CellPrinter extends Function {
|
||||
(obj: any, cell: (label: string, value: any, width?: number) => void):string;
|
||||
}
|
||||
interface Printer extends Function {
|
||||
(table: EasyTable):string;
|
||||
}
|
||||
interface Accumulator extends Function {
|
||||
(sum: number, val: number, index: number, length: number):number;
|
||||
}
|
||||
interface Aggregators {
|
||||
/**
|
||||
* Create a printer which formats the value with `printer`,
|
||||
* adds the `prefix` to it and right aligns the whole thing
|
||||
*
|
||||
* @param {String} prefix
|
||||
* @param {Function} printer
|
||||
* @returns {printer}
|
||||
*/
|
||||
printer<T>(prefix: string, printer: CellPrinter<T>): CellPrinter<T>;
|
||||
/**
|
||||
* Sum reduction
|
||||
*/
|
||||
sum: any;
|
||||
/**
|
||||
* Average reduction
|
||||
*/
|
||||
avg: any;
|
||||
}
|
||||
|
||||
interface TotalOptions<T> {
|
||||
/**
|
||||
* reduce(acc, val, idx, length) function to compute the total value
|
||||
*/
|
||||
reduce?: ReduceFunction<T>;
|
||||
/**
|
||||
* Printer to format the total cell
|
||||
*/
|
||||
printer?: CellPrinter<T>;
|
||||
/**
|
||||
* Initial value for reduction
|
||||
*/
|
||||
init?: T;
|
||||
}
|
||||
|
||||
interface FormatObject {
|
||||
[key: string]: ColumnFormat<any>;
|
||||
}
|
||||
|
||||
interface ColumnFormat<T> {
|
||||
name?: string;
|
||||
printer?: CellPrinter<T>
|
||||
}
|
||||
|
||||
export = EasyTable;
|
||||
|
||||
@@ -52,4 +52,14 @@ declare var localForage: LocalForage;
|
||||
|
||||
localForage.removeItem("key").then(() => {
|
||||
});
|
||||
}
|
||||
|
||||
var config = localForage.config({
|
||||
name: "testyo",
|
||||
driver: localForage.LOCALSTORAGE
|
||||
});
|
||||
|
||||
var store = localForage.createInstance({
|
||||
name: "da instance",
|
||||
driver: localForage.LOCALSTORAGE
|
||||
});
|
||||
}
|
||||
Vendored
+17
-2
@@ -6,7 +6,7 @@
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
interface LocalForageOptions {
|
||||
driver?: LocalForageDriver | LocalForageDriver[];
|
||||
driver?: string | LocalForageDriver | LocalForageDriver[];
|
||||
|
||||
name?: string;
|
||||
|
||||
@@ -46,9 +46,19 @@ interface LocalForage {
|
||||
WEBSQL: string;
|
||||
INDEXEDDB: string;
|
||||
|
||||
config(options: LocalForageOptions): void;
|
||||
/**
|
||||
* Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded.
|
||||
* If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver()
|
||||
* @param {ILocalForageConfig} options?
|
||||
*/
|
||||
config(options: LocalForageOptions): boolean;
|
||||
createInstance(options: LocalForageOptions): LocalForage;
|
||||
|
||||
driver(): LocalForageDriver;
|
||||
/**
|
||||
* Force usage of a particular driver or drivers, if available.
|
||||
* @param {string} driver
|
||||
*/
|
||||
setDriver(driver: string | string[]): Promise<void>;
|
||||
setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void;
|
||||
defineDriver(driver: LocalForageDriver): Promise<void>;
|
||||
@@ -79,3 +89,8 @@ interface LocalForage {
|
||||
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any,
|
||||
callback: (err: any, result: any) => void): void;
|
||||
}
|
||||
|
||||
declare module "localforage" {
|
||||
var localforage: LocalForage;
|
||||
export default localforage;
|
||||
}
|
||||
+127
-39
@@ -1633,13 +1633,6 @@ result = <number>_(0.046).floor(2);
|
||||
result = <number>_(4060).floor(-2);
|
||||
// → 4000
|
||||
|
||||
result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stoogesAges, 'age');
|
||||
result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).max();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max('age');
|
||||
|
||||
result = <number>_.min([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.min(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.min(stoogesAges, 'age');
|
||||
@@ -1988,23 +1981,53 @@ result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallba
|
||||
|
||||
// _.curry
|
||||
var testCurryFn = (a: number, b: number, c: number) => [a, b, c];
|
||||
interface TestCurryResultFn {
|
||||
(...args: number[]): number[] | TestCurryResultFn;
|
||||
}
|
||||
result = <number[]>_.curry<TestCurryResultFn>(testCurryFn)(1, 2, 3);
|
||||
result = <TestCurryResultFn>_.curry<TestCurryResultFn>(testCurryFn)(1);
|
||||
result = <number[]>_(testCurryFn).curry<TestCurryResultFn>().value()(1, 2, 3);
|
||||
result = <TestCurryResultFn>_(testCurryFn).curry<TestCurryResultFn>().value()(1);
|
||||
let curryResult0: number[]
|
||||
let curryResult1: _.CurriedFunction1<number, number[]>
|
||||
let curryResult2: _.CurriedFunction2<number, number, number[]>
|
||||
|
||||
curryResult0 = _.curry(testCurryFn)(1, 2, 3);
|
||||
curryResult1 = _.curry(testCurryFn)(1, 2);
|
||||
curryResult0 = _.curry(testCurryFn)(1, 2)(3);
|
||||
curryResult0 = _.curry(testCurryFn)(1)(2)(3);
|
||||
curryResult2 = _.curry(testCurryFn)(1);
|
||||
curryResult1 = _.curry(testCurryFn)(1)(2);
|
||||
curryResult0 = _.curry(testCurryFn)(1)(2)(3);
|
||||
curryResult0 = _.curry(testCurryFn)(1)(2, 3);
|
||||
curryResult0 = _(testCurryFn).curry().value()(1, 2, 3);
|
||||
curryResult2 = _(testCurryFn).curry().value()(1);
|
||||
|
||||
declare function testCurry2(a: string, b: number, c: boolean): [string, number, boolean];
|
||||
let curryResult3: [string, number, boolean];
|
||||
let curryResult4: _.CurriedFunction1<boolean, [string, number, boolean]>;
|
||||
let curryResult5: _.CurriedFunction2<number, boolean, [string, number, boolean]>;
|
||||
let curryResult6: _.CurriedFunction3<string, number, boolean, [string, number, boolean]>;
|
||||
curryResult3 = _.curry(testCurry2)("1", 2, true);
|
||||
curryResult3 = _.curry(testCurry2)("1", 2)(true);
|
||||
curryResult3 = _.curry(testCurry2)("1")(2, true);
|
||||
curryResult3 = _.curry(testCurry2)("1")(2)(true);
|
||||
curryResult4 = _.curry(testCurry2)("1", 2);
|
||||
curryResult4 = _.curry(testCurry2)("1")(2);
|
||||
curryResult5 = _.curry(testCurry2)("1");
|
||||
curryResult6 = _.curry(testCurry2);
|
||||
|
||||
// _.curryRight
|
||||
var testCurryRightFn = (a: number, b: number, c: number) => [a, b, c];
|
||||
interface TestCurryRightResultFn {
|
||||
(...args: number[]): number[] | TestCurryRightResultFn;
|
||||
}
|
||||
result = <number[]>_.curryRight<TestCurryRightResultFn>(testCurryRightFn)(1, 2, 3);
|
||||
result = <TestCurryRightResultFn>_.curryRight<TestCurryRightResultFn>(testCurryRightFn)(1);
|
||||
result = <number[]>_(testCurryRightFn).curryRight<TestCurryRightResultFn>().value()(1, 2, 3);
|
||||
result = <TestCurryRightResultFn>_(testCurryRightFn).curryRight<TestCurryRightResultFn>().value()(1);
|
||||
curryResult0 = _.curryRight(testCurryRightFn)(1, 2, 3);
|
||||
curryResult2 = _.curryRight(testCurryRightFn)(1);
|
||||
curryResult0 = _(testCurryRightFn).curryRight().value()(1, 2, 3);
|
||||
curryResult2 = _(testCurryRightFn).curryRight().value()(1);
|
||||
|
||||
let curryResult7: _.CurriedFunction1<string, [string, number, boolean]>;
|
||||
let curryResult8: _.CurriedFunction2<number, string, [string, number, boolean]>;
|
||||
let curryResult9: _.CurriedFunction3<boolean, number, string, [string, number, boolean]>;
|
||||
curryResult3 = _.curryRight(testCurry2)(true, 2, "1");
|
||||
curryResult3 = _.curryRight(testCurry2)(true, 2)("1");
|
||||
curryResult3 = _.curryRight(testCurry2)(true)(2, "1");
|
||||
curryResult3 = _.curryRight(testCurry2)(true)(2)("1");
|
||||
curryResult7 = _.curryRight(testCurry2)(true, 2);
|
||||
curryResult7 = _.curryRight(testCurry2)(true)(2);
|
||||
curryResult8 = _.curryRight(testCurry2)(true);
|
||||
curryResult9 = _.curryRight(testCurry2);
|
||||
|
||||
declare var source: any;
|
||||
result = <Function>_.debounce(function () { }, 150);
|
||||
@@ -2403,18 +2426,23 @@ result = <boolean>_([]).lte(2);
|
||||
result = <boolean>_({}).lte(2);
|
||||
|
||||
// _.toPlainObject
|
||||
result = <Object>_.toPlainObject();
|
||||
result = <Object>_.toPlainObject(true);
|
||||
result = <Object>_.toPlainObject(1);
|
||||
result = <Object>_.toPlainObject('a');
|
||||
result = <Object>_.toPlainObject([]);
|
||||
result = <Object>_.toPlainObject({});
|
||||
result = <Object>_(true).toPlainObject();
|
||||
result = <Object>_(1).toPlainObject();
|
||||
result = <Object>_('a').toPlainObject();
|
||||
result = <Object>_([1]).toPlainObject();
|
||||
result = <Object>_<string>([]).toPlainObject();
|
||||
result = <Object>_({}).toPlainObject();
|
||||
module TestToPlainObject {
|
||||
let result: TResult;
|
||||
|
||||
result = _.toPlainObject<TResult>();
|
||||
result = _.toPlainObject<TResult>(true);
|
||||
result = _.toPlainObject<TResult>(1);
|
||||
result = _.toPlainObject<TResult>('a');
|
||||
result = _.toPlainObject<TResult>([]);
|
||||
result = _.toPlainObject<TResult>({});
|
||||
|
||||
result = _(true).toPlainObject<TResult>().value();
|
||||
result = _(1).toPlainObject<TResult>().value();
|
||||
result = _('a').toPlainObject<TResult>().value();
|
||||
result = _([1]).toPlainObject<TResult>().value();
|
||||
result = _<string>([]).toPlainObject<TResult>().value();
|
||||
result = _({}).toPlainObject<TResult>().value();
|
||||
}
|
||||
|
||||
/********
|
||||
* Math *
|
||||
@@ -2424,6 +2452,54 @@ result = <Object>_({}).toPlainObject();
|
||||
result = <number>_.add(1, 1);
|
||||
result = <number>_(1).add(1);
|
||||
|
||||
// _.max
|
||||
module TestMax {
|
||||
let array: number[];
|
||||
let list: _.List<number>;
|
||||
let dictionary: _.Dictionary<number>;
|
||||
|
||||
let listIterator: (value: number, index: number, collection: _.List<number>) => number;
|
||||
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => number;
|
||||
|
||||
let result: number;
|
||||
|
||||
result = _.max<number>(array);
|
||||
result = _.max<number>(array, listIterator);
|
||||
result = _.max<number>(array, listIterator, any);
|
||||
result = _.max<number>(array, '');
|
||||
result = _.max<{a: number}, number>(array, {a: 42});
|
||||
|
||||
result = _.max<number>(list);
|
||||
result = _.max<number>(list, listIterator);
|
||||
result = _.max<number>(list, listIterator, any);
|
||||
result = _.max<number>(list, '');
|
||||
result = _.max<{a: number}, number>(list, {a: 42});
|
||||
|
||||
result = _.max<number>(dictionary);
|
||||
result = _.max<number>(dictionary, dictionaryIterator);
|
||||
result = _.max<number>(dictionary, dictionaryIterator, any);
|
||||
result = _.max<number>(dictionary, '');
|
||||
result = _.max<{a: number}, number>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).max();
|
||||
result = _(array).max(listIterator);
|
||||
result = _(array).max(listIterator, any);
|
||||
result = _(array).max('');
|
||||
result = _(array).max<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).max<number>();
|
||||
result = _(list).max<number>(listIterator);
|
||||
result = _(list).max<number>(listIterator, any);
|
||||
result = _(list).max<number>('');
|
||||
result = _(list).max<{a: number}, number>({a: 42});
|
||||
|
||||
result = _(dictionary).max<number>();
|
||||
result = _(dictionary).max<number>(dictionaryIterator);
|
||||
result = _(dictionary).max<number>(dictionaryIterator, any);
|
||||
result = _(dictionary).max<number>('');
|
||||
result = _(dictionary).max<{a: number}, number>({a: 42});
|
||||
}
|
||||
|
||||
/**********
|
||||
* Number *
|
||||
**********/
|
||||
@@ -2434,6 +2510,24 @@ result = <boolean>_.inRange(4, 8);
|
||||
result = <boolean>_(3).inRange(2, 4);
|
||||
result = <boolean>_(4).inRange(8);
|
||||
|
||||
// _.random
|
||||
module TestRandom {
|
||||
let result: number;
|
||||
|
||||
result = _.random();
|
||||
result = _.random(1);
|
||||
result = _.random(1, 2);
|
||||
result = _.random(1, 2, true);
|
||||
result = _.random(1, true);
|
||||
result = _.random(true);
|
||||
|
||||
result = _(1).random();
|
||||
result = _(1).random(2);
|
||||
result = _(1).random(2, true);
|
||||
result = _(1).random(true);
|
||||
result = _(true).random();
|
||||
}
|
||||
|
||||
/*********
|
||||
* Object *
|
||||
**********/
|
||||
@@ -2911,12 +3005,6 @@ var testAttempFn: TestAttemptFn;
|
||||
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
|
||||
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
|
||||
|
||||
result = <number>_.random(0, 5);
|
||||
result = <number>_.random(5);
|
||||
result = <number>_.random(5, true);
|
||||
result = <number>_.random(1.2, 5.2);
|
||||
result = <number>_.random(0, 5, true);
|
||||
|
||||
// _.noop
|
||||
result = <void>_.noop();
|
||||
result = <void>_.noop(1);
|
||||
|
||||
Vendored
+284
-141
@@ -238,11 +238,6 @@ declare module _ {
|
||||
* @see _.value
|
||||
**/
|
||||
valueOf(): T;
|
||||
|
||||
/**
|
||||
* @see _.toPlainObject
|
||||
*/
|
||||
toPlainObject(): Object;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> extends LoDashWrapperBase<T, LoDashWrapper<T>> { }
|
||||
@@ -4375,117 +4370,6 @@ declare module _ {
|
||||
floor(precision?: number): number;
|
||||
}
|
||||
|
||||
//_.max
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Retrieves the maximum value of a collection. If the collection is empty or falsey -Infinity is
|
||||
* returned. If a callback is provided it will be executed for each value in the collection to
|
||||
* generate the criterion by which the value is ranked. The callback is bound to thisArg and invoked
|
||||
* with three arguments; (value, index, collection).
|
||||
*
|
||||
* If a property name is provided for callback the created "_.pluck" style callback will return the
|
||||
* property value of the given element.
|
||||
*
|
||||
* If an object is provided for callback the created "_.where" style callback will return true for
|
||||
* elements that have the properties of the given object, else false.
|
||||
* @param collection The collection to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return Returns the maximum value.
|
||||
**/
|
||||
max<T>(
|
||||
collection: Array<T>,
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
callback?: DictionaryIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: Array<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: Array<T>,
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: List<T>,
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: Dictionary<T>,
|
||||
whereValue: W): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max(
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max(
|
||||
pluckValue: string): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W>(
|
||||
whereValue: W): LoDashWrapper<T>;
|
||||
}
|
||||
|
||||
//_.min
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -6174,6 +6058,51 @@ declare module _ {
|
||||
|
||||
//_.curry
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
* remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<T1, R>(func: (t1: T1) => R):
|
||||
CurriedFunction1<T1, R>;
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
* remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<T1, T2, R>(func: (t1: T1, t2: T2) => R):
|
||||
CurriedFunction2<T1, T2, R>;
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
* remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R):
|
||||
CurriedFunction3<T1, T2, T3, R>;
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
* remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R):
|
||||
CurriedFunction4<T1, T2, T3, T4, R>;
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
* remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R):
|
||||
CurriedFunction5<T1, T2, T3, T4, T5, R>;
|
||||
/**
|
||||
* Creates a function that accepts one or more arguments of func that when called either invokes func returning
|
||||
* its result, if all func arguments have been provided, or returns a function that accepts one or more of the
|
||||
@@ -6183,8 +6112,43 @@ declare module _ {
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curry<TResult extends Function>(
|
||||
func: Function,
|
||||
arity?: number): TResult;
|
||||
func: Function,
|
||||
arity?: number): TResult;
|
||||
}
|
||||
|
||||
interface CurriedFunction1<T1, R> {
|
||||
(): CurriedFunction1<T1, R>;
|
||||
(t1: T1): R;
|
||||
}
|
||||
|
||||
interface CurriedFunction2<T1, T2, R> {
|
||||
(): CurriedFunction2<T1, T2, R>;
|
||||
(t1: T1): CurriedFunction1<T2, R>;
|
||||
(t1: T1, t2: T2): R;
|
||||
}
|
||||
|
||||
interface CurriedFunction3<T1, T2, T3, R> {
|
||||
(): CurriedFunction3<T1, T2, T3, R>;
|
||||
(t1: T1): CurriedFunction2<T2, T3, R>;
|
||||
(t1: T1, t2: T2): CurriedFunction1<T3, R>;
|
||||
(t1: T1, t2: T2, t3: T3): R;
|
||||
}
|
||||
|
||||
interface CurriedFunction4<T1, T2, T3, T4, R> {
|
||||
(): CurriedFunction4<T1, T2, T3, T4, R>;
|
||||
(t1: T1): CurriedFunction3<T2, T3, T4, R>;
|
||||
(t1: T1, t2: T2): CurriedFunction2<T3, T4, R>;
|
||||
(t1: T1, t2: T2, t3: T3): CurriedFunction1<T4, R>;
|
||||
(t1: T1, t2: T2, t3: T3, t4: T4): R;
|
||||
}
|
||||
|
||||
interface CurriedFunction5<T1, T2, T3, T4, T5, R> {
|
||||
(): CurriedFunction5<T1, T2, T3, T4, T5, R>;
|
||||
(t1: T1): CurriedFunction4<T2, T3, T4, T5, R>;
|
||||
(t1: T1, t2: T2): CurriedFunction3<T3, T4, T5, R>;
|
||||
(t1: T1, t2: T2, t3: T3): CurriedFunction2<T4, T5, R>;
|
||||
(t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1<T5, R>;
|
||||
(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
@@ -6196,6 +6160,46 @@ declare module _ {
|
||||
|
||||
//_.curryRight
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<T1, R>(func: (t1: T1) => R):
|
||||
CurriedFunction1<T1, R>;
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<T1, T2, R>(func: (t1: T1, t2: T2) => R):
|
||||
CurriedFunction2<T2, T1, R>;
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R):
|
||||
CurriedFunction3<T3, T2, T1, R>;
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R):
|
||||
CurriedFunction4<T4, T3, T2, T1, R>;
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
* @param func The function to curry.
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R):
|
||||
CurriedFunction5<T5, T4, T3, T2, T1, R>;
|
||||
/**
|
||||
* This method is like _.curry except that arguments are applied to func in the manner of _.partialRight
|
||||
* instead of _.partial.
|
||||
@@ -6204,8 +6208,8 @@ declare module _ {
|
||||
* @return Returns the new curried function.
|
||||
*/
|
||||
curryRight<TResult extends Function>(
|
||||
func: Function,
|
||||
arity?: number): TResult;
|
||||
func: Function,
|
||||
arity?: number): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
@@ -7180,10 +7184,18 @@ declare module _ {
|
||||
/**
|
||||
* Converts value to a plain object flattening inherited enumerable properties of value to own properties
|
||||
* of the plain object.
|
||||
*
|
||||
* @param value The value to convert.
|
||||
* @return Returns the converted plain object.
|
||||
*/
|
||||
toPlainObject(value?: any): Object;
|
||||
toPlainObject<TResult extends {}>(value?: any): TResult;
|
||||
}
|
||||
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.toPlainObject
|
||||
*/
|
||||
toPlainObject<TResult extends {}>(): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
/********
|
||||
@@ -7208,6 +7220,110 @@ declare module _ {
|
||||
add(addend: number): number;
|
||||
}
|
||||
|
||||
//_.max
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee
|
||||
* function is provided it’s invoked for each value in collection to generate the criterion by which the value
|
||||
* is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection).
|
||||
*
|
||||
* If a property name is provided for iteratee the created _.property style callback returns the property value
|
||||
* of the given element.
|
||||
*
|
||||
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
|
||||
* elements that have a matching property value, else false.
|
||||
*
|
||||
* If an object is provided for iteratee the created _.matches style callback returns true for elements that
|
||||
* have the properties of the given object, else false.
|
||||
*
|
||||
* @param collection The collection to iterate over.
|
||||
* @param iteratee The function invoked per iteration.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns the maximum value.
|
||||
*/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
iteratee?: ListIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
iteratee?: DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
collection: List<T>|Dictionary<T>,
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}, T>(
|
||||
collection: List<T>|Dictionary<T>,
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max(
|
||||
iteratee?: ListIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max(
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}>(
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
iteratee?: ListIterator<T, any>|DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}, T>(
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
/**********
|
||||
* Number *
|
||||
**********/
|
||||
@@ -7243,6 +7359,53 @@ declare module _ {
|
||||
inRange(end: number): boolean;
|
||||
}
|
||||
|
||||
//_.random
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Produces a random number between min and max (inclusive). If only one argument is provided a number between
|
||||
* 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point
|
||||
* number is returned instead of an integer.
|
||||
*
|
||||
* @param min The minimum possible value.
|
||||
* @param max The maximum possible value.
|
||||
* @param floating Specify returning a floating-point number.
|
||||
* @return Returns the random number.
|
||||
*/
|
||||
random(
|
||||
min?: number,
|
||||
max?: number,
|
||||
floating?: boolean
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
*/
|
||||
random(
|
||||
min?: number,
|
||||
floating?: boolean
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
*/
|
||||
random(floating?: boolean): number;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.random
|
||||
*/
|
||||
random(
|
||||
max?: number,
|
||||
floating?: boolean
|
||||
): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
*/
|
||||
random(floating?: boolean): number;
|
||||
}
|
||||
|
||||
/**********
|
||||
* Object *
|
||||
**********/
|
||||
@@ -9415,26 +9578,6 @@ declare module _ {
|
||||
step?: number): LoDashArrayWrapper<number>;
|
||||
}
|
||||
|
||||
//_.random
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Produces a random number between min and max (inclusive). If only one argument is provided a
|
||||
* number between 0 and the given number will be returned. If floating is truey or either min or
|
||||
* max are floats a floating-point number will be returned instead of an integer.
|
||||
* @param max The maximum possible value.
|
||||
* @param floating Specify returning a floating-point number.
|
||||
* @return A random number.
|
||||
**/
|
||||
random(max: number, floating?: boolean): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
* @param min The minimum possible value.
|
||||
* @return A random number between `min` and `max`.
|
||||
**/
|
||||
random(min: number, max: number, floating?: boolean): number;
|
||||
}
|
||||
|
||||
//_.runInContext
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import Long = require("long");
|
||||
|
||||
var val: Long;
|
||||
var val: dcodeIO.Long;
|
||||
var n: number = 42;
|
||||
var b: boolean = true;
|
||||
var s: string = "1337";
|
||||
|
||||
Vendored
+64
-61
@@ -3,70 +3,73 @@
|
||||
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "long" {
|
||||
declare module dcodeIO {
|
||||
interface LongStatic {
|
||||
new (low: number, high?: number, unsigned?: boolean): Long;
|
||||
|
||||
module Long {
|
||||
export var MAX_UNSIGNED_VALUE: Long;
|
||||
export var MAX_VALUE: Long;
|
||||
export var MIN_VALUE: Long;
|
||||
export var NEG_ONE: Long;
|
||||
export var ONE: Long;
|
||||
export var UONE: Long;
|
||||
export var UZERO: Long;
|
||||
export var ZERO: Long;
|
||||
MAX_UNSIGNED_VALUE: Long;
|
||||
MAX_VALUE: Long;
|
||||
MIN_VALUE: Long;
|
||||
NEG_ONE: Long;
|
||||
ONE: Long;
|
||||
UONE: Long;
|
||||
UZERO: Long;
|
||||
ZERO: Long;
|
||||
|
||||
export function fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
||||
export function fromInt(value: number, unsigned?: boolean): Long;
|
||||
export function fromNumber(value: number, unsigned?: boolean): Long;
|
||||
export function fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
|
||||
export function fromValue(val: Long | number | string): Long;
|
||||
fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
||||
fromInt(value: number, unsigned?: boolean): Long;
|
||||
fromNumber(value: number, unsigned?: boolean): Long;
|
||||
fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
|
||||
fromValue(val: Long | number | string): Long;
|
||||
isLong(obj: any): boolean;
|
||||
}
|
||||
|
||||
export function isLong(obj: any): boolean;
|
||||
}
|
||||
interface Long {
|
||||
high: number;
|
||||
low: number;
|
||||
unsigned: boolean;
|
||||
|
||||
class Long {
|
||||
high: number;
|
||||
low: number;
|
||||
unsigned :boolean;
|
||||
add(other: Long | number | string): Long;
|
||||
and(other: Long | number | string): Long;
|
||||
compare(other: Long | number | string): number;
|
||||
div(divisor: Long | number | string): Long;
|
||||
equals(other: Long | number | string): boolean;
|
||||
getHighBits(): number;
|
||||
getHighBitsUnsigned(): number;
|
||||
getLowBits(): number;
|
||||
getLowBitsUnsigned(): number;
|
||||
getNumBitsAbs(): number;
|
||||
greaterThan(other: Long | number | string): boolean;
|
||||
greaterThanOrEqual(other: Long | number | string): boolean;
|
||||
isEven(): boolean;
|
||||
isNegative(): boolean;
|
||||
isOdd(): boolean;
|
||||
isPositive(): boolean;
|
||||
isZero(): boolean;
|
||||
lessThan(other: Long | number | string): boolean;
|
||||
lessThanOrEqual(other: Long | number | string): boolean;
|
||||
modulo(divisor: Long | number | string): Long;
|
||||
multiply(multiplier: Long | number | string): Long;
|
||||
negate(): Long;
|
||||
not(): Long;
|
||||
notEquals(other: Long | number | string): boolean;
|
||||
or(other: Long | number | string): Long;
|
||||
shiftLeft(numBits: number | Long): Long;
|
||||
shiftRight(numBits: number | Long): Long;
|
||||
shiftRightUnsigned(numBits: number | Long): Long;
|
||||
subtract(other: Long | number | string): Long;
|
||||
toInt(): number;
|
||||
toNumber(): number;
|
||||
toSigned(): Long;
|
||||
toString(radix?: number): string;
|
||||
toUnsigned(): Long;
|
||||
xor(other: Long | number | string): Long;
|
||||
}
|
||||
|
||||
constructor(low: number, high?: number, unsigned?:boolean);
|
||||
|
||||
add(other: Long | number | string): Long;
|
||||
and(other: Long | number | string): Long;
|
||||
compare(other: Long | number | string): number;
|
||||
div(divisor: Long | number | string): Long;
|
||||
equals(other: Long | number | string): boolean;
|
||||
getHighBits(): number;
|
||||
getHighBitsUnsigned(): number;
|
||||
getLowBits(): number;
|
||||
getLowBitsUnsigned(): number;
|
||||
getNumBitsAbs(): number;
|
||||
greaterThan(other: Long | number | string): boolean;
|
||||
greaterThanOrEqual(other: Long | number | string): boolean;
|
||||
isEven(): boolean;
|
||||
isNegative(): boolean;
|
||||
isOdd(): boolean;
|
||||
isPositive(): boolean;
|
||||
isZero(): boolean;
|
||||
lessThan(other: Long | number | string): boolean;
|
||||
lessThanOrEqual(other: Long | number | string): boolean;
|
||||
modulo(divisor: Long | number | string): Long;
|
||||
multiply(multiplier: Long | number | string): Long;
|
||||
negate(): Long;
|
||||
not(): Long;
|
||||
notEquals(other: Long | number | string): boolean;
|
||||
or(other: Long | number | string): Long;
|
||||
shiftLeft(numBits: number | Long): Long;
|
||||
shiftRight(numBits: number | Long): Long;
|
||||
shiftRightUnsigned(numBits: number | Long): Long;
|
||||
subtract(other: Long | number | string): Long;
|
||||
toInt(): number;
|
||||
toNumber(): number;
|
||||
toSigned(): Long;
|
||||
toString(radix?: number): string;
|
||||
toUnsigned(): Long;
|
||||
xor(other: Long | number | string): Long;
|
||||
}
|
||||
|
||||
export = Long;
|
||||
export var Long: LongStatic;
|
||||
}
|
||||
|
||||
declare module "long" {
|
||||
var Long: dcodeIO.LongStatic;
|
||||
export = Long;
|
||||
}
|
||||
Vendored
+4
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Moment.js 2.10.6
|
||||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -303,7 +303,7 @@ declare module moment {
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
set(input: MomentInput): Moment;
|
||||
set(objectLiteral: MomentInput): Moment;
|
||||
}
|
||||
|
||||
type formatFunction = () => string;
|
||||
@@ -454,8 +454,8 @@ declare module moment {
|
||||
weekdaysMin(format: string): string[];
|
||||
weekdaysMin(format: string, index: number): string;
|
||||
|
||||
min(moments: Moment[]): Moment;
|
||||
max(moments: Moment[]): Moment;
|
||||
min(...moments: Moment[]): Moment;
|
||||
max(...moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string): number|boolean;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path="./react-input-calendar.d.ts"/>
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
|
||||
import * as ReactInputCalendar from 'react-input-calendar';
|
||||
import * as React from 'react';
|
||||
React.render(<ReactInputCalendar />, document.body);
|
||||
@@ -0,0 +1 @@
|
||||
--target es5 --noImplicitAny --experimentalDecorators --jsx react
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// Type definitions for react-input-calendar
|
||||
// Project: https://github.com/Rudeg/react-input-calendar
|
||||
// Definitions by: Stepan Mikhaylyuk <https://github.com/stepancar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
declare module reactInputCalendar {
|
||||
export interface ReactInputCalendarProps {
|
||||
/**
|
||||
* Format of date, which display in input and set in date property.
|
||||
* Allowed Keys: All formats supported by moment.js
|
||||
* @default 'MM-DD-YYYY'
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Set initial date value
|
||||
* @default current date
|
||||
*/
|
||||
date?: string | Date;
|
||||
/**
|
||||
* Set minimal view. Values:
|
||||
* 0 - days
|
||||
* 1 - months
|
||||
* 2 - years.
|
||||
* @default 0 (DaysView)
|
||||
*/
|
||||
minView?: number;
|
||||
/**
|
||||
* Format of date for the onChange event. Default on the date format (ISO 8601) to ease the save of data.
|
||||
* Allowed Keys: All formats supported by moment.js
|
||||
* @default 'MM-DD-YYYY'
|
||||
*/
|
||||
computableFormat?: string;
|
||||
/**
|
||||
* Set an function that will be triggered whenever there is a change in the selected date. It will return the date in the props.computableFormat format.
|
||||
*/
|
||||
onChange?:(selectedDate: string)=>any;
|
||||
/**
|
||||
* Define state when date picker would close once the user has clicked on a date.
|
||||
*/
|
||||
closeOnSelect?:boolean;
|
||||
/**
|
||||
* Setting this value to true makes the calendar widget open when the iput field is focused.
|
||||
*/
|
||||
openOnInputFocus?: boolean;
|
||||
/**
|
||||
* Value to show in the input text box if no date is set.
|
||||
*/
|
||||
placeholder?:string
|
||||
}
|
||||
interface ReactInputCalendarState { }
|
||||
export class ReactInputCalendar extends __React.Component<ReactInputCalendarProps, ReactInputCalendarState>{
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
}
|
||||
declare var ReactInputCalendar: typeof reactInputCalendar.ReactInputCalendar
|
||||
declare module "react-input-calendar" {
|
||||
export = ReactInputCalendar
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="roslib.d.ts" />
|
||||
|
||||
var ros = new ROSLIB.Ros({url: "http://localhost:9090"});
|
||||
|
||||
ros.on('error', function(event) {
|
||||
//do nothing
|
||||
});
|
||||
|
||||
var service = new ROSLIB.Service({
|
||||
ros: ros,
|
||||
name: '/service_name',
|
||||
serviceType: 'service_type'
|
||||
});
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for roslib.js
|
||||
// Project: http://wiki.ros.org/roslibjs
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ROSLIB {
|
||||
export class Ros {
|
||||
constructor(data: {
|
||||
url: string
|
||||
});
|
||||
|
||||
on(eventName: string, callback: (event: any) => void) : void;
|
||||
connect(url: string) : void;
|
||||
}
|
||||
|
||||
|
||||
export class Service {
|
||||
constructor(data: {
|
||||
ros: Ros,
|
||||
name: string,
|
||||
serviceType: string
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,10 @@ module SigmaJsTests {
|
||||
sigma.canvas.edges['def'] = function() {};
|
||||
sigma.svg.nodes['def'] = {create: (obj: SigmaJs.Node) => { return new Element(); },
|
||||
update: (obj: SigmaJs.Node) => { return; }};
|
||||
sigma.svg.edges['def'] = {create: (obj: SigmaJs.Edge) => { return new Element(); },
|
||||
update: (obj: SigmaJs.Edge) => { return; }};
|
||||
sigma.svg.edges.labels['def'] = {create: (obj: SigmaJs.Edge) => { return new Element(); },
|
||||
update: (obj: SigmaJs.Edge) => { return; }};
|
||||
|
||||
var N = 100;
|
||||
var E = 500;
|
||||
|
||||
Vendored
+8
-1
@@ -287,11 +287,18 @@ declare module SigmaJs{
|
||||
}
|
||||
|
||||
interface SVG {
|
||||
edges: {[renderType: string]: SVGObject<SigmaJs.Edge>};
|
||||
edges: {
|
||||
labels: SVGEdgeLabels;
|
||||
[renderType: string]: SVGObject<SigmaJs.Edge> | SVGEdgeLabels;
|
||||
};
|
||||
labels: {[renderType: string]: SVGObject<SigmaJs.Node>};
|
||||
nodes: {[renderType: string]: SVGObject<SigmaJs.Node>};
|
||||
}
|
||||
|
||||
interface SVGEdgeLabels {
|
||||
[renderType: string]: SVGObject<SigmaJs.Edge>;
|
||||
}
|
||||
|
||||
interface SVGObject<T> {
|
||||
create: (object: T, ...a:any[]) => Element;
|
||||
update: (object: T, ...a:any[]) => void;
|
||||
|
||||
Executable
+299
@@ -0,0 +1,299 @@
|
||||
// Examples from project repo used for tests.
|
||||
|
||||
/// <reference path="sortablejs.d.ts" />
|
||||
|
||||
var simpleList = document.getElementById('list');
|
||||
var list = simpleList;
|
||||
var el = document.getElementById('el');
|
||||
var sortable = new Sortable(simpleList, {});
|
||||
var order = sortable.toArray();
|
||||
var angular: any;
|
||||
var Ply: any;
|
||||
|
||||
sortable.sort(order.reverse());
|
||||
|
||||
Sortable.create(list, {
|
||||
delay: 500,
|
||||
chosenClass: "chosen"
|
||||
});
|
||||
|
||||
Sortable.create(el, {
|
||||
handle: ".my-handle"
|
||||
});
|
||||
|
||||
Sortable.create(list, {
|
||||
filter: ".js-remove, .js-edit",
|
||||
onFilter: function(event) {
|
||||
var item = event.item,
|
||||
control = event.target;
|
||||
|
||||
if (Sortable.utils.is(control, ".js-remove")) {
|
||||
item.parentNode.removeChild(item);
|
||||
}
|
||||
else if (Sortable.utils.is(control, ".js-edit")) {
|
||||
// ..
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Sortable.create(el, {
|
||||
group: "localStorage-example",
|
||||
store: {
|
||||
get: function(sortable) {
|
||||
var order = localStorage.getItem(sortable.options.group);
|
||||
|
||||
return order ? order.split('|') : [];
|
||||
},
|
||||
set: function(sortable) {
|
||||
var order = sortable.toArray();
|
||||
|
||||
localStorage.setItem(sortable.options.group, order.join('|'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Sortable.create(simpleList, {
|
||||
forceFallback: true
|
||||
});
|
||||
|
||||
Sortable.create(simpleList, {
|
||||
ghostClass: 'ghost'
|
||||
});
|
||||
|
||||
simpleList.innerHTML = Array.apply(null, new Array(100)).map(function(value: any, iterator: number) {
|
||||
return `<div class="list-group-item">item ${iterator + 1}</div>`;
|
||||
}).join('');
|
||||
|
||||
Sortable.create(simpleList, {
|
||||
delay: 500,
|
||||
chosenClass: 'chosen'
|
||||
});
|
||||
|
||||
simpleList.innerHTML = Array.apply(null, new Array(10)).map(function(value: any, iterator: number) {
|
||||
return '<div class="list-group-item">item ' +
|
||||
(iterator + 1) +
|
||||
'</div>';
|
||||
}).join('');
|
||||
|
||||
Sortable.create(simpleList, {});
|
||||
|
||||
simpleList.innerHTML = Array.apply(null, new Array(100)).map(function(value: any, iterator: number) {
|
||||
return '<div class="list-group-item">item ' +
|
||||
(iterator + 1) +
|
||||
'</div>';
|
||||
}).join('');
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var byId = function(id: string) { return document.getElementById(id); },
|
||||
|
||||
loadScripts = function(desc: any, callback: any) {
|
||||
var deps: string[] = [];
|
||||
var key: string;
|
||||
var idx = 0;
|
||||
|
||||
for (key in desc) {
|
||||
deps.push(key);
|
||||
}
|
||||
|
||||
(function _next() {
|
||||
var pid: number,
|
||||
name = deps[idx],
|
||||
script = document.createElement('script');
|
||||
|
||||
script.type = 'text/javascript';
|
||||
script.src = desc[deps[idx]];
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
})()
|
||||
},
|
||||
|
||||
console = window.console;
|
||||
|
||||
|
||||
if (!console.log) {
|
||||
console.log = function() {
|
||||
alert([].join.apply(arguments, ' '));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Sortable.create(byId('foo'), {
|
||||
group: "words",
|
||||
animation: 150,
|
||||
store: {
|
||||
get: function(sortable) {
|
||||
var order = localStorage.getItem(sortable.options.group);
|
||||
return order ? order.split('|') : [];
|
||||
},
|
||||
set: function(sortable) {
|
||||
var order = sortable.toArray();
|
||||
localStorage.setItem(sortable.options.group, order.join('|'));
|
||||
}
|
||||
},
|
||||
onAdd: function(evt) { console.log('onAdd.foo:', [evt.item, evt.from]); },
|
||||
onUpdate: function(evt) { console.log('onUpdate.foo:', [evt.item, evt.from]); },
|
||||
onRemove: function(evt) { console.log('onRemove.foo:', [evt.item, evt.from]); },
|
||||
onStart: function(evt) { console.log('onStart.foo:', [evt.item, evt.from]); },
|
||||
onSort: function(evt) { console.log('onStart.foo:', [evt.item, evt.from]); },
|
||||
onEnd: function(evt) { console.log('onEnd.foo:', [evt.item, evt.from]); }
|
||||
});
|
||||
|
||||
|
||||
Sortable.create(byId('bar'), {
|
||||
group: "words",
|
||||
animation: 150,
|
||||
onAdd: function(evt) { console.log('onAdd.bar:', evt.item); },
|
||||
onUpdate: function(evt) { console.log('onUpdate.bar:', evt.item); },
|
||||
onRemove: function(evt) { console.log('onRemove.bar:', evt.item); },
|
||||
onStart: function(evt) { console.log('onStart.foo:', evt.item); },
|
||||
onEnd: function(evt) { console.log('onEnd.foo:', evt.item); }
|
||||
});
|
||||
|
||||
|
||||
// Multi groups
|
||||
Sortable.create(byId('multi'), {
|
||||
animation: 150,
|
||||
draggable: '.tile',
|
||||
handle: '.tile__name'
|
||||
});
|
||||
|
||||
[].forEach.call(byId('multi').getElementsByClassName('tile__list'), function(el: any) {
|
||||
Sortable.create(el, {
|
||||
group: 'photo',
|
||||
animation: 150
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Editable list
|
||||
var editableList = Sortable.create(byId('editable'), {
|
||||
animation: 150,
|
||||
filter: '.js-remove',
|
||||
onFilter: function(evt) {
|
||||
evt.item.parentNode.removeChild(evt.item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
byId('addUser').onclick = function() {
|
||||
Ply.dialog('prompt', {
|
||||
title: 'Add',
|
||||
form: { name: 'name' }
|
||||
}).done(function(ui: any) {
|
||||
var el = document.createElement('li');
|
||||
el.innerHTML = ui.data.name + '<i class="js-remove">✖</i>';
|
||||
editableList.el.appendChild(el);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Advanced groups
|
||||
[{
|
||||
name: 'advanced',
|
||||
pull: true,
|
||||
put: true
|
||||
},
|
||||
{
|
||||
name: 'advanced',
|
||||
pull: 'clone',
|
||||
put: false
|
||||
}, {
|
||||
name: 'advanced',
|
||||
pull: false,
|
||||
put: true
|
||||
}].forEach(function(groupOpts, i) {
|
||||
Sortable.create(byId('advanced-' + (i + 1)), {
|
||||
sort: (i != 1),
|
||||
group: groupOpts,
|
||||
animation: 150
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 'handle' option
|
||||
Sortable.create(byId('handle-1'), {
|
||||
handle: '.drag-handle',
|
||||
animation: 150
|
||||
});
|
||||
|
||||
|
||||
// Angular example
|
||||
angular.module('todoApp', ['ng-sortable'])
|
||||
.constant('ngSortableConfig', {
|
||||
onEnd: function() {
|
||||
console.log('default onEnd()');
|
||||
}
|
||||
})
|
||||
.controller('TodoController', ['$scope', function($scope: any) {
|
||||
$scope.todos = [
|
||||
{ text: 'learn angular', done: true },
|
||||
{ text: 'build an angular app', done: false }
|
||||
];
|
||||
|
||||
$scope.addTodo = function() {
|
||||
$scope.todos.push({ text: $scope.todoText, done: false });
|
||||
$scope.todoText = '';
|
||||
};
|
||||
|
||||
$scope.remaining = function() {
|
||||
var count = 0;
|
||||
angular.forEach($scope.todos, function(todo: any) {
|
||||
count += todo.done ? 0 : 1;
|
||||
});
|
||||
return count;
|
||||
};
|
||||
|
||||
$scope.archive = function() {
|
||||
var oldTodos = $scope.todos;
|
||||
$scope.todos = [];
|
||||
angular.forEach(oldTodos, function(todo: any) {
|
||||
if (!todo.done) $scope.todos.push(todo);
|
||||
});
|
||||
};
|
||||
}])
|
||||
.controller('TodoControllerNext', ['$scope', function($scope: any) {
|
||||
$scope.todos = [
|
||||
{ text: 'learn Sortable', done: true },
|
||||
{ text: 'use ng-sortable', done: false },
|
||||
{ text: 'Enjoy', done: false }
|
||||
];
|
||||
|
||||
$scope.remaining = function() {
|
||||
var count = 0;
|
||||
angular.forEach($scope.todos, function(todo: any) {
|
||||
count += todo.done ? 0 : 1;
|
||||
});
|
||||
return count;
|
||||
};
|
||||
|
||||
$scope.sortableConfig = { group: 'todo', animation: 150 };
|
||||
'Start End Add Update Remove Sort'.split(' ').forEach(function(name: string) {
|
||||
$scope.sortableConfig['on' + name] = console.log.bind(console, name);
|
||||
});
|
||||
}]);
|
||||
})();
|
||||
|
||||
// Background
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
function setNoiseBackground(el: any, width: number, height: number, opacity: number) {
|
||||
var canvas = document.createElement("canvas");
|
||||
var context = canvas.getContext("2d");
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
for (var i = 0; i < width; i++) {
|
||||
for (var j = 0; j < height; j++) {
|
||||
var val = Math.floor(Math.random() * 255);
|
||||
context.fillStyle = "rgba(" + val + "," + val + "," + val + "," + opacity + ")";
|
||||
context.fillRect(i, j, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
el.style.background = "url(" + canvas.toDataURL("image/png") + ")";
|
||||
}
|
||||
|
||||
setNoiseBackground(document.getElementsByTagName('body')[0], 50, 50, 0.02);
|
||||
}, false);
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
// Type definitions for Sortable.js v1.3.0-rc1
|
||||
// Project: https://github.com/RubaXa/Sortable
|
||||
// Definitions by: Maw-Fox <github.com/Maw-Fox>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Sortablejs {
|
||||
interface SortableOptions {
|
||||
group?: any;
|
||||
sort?: boolean;
|
||||
delay?: number;
|
||||
disabled?: boolean;
|
||||
store?: {
|
||||
get: (sortable: Sortable) => any[];
|
||||
set: (sortable: Sortable) => any;
|
||||
};
|
||||
animation?: number;
|
||||
handle?: string;
|
||||
filter?: any;
|
||||
draggable?: string;
|
||||
ghostClass?: string;
|
||||
chosenClass?: string;
|
||||
dataIdAttr?: string;
|
||||
forceFallback?: boolean;
|
||||
fallbackClass?: string;
|
||||
fallbackOnBody?: boolean;
|
||||
scroll?: boolean;
|
||||
scrollSensitivity?: number;
|
||||
scrollSpeed?: number;
|
||||
setData?: (dataTransfer: any, draggedElement: any) => any;
|
||||
onStart?: (event: any) => any;
|
||||
onEnd?: (event: any) => any;
|
||||
onAdd?: (event: any) => any;
|
||||
onUpdate?: (event: any) => any;
|
||||
onSort?: (event: any) => any;
|
||||
onRemove?: (event: any) => any;
|
||||
onFilter?: (event: any) => any;
|
||||
onMove?: (event: any) => boolean;
|
||||
}
|
||||
|
||||
interface SortableUtils {
|
||||
/**
|
||||
* Attach an event handler function
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} event an Event context.
|
||||
* @param {Function} fn
|
||||
*/
|
||||
on(element: any, event: string, fn: (event: any) => any): void;
|
||||
|
||||
/**
|
||||
* Remove an event handler function
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} event an Event context.
|
||||
* @param {Function} fn a callback.
|
||||
*/
|
||||
off(element: any, event: string, fn: (event: any) => any): void;
|
||||
|
||||
/**
|
||||
* Get the values of all the CSS properties.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @returns {Object}
|
||||
*/
|
||||
css(element: any): any;
|
||||
|
||||
/**
|
||||
* Get the value of style properties.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} prop a property key.
|
||||
* @returns {*}
|
||||
*/
|
||||
css(element: any, prop: string): any;
|
||||
|
||||
/**
|
||||
* Set one CSS property.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} prop a property key.
|
||||
* @param {string} value a property value.
|
||||
*/
|
||||
css(element: any, prop: string, value: string): void;
|
||||
|
||||
/**
|
||||
* Set CSS properties.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {Object} props a properties object.
|
||||
*/
|
||||
css(element: any, props: any): void;
|
||||
|
||||
/**
|
||||
* Get elements by tag name.
|
||||
* @param {HTMLElement} context an HTMLElement.
|
||||
* @param {string} tagName A tag name.
|
||||
* @param {function} [iterator] An iterator.
|
||||
* @returns {HTMLElement[]}
|
||||
*/
|
||||
find(context: any, tagName: string, iterator?: (value: any) => any): any[];
|
||||
|
||||
/**
|
||||
* Takes a function and returns a new one that will always have a particular context.
|
||||
* @param {*} context an HTMLElement.
|
||||
* @param {function} fn a function.
|
||||
* @returns {function}
|
||||
*/
|
||||
bind(context: any, fn: () => any): () => any;
|
||||
|
||||
/**
|
||||
* Check the current matched set of elements against a selector.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} selector an element selector.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
is(element: any, selector: string): boolean;
|
||||
|
||||
/**
|
||||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} selector an element seletor.
|
||||
* @param {HTMLElement} [context] a specific element's context.
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
closest(element: any, selector: string, context?: any): any;
|
||||
|
||||
/**
|
||||
* Add or remove one classes from each element
|
||||
* @param {HTMLElement} element an HTMLElement.
|
||||
* @param {string} name a class name.
|
||||
* @param {boolean} state a class's state.
|
||||
*/
|
||||
toggleClass(element: any, name: string, state: boolean): void;
|
||||
}
|
||||
|
||||
class DOMRect {
|
||||
public bottom: number;
|
||||
public height: number;
|
||||
public left: number;
|
||||
public right: number;
|
||||
public top: number;
|
||||
public width: number;
|
||||
public x: number;
|
||||
public y: number;
|
||||
}
|
||||
|
||||
class Sortable {
|
||||
public options: SortableOptions;
|
||||
public el: any;
|
||||
|
||||
/**
|
||||
* Sortable's main constructor.
|
||||
* @param {HTMLElement} element Any variety of HTMLElement.
|
||||
* @param {SortableOptions} options Sortable options object.
|
||||
*/
|
||||
constructor(element: any, options: SortableOptions);
|
||||
|
||||
static active: Sortable;
|
||||
static utils: SortableUtils;
|
||||
|
||||
/**
|
||||
* Creation of new instances.
|
||||
* @param {HTMLElement} element Any variety of HTMLElement.
|
||||
* @param {SortableOptions} options Sortable options object.
|
||||
* @returns {Sortable}
|
||||
*/
|
||||
static create(element: any, options: SortableOptions): Sortable;
|
||||
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param {string} name a SortableOptions property.
|
||||
* @param {*} [value] a Value.
|
||||
* @returns {*}
|
||||
*/
|
||||
option(name: string, value: any): any;
|
||||
option(name: string): any;
|
||||
|
||||
/**
|
||||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
||||
* @param {string|HTMLElement} element an HTMLElement or selector string.
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
closest(element: any): any;
|
||||
|
||||
/**
|
||||
* Sorts the elements according to the array.
|
||||
* @param {string[]} order an array of strings to sort.
|
||||
*/
|
||||
sort(order: string[]): void;
|
||||
|
||||
/**
|
||||
* Saving and restoring of the sort.
|
||||
*/
|
||||
save(): void;
|
||||
|
||||
/**
|
||||
* Removes the sortable functionality completely.
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Serializes the sortable's item data-id's (dataIdAttr option) into an array of string.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
toArray(): string[];
|
||||
}
|
||||
}
|
||||
|
||||
import Sortable = Sortablejs.Sortable;
|
||||
|
||||
declare module 'Sortable' {
|
||||
import Sortable = Sortablejs.Sortable;
|
||||
export = Sortable;
|
||||
}
|
||||
Vendored
+23
@@ -483,6 +483,10 @@ declare module uiGrid {
|
||||
* use gridOptions.appScopeProvider to override the default assignment of $scope.$parent with any reference
|
||||
*/
|
||||
appScope?: ng.IScope;
|
||||
/**
|
||||
* returns an array of columns in the grid
|
||||
*/
|
||||
columns: Array<IGridColumn>;
|
||||
/**
|
||||
* returns the total column footer height
|
||||
*/
|
||||
@@ -718,6 +722,25 @@ declare module uiGrid {
|
||||
* @default 4
|
||||
*/
|
||||
horizontalScrollThreshold?: number;
|
||||
/**
|
||||
* Number of rows from the end of the dataset
|
||||
* at which infinite scroll will trigger a request
|
||||
* for more data
|
||||
* @default 20
|
||||
*/
|
||||
infiniteScrollRowsFromEnd?: number;
|
||||
/**
|
||||
* Inform the grid of whether there are rows
|
||||
* to load when scrolling up
|
||||
* @default false
|
||||
*/
|
||||
infiniteScrollUp?: boolean,
|
||||
/**
|
||||
* Inform the grid of whether there are rows
|
||||
* to load scrolling down
|
||||
* @default true
|
||||
*/
|
||||
infiniteScrollDown?: boolean,
|
||||
/**
|
||||
* Defaults to 200
|
||||
* @default 200
|
||||
|
||||
Reference in New Issue
Block a user