mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
+122
-41
@@ -1,10 +1,87 @@
|
||||
// Test file for goJS.d.ts
|
||||
// This is taken from http://gojs.net/latest/samples/basic.html
|
||||
// This is taken and adapted from http://gojs.net/latest/samples/basic.html
|
||||
|
||||
/* Copyright (C) 1998-2015 by Northwoods Software Corporation. */
|
||||
/* Copyright (C) 1998-2016 by Northwoods Software Corporation. */
|
||||
|
||||
/// <reference path="goJS.d.ts" />
|
||||
|
||||
class CustomLink extends go.Link {
|
||||
constructor() {
|
||||
super();
|
||||
this.routing = go.Link.Orthogonal;
|
||||
}
|
||||
|
||||
hasCurviness(): boolean {
|
||||
if (isNaN(this.curviness)) return true;
|
||||
return super.hasCurviness();
|
||||
}
|
||||
|
||||
computeCurviness(): number {
|
||||
if (isNaN(this.curviness)) {
|
||||
var links = this.fromNode.findLinksTo(this.toNode);
|
||||
if (links.count < 2) return 0;
|
||||
var i = 0;
|
||||
while (links.next()) { if (links.value === this) break; i++; }
|
||||
return 10 * (i - (links.count - 1) / 2);
|
||||
}
|
||||
return super.computeCurviness();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTreeLayout extends go.TreeLayout {
|
||||
constructor() {
|
||||
super();
|
||||
this.extraProp = 3;
|
||||
}
|
||||
|
||||
extraProp: number;
|
||||
|
||||
// override various methods
|
||||
|
||||
cloneProtected(copy: CustomTreeLayout): void {
|
||||
super.cloneProtected(copy);
|
||||
copy.extraProp = this.extraProp;
|
||||
}
|
||||
|
||||
createNetwork(): CustomTreeNetwork {
|
||||
return new CustomTreeNetwork();
|
||||
}
|
||||
|
||||
assignTreeVertexValues(v: CustomTreeVertex): void {
|
||||
super.assignTreeVertexValues(v);
|
||||
v.someProp = Math.random() * 100;
|
||||
}
|
||||
|
||||
commitNodes(): void {
|
||||
super.commitNodes();
|
||||
// ...
|
||||
}
|
||||
|
||||
commitLinks(): void {
|
||||
super.commitLinks();
|
||||
this.network.edges.each(e => { e.link.path.strokeWidth = (<CustomTreeEdge>(e)).anotherProp; });
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTreeNetwork extends go.TreeNetwork {
|
||||
createVertex(): CustomTreeVertex {
|
||||
return new CustomTreeVertex();
|
||||
}
|
||||
|
||||
createEdge(): CustomTreeEdge {
|
||||
return new CustomTreeEdge();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTreeVertex extends go.TreeVertex {
|
||||
someProp: number = 17;
|
||||
}
|
||||
|
||||
class CustomTreeEdge extends go.TreeEdge {
|
||||
anotherProp: number = 1;
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
var $ = go.GraphObject.make; // for conciseness in defining templates
|
||||
|
||||
@@ -20,6 +97,8 @@ function init() {
|
||||
// allow Ctrl-G to call groupSelection()
|
||||
"commandHandler.archetypeGroupData": { text: "Group", isGroup: true, color: "blue" },
|
||||
|
||||
layout: $(CustomTreeLayout, { angle: 90 }),
|
||||
|
||||
// enable undo & redo
|
||||
"undoManager.isEnabled": true
|
||||
});
|
||||
@@ -30,19 +109,19 @@ function init() {
|
||||
|
||||
// To simplify this code we define a function for creating a context menu button:
|
||||
function makeButton(text: string, action: (e: go.InputEvent, obj: go.GraphObject) => void, visiblePredicate?: (obj: go.GraphObject) => boolean) {
|
||||
if (visiblePredicate === undefined) visiblePredicate = function (o) { return true; };
|
||||
if (visiblePredicate === undefined) visiblePredicate = o => true;
|
||||
return $("ContextMenuButton",
|
||||
$(go.TextBlock, text),
|
||||
{ click: action },
|
||||
// don't bother with binding GraphObject.visible if there's no predicate
|
||||
visiblePredicate ? new go.Binding("visible", "", visiblePredicate).ofObject() : {});
|
||||
$(go.TextBlock, text),
|
||||
{ click: action },
|
||||
// don't bother with binding GraphObject.visible if there's no predicate
|
||||
visiblePredicate ? new go.Binding("visible", "", visiblePredicate).ofObject() : {});
|
||||
}
|
||||
|
||||
// a context menu is an Adornment with a bunch of buttons in them
|
||||
var partContextMenu =
|
||||
$(go.Adornment, "Vertical",
|
||||
makeButton("Properties",
|
||||
function (e, obj) { // the OBJ is this Button
|
||||
(e, obj) => { // the OBJ is this Button
|
||||
var contextmenu = <go.Adornment>obj.part; // the Button is in the context menu Adornment
|
||||
var part = contextmenu.adornedPart; // the adornedPart is the Part that the context menu adorns
|
||||
// now can do something with PART, or with its data, or with the Adornment (the context menu)
|
||||
@@ -51,29 +130,29 @@ function init() {
|
||||
else alert(nodeInfo(part.data));
|
||||
}),
|
||||
makeButton("Cut",
|
||||
function (e, obj) { e.diagram.commandHandler.cutSelection(); },
|
||||
function (o) { return o.diagram.commandHandler.canCutSelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.cutSelection(),
|
||||
o => o.diagram.commandHandler.canCutSelection()),
|
||||
makeButton("Copy",
|
||||
function (e, obj) { e.diagram.commandHandler.copySelection(); },
|
||||
function (o) { return o.diagram.commandHandler.canCopySelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.copySelection(),
|
||||
o => o.diagram.commandHandler.canCopySelection()),
|
||||
makeButton("Paste",
|
||||
function (e, obj) { e.diagram.commandHandler.pasteSelection(e.diagram.lastInput.documentPoint); },
|
||||
function (o) { return o.diagram.commandHandler.canPasteSelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.pasteSelection(e.diagram.lastInput.documentPoint),
|
||||
o => o.diagram.commandHandler.canPasteSelection()),
|
||||
makeButton("Delete",
|
||||
function (e, obj) { e.diagram.commandHandler.deleteSelection(); },
|
||||
function (o) { return o.diagram.commandHandler.canDeleteSelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.deleteSelection(),
|
||||
o => o.diagram.commandHandler.canDeleteSelection()),
|
||||
makeButton("Undo",
|
||||
function (e, obj) { e.diagram.commandHandler.undo(); },
|
||||
function (o) { return o.diagram.commandHandler.canUndo(); }),
|
||||
(e, obj) => e.diagram.commandHandler.undo(),
|
||||
o => o.diagram.commandHandler.canUndo()),
|
||||
makeButton("Redo",
|
||||
function (e, obj) { e.diagram.commandHandler.redo(); },
|
||||
function (o) { return o.diagram.commandHandler.canRedo(); }),
|
||||
(e, obj) => e.diagram.commandHandler.redo(),
|
||||
o => o.diagram.commandHandler.canRedo()),
|
||||
makeButton("Group",
|
||||
function (e, obj) { e.diagram.commandHandler.groupSelection(); },
|
||||
function (o) { return o.diagram.commandHandler.canGroupSelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.groupSelection(),
|
||||
o => o.diagram.commandHandler.canGroupSelection()),
|
||||
makeButton("Ungroup",
|
||||
function (e, obj) { e.diagram.commandHandler.ungroupSelection(); },
|
||||
function (o) { return o.diagram.commandHandler.canUngroupSelection(); })
|
||||
(e, obj) => e.diagram.commandHandler.ungroupSelection(),
|
||||
o => o.diagram.commandHandler.canUngroupSelection())
|
||||
);
|
||||
|
||||
function nodeInfo(d) { // Tooltip info for a node data object
|
||||
@@ -120,7 +199,7 @@ function init() {
|
||||
// this context menu Adornment is shared by all nodes
|
||||
contextMenu: partContextMenu
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
// Define the appearance and behavior for Links:
|
||||
|
||||
@@ -130,7 +209,7 @@ function init() {
|
||||
|
||||
// The link shape and arrowhead have their stroke brush data bound to the "color" property
|
||||
myDiagram.linkTemplate =
|
||||
$(go.Link,
|
||||
$(CustomLink,
|
||||
{ relinkableFrom: true, relinkableTo: true }, // allow the user to relink existing links
|
||||
$(go.Shape,
|
||||
{ strokeWidth: 2 },
|
||||
@@ -148,17 +227,14 @@ function init() {
|
||||
// the same context menu Adornment is shared by all links
|
||||
contextMenu: partContextMenu
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
// Define the appearance and behavior for Groups:
|
||||
|
||||
function groupInfo(adornment: go.Adornment) { // takes the tooltip, not a group node data object
|
||||
var g = <go.Group>adornment.adornedPart; // get the Group that the tooltip adorns
|
||||
var mems = g.memberParts.count;
|
||||
var links = 0;
|
||||
g.memberParts.each(function (part) {
|
||||
if (part instanceof go.Link) links++;
|
||||
});
|
||||
var links = g.memberParts.filter(p => p instanceof go.Link).count;
|
||||
return "Group " + g.data.key + ": " + g.data.text + "\n" + mems + " members including " + links + " links";
|
||||
}
|
||||
|
||||
@@ -168,7 +244,8 @@ function init() {
|
||||
$(go.Group, "Vertical",
|
||||
{
|
||||
selectionObjectName: "PANEL", // selection handle goes around shape, not label
|
||||
ungroupable: true // enable Ctrl-Shift-G to ungroup a selected Group
|
||||
ungroupable: true, // enable Ctrl-Shift-G to ungroup a selected Group
|
||||
layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutNodeSized
|
||||
},
|
||||
$(go.TextBlock,
|
||||
{
|
||||
@@ -195,7 +272,7 @@ function init() {
|
||||
// the same context menu Adornment is shared by all groups
|
||||
contextMenu: partContextMenu
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
// Define the behavior for the Diagram background:
|
||||
|
||||
@@ -209,21 +286,21 @@ function init() {
|
||||
$(go.Shape, { fill: "#FFFFCC" }),
|
||||
$(go.TextBlock, { margin: 4 },
|
||||
new go.Binding("text", "", diagramInfo))
|
||||
);
|
||||
);
|
||||
|
||||
// provide a context menu for the background of the Diagram, when not over any Part
|
||||
myDiagram.contextMenu =
|
||||
$(go.Adornment, "Vertical",
|
||||
makeButton("Paste",
|
||||
function (e, obj) { e.diagram.commandHandler.pasteSelection(e.diagram.lastInput.documentPoint); },
|
||||
function (o) { return o.diagram.commandHandler.canPasteSelection(); }),
|
||||
(e, obj) => e.diagram.commandHandler.pasteSelection(e.diagram.lastInput.documentPoint),
|
||||
o => o.diagram.commandHandler.canPasteSelection()),
|
||||
makeButton("Undo",
|
||||
function (e, obj) { e.diagram.commandHandler.undo(); },
|
||||
function (o) { return o.diagram.commandHandler.canUndo(); }),
|
||||
(e, obj) => e.diagram.commandHandler.undo(),
|
||||
o => o.diagram.commandHandler.canUndo()),
|
||||
makeButton("Redo",
|
||||
function (e, obj) { e.diagram.commandHandler.redo(); },
|
||||
function (o) { return o.diagram.commandHandler.canRedo(); })
|
||||
);
|
||||
(e, obj) => e.diagram.commandHandler.redo(),
|
||||
o => o.diagram.commandHandler.canRedo())
|
||||
);
|
||||
|
||||
// Create the Diagram's Model:
|
||||
var nodeDataArray = [
|
||||
@@ -240,4 +317,8 @@ function init() {
|
||||
{ from: 3, to: 1, color: "purple" }
|
||||
];
|
||||
myDiagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
|
||||
|
||||
var img = myDiagram.makeImageData({
|
||||
scale: 0.4, position: new go.Point(-10, -10)
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+539
-128
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -4461,7 +4461,7 @@ declare namespace kendo.ui {
|
||||
scrollable?: GridScrollable;
|
||||
selectable?: boolean|string;
|
||||
sortable?: GridSortable;
|
||||
toolbar?: GridToolbarItem[];
|
||||
toolbar?: string | ((...args:any[]) => string) | GridToolbarItem[];
|
||||
cancel?(e: GridCancelEvent): void;
|
||||
change?(e: GridChangeEvent): void;
|
||||
columnHide?(e: GridColumnHideEvent): void;
|
||||
|
||||
@@ -76,14 +76,19 @@ winston.exitOnError = bool;
|
||||
|
||||
winston.log(str, str);
|
||||
winston.log(str, str, metadata);
|
||||
winston.log(str, str, metadata, metadata, metadata);
|
||||
winston.debug(str);
|
||||
winston.debug(str, metadata);
|
||||
winston.debug(str, metadata, metadata, metadata);
|
||||
winston.info(str);
|
||||
winston.info(str, metadata);
|
||||
winston.info(str, metadata, metadata, metadata);
|
||||
winston.warn(str);
|
||||
winston.warn(str, metadata);
|
||||
winston.warn(str, metadata, metadata, metadata);
|
||||
winston.error(str);
|
||||
winston.error(str, metadata);
|
||||
winston.error(str, metadata, metadata, metadata);
|
||||
|
||||
winston.query(queryOptions, (err: Error, results: any): void => {
|
||||
|
||||
@@ -94,6 +99,7 @@ winston.query((err: Error, results: any): void => {
|
||||
|
||||
logger = winston.add(transport, transportOptions);
|
||||
logger = winston.remove(transport);
|
||||
logger = winston.add(transport, {filename: 'path/to/file.log'});
|
||||
|
||||
winston.clear();
|
||||
logger = winston.profile(str, str, metadata, (err: Error, level: string, msg: string, meta: any):void => {
|
||||
@@ -118,14 +124,19 @@ readableStream.on('log', function (log:any):void {
|
||||
logger = logger.extend(obj);
|
||||
logger.log(str, str);
|
||||
logger.log(str, str, metadata);
|
||||
logger.log(str, str, metadata, metadata, metadata);
|
||||
logger.debug(str);
|
||||
logger.debug(str, metadata);
|
||||
logger.debug(str, metadata, metadata, metadata);
|
||||
logger.info(str);
|
||||
logger.info(str, metadata);
|
||||
logger.info(str, metadata, metadata, metadata);
|
||||
logger.warn(str);
|
||||
logger.warn(str, metadata);
|
||||
logger.warn(str, metadata, metadata, metadata);
|
||||
logger.error(str);
|
||||
logger.error(str, metadata);
|
||||
logger.error(str, metadata, metadata, metadata);
|
||||
|
||||
logger.query(queryOptions, (err: Error, results: any): void => {
|
||||
|
||||
@@ -140,6 +151,7 @@ logger.handleExceptions(transport);
|
||||
logger.unhandleExceptions(transport);
|
||||
logger = logger.add(transport, transportOptions, bool);
|
||||
logger = logger.add(transport);
|
||||
logger = logger.add(transport, {filename: 'path/to/file.log'});
|
||||
|
||||
logger.clear();
|
||||
logger = logger.remove(transport);
|
||||
|
||||
Vendored
+36
-34
@@ -24,20 +24,12 @@ declare module "winston" {
|
||||
export var exitOnError: boolean;
|
||||
export var level: string;
|
||||
|
||||
export function log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export function log(level: string, msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export var log: LogMethod;
|
||||
|
||||
export function debug(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export function debug(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
export function info(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export function info(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
export function warn(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export function warn(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
export function error(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export function error(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
export var debug: LeveledLogMethod;
|
||||
export var info: LeveledLogMethod;
|
||||
export var warn: LeveledLogMethod;
|
||||
export var error: LeveledLogMethod;
|
||||
|
||||
export function query(options: QueryOptions, callback?: (err: Error, results: any) => void): any;
|
||||
export function query(callback: (err: Error, results: any) => void): any;
|
||||
@@ -113,20 +105,12 @@ declare module "winston" {
|
||||
|
||||
extend(target: any): LoggerInstance;
|
||||
|
||||
log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
log(level: string, msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
log: LogMethod;
|
||||
|
||||
debug(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
debug(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
info(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
info(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
warn(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
warn(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
|
||||
error(msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
error(msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
debug: LeveledLogMethod;
|
||||
info: LeveledLogMethod;
|
||||
warn: LeveledLogMethod;
|
||||
error: LeveledLogMethod;
|
||||
|
||||
query(options: QueryOptions, callback?: (err: Error, results: any) => void): any;
|
||||
query(callback: (err: Error, results: any) => void): any;
|
||||
@@ -225,7 +209,9 @@ declare module "winston" {
|
||||
Webhook: WebhookTransportInstance;
|
||||
}
|
||||
|
||||
export interface TransportOptions {
|
||||
export type TransportOptions = ConsoleTransportOptions|DailyRotateFileTransportOptions|FileTransportOptions|HttpTransportOptions|MemoryTransportOptions|WebhookTransportOptions|WinstonModuleTransportOptions;
|
||||
|
||||
export interface GenericTransportOptions {
|
||||
level?: string;
|
||||
silent?: boolean;
|
||||
raw?: boolean;
|
||||
@@ -258,12 +244,12 @@ declare module "winston" {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export interface ConsoleTransportOptions extends TransportOptions, GenericTextTransportOptions {
|
||||
export interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
debugStdout?: boolean;
|
||||
}
|
||||
|
||||
export interface DailyRotateFileTransportOptions extends TransportOptions, GenericTextTransportOptions {
|
||||
export interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
maxsize?: number;
|
||||
maxFiles?: number;
|
||||
@@ -279,7 +265,7 @@ declare module "winston" {
|
||||
stream?: NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
export interface FileTransportOptions extends TransportOptions, GenericTextTransportOptions {
|
||||
export interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
maxsize?: number;
|
||||
rotationFormat?: boolean;
|
||||
@@ -297,14 +283,14 @@ declare module "winston" {
|
||||
stream?: NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
export interface HttpTransportOptions extends TransportOptions, GenericNetworkTransportOptions {
|
||||
export interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions {
|
||||
ssl?: boolean;
|
||||
}
|
||||
|
||||
export interface MemoryTransportOptions extends TransportOptions, GenericTextTransportOptions {
|
||||
export interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
}
|
||||
|
||||
export interface WebhookTransportOptions extends TransportOptions, GenericNetworkTransportOptions {
|
||||
export interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions {
|
||||
method?: string;
|
||||
ssl?: {
|
||||
key?: any;
|
||||
@@ -313,7 +299,7 @@ declare module "winston" {
|
||||
};
|
||||
}
|
||||
|
||||
export interface WinstonModuleTransportOptions extends TransportOptions {
|
||||
export interface WinstonModuleTransportOptions extends GenericTransportOptions {
|
||||
[optionName: string]: any;
|
||||
}
|
||||
|
||||
@@ -332,4 +318,20 @@ declare module "winston" {
|
||||
start: Date;
|
||||
done: (msg: string) => LoggerInstance;
|
||||
}
|
||||
|
||||
interface LogMethod {
|
||||
(level: string, msg: string, callback: LogCallback): LoggerInstance;
|
||||
(level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance;
|
||||
(level: string, msg: string, ... meta: any[]): LoggerInstance;
|
||||
}
|
||||
|
||||
interface LeveledLogMethod {
|
||||
(msg: string, callback: LogCallback): LoggerInstance;
|
||||
(msg: string, meta: any, callback: LogCallback): LoggerInstance;
|
||||
(msg: string, ... meta: any[]): LoggerInstance;
|
||||
}
|
||||
|
||||
interface LogCallback {
|
||||
(error?: any, level?: string, msg?: string, meta?:any): void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user