mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 12:46:36 +08:00
Merge pull request #12893 from DefinitelyTyped/types-merge-20161123
Types merge 20161123
This commit is contained in:
@@ -13,5 +13,5 @@ If adding a new definition:
|
||||
- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. Base these on the README, *not* on an existing project.
|
||||
|
||||
If changing an existing definition:
|
||||
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
|
||||
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
|
||||
- [ ] Increase the version number in the header if appropriate.
|
||||
|
||||
@@ -113,6 +113,7 @@ Your package should have this structure:
|
||||
| index.d.ts | This contains the typings for the package. |
|
||||
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
|
||||
| tsconfig.json | This allows you to run `tsc` within the package. |
|
||||
| tslint.json | Enables linting. |
|
||||
|
||||
Generate these by running `npm run new-package -- new-package-name`.
|
||||
|
||||
@@ -130,7 +131,7 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object.
|
||||
* `interface IFoo {}`: Don't add `I` to the front of an interface name.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }
|
||||
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`.
|
||||
* `const Class: { new(): IClass; }`:
|
||||
Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant.
|
||||
* `namespace foo {}`:
|
||||
|
||||
2
eventemitter2/index.d.ts
vendored
2
eventemitter2/index.d.ts
vendored
@@ -23,7 +23,7 @@ interface EventEmitter2Configuration {
|
||||
* max listeners that can be assigned to an event, default 10.
|
||||
*/
|
||||
maxListeners?: number;
|
||||
|
||||
|
||||
/**
|
||||
* show event name in memory leak message when more than maximum amount of listeners is assigned, default false
|
||||
*/
|
||||
|
||||
11
fuse/index.d.ts
vendored
11
fuse/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Fuse.js 2.2.0
|
||||
// Type definitions for Fuse.js 2.5.0
|
||||
// Project: https://github.com/krisk/Fuse
|
||||
// Definitions by: Greg Smith <https://github.com/smrq/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -9,7 +9,8 @@ declare class Fuse {
|
||||
}
|
||||
|
||||
declare namespace fuse {
|
||||
interface IFuseOptions extends ISearchOptions {
|
||||
interface IFuseOptions {
|
||||
id?: string;
|
||||
caseSensitive?: boolean;
|
||||
include?: string[];
|
||||
shouldSort?: boolean;
|
||||
@@ -18,9 +19,9 @@ declare namespace fuse {
|
||||
getFn?: (obj: any, path: string) => any;
|
||||
keys?: string[] | { name:string; weight:number} [];
|
||||
verbose?:boolean;
|
||||
}
|
||||
|
||||
interface ISearchOptions {
|
||||
tokenize?: boolean;
|
||||
tokenSeparator? : RegExp;
|
||||
matchAllTokens?: boolean;
|
||||
location?: number;
|
||||
distance?: number;
|
||||
threshold?: number;
|
||||
|
||||
21
react-data-grid/index.d.ts
vendored
21
react-data-grid/index.d.ts
vendored
@@ -6,6 +6,12 @@
|
||||
/// <reference types="react" />
|
||||
|
||||
declare namespace AdazzleReactDataGrid {
|
||||
|
||||
interface SelectionParams {
|
||||
rowIdx: number,
|
||||
row: any
|
||||
}
|
||||
|
||||
interface GridProps {
|
||||
/**
|
||||
* Gets the data to render in each row. Required.
|
||||
@@ -170,6 +176,20 @@ declare namespace AdazzleReactDataGrid {
|
||||
* @default 0
|
||||
*/
|
||||
rowScrollTimeout?: number
|
||||
/**
|
||||
* Options object for selecting rows
|
||||
*/
|
||||
rowSelection?: {
|
||||
showCheckbox?: boolean
|
||||
enableShiftSelect?: boolean
|
||||
onRowsSelected?: (rows: Array<SelectionParams>) => void,
|
||||
onRowsDeselected?: (rows: Array<SelectionParams>) => void,
|
||||
selectBy?: {
|
||||
indexes?: Array<number>;
|
||||
keys?: { rowKey: string, values: Array<any> };
|
||||
isSelectedKey?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,6 +413,7 @@ declare namespace AdazzleReactDataGrid {
|
||||
|
||||
// Various events
|
||||
export import RowUpdateEvent = AdazzleReactDataGrid.RowUpdateEvent;
|
||||
export import SelectionParams = AdazzleReactDataGrid.SelectionParams;
|
||||
export import CellDragEvent = AdazzleReactDataGrid.CellDragEvent;
|
||||
export import DragHandleDoubleClickEvent = AdazzleReactDataGrid.DragHandleDoubleClickEvent;
|
||||
export import CellCopyPasteEvent = AdazzleReactDataGrid.CellCopyPasteEvent;
|
||||
|
||||
@@ -243,7 +243,19 @@ class Example extends React.Component<any, any> {
|
||||
return this.state.rows.length;
|
||||
}
|
||||
|
||||
onRowsSelected(rows: Array<ReactDataGrid.SelectionParams>) {
|
||||
var selectedIndexes = this.state.selectedIndexes as Array<number>;
|
||||
|
||||
this.setState({selectedIndexes: selectedIndexes.concat(rows.map(r => r.rowIdx))});
|
||||
}
|
||||
onRowsDeselected(rows: Array<ReactDataGrid.SelectionParams>) {
|
||||
var rowIndexes = rows.map(r => r.rowIdx);
|
||||
var selectedIndexes = this.state.selectedIndexes as Array<number>;
|
||||
this.setState({selectedIndexes: selectedIndexes.filter(i => rowIndexes.indexOf(i) === -1 )});
|
||||
}
|
||||
|
||||
render() {
|
||||
let selectedRows = ['id1', 'id2'];
|
||||
return (
|
||||
<ReactDataGrid
|
||||
ref='grid'
|
||||
@@ -257,6 +269,15 @@ class Example extends React.Component<any, any> {
|
||||
rowHeight={50}
|
||||
minHeight={600}
|
||||
rowScrollTimeout={200}
|
||||
rowSelection={{
|
||||
showCheckbox: true,
|
||||
enableShiftSelect: true,
|
||||
onRowsSelected: this.onRowsSelected,
|
||||
onRowsDeselected: this.onRowsDeselected,
|
||||
selectBy: {
|
||||
keys: {rowKey: 'id', values: selectedRows}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
);
|
||||
|
||||
1
react-day-picker/index.d.ts
vendored
1
react-day-picker/index.d.ts
vendored
@@ -65,6 +65,7 @@ declare namespace ReactDayPicker {
|
||||
numberOfMonths?: number;
|
||||
renderDay?: (date: Date) => number | string | JSX.Element;
|
||||
enableOutsideDays?: boolean;
|
||||
firstDayOfWeek?:number;
|
||||
canChangeMonth?: boolean;
|
||||
disabledDays?: (date: Date) => boolean;
|
||||
fixedWeeks?: boolean;
|
||||
|
||||
2
react-router/index.d.ts
vendored
2
react-router/index.d.ts
vendored
@@ -47,9 +47,11 @@ export type PlainRoute = Router.PlainRoute;
|
||||
export type EnterHook = Router.EnterHook;
|
||||
export type LeaveHook = Router.LeaveHook;
|
||||
export type ParseQueryString = Router.ParseQueryString;
|
||||
export type LocationDescriptor = Router.LocationDescriptor;
|
||||
export type RedirectFunction = Router.RedirectFunction;
|
||||
export type RouteComponent = Router.RouteComponent;
|
||||
export type RouteComponentProps<P, R> = Router.RouteComponentProps<P, R>;
|
||||
export type RouteConfig = Router.RouteConfig;
|
||||
export type RouteHook = Router.RouteHook;
|
||||
export type StringifyQuery = Router.StringifyQuery;
|
||||
export type RouterListener = Router.RouterListener;
|
||||
|
||||
5
react-router/lib/Link.d.ts
vendored
5
react-router/lib/Link.d.ts
vendored
@@ -1,6 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
import * as H from 'history';
|
||||
|
||||
declare const Link: Link;
|
||||
type Link = Link.Link;
|
||||
@@ -12,9 +11,7 @@ declare namespace Link {
|
||||
activeStyle?: React.CSSProperties;
|
||||
activeClassName?: string;
|
||||
onlyActiveOnIndex?: boolean;
|
||||
to: Router.RoutePattern | H.LocationDescriptor;
|
||||
query?: H.Query;
|
||||
state?: H.LocationState;
|
||||
to: Router.RoutePattern | Router.LocationDescriptor | ((...args: any[]) => Router.LocationDescriptor);
|
||||
}
|
||||
|
||||
interface Link extends React.ComponentClass<LinkProps> {}
|
||||
|
||||
20
react-router/lib/Router.d.ts
vendored
20
react-router/lib/Router.d.ts
vendored
@@ -2,8 +2,8 @@ import * as React from 'react';
|
||||
import RouterContext from './RouterContext';
|
||||
import {
|
||||
QueryString, Query,
|
||||
Location, LocationDescriptor, LocationState,
|
||||
History,
|
||||
Location, LocationDescriptor, LocationState as HLocationState,
|
||||
History, Href,
|
||||
Pathname, Path } from 'history';
|
||||
|
||||
declare const Router: Router;
|
||||
@@ -33,13 +33,19 @@ declare namespace Router {
|
||||
|
||||
type RouterListener = (error: Error, nextState: RouterState) => void;
|
||||
|
||||
type LocationDescriptor = {
|
||||
pathname?: Pathname
|
||||
query?: Query
|
||||
hash?: Href
|
||||
state?: HLocationState
|
||||
}
|
||||
|
||||
interface RedirectFunction {
|
||||
(location: LocationDescriptor): void;
|
||||
/**
|
||||
* @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated
|
||||
*/
|
||||
(state: LocationState, pathname: Pathname | Path, query?: Query): void;
|
||||
(state: HLocationState, pathname: Pathname | Path, query?: Query): void;
|
||||
}
|
||||
|
||||
interface RouterState {
|
||||
@@ -87,7 +93,7 @@ declare namespace Router {
|
||||
|
||||
interface RouterOnContext extends History {
|
||||
setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void;
|
||||
isActive(pathOrLoc: LocationDescriptor, indexOnly?: boolean): boolean;
|
||||
isActive(pathOrLoc: Path | LocationDescriptor, indexOnly?: boolean): boolean;
|
||||
}
|
||||
|
||||
// Wrap a component using withRouter(Component) to provide a router object
|
||||
@@ -97,14 +103,14 @@ declare namespace Router {
|
||||
// https://github.com/reactjs/react-router/blob/v2.4.0/upgrade-guides/v2.4.0.md
|
||||
|
||||
interface InjectedRouter {
|
||||
push: (pathOrLoc: History.LocationDescriptor) => void
|
||||
replace: (pathOrLoc: History.LocationDescriptor) => void
|
||||
push: (pathOrLoc: Path | LocationDescriptor) => void
|
||||
replace: (pathOrLoc: Path | LocationDescriptor) => void
|
||||
go: (n: number) => void
|
||||
goBack: () => void
|
||||
goForward: () => void
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
||||
createPath(path: History.Path, query?: History.Query): History.Path
|
||||
createHref(path: History.Path, query?: History.Query): History.Href
|
||||
isActive: (pathOrLoc: History.LocationDescriptor, indexOnly?: boolean) => boolean
|
||||
isActive: (pathOrLoc: Path | LocationDescriptor, indexOnly?: boolean) => boolean
|
||||
}
|
||||
}
|
||||
|
||||
6
toastr/index.d.ts
vendored
6
toastr/index.d.ts
vendored
@@ -187,6 +187,12 @@ interface Toastr {
|
||||
(toast: JQuery, clearOptions: { force: boolean }): void;
|
||||
};
|
||||
/**
|
||||
* Removes all toasts (without animation)
|
||||
*/
|
||||
remove: {
|
||||
(): void;
|
||||
};
|
||||
/**
|
||||
* Create an error toast
|
||||
*/
|
||||
error: ToastrDisplayMethod;
|
||||
|
||||
@@ -8,6 +8,7 @@ function test_basic() {
|
||||
t.push(toastr.error('I do not think that word means what you think it means.', 'Inconceivable!'));
|
||||
toastr.clear(t[0]); // clear 1
|
||||
toastr.clear(); // clear all
|
||||
toastr.remove();
|
||||
|
||||
var msg = 'Do you think Rodents of Unusual Size really exist?';
|
||||
var title = 'Fireswamp Legends';
|
||||
|
||||
25
xrm/index.d.ts
vendored
25
xrm/index.d.ts
vendored
@@ -482,17 +482,32 @@ declare namespace Xrm
|
||||
export module Async
|
||||
{
|
||||
/**
|
||||
* Called when the operation is successful.
|
||||
* Object passed to ErrorCallbackDelegate
|
||||
*/
|
||||
export type SuccessCallbackDelegate = ( object: any ) => void;
|
||||
export interface ErrorCallbackObject
|
||||
{
|
||||
errorCode: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface SuccessCallbackObject
|
||||
{
|
||||
savedEntityReference: Page.LookupValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the operation is successful.
|
||||
* Currently, only the Xrm.Utility.openQuickCreate successCallback
|
||||
* is passed a parameter so an optional parameter for it is included
|
||||
*/
|
||||
export type SuccessCallbackDelegate = (object?: SuccessCallbackObject ) => void;
|
||||
|
||||
/**
|
||||
* Called when the operation fails.
|
||||
*
|
||||
* @param {number} errorCode The error code.
|
||||
* @param {string} message The message.
|
||||
* @param {ErrorCallbackObject} error The error object
|
||||
*/
|
||||
export type ErrorCallbackDelegate = ( errorCode: number, message: string ) => void;
|
||||
export type ErrorCallbackDelegate = ( error: ErrorCallbackObject ) => void;
|
||||
|
||||
/**
|
||||
* Interface for Xrm.Page.data promises.
|
||||
|
||||
@@ -72,7 +72,7 @@ if (Xrm.Page.data.process != null)
|
||||
|
||||
/// Demonstrate v7.1 Quick Create form
|
||||
|
||||
Xrm.Utility.openQuickCreate("account").then(( newRecord: Xrm.Page.LookupValue ) => { alert( `Newly created record Id: ${newRecord.id}` ); }, (code, message) => {console.log(message)});
|
||||
Xrm.Utility.openQuickCreate("account").then(( object ) => { if (object) alert( `Newly created record Id: ${object.savedEntityReference.id}` ); }, (error) => {console.log(`Code: ${error.errorCode}, Message: ${error.message}`)});
|
||||
|
||||
/// Make all controls visible.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user