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:
Vendored
+2
-2
@@ -653,7 +653,7 @@ declare module AceAjax {
|
||||
* @param type Identify the type of the marker
|
||||
* @param inFront Set to `true` to establish a front marker
|
||||
**/
|
||||
addMarker(range: Range, clazz: string, type: Function, inFront: boolean): void;
|
||||
addMarker(range: Range, clazz: string, type: Function, inFront: boolean): number;
|
||||
|
||||
/**
|
||||
* Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires.
|
||||
@@ -662,7 +662,7 @@ declare module AceAjax {
|
||||
* @param type Identify the type of the marker
|
||||
* @param inFront Set to `true` to establish a front marker
|
||||
**/
|
||||
addMarker(range: Range, clazz: string, type: string, inFront: boolean): void;
|
||||
addMarker(range: Range, clazz: string, type: string, inFront: boolean): number;
|
||||
|
||||
/**
|
||||
* Adds a dynamic marker to the session.
|
||||
|
||||
Vendored
+23
-17
@@ -16,32 +16,34 @@ declare module 'angular-formly' {
|
||||
|
||||
declare module AngularFormly {
|
||||
|
||||
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
|
||||
interface IFieldArray extends Array<IFieldConfigurationObject | IFieldGroup> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface IFieldGroup {
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
className?: string;
|
||||
elementAttributes?: string;
|
||||
fieldGroup?: IFieldArray;
|
||||
fieldGroup?: IFieldArray;
|
||||
form?: Object;
|
||||
hide?: boolean;
|
||||
hideExpression?: string | IExpressionFunction;
|
||||
key?: string | number;
|
||||
model?: string | Object;
|
||||
options?: IFormOptionsAPI;
|
||||
templateOptions?: ITemplateOptions;
|
||||
wrapper?: string | string[];
|
||||
model?: string | {
|
||||
[key: string]: any;
|
||||
};
|
||||
options?: IFormOptionsAPI;
|
||||
templateOptions?: ITemplateOptions;
|
||||
wrapper?: string | string[];
|
||||
}
|
||||
|
||||
|
||||
interface IFormOptionsAPI {
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
fieldTransform?: Function;
|
||||
formState?: Object;
|
||||
removeChromeAutoComplete?: boolean;
|
||||
@@ -182,8 +184,8 @@ declare module AngularFormly {
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#data-object
|
||||
*/
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -287,7 +289,9 @@ declare module AngularFormly {
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string
|
||||
*/
|
||||
model?: Object | string;
|
||||
model?: string | {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -543,8 +547,8 @@ declare module AngularFormly {
|
||||
defaultOptions?: IFieldConfigurationObject | Function;
|
||||
controller?: Function | string | any[];
|
||||
data?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
extends?: string;
|
||||
link?: ng.IDirectiveLinkFn;
|
||||
overwriteOk?: boolean;
|
||||
@@ -612,7 +616,9 @@ declare module AngularFormly {
|
||||
//The index of the field the form is on (in ng-repeat)
|
||||
index: number;
|
||||
//the model of the form (or the model specified by the field if it was specified).
|
||||
model: Object | string;
|
||||
model?: string | {
|
||||
[key: string]: any;
|
||||
};
|
||||
//Shortcut to options.validation.errorExistsAndShouldBeVisible
|
||||
showError: boolean;
|
||||
//Shortcut to options.templateOptions
|
||||
|
||||
@@ -6,7 +6,7 @@ angular.module('app',['angularLoad'])
|
||||
()=>console.log("angular material js loaded")
|
||||
);
|
||||
|
||||
angularLoad.loadCss("https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.css").then(
|
||||
angularLoad.loadCSS("https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.css").then(
|
||||
()=>console.log("angular material css loaded")
|
||||
);
|
||||
}]);
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ declare module angular.load {
|
||||
|
||||
interface IAngularLoadService {
|
||||
loadScript(url:string): ng.IPromise<any>;
|
||||
loadCss(url:string): ng.IPromise<any>;
|
||||
loadCSS(url:string): ng.IPromise<any>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -272,6 +272,9 @@ module TestQ {
|
||||
{
|
||||
let result: angular.IPromise<any[]>;
|
||||
result = $q.all([promiseAny, promiseAny]);
|
||||
// TS should infer that n1 and n2 are numbers and have toFixed.
|
||||
$q.all([1, $q.when(2)]).then(([ n1, n2 ]) => n1.toFixed() + n2.toFixed());
|
||||
$q.all([1, $q.when(2), '3']).then(([ n1, n2, n3 ]) => n1.toFixed() + n2.toFixed() + n3.slice(1));
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult[]>;
|
||||
|
||||
Vendored
+10
-1
@@ -1006,7 +1006,16 @@ declare module angular {
|
||||
*
|
||||
* @param promises An array of promises.
|
||||
*/
|
||||
all<T>(promises: IPromise<any>[]): IPromise<T[]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>, T10 | IPromise<T10>]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>]): IPromise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>, T6 | IPromise<T6>]): IPromise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>, T5 | IPromise<T5>]): IPromise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>]): IPromise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[T1, T2]>;
|
||||
all<TAll>(promises: IPromise<TAll>[]): IPromise<TAll[]>;
|
||||
/**
|
||||
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
|
||||
*
|
||||
|
||||
Vendored
+852
-21
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
@@ -127,8 +127,8 @@ interface Async {
|
||||
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, results?: any) => void): void;
|
||||
compose(...fns: Function[]): void;
|
||||
seq(...fns: Function[]): void;
|
||||
compose(...fns: Function[]): Function;
|
||||
seq(...fns: Function[]): Function;
|
||||
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
|
||||
|
||||
Vendored
+1
-1
@@ -88,7 +88,7 @@ declare module 'bookshelf' {
|
||||
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
destroy(options : SyncOptions) : Promise<T>;
|
||||
destroy(options? : SyncOptions) : Promise<T>;
|
||||
fetch(options? : FetchOptions) : Promise<T>;
|
||||
fetchAll(options? : FetchAllOptions) : Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : Collection<R>;
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
// Type definitions for Bootstrap datetimepicker v3
|
||||
// Project: http://eonasdan.github.io/bootstrap-datetimepicker
|
||||
// Definitions by: Jesica N. Fera <https://github.com/bayitajesi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson
|
||||
* Available via the MIT license.
|
||||
* see: http://eonasdan.github.io/bootstrap-datetimepicker or https://github.com/Eonasdan/bootstrap-datetimepicker for details.
|
||||
*/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
|
||||
declare module BootstrapV3DatetimePicker {
|
||||
interface DatetimepickerChangeEventObject extends DatetimepickerEventObject {
|
||||
oldDate: moment.Moment;
|
||||
}
|
||||
|
||||
interface DatetimepickerEventObject extends JQueryEventObject {
|
||||
date: moment.Moment;
|
||||
}
|
||||
|
||||
interface DatetimepickerIcons {
|
||||
time?: string;
|
||||
date?: string;
|
||||
up?: string;
|
||||
down?: string;
|
||||
}
|
||||
|
||||
interface DatetimepickerOptions {
|
||||
pickDate?: boolean;
|
||||
pickTime?: boolean;
|
||||
useMinutes?: boolean;
|
||||
useSeconds?: boolean;
|
||||
useCurrent?: boolean;
|
||||
minuteStepping?: number;
|
||||
minDate?: moment.Moment | Date | string;
|
||||
maxDate?: moment.Moment | Date | string;
|
||||
showToday?: boolean;
|
||||
collapse?: boolean;
|
||||
language?: string;
|
||||
defaultDate?: moment.Moment | Date | string;
|
||||
disabledDates?: Array<moment.Moment | Date | string>;
|
||||
enabledDates?: Array<moment.Moment | Date | string>;
|
||||
icons?: DatetimepickerIcons;
|
||||
useStrict?: boolean;
|
||||
direction?: string;
|
||||
sideBySide?: boolean;
|
||||
daysOfWeekDisabled?: Array<number>;
|
||||
calendarWeeks?: boolean;
|
||||
format?: string | boolean;
|
||||
locale?: string;
|
||||
showTodayButton?: boolean;
|
||||
viewMode?: string;
|
||||
inline?: boolean;
|
||||
toolbarPlacement?: string;
|
||||
showClear?: boolean;
|
||||
ignoreReadonly?: boolean;
|
||||
}
|
||||
|
||||
interface Datetimepicker {
|
||||
date(date: moment.Moment | Date | string): void;
|
||||
date(): moment.Moment;
|
||||
minDate(date: moment.Moment | Date | string): void;
|
||||
minDate(): moment.Moment | boolean;
|
||||
maxDate(date: moment.Moment | Date | string): void;
|
||||
maxDate(): moment.Moment | boolean;
|
||||
show(): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
destroy(): void;
|
||||
toggle(): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface JQuery {
|
||||
|
||||
datetimepicker(): JQuery;
|
||||
datetimepicker(options: BootstrapV3DatetimePicker.DatetimepickerOptions): JQuery;
|
||||
|
||||
off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
|
||||
on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
on(events: 'dp.change', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
|
||||
off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.show', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.hide', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker;
|
||||
}
|
||||
@@ -3,12 +3,6 @@
|
||||
|
||||
function test_cases() {
|
||||
$('#datetimepicker').datetimepicker();
|
||||
$('#datetimepicker').datetimepicker({
|
||||
pickDate: false
|
||||
});
|
||||
$('#datetimepicker').datetimepicker({
|
||||
pickTime: false
|
||||
});
|
||||
$('#datetimepicker').datetimepicker({
|
||||
minDate: '2012-12-31'
|
||||
});
|
||||
|
||||
+554
-79
@@ -1,10 +1,11 @@
|
||||
// Type definitions for Bootstrap datetimepicker v3
|
||||
// Type definitions for Bootstrap 3 Datepicker v4.17.37
|
||||
// Project: http://eonasdan.github.io/bootstrap-datetimepicker
|
||||
// Definitions by: Jesica N. Fera <https://github.com/bayitajesi>
|
||||
// Definitions by: Katona Péter <https://github.com/katonap>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// based on the previous version created by Jesica N. Fera <https://github.com/bayitajesi>
|
||||
|
||||
/**
|
||||
* bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson
|
||||
* bootstrap-datetimepicker.js 4.17.37 Copyright (c) 2015 Jonathan Peterson
|
||||
* Available via the MIT license.
|
||||
* see: http://eonasdan.github.io/bootstrap-datetimepicker or https://github.com/Eonasdan/bootstrap-datetimepicker for details.
|
||||
*/
|
||||
@@ -13,101 +14,575 @@
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
|
||||
declare module BootstrapV3DatetimePicker {
|
||||
interface DatetimepickerChangeEventObject extends DatetimepickerEventObject {
|
||||
oldDate: moment.Moment;
|
||||
|
||||
interface Datetimepicker {
|
||||
/**Clears the datepicker by setting the value to null */
|
||||
clear(): void;
|
||||
/**Returns the component's model current date, a moment object or null if not set. */
|
||||
date(): moment.Moment;
|
||||
/**Takes string, Date, moment, null parameter and sets the components model current moment to it.
|
||||
* Passing a null value unsets the components model current moment.
|
||||
* Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
|
||||
* Throws:
|
||||
* - TypeError - in case the newDate cannot be parsed
|
||||
*
|
||||
* Emits:
|
||||
* - dp.change - In case newDate is different from current moment
|
||||
*/
|
||||
date(date: moment.Moment | Date | string): void;
|
||||
/**Destroys the widget and removes all attached event listeners */
|
||||
destroy(): void;
|
||||
/**Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
|
||||
* Emits:
|
||||
* - dp.hide - if the widget was visible before that call
|
||||
*/
|
||||
disable(): void;
|
||||
/**Enables the input element, the component is attached to, by removing disabled attribute from it. */
|
||||
enable(): void;
|
||||
/**Hides the widget
|
||||
* Emits:
|
||||
* - dp.hide - if the widget was visible before that call
|
||||
*/
|
||||
hide(): void;
|
||||
/**Returns the components current options object.
|
||||
* Note that the changing the values of the returned object does not change the components actual configuration. */
|
||||
options(): DatetimepickerOptions
|
||||
/**Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
|
||||
options(options: DatetimepickerOptions): void
|
||||
/**Shows the widget
|
||||
* Emits:
|
||||
* - dp.show - if the widget was hidden before that call
|
||||
* - dp.change - if the widget is opened for the first time and the useCurrent is set to true or to a granularity value and the input element the component is attached to has an empty value
|
||||
*/
|
||||
show(): void;
|
||||
/**Shows or hides the widget
|
||||
* Emits:
|
||||
* - dp.hide - if the widget is hidden after the toggle call
|
||||
* - dp.show - if the widget is show after the toggle call
|
||||
* - dp.change - if the widget is opened for the first time and the input element is empty and options.useCurrent != false
|
||||
*/
|
||||
toggle(): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//// Below are the getters/setters for the properties of the 'options(): DatetimepickerOptions' ////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Returns the options.allowInputToggle option. */
|
||||
allowInputToggle(): boolean;
|
||||
/**If true, the picker will show on textbox focus and icon click when used in a button group */
|
||||
allowInputToggle(value: boolean): void;
|
||||
/**Returns the current options.calendarWeeks option configuration */
|
||||
calendarWeeks(): boolean;
|
||||
/**Set if the week numbers will appear to the left on the days view */
|
||||
calendarWeeks(value: boolean): void;
|
||||
/**Returns the options.collapse option configuration */
|
||||
collapse(): boolean;
|
||||
/**If set to false the picker will display similar to sideBySide except vertical. */
|
||||
collapse(value: boolean): void;
|
||||
/**Returns the options.daysOfWeekDisabled configuration
|
||||
* IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459
|
||||
*/
|
||||
daysOfWeekDisabled(): Array<number>;
|
||||
/**Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
|
||||
* This has lower priority over the options.minDate, options.maxDate, options.disabledDates and options.enabledDates configuration settings.
|
||||
* Emits:
|
||||
* - dp.change - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
|
||||
* - dp.error - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
|
||||
*/
|
||||
daysOfWeekDisabled(days: Array<number>): void;
|
||||
/**Returns the options.dayViewHeaderFormat option. */
|
||||
dayViewHeaderFormat(): string;
|
||||
/**Used to customize the header of the day view. */
|
||||
dayViewHeaderFormat(value: string): void;
|
||||
/**Returns a moment with the options.defaultDate option configuration or false if not set */
|
||||
defaultDate(): moment.Moment | boolean;
|
||||
/**Will set the picker's inital date.
|
||||
* If a boolean:false value is passed the options.defaultDate parameter is cleared.
|
||||
* Throws:
|
||||
* - TypeError - if the provided date doesn't pass validation, including disabledDates, enabledDates, minDate, maxDate, and daysOfWeekDisabled
|
||||
* - TypeError - if the provided date cannot be parsed by momentjs
|
||||
*/
|
||||
defaultDate(date: string | Date | moment.Moment | boolean): void;
|
||||
/**Returns the options.disabledDates option.
|
||||
* NOTES: probably should be: disabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
|
||||
*/
|
||||
disabledDates(): boolean | any;
|
||||
/**Takes an array of values and disallows the user to select those days.
|
||||
* Setting this takes precedence over options.minDate, options.maxDate configuration.
|
||||
* Also calling this function removes the configuration of options.enabledDates if such exist.
|
||||
* Note: These values are matched with Day granularity.
|
||||
*/
|
||||
disabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
|
||||
/**Returns the options.disabledHours option.
|
||||
* NOTES: probably should be: disabledHours(): boolean | Array<number>; see: DatetimepickerOptions
|
||||
*/
|
||||
disabledHours(): boolean | any;
|
||||
/**Must be in 24 hour format. Will disallow hour selections (much like disabledTimeIntervals) but will affect all days.
|
||||
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
|
||||
disabledHours(value: boolean | Array<number>): void;
|
||||
/**Returns the options.disabledTimeIntervals option, or... not exactly
|
||||
* IMPORTANT! Creates an object from the options.disabledTimeIntervals with the keys being numbers, the values being the moment arrays.
|
||||
* eg { "0": [<moment.Moment1>, <moment.Moment2>], "1": [...] }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1498
|
||||
*/
|
||||
disabledTimeIntervals(): boolean | Array<Array<moment.Moment>>;
|
||||
/**Disables time selection between the given moments
|
||||
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
|
||||
*/
|
||||
disabledTimeIntervals(value: boolean | Array<Array<moment.Moment>>): void;
|
||||
/**Returns the options.enabledDates option
|
||||
* NOTES: probably should be: enabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
|
||||
*/
|
||||
enabledDates(): boolean | any;
|
||||
/**Takes an array of values and allows the user to select only from those days.
|
||||
* Setting this takes precedence over options.minDate, options.maxDate configuration.
|
||||
* Also calling this function removes the configuration of options.disabledDates if such exist.
|
||||
* Note: These values are matched with Day granularity.
|
||||
*/
|
||||
enabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
|
||||
/**Returns the options.enabledHours option.
|
||||
* NOTES: probably should be: enabledHours(): boolean | Array<number>; see: DatetimepickerOptions
|
||||
*/
|
||||
enabledHours(): boolean | any;
|
||||
/**Must be in 24 hour format. Will allow hour selections (much like enabledTimeIntervals) but will affect all days.
|
||||
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
|
||||
enabledHours(value: boolean | Array<number>): void;
|
||||
/**Returns a boolean or array with the options.extraFormats option configuration */
|
||||
extraFormats(): boolean | Array<string>;
|
||||
/**Takes an array of valid input moment format options, or boolean:false */
|
||||
extraFormats(formats: boolean | Array<string>): void;
|
||||
/**Returns the options.focusOnShow option. */
|
||||
focusOnShow(): boolean;
|
||||
/**If false, the textbox will not be given focus when the picker is shown */
|
||||
focusOnShow(value: boolean): void;
|
||||
/**Returns the component's options.format string */
|
||||
format(): boolean | string;
|
||||
/**Takes a moment.js format string and sets the components options.format.
|
||||
* This is used for displaying and also for parsing input strings either from the input element the component is attached to or the date() function.
|
||||
* The parameter can also be a boolean:false in which case the format is set to the locale's L LT.
|
||||
* Note: this is also used to determine if the TimePicker sub component will display the hours in 12 or 24 format. (if "a" or "h" exists in the passed string then a 12 hour mode is set)
|
||||
*/
|
||||
format(format: boolean | string): void;
|
||||
/**Returns options.icons */
|
||||
icons(): Icons;
|
||||
/**Takes an Object of strings.
|
||||
* Throws:
|
||||
* - TypeError - if icons parameter is not an Object
|
||||
*/
|
||||
icons(icons: Icons): void;
|
||||
/**Returns the options.ignoreReadonly option. */
|
||||
ignoreReadonly(): boolean;
|
||||
/**Set this to true to allow the picker to be used even if the input field is readonly. This will not bypass the disabled property */
|
||||
ignoreReadonly(value: boolean): void;
|
||||
/**Returns the options.inline option. */
|
||||
inline(): boolean;
|
||||
/**Used to customize the header of the day view. */
|
||||
inline(value: boolean): void;
|
||||
/**Returns the options.keepInvalid option. */
|
||||
keepInvalid(): boolean;
|
||||
/**If true, invalid dates will not be reverted to a previous selection or changed. */
|
||||
keepInvalid(value: boolean): void;
|
||||
/**Returns a string variable with the currently set options.keyBinds option. */
|
||||
keyBinds(): any;
|
||||
/**Allows for several keyBinding functions to be specified for ease of access or accessibility. For defaults see {@link http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds}.
|
||||
*/
|
||||
keyBinds(value: any): void;
|
||||
/**Returns the currently set locale of the options.locale */
|
||||
locale(): string;
|
||||
/**Takes a string of any valid moment locale e.g. de for German.
|
||||
* Throws:
|
||||
* - TypeError - if the locale is not loaded via a separate script or moment-with-locale
|
||||
*/
|
||||
locale(newLocale: string): void;
|
||||
/**Returns the currently set moment of the options.maxDate or false if not set */
|
||||
maxDate(): moment.Moment | boolean;
|
||||
/**Takes a parameter and disallows the user to select a moment that is after that moment.
|
||||
* If a boolean:false value is passed options.maxDate is cleared and there is no restriction to the maximum moment the user can select.
|
||||
* Note: If the parameter is before the currently selected moment the currently selected moment changes to maxDate
|
||||
* Throws:
|
||||
* - TypeError - if the parameter cannot be parsed using the options.format and options.useStrict configuration settings
|
||||
* - TypeError - if the parameter is before options.minDate
|
||||
*
|
||||
* Emits:
|
||||
* - dp.change - if the new maxDate is after currently selected moment
|
||||
* - dp.error - if the new maxDate is after currently selected moment
|
||||
*/
|
||||
maxDate(date: moment.Moment | Date | string | boolean): void;
|
||||
/**Returns the currently set moment of the options.minDate or false if not set */
|
||||
minDate(): moment.Moment | boolean;
|
||||
/**Takes a parameter and disallows the user to select a moment that is before that moment.
|
||||
* If a boolean:false value is passed the options.minDate parameter is cleared and there is no restriction to the miminum moment the user can select.
|
||||
* Note: If the parameter is after the currently selected moment the currently selected moment changes to minDate parameter
|
||||
* Throws:
|
||||
* - TypeError - if the parameter cannot be parsed using the options.format and options.useStrict configuration settings
|
||||
* - TypeError - if the parameter is after options.maxDate
|
||||
*
|
||||
* Emits:
|
||||
* - dp.change - if the new minDate is after currently selected moment
|
||||
* - dp.error - if the new minDate is after currently selected moment
|
||||
*/
|
||||
minDate(date: moment.Moment | Date | string | boolean): void;
|
||||
/**Returns the options.parseInputDate option */
|
||||
parseInputDate(): Function;
|
||||
/**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
|
||||
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
|
||||
*/
|
||||
parseInputDate(value: (input: string) => moment.Moment): void;
|
||||
/**Returns the options.showClear option. */
|
||||
showClear(): boolean;
|
||||
/**Set if the clear date button will appear on the widget */
|
||||
showClear(value: boolean): void;
|
||||
/**Returns the options.showClose option. */
|
||||
showClose(): boolean;
|
||||
/**If true, an icon will be displayed on the toolbar that will hide the picker */
|
||||
showClose(value: boolean): void;
|
||||
/**Returns the options.showTodayButton option. */
|
||||
showTodayButton(): boolean;
|
||||
/**Set if the Today button will appear on the widget */
|
||||
showTodayButton(value: boolean): void;
|
||||
/**Returns a boolean of the options.sideBySide. */
|
||||
sideBySide(): boolean;
|
||||
/**If sideBySide is true and the time picker is used, both components will display side by side instead of collapsing. */
|
||||
sideBySide(value: boolean): void;
|
||||
/**Returns a number with the options.stepping option configuration */
|
||||
stepping(): number;
|
||||
/**This will be the amount the up/down arrows move the minute value with a time picker. */
|
||||
stepping(step: number): void;
|
||||
/**Returns the options.toolbarplacement option. */
|
||||
toolbarPlacement(): string;
|
||||
/**Changes the placement of the toolbar where the today, clear, component switch icon are located.
|
||||
* See valid values at DatetimepickerOptions.toolbarplacement
|
||||
* Throws:
|
||||
* - TypeError if the parameter is not a valid value
|
||||
*/
|
||||
toolbarPlacement(value: string): void;
|
||||
/**Returns the options.tooltips option */
|
||||
tooltips(): Tooltips;
|
||||
/**Sets the tooltips for icons.
|
||||
* Throws:
|
||||
* - TypeError - if tooltips parameter is not an Object
|
||||
*/
|
||||
tooltips(value: Tooltips): void;
|
||||
/**Returns the options.useCurrent option configuration */
|
||||
useCurrent(): boolean | string;
|
||||
/**Takes a boolean or string.
|
||||
* If a boolean true is passed and the components model moment is not set (either through setDate or through a valid value on the input element the component is attached to) then the first time the user opens the datetimepicker widget the value is initialized to the current moment of the action.
|
||||
* If a false boolean is passed then no initialization happens on the input element.
|
||||
* You can select the granularity on the initialized moment by passing one of the following strings ("year", "month", "day", "hour", "minute") in the variable.
|
||||
* If for example you pass "day" to the useCurrent function and the input field is empty the first time the user opens the datetimepicker widget the input text will be initialized to the current datetime with day granularity (ie if currentTime = 2014-08-10 13:32:33 the input value will be initialized to 2014-08-10 00:00:00)
|
||||
* Note: If the options.defaultDate is set or the input element the component is attached to has already a value that takes precedence and the functionality of useCurrent is not triggered!
|
||||
*/
|
||||
useCurrent(value: boolean | string): void;
|
||||
/**Returns the options.useStrict */
|
||||
useStrict(): boolean;
|
||||
/**If useStrict is true, momentjs parsing rules will be stricter when determining if a date is valid or not. */
|
||||
useStrict(value: boolean): void;
|
||||
/**Returns the options.viewDate option. */
|
||||
viewDate(): boolean | moment.Moment;
|
||||
/**This will change the viewDate without changing or setting the selected date. */
|
||||
viewDate(value: string | Date | moment.Moment | boolean): void;
|
||||
/**Returns the options.viewMode. */
|
||||
viewMode(): string;
|
||||
/**Takes a string. See valid values at DatetimepickerOptions.viewMode
|
||||
* Throws:
|
||||
* - TypeError - if the parameter is not a string or not a valid value
|
||||
*/
|
||||
viewMode(value: string): void;
|
||||
/**Returns the options.widgetPositioning object */
|
||||
widgetPositioning(): WidgetPositioningOptions;
|
||||
/**WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
|
||||
* "auto" is the default value for both horizontal and vertical keys and it tries to automatically place the dropdown in a position that is visible to the user.
|
||||
* Usually you should not override those options unless you have a special need in your layout.
|
||||
*/
|
||||
widgetPositioning(value: WidgetPositioningOptions): void;
|
||||
}
|
||||
|
||||
interface DatetimepickerOptions {
|
||||
/**If true, the picker will show on textbox focus and icon click when used in a button group
|
||||
* @default: false
|
||||
*/
|
||||
allowInputToggle?: boolean;
|
||||
/**Shows the week of the year to the left of first day of the week.
|
||||
* @default: false
|
||||
*/
|
||||
calendarWeeks?: boolean;
|
||||
/**Using a Bootstraps collapse to switch between date/time pickers.
|
||||
* @default: true
|
||||
*/
|
||||
collapse?: boolean;
|
||||
/**Disables the section of days of the week, e.g. weekends.
|
||||
* Accepts: array of numbers from 0-6
|
||||
* @default: false
|
||||
*/
|
||||
daysOfWeekDisabled?: Array<number> | boolean;
|
||||
/**Changes the heading of the datepicker when in "days" view.
|
||||
* @default: "MMMM YYYY"
|
||||
*/
|
||||
dayViewHeaderFormat?: string;
|
||||
/**Will cause the date picker to stay open after a blur event.
|
||||
* @default: false
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**Sets the picker default date/time. Overrides useCurrent
|
||||
* @default: false
|
||||
*/
|
||||
defaultDate?: boolean | moment.Moment | Date | string;
|
||||
/**Disables selection of dates in the array, e.g. holidays
|
||||
* @default: false
|
||||
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
|
||||
* eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
disabledDates?: boolean | Array<moment.Moment | Date | string> | any;
|
||||
/**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
|
||||
* @default: false
|
||||
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
|
||||
* eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
disabledHours?: boolean | Array<number> | any;
|
||||
/**Disables time selection between the given moments
|
||||
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
|
||||
* @default: false
|
||||
*/
|
||||
disabledTimeIntervals?: boolean | Array<Array<moment.Moment>>;
|
||||
/**Disables selection of dates NOT in the array, e.g. holidays
|
||||
* @default: false
|
||||
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
|
||||
* eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
enabledDates?: boolean | Array<moment.Moment | Date | string> | any;
|
||||
/**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
|
||||
* @default: false
|
||||
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
|
||||
* eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true }
|
||||
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
|
||||
*/
|
||||
enabledHours?: boolean | Array<number>;
|
||||
/**Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
|
||||
* @default: false
|
||||
*/
|
||||
extraFormats?: boolean | Array<string>;
|
||||
/**If false, the textbox will not be given focus when the picker is shown
|
||||
* @default: true
|
||||
*/
|
||||
focusOnShow?: boolean;
|
||||
/**See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
|
||||
* @default: false
|
||||
*/
|
||||
format?: boolean | string;
|
||||
/**Change the default icons for the pickers functions. */
|
||||
icons?: Icons;
|
||||
/**Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
|
||||
* @default: false
|
||||
*/
|
||||
ignoreReadonly?: boolean;
|
||||
/**Will display the picker inline without the need of a input field. This will also hide borders and shadows.
|
||||
* @default: false
|
||||
*/
|
||||
inline?: boolean;
|
||||
/**Allows for custom events to fire on keyboard press.
|
||||
* eg: keybinds: {
|
||||
* up: (widget) => console.log(widget),
|
||||
* "control up": (widget) => console.log(widget)
|
||||
* }
|
||||
* The widget parameter is false, if the datepicker is closed.
|
||||
*/
|
||||
keyBinds?: { [key: string]: (widget: boolean | JQuery) => void };
|
||||
/**Will cause the date picker to not revert or overwrite invalid dates.
|
||||
* @default: false
|
||||
*/
|
||||
keepInvalid?: boolean;
|
||||
/**Will cause the date picker to stay open after selecting a date if no time components are being used.
|
||||
* @default: false
|
||||
*/
|
||||
keepOpen?: boolean;
|
||||
/**See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
|
||||
* @default: moment.locale()
|
||||
*/
|
||||
locale?: string;
|
||||
/**Prevents date/time selections after this date.
|
||||
* maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
|
||||
* @default: false
|
||||
*/
|
||||
maxDate?: boolean | moment.Moment | Date | string;
|
||||
/**Prevents date/time selections before this date.
|
||||
* minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
|
||||
* @default: false
|
||||
*/
|
||||
minDate?: boolean | moment.Moment | Date | string;
|
||||
/**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
|
||||
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
|
||||
*/
|
||||
parseInputDate?: (input: string) => moment.Moment;
|
||||
/**Show the "Clear" button in the icon toolbar.
|
||||
* Clicking the "Clear" button will set the calendar to null.
|
||||
* @default: false
|
||||
*/
|
||||
showClear?: boolean;
|
||||
/**Show the "Close" button in the icon toolbar.
|
||||
* Clicking the "Close" button will call hide()
|
||||
* @default: false
|
||||
*/
|
||||
showClose?: boolean;
|
||||
/**Show the "Today" button in the icon toolbar.
|
||||
* Clicking the "Today" button will set the calendar view and set the date to now.
|
||||
* @default: false
|
||||
*/
|
||||
showTodayButton?: boolean;
|
||||
/**Shows the picker side by side when using the time and date together.
|
||||
* @default: false
|
||||
*/
|
||||
sideBySide?: boolean;
|
||||
/**Number of minutes the up/down arrow's will move the minutes value in the time picker
|
||||
* @default: 1
|
||||
*/
|
||||
stepping?: number;
|
||||
/**Changes the placement of the icon toolbar.
|
||||
* @default: "default"
|
||||
*/
|
||||
toolbarPlacement?: "default" | "top" | "bottom";
|
||||
/**This will change the tooltips over each icon to a custom string */
|
||||
tooltips?: Tooltips;
|
||||
/**On show, will set the picker to the current date/time
|
||||
* @default: true
|
||||
*/
|
||||
useCurrent?: boolean;
|
||||
/**Defines if moment should use strict date parsing when considering a date to be valid
|
||||
* @default: false
|
||||
*/
|
||||
useStrict?: boolean;
|
||||
/**This will change the viewDate without changing or setting the selected date.
|
||||
* @default: false
|
||||
*/
|
||||
viewDate?: boolean | moment.Moment | Date | string;
|
||||
/**The default view to display when the picker is shown.
|
||||
* Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
|
||||
* @default: "days"
|
||||
*/
|
||||
viewMode?: "decades" | "years" | "months" | "days";
|
||||
/**On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
|
||||
* @default: null
|
||||
*/
|
||||
widgetParent?: string | JQuery;
|
||||
widgetPositioning?: WidgetPositioningOptions;
|
||||
}
|
||||
|
||||
interface DatetimepickerEventObject extends JQueryEventObject {
|
||||
interface Icons {
|
||||
/**default: "glyphicon glyphicon-trash" */
|
||||
clear?: string;
|
||||
/**default: "glyphicon glyphicon-remove" */
|
||||
close?: string;
|
||||
/**default: "glyphicon glyphicon-calendar" */
|
||||
date?: string;
|
||||
/**default: "glyphicon glyphicon-time" */
|
||||
down?: string;
|
||||
/**default: "glyphicon glyphicon-chevron-left" */
|
||||
next?: string;
|
||||
/**default: "glyphicon glyphicon-screenshot" */
|
||||
previous?: string;
|
||||
/**default: "glyphicon glyphicon-chevron-right" */
|
||||
time?: string;
|
||||
/**default: "glyphicon glyphicon-chevron-down" */
|
||||
today?: string;
|
||||
/**default: "glyphicon glyphicon-chevron-up" */
|
||||
up?: string;
|
||||
}
|
||||
|
||||
interface Tooltips {
|
||||
today?: string;
|
||||
clear?: string;
|
||||
close?: string;
|
||||
selectMonth?: string;
|
||||
prevMonth?: string;
|
||||
nextMonth?: string;
|
||||
selectYear?: string;
|
||||
prevYear?: string;
|
||||
nextYear?: string;
|
||||
selectDecade?: string;
|
||||
prevDecade?: string;
|
||||
nextDecade?: string;
|
||||
prevCentury?: string;
|
||||
nextCentury?: string;
|
||||
selectTime?: string;
|
||||
pickHour?: string;
|
||||
incrementHour?: string;
|
||||
decrementHour?: string;
|
||||
pickMinute?: string;
|
||||
incrementMinute?: string;
|
||||
decrementMinute?: string;
|
||||
togglePeriod?: string;
|
||||
pickSecond?: string;
|
||||
incrementSecond?: string;
|
||||
decrementSecond?: string;
|
||||
}
|
||||
|
||||
interface WidgetPositioningOptions {
|
||||
horizontal?: "auto" | "left" | "right";
|
||||
vertical?: "auto" | "top" | "bottom";
|
||||
}
|
||||
|
||||
interface Event extends JQueryEventObject {
|
||||
date: moment.Moment;
|
||||
}
|
||||
|
||||
interface DatetimepickerIcons {
|
||||
time?: string;
|
||||
date?: string;
|
||||
up?: string;
|
||||
down?: string;
|
||||
}
|
||||
|
||||
interface DatetimepickerOptions {
|
||||
pickDate?: boolean;
|
||||
pickTime?: boolean;
|
||||
useMinutes?: boolean;
|
||||
useSeconds?: boolean;
|
||||
useCurrent?: boolean;
|
||||
minuteStepping?: number;
|
||||
minDate?: moment.Moment | Date | string;
|
||||
maxDate?: moment.Moment | Date | string;
|
||||
showToday?: boolean;
|
||||
collapse?: boolean;
|
||||
language?: string;
|
||||
defaultDate?: moment.Moment | Date | string;
|
||||
disabledDates?: Array<moment.Moment | Date | string>;
|
||||
enabledDates?: Array<moment.Moment | Date | string>;
|
||||
icons?: DatetimepickerIcons;
|
||||
useStrict?: boolean;
|
||||
direction?: string;
|
||||
sideBySide?: boolean;
|
||||
daysOfWeekDisabled?: Array<number>;
|
||||
calendarWeeks?: boolean;
|
||||
format?: string | boolean;
|
||||
locale?: string;
|
||||
showTodayButton?: boolean;
|
||||
viewMode?: string;
|
||||
inline?: boolean;
|
||||
toolbarPlacement?: string;
|
||||
showClear?: boolean;
|
||||
ignoreReadonly?: boolean;
|
||||
}
|
||||
|
||||
interface Datetimepicker {
|
||||
date(date: moment.Moment | Date | string): void;
|
||||
date(): moment.Moment;
|
||||
minDate(date: moment.Moment | Date | string): void;
|
||||
minDate(): moment.Moment | boolean;
|
||||
maxDate(date: moment.Moment | Date | string): void;
|
||||
maxDate(): moment.Moment | boolean;
|
||||
show(): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
destroy(): void;
|
||||
toggle(): void;
|
||||
interface ChangeEvent extends Event {
|
||||
/**Previous date. False if the previous date is null. */
|
||||
oldDate: moment.Moment | boolean;
|
||||
}
|
||||
|
||||
interface UpdateEvent extends JQueryEventObject {
|
||||
/**Change type as a momentjs format token. e.g. yyyy on year change */
|
||||
change: string;
|
||||
/**New viewDate. */
|
||||
viewDate: moment.Moment;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface JQuery {
|
||||
|
||||
datetimepicker(): JQuery;
|
||||
datetimepicker(options: BootstrapV3DatetimePicker.DatetimepickerOptions): JQuery;
|
||||
|
||||
off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
data(key: "DateTimePicker"): BootstrapV3DatetimePicker.Datetimepicker;
|
||||
|
||||
on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
on(events: 'dp.change', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery;
|
||||
on(events: "dp.change", handler: (eventObject: BootstrapV3DatetimePicker.ChangeEvent) => any): JQuery;
|
||||
on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.ChangeEvent) => any): JQuery;
|
||||
on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.ChangeEvent) => any): JQuery;
|
||||
|
||||
off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.ChangeEvent) => any): JQuery;
|
||||
off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.ChangeEvent) => any): JQuery;
|
||||
|
||||
on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.show', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.show", handler: (eventObject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.hide', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
on(events: "dp.hide", handler: (eventObject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker;
|
||||
}
|
||||
off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
|
||||
on(events: "dp.error", handler: (eventObject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
|
||||
|
||||
on(events: "dp.update", handler: (eventObject: BootstrapV3DatetimePicker.UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.UpdateEvent) => any): JQuery;
|
||||
on(events: "dp.update", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.UpdateEvent) => any): JQuery;
|
||||
|
||||
off(events: "dp.update", handler: (eventobject: BootstrapV3DatetimePicker.Event) => any): JQuery;
|
||||
off(events: "dp.update", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.UpdateEvent) => any): JQuery;
|
||||
}
|
||||
Vendored
+5
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chokidar 1.0.0
|
||||
// Type definitions for chokidar 1.4.3
|
||||
// Project: https://github.com/paulmillr/chokidar
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -13,6 +13,7 @@ declare module "fs"
|
||||
add(filesDirsOrGlobs:Array<string>):void;
|
||||
unwatch(fileDirOrGlob:string):void;
|
||||
unwatch(filesDirsOrGlobs:Array<string>):void;
|
||||
getWatched():any;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +34,11 @@ declare module "chokidar"
|
||||
binaryInterval?:number;
|
||||
ignorePermissionErrors?:boolean;
|
||||
atomic?:boolean;
|
||||
awaitWriteFinish?:any;
|
||||
}
|
||||
|
||||
import fs = require("fs");
|
||||
|
||||
function watch( fileDirOrGlob:string, options?:WatchOptions ):fs.FSWatcher;
|
||||
function watch( filesDirsOrGlobs:Array<string>, options?:WatchOptions ):fs.FSWatcher;
|
||||
function watch(fileDirOrGlob:string, options?:WatchOptions):fs.FSWatcher;
|
||||
function watch(filesDirsOrGlobs:Array<string>, options?:WatchOptions):fs.FSWatcher;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -5312,7 +5312,7 @@ declare module chrome.runtime {
|
||||
* Fired when a connection is made from another extension.
|
||||
* @since Chrome 26.
|
||||
*/
|
||||
var onConnectExternal: RuntimeEvent;
|
||||
var onConnectExternal: ExtensionConnectEvent;
|
||||
/** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */
|
||||
var onSuspend: RuntimeEvent;
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="codemirror-runmode.d.ts" />
|
||||
|
||||
var query = "SELECT * FROM Table";
|
||||
|
||||
CodeMirror.runMode(query, "text/x-sql", document.body);
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: Joseph Vaughan <https://github.com/Joev->
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// See docs https://codemirror.net/doc/manual.html#addon_runmode
|
||||
|
||||
declare module CodeMirror {
|
||||
|
||||
/**
|
||||
* Runs a CodeMirror mode over text without opening an editor instance.
|
||||
*
|
||||
* @param text The document to run through the highlighter.
|
||||
* @param mode The mode to use (must be loaded as normal).
|
||||
* @param output If this is a function, it will be called for each token with
|
||||
* two arguments, the token's text and the token's style class
|
||||
* (may be null for unstyled tokens). If it is a DOM node, the
|
||||
* tokens will be converted to span elements as in an editor,
|
||||
* and inserted into the node (through innerHTML).
|
||||
*/
|
||||
function runMode(text: string, modespec: any, callback: (HTMLElement | ((text: string, style: string) => void)), options? : { tabSize?: number; state?: any; }): void;
|
||||
}
|
||||
Vendored
+1
-1
@@ -2488,7 +2488,7 @@ declare module d3 {
|
||||
}
|
||||
|
||||
interface Diagonal<Link, Node> {
|
||||
(d: Link, i: number): string;
|
||||
(d: Link, i?: number): string;
|
||||
|
||||
source(): (d: Link, i: number) => Node;
|
||||
source(source: Node): Diagonal<Link, Node>;
|
||||
|
||||
@@ -105,6 +105,10 @@ describe('EventEmitter', function tests() {
|
||||
/* rawr, i'm a beast */
|
||||
}
|
||||
|
||||
class BeastES6 extends EventEmitter3ImportedAsES6Module {
|
||||
/* rawr, i'm a beast */
|
||||
}
|
||||
|
||||
util.inherits(Beast, EventEmitter);
|
||||
|
||||
var moop = new Beast()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="express-serve-static-core.d.ts" />
|
||||
|
||||
import * as express from 'express-serve-static-core';
|
||||
|
||||
// null test file - everything should be tested from express.d.ts and serve-static.d.ts
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+29
-1056
File diff suppressed because it is too large
Load Diff
+1
-4
@@ -387,16 +387,13 @@ declare module FixedDataTable {
|
||||
}
|
||||
|
||||
export class Table extends __React.Component<TableProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
export class Column extends __React.Component<ColumnProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
export class ColumnGroup extends __React.Component<ColumnGroupProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
}
|
||||
|
||||
declare module "fixed-data-table" {
|
||||
export = FixedDataTable;
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -483,16 +483,12 @@ declare module FixedDataTable {
|
||||
}
|
||||
|
||||
export class Table extends __React.Component<TableProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
export class Column extends __React.Component<ColumnProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
export class ColumnGroup extends __React.Component<ColumnGroupProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
export class Cell extends __React.Component<CellProps, {}> {
|
||||
render(): __React.DOMElement<any>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+61
-5
@@ -444,6 +444,12 @@ declare module google {
|
||||
row?: number;
|
||||
}
|
||||
|
||||
export interface Candlestick {
|
||||
hollowIsRising?: boolean;
|
||||
fallingColor?: ChartStroke;
|
||||
risingColor?: ChartStroke;
|
||||
}
|
||||
|
||||
class ChartBase {
|
||||
constructor(element: Element);
|
||||
getSelection(): VisualizationSelectionArray[];
|
||||
@@ -1024,11 +1030,7 @@ declare module google {
|
||||
axisTitlesPosition?: string;
|
||||
backgroundColor?: any;
|
||||
bar?: GroupWidth;
|
||||
candlestick?: {
|
||||
hollowIsRising?: boolean;
|
||||
fallingColor?: ChartStroke;
|
||||
risingColor?: ChartStroke;
|
||||
}
|
||||
candlestick?: Candlestick;
|
||||
chartArea?: ChartArea;
|
||||
colors?: string[];
|
||||
enableInteractivity?: boolean;
|
||||
@@ -1052,6 +1054,60 @@ declare module google {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region ComboChart
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart
|
||||
export class ComboChart extends CoreChartBase {
|
||||
draw(data: DataTable, options: ComboChartOptions): void;
|
||||
draw(data: DataView, options: ComboChartOptions): void;
|
||||
}
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart#configuration-options
|
||||
export interface ComboChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
annotations?: ChartAnnotations;
|
||||
areaOpacity?: number;
|
||||
axisTitlesPosition?: string; // in, out, none
|
||||
backgroundColor?: any;
|
||||
bar?: GroupWidth;
|
||||
candlestick?: Candlestick;
|
||||
chartArea?: ChartArea;
|
||||
colors?: string[];
|
||||
crosshair?: ChartCrosshair;
|
||||
curveType?: string;
|
||||
dataOpacity?: number;
|
||||
enableInteractivity?: boolean;
|
||||
focusTarget?: string;
|
||||
fontSize?: number;
|
||||
fontName?: string;
|
||||
forceIFrame?: boolean;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
interpolateNulls?: boolean;
|
||||
isStacked?: boolean;
|
||||
legend?: ChartLegend;
|
||||
lineDashStyle?: number[];
|
||||
lineWidth?: number;
|
||||
orientation?: string;
|
||||
pointShape?: string;
|
||||
pointSize?: number;
|
||||
pointsVisible?: boolean;
|
||||
reverseCategories?: boolean;
|
||||
selectionMode?: string;// single / multiple
|
||||
series?: any;
|
||||
seriesType?: string;
|
||||
theme?: string;
|
||||
title?: string;
|
||||
titlePosition?: string;
|
||||
titleTextStyle?: ChartTextStyle;
|
||||
tooltip?: ChartTooltip;
|
||||
vAxes?: any;
|
||||
vAxis?: ChartAxis;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region Events
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="./harmony-proxy.d.ts" />
|
||||
|
||||
import * as Proxy from "harmony-proxy";
|
||||
|
||||
interface IKatana {
|
||||
use: () => void;
|
||||
}
|
||||
|
||||
class Katana implements IKatana {
|
||||
public use() {
|
||||
console.log("Used Katana!");
|
||||
}
|
||||
}
|
||||
|
||||
let handler = {
|
||||
apply: function(target: any, thisArg: any, argArray: any) {
|
||||
console.log(`Starting: ${performance.now()}`);
|
||||
let result = target.apply(thisArg, argArray);
|
||||
console.log(`Finished: ${performance.now()}`);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
let katana = new Katana();
|
||||
|
||||
let katanaProxy = new Proxy<IKatana>(katana, handler);
|
||||
katanaProxy.use();
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for harmony-proxy 1.0.0
|
||||
// Project: https://www.npmjs.com/package/harmony-proxy
|
||||
// Definitions by: Remo Jansen <https://github.com/remojansen/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module harmonyProxy {
|
||||
type PropertyKey = string | number | symbol;
|
||||
|
||||
interface ProxyHandler<T> {
|
||||
getPrototypeOf? (target: T): any;
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
preventExtensions? (target: T): boolean;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;
|
||||
has? (target: T, p: PropertyKey): boolean;
|
||||
get? (target: T, p: PropertyKey, receiver: any): any;
|
||||
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
|
||||
deleteProperty? (target: T, p: PropertyKey): boolean;
|
||||
defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
enumerate? (target: T): PropertyKey[];
|
||||
ownKeys? (target: T): PropertyKey[];
|
||||
apply? (target: T, thisArg: any, argArray?: any): any;
|
||||
construct? (target: T, thisArg: any, argArray?: any): any;
|
||||
}
|
||||
|
||||
interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
}
|
||||
}
|
||||
|
||||
declare module "harmony-proxy" {
|
||||
let _Proxy: harmonyProxy.ProxyConstructor;
|
||||
export = _Proxy;
|
||||
}
|
||||
Vendored
+7
@@ -18,14 +18,21 @@ interface IHowlSoundSpriteDefinition {
|
||||
[name: string]: number[];
|
||||
}
|
||||
|
||||
declare type HowlPos3d = [number, number, number]|[number, number, number, number];
|
||||
|
||||
interface IHowlProperties {
|
||||
autoplay?: boolean;
|
||||
buffer?: boolean;
|
||||
duration?: number;
|
||||
format?: string;
|
||||
loop?: boolean;
|
||||
sprite?: IHowlSoundSpriteDefinition;
|
||||
src?: string;
|
||||
pos3d?: HowlPos3d;
|
||||
volume?: number;
|
||||
urls?: string[];
|
||||
rate?: number;
|
||||
model?: 'equalpower'|'HRTF';
|
||||
onend?: Function;
|
||||
onload?: Function;
|
||||
onloaderror?: Function;
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
/// <reference path="inversify.d.ts" />
|
||||
|
||||
module global_module_test {
|
||||
|
||||
interface INinja {
|
||||
fight(): string;
|
||||
sneak(): string;
|
||||
}
|
||||
|
||||
interface IKatana {
|
||||
hit(): string;
|
||||
}
|
||||
|
||||
interface IShuriken {
|
||||
throw(): string;
|
||||
}
|
||||
|
||||
class Katana implements IKatana {
|
||||
public hit() {
|
||||
return "cut!";
|
||||
}
|
||||
}
|
||||
|
||||
class Shuriken implements IShuriken {
|
||||
public throw() {
|
||||
return "hit!";
|
||||
}
|
||||
}
|
||||
|
||||
@inversify.inject("IKatana", "IShuriken")
|
||||
class Ninja implements INinja {
|
||||
|
||||
private _katana: IKatana;
|
||||
private _shuriken: IShuriken;
|
||||
|
||||
public constructor(katana: IKatana, shuriken: IShuriken) {
|
||||
this._katana = katana;
|
||||
this._shuriken = shuriken;
|
||||
}
|
||||
|
||||
public fight() { return this._katana.hit(); };
|
||||
public sneak() { return this._shuriken.throw(); };
|
||||
|
||||
}
|
||||
|
||||
let kernel = new inversify.Kernel();
|
||||
kernel.bind<INinja>("INinja").to(Ninja);
|
||||
kernel.bind<IKatana>("IKatana").to(Katana);
|
||||
kernel.bind<IShuriken>("IShuriken").to(Shuriken).inSingletonScope();
|
||||
|
||||
let ninja = kernel.get<INinja>("INinja");
|
||||
console.log(ninja);
|
||||
|
||||
// Unbind
|
||||
kernel.unbind("INinja");
|
||||
kernel.unbindAll();
|
||||
|
||||
// Kernel modules
|
||||
let module: inversify.IKernelModule = (k: inversify.IKernel) => {
|
||||
k.bind<INinja>("INinja").to(Ninja);
|
||||
k.bind<IKatana>("IKatana").to(Katana).inTransientScope();
|
||||
k.bind<IShuriken>("IShuriken").to(Shuriken).inSingletonScope();
|
||||
};
|
||||
|
||||
let options: inversify.IKernelOptions = {
|
||||
middleware: [],
|
||||
modules: [module]
|
||||
};
|
||||
|
||||
kernel = new inversify.Kernel(options);
|
||||
let ninja2 = kernel.get<INinja>("INinja");
|
||||
console.log(ninja2);
|
||||
|
||||
// binding types
|
||||
kernel.bind<IKatana>("IKatana").to(Katana);
|
||||
kernel.bind<IKatana>("IKatana").toValue(new Katana());
|
||||
|
||||
kernel.bind<inversify.INewable<IKatana>>("IKatana").toConstructor<IKatana>(Katana);
|
||||
|
||||
kernel.bind<inversify.IFactory<IKatana>>("IKatana").toFactory<IKatana>((context) => {
|
||||
return () => {
|
||||
return kernel.get<IKatana>("IKatana");
|
||||
};
|
||||
});
|
||||
|
||||
kernel.bind<inversify.IFactory<IKatana>>("IKatana").toAutoFactory<IKatana>();
|
||||
|
||||
kernel.bind<inversify.IProvider<IKatana>>("IKatana").toProvider<IKatana>((context) => {
|
||||
return () => {
|
||||
return new Promise<IKatana>((resolve) => {
|
||||
let katana = kernel.get<IKatana>("IKatana");
|
||||
resolve(katana);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
kernel.bind<IKatana>("IKatana").to(Katana).proxy((katanaToBeInjected: IKatana) => {
|
||||
// BLOCK http://stackoverflow.com/questions/35906938/how-to-enable-harmony-proxies-in-gulp-mocha
|
||||
/*
|
||||
let handler = {
|
||||
apply: function(target, thisArgument, argumentsList) {
|
||||
console.log(`Starting: ${performance.now()}`);
|
||||
let result = target.apply(thisArgument, argumentsList);
|
||||
console.log(`Finished: ${performance.now()}`);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
return new Proxy(katanaToBeInjected, handler);
|
||||
*/
|
||||
return katanaToBeInjected;
|
||||
});
|
||||
|
||||
interface IWeapon {}
|
||||
interface ISamurai {
|
||||
katana: IWeapon;
|
||||
shuriken: IWeapon;
|
||||
}
|
||||
|
||||
@inversify.inject("IWeapon", "IWeapon")
|
||||
class Samurai implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@inversify.tagged("canThrow", false) katana: IWeapon,
|
||||
@inversify.tagged("canThrow", true) shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<Samurai>("Samurai").to(Samurai);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).whenTargetTagged("canThrow", false);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).whenTargetTagged("canThrow", true);
|
||||
|
||||
let throwable = inversify.tagged("canThrow", true);
|
||||
let notThrowable = inversify.tagged("canThrow", false);
|
||||
|
||||
@inversify.inject("IWeapon", "IWeapon")
|
||||
class Samurai2 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@throwable("canThrow", false) katana: IWeapon,
|
||||
@notThrowable("canThrow", true) shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
@inversify.inject("IWeapon", "IWeapon")
|
||||
class Samurai3 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@inversify.named("strong") katana: IWeapon,
|
||||
@inversify.named("weak") shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<ISamurai>("ISamurai").to(Samurai3);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).whenTargetNamed("strong");
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).whenTargetNamed("weak");
|
||||
|
||||
@inversify.inject("IWeapon", "IWeapon")
|
||||
@inversify.paramNames("katana", "shuriken")
|
||||
class Samurai4 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
katana: IWeapon,
|
||||
shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<ISamurai>("ISamurai").to(Samurai4);
|
||||
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).when((request: inversify.IRequest) => {
|
||||
return request.target.name.equals("katana");
|
||||
});
|
||||
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).when((request: inversify.IRequest) => {
|
||||
return request.target.name.equals("shuriken");
|
||||
});
|
||||
|
||||
}
|
||||
+197
-72
@@ -1,75 +1,200 @@
|
||||
/// <reference path="inversify.d.ts" />
|
||||
|
||||
interface FooInterface {
|
||||
name : string;
|
||||
greet() : string;
|
||||
import {
|
||||
Kernel,
|
||||
inject, tagged, named, paramNames,
|
||||
IKernel, IKernelOptions, INewable,
|
||||
IKernelModule, IFactory, IProvider, IRequest
|
||||
} from "inversify";
|
||||
|
||||
module external_module_test {
|
||||
|
||||
interface INinja {
|
||||
fight(): string;
|
||||
sneak(): string;
|
||||
}
|
||||
|
||||
interface IKatana {
|
||||
hit(): string;
|
||||
}
|
||||
|
||||
interface IShuriken {
|
||||
throw(): string;
|
||||
}
|
||||
|
||||
class Katana implements IKatana {
|
||||
public hit() {
|
||||
return "cut!";
|
||||
}
|
||||
}
|
||||
|
||||
class Shuriken implements IShuriken {
|
||||
public throw() {
|
||||
return "hit!";
|
||||
}
|
||||
}
|
||||
|
||||
@inject("IKatana", "IShuriken")
|
||||
class Ninja implements INinja {
|
||||
|
||||
private _katana: IKatana;
|
||||
private _shuriken: IShuriken;
|
||||
|
||||
public constructor(katana: IKatana, shuriken: IShuriken) {
|
||||
this._katana = katana;
|
||||
this._shuriken = shuriken;
|
||||
}
|
||||
|
||||
public fight() { return this._katana.hit(); };
|
||||
public sneak() { return this._shuriken.throw(); };
|
||||
|
||||
}
|
||||
|
||||
let kernel = new Kernel();
|
||||
kernel.bind<INinja>("INinja").to(Ninja);
|
||||
kernel.bind<IKatana>("IKatana").to(Katana);
|
||||
kernel.bind<IShuriken>("IShuriken").to(Shuriken).inSingletonScope();
|
||||
|
||||
let ninja = kernel.get<INinja>("INinja");
|
||||
console.log(ninja);
|
||||
|
||||
// Unbind
|
||||
kernel.unbind("INinja");
|
||||
kernel.unbindAll();
|
||||
|
||||
// Kernel modules
|
||||
let module: IKernelModule = (k: IKernel) => {
|
||||
k.bind<INinja>("INinja").to(Ninja);
|
||||
k.bind<IKatana>("IKatana").to(Katana).inTransientScope();
|
||||
k.bind<IShuriken>("IShuriken").to(Shuriken).inSingletonScope();
|
||||
};
|
||||
|
||||
let options: IKernelOptions = {
|
||||
middleware: [],
|
||||
modules: [module]
|
||||
};
|
||||
|
||||
kernel = new Kernel(options);
|
||||
let ninja2 = kernel.get<INinja>("INinja");
|
||||
console.log(ninja2);
|
||||
|
||||
// binding types
|
||||
kernel.bind<IKatana>("IKatana").to(Katana);
|
||||
kernel.bind<IKatana>("IKatana").toValue(new Katana());
|
||||
|
||||
kernel.bind<INewable<IKatana>>("IKatana").toConstructor<IKatana>(Katana);
|
||||
|
||||
kernel.bind<IFactory<IKatana>>("IKatana").toFactory<IKatana>((context) => {
|
||||
return () => {
|
||||
return kernel.get<IKatana>("IKatana");
|
||||
};
|
||||
});
|
||||
|
||||
kernel.bind<IFactory<IKatana>>("IKatana").toAutoFactory<IKatana>();
|
||||
|
||||
kernel.bind<IProvider<IKatana>>("IKatana").toProvider<IKatana>((context) => {
|
||||
return () => {
|
||||
return new Promise<IKatana>((resolve) => {
|
||||
let katana = kernel.get<IKatana>("IKatana");
|
||||
resolve(katana);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
kernel.bind<IKatana>("IKatana").to(Katana).proxy((katanaToBeInjected: IKatana) => {
|
||||
// BLOCK http://stackoverflow.com/questions/35906938/how-to-enable-harmony-proxies-in-gulp-mocha
|
||||
/*
|
||||
let handler = {
|
||||
apply: function(target, thisArgument, argumentsList) {
|
||||
console.log(`Starting: ${performance.now()}`);
|
||||
let result = target.apply(thisArgument, argumentsList);
|
||||
console.log(`Finished: ${performance.now()}`);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
return new Proxy(katanaToBeInjected, handler);
|
||||
*/
|
||||
return katanaToBeInjected;
|
||||
});
|
||||
|
||||
interface IWeapon {}
|
||||
interface ISamurai {
|
||||
katana: IWeapon;
|
||||
shuriken: IWeapon;
|
||||
}
|
||||
|
||||
@inject("IWeapon", "IWeapon")
|
||||
class Samurai implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@tagged("canThrow", false) katana: IWeapon,
|
||||
@tagged("canThrow", true) shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<Samurai>("Samurai").to(Samurai);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).whenTargetTagged("canThrow", false);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).whenTargetTagged("canThrow", true);
|
||||
|
||||
let throwable = tagged("canThrow", true);
|
||||
let notThrowable = tagged("canThrow", false);
|
||||
|
||||
@inject("IWeapon", "IWeapon")
|
||||
class Samurai2 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@throwable("canThrow", false) katana: IWeapon,
|
||||
@notThrowable("canThrow", true) shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
@inject("IWeapon", "IWeapon")
|
||||
class Samurai3 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
@named("strong") katana: IWeapon,
|
||||
@named("weak") shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<ISamurai>("ISamurai").to(Samurai3);
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).whenTargetNamed("strong");
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).whenTargetNamed("weak");
|
||||
|
||||
@inject("IWeapon", "IWeapon")
|
||||
@paramNames("katana", "shuriken")
|
||||
class Samurai4 implements ISamurai {
|
||||
public katana: IWeapon;
|
||||
public shuriken: IWeapon;
|
||||
public constructor(
|
||||
katana: IWeapon,
|
||||
shuriken: IWeapon
|
||||
) {
|
||||
this.katana = katana;
|
||||
this.shuriken = shuriken;
|
||||
}
|
||||
}
|
||||
|
||||
kernel.bind<ISamurai>("ISamurai").to(Samurai4);
|
||||
|
||||
kernel.bind<IWeapon>("IWeapon").to(Katana).when((request: IRequest) => {
|
||||
return request.target.name.equals("katana");
|
||||
});
|
||||
|
||||
kernel.bind<IWeapon>("IWeapon").to(Shuriken).when((request: IRequest) => {
|
||||
return request.target.name.equals("shuriken");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
interface BarInterface {
|
||||
name : string;
|
||||
greet() : string;
|
||||
}
|
||||
|
||||
interface FooBarInterface {
|
||||
foo : FooInterface;
|
||||
bar : BarInterface;
|
||||
greet() : string;
|
||||
}
|
||||
|
||||
class Foo implements FooInterface {
|
||||
public name : string;
|
||||
constructor() {
|
||||
this.name = "foo";
|
||||
}
|
||||
public greet() : string {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
class Bar implements BarInterface {
|
||||
public name : string;
|
||||
constructor() {
|
||||
this.name = "bar";
|
||||
}
|
||||
public greet() : string {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
class FooBar implements FooBarInterface {
|
||||
public foo : FooInterface;
|
||||
public bar : BarInterface;
|
||||
constructor(FooInterface : FooInterface, BarInterface : BarInterface) {
|
||||
this.foo = FooInterface;
|
||||
this.bar = BarInterface;
|
||||
}
|
||||
public greet() : string{
|
||||
return this.foo.greet() + this.bar.greet();
|
||||
}
|
||||
}
|
||||
|
||||
// Kernel
|
||||
var kernel = new inversify.Kernel();
|
||||
|
||||
// Identifiers
|
||||
var fooRuntimeIdentifier = "FooInterface";
|
||||
var barRuntimeIdentifier = "BarInterface";
|
||||
var fooBarRuntimeIdentifier = "FooBarInterface";
|
||||
|
||||
// Bindings
|
||||
var fooBinding = new inversify.TypeBinding<FooInterface>(fooRuntimeIdentifier, Foo);
|
||||
var barBinding = new inversify.TypeBinding<BarInterface>(barRuntimeIdentifier, Bar);
|
||||
var fooBarBinding = new inversify.TypeBinding<FooBarInterface>(fooBarRuntimeIdentifier, FooBar);
|
||||
|
||||
kernel.bind(fooBinding);
|
||||
kernel.bind(barBinding);
|
||||
kernel.bind(fooBarBinding);
|
||||
|
||||
// Resolve
|
||||
var foo = kernel.resolve<Foo>(fooRuntimeIdentifier);
|
||||
var bar = kernel.resolve<Bar>(barRuntimeIdentifier);
|
||||
var fooBar = kernel.resolve<FooBar>(fooBarRuntimeIdentifier);
|
||||
|
||||
// Unbind
|
||||
kernel.unbind(fooRuntimeIdentifier);
|
||||
kernel.unbindAll();
|
||||
|
||||
Vendored
+134
-42
@@ -1,51 +1,143 @@
|
||||
// Type definitions for inversify 1.0.0
|
||||
// Type definitions for inversify 2.0.0-alpha.3
|
||||
// Project: https://github.com/inversify/InversifyJS
|
||||
// Definitions by: inversify <https://github.com/inversify>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module inversify {
|
||||
|
||||
interface TypeBindingInterface<TServiceType> {
|
||||
runtimeIdentifier : string;
|
||||
implementationType : { new(): TServiceType ;};
|
||||
cache : TServiceType;
|
||||
scope : number; // TypeBindingScopeEnum
|
||||
}
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
interface KernelInterface {
|
||||
bind(typeBinding : TypeBindingInterface<any>) : void;
|
||||
unbind(runtimeIdentifier : string) : void;
|
||||
unbindAll() : void;
|
||||
resolve<TImplementationType>(runtimeIdentifier : string) : TImplementationType;
|
||||
}
|
||||
declare namespace inversify {
|
||||
|
||||
enum TypeBindingScopeEnum {
|
||||
Transient = 0,
|
||||
Singleton = 1,
|
||||
}
|
||||
interface IKernelConstructor {
|
||||
new(options?: IKernelOptions): IKernel;
|
||||
}
|
||||
|
||||
class TypeBinding<TServiceType> implements TypeBindingInterface<TServiceType> {
|
||||
runtimeIdentifier: string;
|
||||
implementationType: {
|
||||
new (): TServiceType;
|
||||
};
|
||||
cache: TServiceType;
|
||||
scope: TypeBindingScopeEnum;
|
||||
constructor(runtimeIdentifier: string, implementationType: {
|
||||
new (...args: any[]): TServiceType;
|
||||
}, scopeType?: TypeBindingScopeEnum);
|
||||
}
|
||||
export interface IKernel {
|
||||
bind<T>(runtimeIdentifier: string): IBindingToSyntax<T>;
|
||||
unbind(runtimeIdentifier: string): void;
|
||||
unbindAll(): void;
|
||||
get<T>(runtimeIdentifier: string): T;
|
||||
getAll<T>(runtimeIdentifier: string): T[];
|
||||
}
|
||||
|
||||
class Kernel implements KernelInterface {
|
||||
private _bindings;
|
||||
bind(typeBinding: TypeBindingInterface<any>): void;
|
||||
unbind(runtimeIdentifier: string): void;
|
||||
unbindAll(): void;
|
||||
resolve<TImplementationType>(runtimeIdentifier: string): TImplementationType;
|
||||
private _validateBinding(typeBinding);
|
||||
private _getConstructorArguments(func);
|
||||
private _injectDependencies<TImplementationType>(func);
|
||||
private _construct<TImplementationType>(constr, args);
|
||||
constructor();
|
||||
}
|
||||
export interface IKernelOptions {
|
||||
middleware?: IMiddleware[];
|
||||
modules?: IKernelModule[];
|
||||
}
|
||||
|
||||
interface IMiddleware extends Function {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface IKernelModule extends Function {
|
||||
(kernel: IKernel): void;
|
||||
}
|
||||
|
||||
interface IBindingToSyntax<T> {
|
||||
to(constructor: { new(...args: any[]): T; }): IBindingInWhenProxySyntax<T>;
|
||||
toValue(value: T): IBindingInWhenProxySyntax<T>;
|
||||
toConstructor<T2>(constructor: INewable<T2>): IBindingInWhenProxySyntax<T>;
|
||||
toFactory<T2>(factory: IFactoryCreator<T2>): IBindingInWhenProxySyntax<T>;
|
||||
toAutoFactory<T2>(): IBindingInWhenProxySyntax<T>;
|
||||
toProvider<T2>(provider: IProviderCreator<T2>): IBindingInWhenProxySyntax<T>;
|
||||
}
|
||||
|
||||
interface IBindingInWhenProxySyntax<T> {
|
||||
inTransientScope(): IBindingInWhenProxySyntax<T>;
|
||||
inSingletonScope(): IBindingInWhenProxySyntax<T>;
|
||||
when(constraint: (request: IRequest) => boolean): IBindingInWhenProxySyntax<T>;
|
||||
whenTargetNamed(name: string): IBindingInWhenProxySyntax<T>;
|
||||
whenTargetTagged(tag: string, value: any): IBindingInWhenProxySyntax<T>;
|
||||
proxy(fn: (injectable: T) => T): IBindingInWhenProxySyntax<T>;
|
||||
}
|
||||
|
||||
export interface IFactory<T> extends Function {
|
||||
(): T;
|
||||
}
|
||||
|
||||
interface IFactoryCreator<T> extends Function {
|
||||
(context: IContext): IFactory<T>;
|
||||
}
|
||||
|
||||
export interface INewable<T> {
|
||||
new(...args: any[]): T;
|
||||
}
|
||||
|
||||
export interface IProvider<T> extends Function {
|
||||
(): Promise<T>;
|
||||
}
|
||||
|
||||
interface IProviderCreator<T> extends Function {
|
||||
(context: IContext): IProvider<T>;
|
||||
}
|
||||
|
||||
export interface IContext {
|
||||
kernel: IKernel;
|
||||
plan: IPlan;
|
||||
addPlan(plan: IPlan): void;
|
||||
}
|
||||
|
||||
export interface IPlan {
|
||||
parentContext: IContext;
|
||||
rootRequest: IRequest;
|
||||
}
|
||||
|
||||
export interface IRequest {
|
||||
service: string;
|
||||
parentContext: IContext;
|
||||
parentRequest: IRequest;
|
||||
childRequests: IRequest[];
|
||||
target: ITarget;
|
||||
bindings: IBinding<any>[];
|
||||
addChildRequest(
|
||||
service: string,
|
||||
bindings: (IBinding<any>|IBinding<any>[]),
|
||||
target: ITarget): IRequest;
|
||||
}
|
||||
|
||||
export interface IBinding<T> {
|
||||
runtimeIdentifier: string;
|
||||
implementationType: INewable<T>;
|
||||
factory: IFactoryCreator<any>;
|
||||
provider: IProviderCreator<any>;
|
||||
constraint: (request: IRequest) => boolean;
|
||||
proxyMaker: (injectable: T) => T;
|
||||
cache: T;
|
||||
scope: number; // BindingScope
|
||||
type: number; // BindingType
|
||||
}
|
||||
|
||||
export interface ITarget {
|
||||
service: IQueryableString;
|
||||
name: IQueryableString;
|
||||
metadata: Array<IMetadata>;
|
||||
isArray(): boolean;
|
||||
isNamed(): boolean;
|
||||
isTagged(): boolean;
|
||||
matchesName(name: string): boolean;
|
||||
matchesTag(name: IMetadata): boolean;
|
||||
}
|
||||
|
||||
export interface IQueryableString {
|
||||
startsWith(searchString: string): boolean;
|
||||
endsWith(searchString: string): boolean;
|
||||
contains(searchString: string): boolean;
|
||||
equals(compareString: string): boolean;
|
||||
value(): string;
|
||||
}
|
||||
|
||||
export interface IMetadata {
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export var Kernel: IKernelConstructor;
|
||||
export var decorate: any;
|
||||
export function inject(...typeIdentifiers: string[]): (typeConstructor: any) => void;
|
||||
export var tagged: any;
|
||||
export var named: any;
|
||||
export var paramNames: any;
|
||||
}
|
||||
|
||||
declare module "inversify" {
|
||||
export = inversify;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -20,6 +20,7 @@ interface MockJaxSettings {
|
||||
statusText?: string;
|
||||
responseTime?: number;
|
||||
isTimeout?: boolean;
|
||||
dataType?: string;
|
||||
contentType?: string;
|
||||
response?: (settings: any) => void;
|
||||
responseText?: string | Object;
|
||||
|
||||
@@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler
|
||||
|
||||
// Tests with spec string
|
||||
function spec_string () {
|
||||
var result: React.ReactHTMLElement
|
||||
var result: React.ReactHTMLElement<HTMLElement>
|
||||
|
||||
// just spec string
|
||||
result = $('div')
|
||||
|
||||
Vendored
+2
-2
@@ -31,7 +31,7 @@ declare module 'jsnox' {
|
||||
* @param children A single React node (string or ReactElement) or array of nodes.
|
||||
* Note that unlike with React itself, multiple children must be placed into an array.
|
||||
*/
|
||||
<P>(specString: string, children: React.ReactNode): React.DOMElement<P>
|
||||
<P>(specString: string, children: React.ReactNode): React.DOMElement<P, Element>
|
||||
|
||||
/**
|
||||
* Renders an HTML element from the given spec string, with optional props
|
||||
@@ -42,7 +42,7 @@ declare module 'jsnox' {
|
||||
* @param children A single React node (string or ReactElement) or array of nodes.
|
||||
* Note that unlike with React itself, multiple children must be placed into an array.
|
||||
*/
|
||||
<P>(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.DOMElement<P>
|
||||
<P>(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.DOMElement<P, Element>
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="jss.d.ts" />
|
||||
|
||||
jss.set('.demo', {
|
||||
'font-size': '15px',
|
||||
'color': 'red'
|
||||
});
|
||||
|
||||
jss.get('.demo');
|
||||
|
||||
jss.get();
|
||||
|
||||
jss.getAll('.demo');
|
||||
|
||||
jss.remove('.demo');
|
||||
|
||||
jss.remove();
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Type definitions for jss v0.6
|
||||
// Project: https://github.com/Box9/jss
|
||||
// Definitions by: Valentin Robert <https://github.com/Ptival/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Properties {
|
||||
[name: string]: string;
|
||||
}
|
||||
|
||||
interface Selectors {
|
||||
[selector: string]: Properties;
|
||||
}
|
||||
|
||||
interface JSS {
|
||||
/**
|
||||
* Retrieve all rules added via JSS, organized by selectors
|
||||
*/
|
||||
get(): Selectors;
|
||||
|
||||
/**
|
||||
* Retrieve rules added via JSS for a given selector
|
||||
* @param s CSS selector
|
||||
*/
|
||||
get(s: string): Properties;
|
||||
|
||||
/**
|
||||
* Retrieve all rules specified for a given selector (not necessarily added via JSS)
|
||||
* @param s CSS selector
|
||||
*/
|
||||
getAll(s: string): Properties;
|
||||
|
||||
/**
|
||||
* Remove all rules added via JSS
|
||||
*/
|
||||
remove(): void;
|
||||
|
||||
/**
|
||||
* Remove all rules added via JSS for the given selector
|
||||
*/
|
||||
remove(s: string): void;
|
||||
|
||||
/**
|
||||
* Add or extend an existing rule
|
||||
* @param s CSS selector
|
||||
* @param p CSS properties
|
||||
*/
|
||||
set(s: string, p: Properties): void;
|
||||
}
|
||||
|
||||
declare var jss: JSS;
|
||||
Vendored
+46
-12
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Kendo UI Professional v2016.1.226
|
||||
// Type definitions for Kendo UI Professional v2016.1.314
|
||||
// Project: http://www.telerik.com/kendo-ui
|
||||
// Definitions by: Telerik <https://github.com/telerik/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -246,6 +246,8 @@ declare module kendo {
|
||||
};
|
||||
};
|
||||
|
||||
var version: string;
|
||||
|
||||
interface TemplateOptions {
|
||||
paramName?: string;
|
||||
useWithBlock?: boolean;
|
||||
@@ -301,7 +303,7 @@ declare module kendo {
|
||||
|
||||
class Layout extends View {
|
||||
containers: { [selector: string]: ViewContainer; };
|
||||
showIn(selector: string, view: View): void;
|
||||
showIn(selector: string, view: View, transitionClass?: string): void;
|
||||
}
|
||||
|
||||
class History extends Observable {
|
||||
@@ -317,8 +319,13 @@ declare module kendo {
|
||||
|
||||
interface RouterOptions {
|
||||
init?: (e: RouterEvent) => void;
|
||||
routeMissing?: (e: RouterEvent) => void;
|
||||
change?: (e: RouterEvent) => void;
|
||||
pushState?: boolean;
|
||||
hashBang?: boolean;
|
||||
root?: string;
|
||||
ignoreCase?: boolean;
|
||||
change?(e: RouterChangeEvent): void;
|
||||
routeMissing?(e: RouterRouteMissingEvent): void;
|
||||
same?(e: RouterEvent): void;
|
||||
}
|
||||
|
||||
interface RouterEvent {
|
||||
@@ -328,6 +335,15 @@ declare module kendo {
|
||||
isDefaultPrevented(): boolean;
|
||||
}
|
||||
|
||||
interface RouterChangeEvent extends RouterEvent {
|
||||
params: any;
|
||||
backButtonPressed: boolean;
|
||||
}
|
||||
|
||||
interface RouterRouteMissingEvent extends RouterEvent {
|
||||
params: any;
|
||||
}
|
||||
|
||||
class Route extends Class {
|
||||
route: RegExp;
|
||||
callback(url: string): void;
|
||||
@@ -348,6 +364,9 @@ declare module kendo {
|
||||
}
|
||||
|
||||
declare module kendo.effects {
|
||||
function enable(): void;
|
||||
function disable(): void;
|
||||
|
||||
interface Element {
|
||||
expand(direction: string): effects.Expand;
|
||||
expandHorizontal(): effects.Expand;
|
||||
@@ -932,6 +951,7 @@ declare module kendo.data {
|
||||
interface DataSourceSchemaModel {
|
||||
id?: string;
|
||||
fields?: any;
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
interface DataSourceSchemaModelWithFieldsArray extends DataSourceSchemaModel {
|
||||
@@ -4390,6 +4410,9 @@ declare module kendo.ui {
|
||||
landscape?: boolean;
|
||||
margin?: GridPdfMargin;
|
||||
paperSize?: string|any;
|
||||
template?: string;
|
||||
repeatHeaders?: boolean;
|
||||
scale?: number|any|any;
|
||||
proxyURL?: string;
|
||||
proxyTarget?: string;
|
||||
subject?: string;
|
||||
@@ -6555,9 +6578,16 @@ declare module kendo.ui {
|
||||
mergedCells?: any;
|
||||
rows?: SpreadsheetSheetRow[];
|
||||
selection?: string;
|
||||
showGridLines?: boolean;
|
||||
sort?: SpreadsheetSheetSort;
|
||||
}
|
||||
|
||||
interface SpreadsheetToolbar {
|
||||
home?: boolean|any;
|
||||
insert?: boolean|any;
|
||||
data?: boolean|any;
|
||||
}
|
||||
|
||||
interface SpreadsheetInsertSheetOptions {
|
||||
rows?: number;
|
||||
columns?: number;
|
||||
@@ -6582,7 +6612,7 @@ declare module kendo.ui {
|
||||
rows?: number;
|
||||
sheets?: SpreadsheetSheet[];
|
||||
sheetsbar?: boolean;
|
||||
toolbar?: boolean;
|
||||
toolbar?: SpreadsheetToolbar;
|
||||
change?(e: SpreadsheetChangeEvent): void;
|
||||
render?(e: SpreadsheetRenderEvent): void;
|
||||
excelExport?(e: SpreadsheetExcelExportEvent): void;
|
||||
@@ -7854,9 +7884,9 @@ declare module kendo.ui {
|
||||
|
||||
center(): kendo.ui.Window;
|
||||
close(): kendo.ui.Window;
|
||||
content(): any;
|
||||
content(content?: string): void;
|
||||
content(content?: JQuery): void;
|
||||
content(): string;
|
||||
content(content?: string): kendo.ui.Window;
|
||||
content(content?: JQuery): kendo.ui.Window;
|
||||
destroy(): void;
|
||||
maximize(): kendo.ui.Window;
|
||||
minimize(): kendo.ui.Window;
|
||||
@@ -7865,8 +7895,8 @@ declare module kendo.ui {
|
||||
refresh(options: any): kendo.ui.Window;
|
||||
restore(): kendo.ui.Window;
|
||||
setOptions(options: any): void;
|
||||
title(): kendo.ui.Window;
|
||||
title(text?: string): void;
|
||||
title(): string;
|
||||
title(text?: string): kendo.ui.Window;
|
||||
toFront(): kendo.ui.Window;
|
||||
toggleMaximization(): kendo.ui.Window;
|
||||
unpin(): void;
|
||||
@@ -10332,9 +10362,9 @@ declare module kendo.dataviz.ui {
|
||||
options: DiagramOptions;
|
||||
|
||||
dataSource: kendo.data.DataSource;
|
||||
connections: DiagramConnection[];
|
||||
connections: kendo.dataviz.diagram.Connection[];
|
||||
connectionsDataSource: kendo.data.DataSource;
|
||||
shapes: DiagramShape[];
|
||||
shapes: kendo.dataviz.diagram.Shape[];
|
||||
|
||||
element: JQuery;
|
||||
wrapper: JQuery;
|
||||
@@ -15753,6 +15783,7 @@ declare module kendo.spreadsheet {
|
||||
fontFamily(value?: string): void;
|
||||
fontSize(): number;
|
||||
fontSize(value?: number): void;
|
||||
forEachCell(callback: Function): void;
|
||||
format(): string;
|
||||
format(format?: string): void;
|
||||
formula(): string;
|
||||
@@ -15824,6 +15855,8 @@ declare module kendo.spreadsheet {
|
||||
rowHeight(): void;
|
||||
rowHeight(index: number, width?: number): void;
|
||||
selection(): kendo.spreadsheet.Range;
|
||||
showGridLines(): boolean;
|
||||
showGridLines(showGridLiens?: boolean): void;
|
||||
toJSON(): void;
|
||||
unhideColumn(index: number): void;
|
||||
unhideRow(index: number): void;
|
||||
@@ -16959,6 +16992,7 @@ declare module kendo.ooxml {
|
||||
filter?: WorkbookSheetFilter;
|
||||
name?: string;
|
||||
rows?: WorkbookSheetRow[];
|
||||
showGridLines?: boolean;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -6340,28 +6340,28 @@ namespace TestClone {
|
||||
let customizer: CloneCustomizer<number, string>;
|
||||
let result: string;
|
||||
|
||||
result = _.clone<number>(42, false, customizer);
|
||||
result = _.clone<number>(42, false, customizer, any);
|
||||
result = _.clone<number>(42, customizer);
|
||||
result = _.clone<number>(42, customizer, any);
|
||||
result = _.clone<string>(42, false, customizer);
|
||||
result = _.clone<string>(42, false, customizer, any);
|
||||
result = _.clone<string>(42, customizer);
|
||||
result = _.clone<string>(42, customizer, any);
|
||||
result = _.clone<number, string>(42, false, customizer);
|
||||
result = _.clone<number, string>(42, false, customizer, any);
|
||||
result = _.clone<number, string>(42, customizer);
|
||||
result = _.clone<number, string>(42, customizer, any);
|
||||
result = _(42).clone<number>(false, customizer);
|
||||
result = _(42).clone<number>(false, customizer, any);
|
||||
result = _(42).clone<number>(customizer);
|
||||
result = _(42).clone<number>(customizer, any);
|
||||
result = _(42).clone<string>(false, customizer);
|
||||
result = _(42).clone<string>(false, customizer, any);
|
||||
result = _(42).clone<string>(customizer);
|
||||
result = _(42).clone<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneCustomizer<number, string>;
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _(42).chain().clone<number>(false, customizer);
|
||||
result = _(42).chain().clone<number>(false, customizer, any);
|
||||
result = _(42).chain().clone<number>(customizer);
|
||||
result = _(42).chain().clone<number>(customizer, any);
|
||||
result = _(42).chain().clone<string>(false, customizer);
|
||||
result = _(42).chain().clone<string>(false, customizer, any);
|
||||
result = _(42).chain().clone<string>(customizer);
|
||||
result = _(42).chain().clone<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -6386,28 +6386,28 @@ namespace TestClone {
|
||||
let customizer: CloneCustomizer<number[], string[]>;
|
||||
let result: string[];
|
||||
|
||||
result = _.clone<number[]>([42], false, customizer);
|
||||
result = _.clone<number[]>([42], false, customizer, any);
|
||||
result = _.clone<number[]>([42], customizer);
|
||||
result = _.clone<number[]>([42], customizer, any);
|
||||
result = _.clone<string[]>([42], false, customizer);
|
||||
result = _.clone<string[]>([42], false, customizer, any);
|
||||
result = _.clone<string[]>([42], customizer);
|
||||
result = _.clone<string[]>([42], customizer, any);
|
||||
result = _.clone<number[], string[]>([42], false, customizer);
|
||||
result = _.clone<number[], string[]>([42], false, customizer, any);
|
||||
result = _.clone<number[], string[]>([42], customizer);
|
||||
result = _.clone<number[], string[]>([42], customizer, any);
|
||||
result = _([42]).clone<number[]>(false, customizer);
|
||||
result = _([42]).clone<number[]>(false, customizer, any);
|
||||
result = _([42]).clone<number[]>(customizer);
|
||||
result = _([42]).clone<number[]>(customizer, any);
|
||||
result = _([42]).clone<string[]>(false, customizer);
|
||||
result = _([42]).clone<string[]>(false, customizer, any);
|
||||
result = _([42]).clone<string[]>(customizer);
|
||||
result = _([42]).clone<string[]>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneCustomizer<number[], string[]>;
|
||||
let result: _.LoDashExplicitArrayWrapper<string>;
|
||||
|
||||
result = _([42]).chain().clone<number[]>(false, customizer);
|
||||
result = _([42]).chain().clone<number[]>(false, customizer, any);
|
||||
result = _([42]).chain().clone<number[]>(customizer);
|
||||
result = _([42]).chain().clone<number[]>(customizer, any);
|
||||
result = _([42]).chain().clone<string>(false, customizer);
|
||||
result = _([42]).chain().clone<string>(false, customizer, any);
|
||||
result = _([42]).chain().clone<string>(customizer);
|
||||
result = _([42]).chain().clone<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -6432,28 +6432,28 @@ namespace TestClone {
|
||||
let customizer: CloneCustomizer<{a: {b: number;};}, {a: {b: string;};}>;
|
||||
let result: {a: {b: string;};};
|
||||
|
||||
result = _.clone<{a: {b: number;};}>({a: {b: 42}}, false, customizer);
|
||||
result = _.clone<{a: {b: number;};}>({a: {b: 42}}, false, customizer, any);
|
||||
result = _.clone<{a: {b: number;};}>({a: {b: 42}}, customizer);
|
||||
result = _.clone<{a: {b: number;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _.clone<{a: {b: string;};}>({a: {b: 42}}, false, customizer);
|
||||
result = _.clone<{a: {b: string;};}>({a: {b: 42}}, false, customizer, any);
|
||||
result = _.clone<{a: {b: string;};}>({a: {b: 42}}, customizer);
|
||||
result = _.clone<{a: {b: string;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _.clone<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, false, customizer);
|
||||
result = _.clone<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, false, customizer, any);
|
||||
result = _.clone<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer);
|
||||
result = _.clone<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: number;};}>(false, customizer);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: number;};}>(false, customizer, any);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: number;};}>(customizer);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: number;};}>(customizer, any);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: string;};}>(false, customizer);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: string;};}>(false, customizer, any);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: string;};}>(customizer);
|
||||
result = _({a: {b: 42}}).clone<{a: {b: string;};}>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneCustomizer<{a: {b: number;};}, {a: {b: string;};}>;
|
||||
let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>;
|
||||
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: number;};}>(false, customizer);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: number;};}>(false, customizer, any);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: number;};}>(customizer);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: number;};}>(customizer, any);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: string;};}>(false, customizer);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: string;};}>(false, customizer, any);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: string;};}>(customizer);
|
||||
result = _({a: {b: 42}}).chain().clone<{a: {b: string;};}>(customizer, any);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6475,27 +6475,27 @@ namespace TestCloneDeep {
|
||||
let customizer: CloneDeepCustomizer<number, number>;
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _(42).chain.cloneDeep();
|
||||
result = _(42).chain().cloneDeep();
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneDeepCustomizer<number, string>;
|
||||
let result: string;
|
||||
|
||||
result = _.cloneDeep<number>(42, customizer);
|
||||
result = _.cloneDeep<number>(42, customizer, any);
|
||||
result = _.cloneDeep<string>(42, customizer);
|
||||
result = _.cloneDeep<string>(42, customizer, any);
|
||||
result = _.cloneDeep<number, string>(42, customizer);
|
||||
result = _.cloneDeep<number, string>(42, customizer, any);
|
||||
result = _(42).cloneDeep<number>(customizer);
|
||||
result = _(42).cloneDeep<number>(customizer, any);
|
||||
result = _(42).cloneDeep<string>(customizer);
|
||||
result = _(42).cloneDeep<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneDeepCustomizer<number, string>;
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _(42).chain().cloneDeep<number>(customizer);
|
||||
result = _(42).chain().cloneDeep<number>(customizer, any);
|
||||
result = _(42).chain().cloneDeep<string>(customizer);
|
||||
result = _(42).chain().cloneDeep<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -6517,20 +6517,20 @@ namespace TestCloneDeep {
|
||||
let customizer: CloneDeepCustomizer<number[], string[]>;
|
||||
let result: string[];
|
||||
|
||||
result = _.cloneDeep<number[]>([42], customizer);
|
||||
result = _.cloneDeep<number[]>([42], customizer, any);
|
||||
result = _.cloneDeep<string[]>([42], customizer);
|
||||
result = _.cloneDeep<string[]>([42], customizer, any);
|
||||
result = _.cloneDeep<number[], string[]>([42], customizer);
|
||||
result = _.cloneDeep<number[], string[]>([42], customizer, any);
|
||||
result = _([42]).cloneDeep<number[]>(customizer);
|
||||
result = _([42]).cloneDeep<number[]>(customizer, any);
|
||||
result = _([42]).cloneDeep<string[]>(customizer);
|
||||
result = _([42]).cloneDeep<string[]>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneDeepCustomizer<number[], string[]>;
|
||||
let result: _.LoDashExplicitArrayWrapper<string>;
|
||||
|
||||
result = _([42]).chain().cloneDeep<number[]>(customizer);
|
||||
result = _([42]).chain().cloneDeep<number[]>(customizer, any);
|
||||
result = _([42]).chain().cloneDeep<string>(customizer);
|
||||
result = _([42]).chain().cloneDeep<string>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -6552,20 +6552,20 @@ namespace TestCloneDeep {
|
||||
let customizer: CloneDeepCustomizer<{a: {b: number;};}, {a: {b: string;};}>;
|
||||
let result: {a: {b: string;};};
|
||||
|
||||
result = _.cloneDeep<{a: {b: number;};}>({a: {b: 42}}, customizer);
|
||||
result = _.cloneDeep<{a: {b: number;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _.cloneDeep<{a: {b: string;};}>({a: {b: 42}}, customizer);
|
||||
result = _.cloneDeep<{a: {b: string;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _.cloneDeep<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer);
|
||||
result = _.cloneDeep<{a: {b: number;};}, {a: {b: string;};}>({a: {b: 42}}, customizer, any);
|
||||
result = _({a: {b: 42}}).cloneDeep<{a: {b: number;};}>(customizer);
|
||||
result = _({a: {b: 42}}).cloneDeep<{a: {b: number;};}>(customizer, any);
|
||||
result = _({a: {b: 42}}).cloneDeep<{a: {b: string;};}>(customizer);
|
||||
result = _({a: {b: 42}}).cloneDeep<{a: {b: string;};}>(customizer, any);
|
||||
}
|
||||
|
||||
{
|
||||
let customizer: CloneDeepCustomizer<{a: {b: number;};}, {a: {b: string;};}>;
|
||||
let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>;
|
||||
|
||||
result = _({a: {b: 42}}).chain().cloneDeep<{a: {b: number;};}>(customizer);
|
||||
result = _({a: {b: 42}}).chain().cloneDeep<{a: {b: number;};}>(customizer, any);
|
||||
result = _({a: {b: 42}}).chain().cloneDeep<{a: {b: string;};}>(customizer);
|
||||
result = _({a: {b: 42}}).chain().cloneDeep<{a: {b: string;};}>(customizer, any);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-11
@@ -10240,7 +10240,7 @@ declare module _ {
|
||||
*/
|
||||
clone(
|
||||
isDeep?: boolean
|
||||
): T;
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
@@ -10519,7 +10519,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.cloneDeep
|
||||
*/
|
||||
cloneDeep(): T;
|
||||
cloneDeep(): T[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
@@ -10565,9 +10565,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.cloneDeep
|
||||
*/
|
||||
cloneDeep(
|
||||
isDeep?: boolean
|
||||
): LoDashExplicitWrapper<T>;
|
||||
cloneDeep(): LoDashExplicitWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
@@ -10598,9 +10596,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.cloneDeep
|
||||
*/
|
||||
cloneDeep(
|
||||
isDeep?: boolean
|
||||
): LoDashExplicitArrayWrapper<T>;
|
||||
cloneDeep(): LoDashExplicitArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
@@ -10631,9 +10627,7 @@ declare module _ {
|
||||
/**
|
||||
* @see _.cloneDeep
|
||||
*/
|
||||
cloneDeep(
|
||||
isDeep?: boolean
|
||||
): LoDashExplicitObjectWrapper<T>;
|
||||
cloneDeep(): LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.eq
|
||||
|
||||
@@ -7170,6 +7170,37 @@ module TestIsUndefined {
|
||||
}
|
||||
}
|
||||
|
||||
// _.isWeakMap
|
||||
module TestIsWeakMap {
|
||||
{
|
||||
let value: number|WeakMap<string, number>;
|
||||
|
||||
if (_.isWeakMap<string, number>(value)) {
|
||||
let result: WeakMap<string, number> = value;
|
||||
}
|
||||
else {
|
||||
let result: number = value;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.isWeakMap(any);
|
||||
result = _(1).isWeakMap();
|
||||
result = _<any>([]).isWeakMap();
|
||||
result = _({}).isWeakMap();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _(1).chain().isWeakMap();
|
||||
result = _<any>([]).chain().isWeakMap();
|
||||
result = _({}).chain().isWeakMap();
|
||||
}
|
||||
}
|
||||
|
||||
// _.lt
|
||||
module TestLt {
|
||||
{
|
||||
|
||||
Vendored
+26
@@ -12267,6 +12267,31 @@ declare module _ {
|
||||
isUndefined(): LoDashExplicitWrapper<boolean>;
|
||||
}
|
||||
|
||||
//_.isWeakMap
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is classified as a WeakMap object.
|
||||
*
|
||||
* @param value The value to check.
|
||||
* @returns Returns true if value is correctly classified, else false.
|
||||
*/
|
||||
isWeakMap<K, V>(value?: any): value is WeakMap<K, V>;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.isSet
|
||||
*/
|
||||
isWeakMap(): boolean;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.isSet
|
||||
*/
|
||||
isWeakMap(): LoDashExplicitWrapper<boolean>;
|
||||
}
|
||||
|
||||
//_.lt
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -18487,3 +18512,4 @@ declare module "lodash" {
|
||||
// Backward compatibility with --target es5
|
||||
interface Set<T> {}
|
||||
interface Map<K, V> {}
|
||||
interface WeakMap<K, V> {}
|
||||
|
||||
Vendored
+864
-484
File diff suppressed because it is too large
Load Diff
@@ -11,3 +11,9 @@ var merged = merge(stream1, stream2);
|
||||
|
||||
var stream3 = new Stream();
|
||||
merged.add(stream3);
|
||||
|
||||
var stream4 = new Stream();
|
||||
var stream5 = new Stream();
|
||||
merged.add([stream4, stream5]);
|
||||
|
||||
merged.isEmpty();
|
||||
|
||||
Vendored
+6
-5
@@ -1,14 +1,15 @@
|
||||
// Type definitions for merge-stream
|
||||
// Type definitions for merge-stream v1.0.0
|
||||
// Project: https://github.com/grncdr/merge-stream
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>, Tom X. Tobin <http://tomxtobin.com/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "merge-stream" {
|
||||
|
||||
interface IMergedStream extends NodeJS.ReadWriteStream {
|
||||
add: (source: NodeJS.ReadableStream) => IMergedStream;
|
||||
add(source: NodeJS.ReadableStream): IMergedStream;
|
||||
add(source: NodeJS.ReadableStream[]): IMergedStream;
|
||||
isEmpty(): boolean;
|
||||
}
|
||||
|
||||
function merge<T extends NodeJS.ReadableStream>(...streams: T[]): IMergedStream;
|
||||
|
||||
+143
-36
@@ -2657,22 +2657,22 @@ declare module Sdk.Mdq
|
||||
|
||||
export interface IEntityMetadata
|
||||
{
|
||||
ActivityTypeMask: any;
|
||||
ActivityTypeMask: number;
|
||||
Attributes: IAttributeMetadata[];
|
||||
AutoCreateAccessTeams: any;
|
||||
AutoRouteToOwnerQueue: boolean;
|
||||
CanBeInManyToMany: boolean;
|
||||
CanBePrimaryEntityInRelationship: boolean;
|
||||
CanBeRelatedEntityInRelationship: boolean;
|
||||
CanCreateAttributes: boolean;
|
||||
CanCreateCharts: boolean;
|
||||
CanCreateForms: boolean;
|
||||
CanCreateViews: boolean;
|
||||
CanModifyAdditionalSettings: boolean;
|
||||
CanBeInManyToMany: ManagedProperty<boolean>;
|
||||
CanBePrimaryEntityInRelationship: ManagedProperty<boolean>;
|
||||
CanBeRelatedEntityInRelationship: ManagedProperty<boolean>;
|
||||
CanCreateAttributes: ManagedProperty<boolean>;
|
||||
CanCreateCharts: ManagedProperty<boolean>;
|
||||
CanCreateForms: ManagedProperty<boolean>;
|
||||
CanCreateViews: ManagedProperty<boolean>;
|
||||
CanModifyAdditionalSettings: ManagedProperty<boolean>;
|
||||
CanTriggerWorkflow: boolean;
|
||||
Description: string;
|
||||
DisplayCollectionName: string;
|
||||
DisplayName: string;
|
||||
Description: Label;
|
||||
DisplayCollectionName: Label;
|
||||
DisplayName: Label;
|
||||
IconLargeName: string;
|
||||
IconMediumName: string;
|
||||
IconSmallName: string;
|
||||
@@ -2680,60 +2680,145 @@ declare module Sdk.Mdq
|
||||
IsActivity: boolean;
|
||||
IsActivityParty: boolean;
|
||||
IsAIRUpdated: boolean;
|
||||
IsAuditEnabled: boolean;
|
||||
IsAuditEnabled: ManagedProperty<boolean>;
|
||||
IsAvailableOffline: boolean;
|
||||
IsBusinessProcessEnabled: boolean;
|
||||
IsChildEntity: boolean;
|
||||
IsConnectionsEnabled: boolean;
|
||||
IsConnectionsEnabled: ManagedProperty<boolean>;
|
||||
IsCustomEntity: boolean;
|
||||
IsCustomizable: boolean;
|
||||
IsCustomizable: ManagedProperty<boolean>;
|
||||
IsDocumentManagementEnabled: boolean;
|
||||
IsDuplicateDetectionEnabled: boolean;
|
||||
IsDuplicateDetectionEnabled: ManagedProperty<boolean>;
|
||||
IsEnabledForCharts: boolean;
|
||||
IsImportable: boolean;
|
||||
IsIntersect: boolean;
|
||||
IsMailMergeEnabled: boolean;
|
||||
IsMailMergeEnabled: ManagedProperty<boolean>;
|
||||
IsManaged: boolean;
|
||||
IsMappable: boolean;
|
||||
IsMappable: ManagedProperty<boolean>;
|
||||
IsQuickCreateEnabled: boolean;
|
||||
IsReadingPaneEnabled: boolean;
|
||||
IsRenameable: boolean;
|
||||
IsValidForAdvancedFind: boolean;
|
||||
IsValidForQueue: boolean;
|
||||
IsVisibleInMobile: boolean;
|
||||
IsValidForQueue: ManagedProperty<boolean>;
|
||||
IsVisibleInMobile: ManagedProperty<boolean>;
|
||||
IsVisibleInMobileClient: boolean;
|
||||
LogicalName: string;
|
||||
ManyToManyRelationships: any;
|
||||
ManyToOneRelationships: any;
|
||||
ManyToManyRelationships: ManyToManyRelationshipMetadata;
|
||||
ManyToOneRelationships: OneToManyRelationshipMetadata;
|
||||
MetadataId: string;
|
||||
ObjectTypeCode: number;
|
||||
OneToManyRelationships: any;
|
||||
OwnershipType: string;
|
||||
OneToManyRelationships: OneToManyRelationshipMetadata;
|
||||
OwnershipType: "BusinessOwned" | "BusinessParented" | "None OrganizationOwned" | "TeamOwned UserOwned";
|
||||
PrimaryIdAttribute: string;
|
||||
PrimaryImageAttribute: string;
|
||||
PrimaryNameAttribute: string;
|
||||
Privileges: any;
|
||||
Privileges: SecurityPrivilegeMetadata[];
|
||||
RecurrenceBaseEntityLogicalName: string;
|
||||
ReportViewName: string;
|
||||
SchemaName: string;
|
||||
}
|
||||
|
||||
export interface SecurityPrivilegeMetadata
|
||||
{
|
||||
CanBeBasic: boolean;
|
||||
CanBeDeep: boolean;
|
||||
CanBeEntityReference: boolean;
|
||||
CanBeGlobal: boolean;
|
||||
CanBeLocal: boolean;
|
||||
CanBeParentEntityReference: boolean;
|
||||
ExtensionData: boolean;
|
||||
Name: string;
|
||||
PrivilegeId: string;
|
||||
PrivilegeType: "Append" | "AppendTo" | "Assign" | "Create" | "Delete" | "None" | "Read" | "Share" | "Write";
|
||||
}
|
||||
|
||||
export interface OneToManyRelationshipMetadata
|
||||
{
|
||||
AssociatedMenuConfiguration: AssociatedMenuConfiguration;
|
||||
CascadeConfiguration: CascadeConfiguration;
|
||||
HasChanged: any;
|
||||
IntroducedVersion: any;
|
||||
IsCustomizable: ManagedProperty<boolean>;
|
||||
IsCustomRelationship: boolean;
|
||||
IsHierarchical: any;
|
||||
IsManaged: boolean;
|
||||
IsValidForAdvancedFind: boolean;
|
||||
MetadataId: string;
|
||||
ReferencedAttribute: string;
|
||||
ReferencedEntity: string;
|
||||
ReferencingAttribute: string;
|
||||
ReferencingEntity: string;
|
||||
RelationshipType: string;
|
||||
SchemaName: string;
|
||||
SecurityTypes: any;
|
||||
}
|
||||
|
||||
export interface CascadeConfiguration
|
||||
{
|
||||
Assign: CascadeType;
|
||||
Delete: CascadeType;
|
||||
ExtensionData: CascadeType;
|
||||
Merge: CascadeType;
|
||||
Reparent: CascadeType;
|
||||
Share: CascadeType;
|
||||
Unshare: CascadeType;
|
||||
}
|
||||
|
||||
export type CascadeType = "Active" | "Cascade" | "NoCascade" | "UserOwned";
|
||||
|
||||
export interface ManyToManyRelationshipMetadata
|
||||
{
|
||||
Entity1AssociatedMenuConfiguration: AssociatedMenuConfiguration;
|
||||
Entity1IntersectAttribute: string;
|
||||
Entity1LogicalName: string;
|
||||
Entity2AssociatedMenuConfiguration: AssociatedMenuConfiguration;
|
||||
Entity2IntersectAttribute: string;
|
||||
Entity2LogicalName: string;
|
||||
HasChanged: boolean;
|
||||
IntersectEntityName: string;
|
||||
IntroducedVersion: any;
|
||||
IsCustomizable: ManagedProperty<boolean>;
|
||||
IsCustomRelationship: boolean;
|
||||
IsManaged: boolean;
|
||||
IsValidForAdvancedFind: boolean;
|
||||
MetadataId: string;
|
||||
RelationshipType: RelationshipType;
|
||||
SchemaName: string;
|
||||
SecurityTypes: SecurityType;
|
||||
}
|
||||
|
||||
export interface AssociatedMenuConfiguration
|
||||
{
|
||||
Behavior: AssociatedMenuBehavior;
|
||||
Group: AssociatedMenuGroup;
|
||||
Label: Label;
|
||||
Order: number;
|
||||
}
|
||||
|
||||
export type AssociatedMenuBehavior = "DoNotDisplay" | "UseCollectionName" | "UseLabel";
|
||||
|
||||
export type AssociatedMenuGroup = "Details" | "Marketing" | "Sales" | "Service";
|
||||
|
||||
export type RelationshipType = "Default" | "ManyToManyRelationship" | "OneToManyRelationship";
|
||||
|
||||
export type SecurityType = "Append" | "Inheritance" | "None" | "ParentChild" | "Pointer";
|
||||
|
||||
export interface IAttributeMetadata
|
||||
{
|
||||
AttributeOf: any;
|
||||
AttributeType: any;
|
||||
AttributeTypeName: string;
|
||||
AttributeOf: string;
|
||||
AttributeType: "Customer" | "DateTime" | "Decimal" | "Double" | "EntityName" | "Integer" | "Lookup" | "ManagedProperty" | "Memo" | "Money" | "Owner" | "PartyList" | "Picklist" | "State" | "Status" | "Uniqueidentifier" | "Virtual"
|
||||
AttributeTypeName: "BigIntType" | "BooleanType" | "CalendarRulesType" | "CustomerType" | "DateTimeType" | "DecimalType" | "DoubleType" | "EntityNameType" | "ImageType" | "IntegerType" | "LookupType" | "ManagedPropertyType" | "MemoType" | "MoneyType" | "OwnerType" | "PartyListType" | "PicklistType" | "StateType StatusType" | "StringType" | "UniqueidentifierType" | "VirtualType";
|
||||
CalculationOf: any;
|
||||
CanBeSecuredForCreate: boolean;
|
||||
CanBeSecuredForRead: boolean;
|
||||
CanBeSecuredForUpdate: boolean;
|
||||
CanModifyAdditionalSettings: boolean;
|
||||
CanModifyAdditionalSettings: ManagedProperty<boolean>;
|
||||
ColumnNumber: number;
|
||||
DefaultFormValue: any;
|
||||
DefaultValue: any;
|
||||
DeprecatedVersion: any;
|
||||
Description: string;
|
||||
DisplayName: string;
|
||||
Description: Label;
|
||||
DisplayName: Label;
|
||||
EntityLogicalName: string;
|
||||
Format: any;
|
||||
FormatName: string;
|
||||
@@ -2741,13 +2826,13 @@ declare module Sdk.Mdq
|
||||
IntroducedVersion: any;
|
||||
IsAuditEnabled: boolean;
|
||||
IsCustomAttribute: boolean;
|
||||
IsCustomizable: boolean;
|
||||
IsCustomizable: ManagedProperty<boolean>;
|
||||
IsManaged: boolean;
|
||||
IsPrimaryId: boolean;
|
||||
IsPrimaryName: boolean;
|
||||
IsRenameable: boolean;
|
||||
IsRenameable: ManagedProperty<boolean>;
|
||||
IsSecured: boolean;
|
||||
IsValidForAdvancedFind: boolean;
|
||||
IsValidForAdvancedFind: ManagedProperty<boolean>;
|
||||
IsValidForCreate: boolean;
|
||||
IsValidForRead: boolean;
|
||||
IsValidForUpdate: boolean;
|
||||
@@ -2760,12 +2845,34 @@ declare module Sdk.Mdq
|
||||
OptionSet: any;
|
||||
Precision: any;
|
||||
PrecisionSource: any;
|
||||
RequiredLevel: any;
|
||||
RequiredLevel: ManagedProperty<string>;
|
||||
SchemaName: string;
|
||||
Targets: string[];
|
||||
YomiOf: any;
|
||||
}
|
||||
|
||||
export interface ManagedProperty<T>
|
||||
{
|
||||
CanBeChanged: boolean;
|
||||
ManagedPropertyLogicalName: string;
|
||||
Value: T;
|
||||
}
|
||||
|
||||
export interface Label
|
||||
{
|
||||
LocalizedLabels: LocalizedLabel[];
|
||||
UserLocalizedLabel: LocalizedLabel;
|
||||
}
|
||||
|
||||
export interface LocalizedLabel
|
||||
{
|
||||
Label: string;
|
||||
LangaugeCode: number;
|
||||
MetadataId: string;
|
||||
HasChanged: boolean;
|
||||
IsManaged: boolean;
|
||||
}
|
||||
|
||||
module ValueEnums
|
||||
{
|
||||
export enum OwnershipType
|
||||
@@ -2860,4 +2967,4 @@ declare module Sdk.Mdq
|
||||
}
|
||||
|
||||
declare module Sdk.Mdq.ValueEnums
|
||||
{ }
|
||||
{ }
|
||||
Vendored
+116
-45
@@ -80,6 +80,7 @@ declare var SlowBuffer: {
|
||||
|
||||
|
||||
// Buffer class
|
||||
type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "binary" | "hex";
|
||||
interface Buffer extends NodeBuffer {}
|
||||
|
||||
/**
|
||||
@@ -227,8 +228,8 @@ declare module NodeJS {
|
||||
removeListener(event: string, listener: Function): this;
|
||||
removeAllListeners(event?: string): this;
|
||||
}
|
||||
|
||||
export interface MemoryUsage {
|
||||
|
||||
export interface MemoryUsage {
|
||||
rss: number;
|
||||
heapTotal: number;
|
||||
heapUsed: number;
|
||||
@@ -945,7 +946,7 @@ declare module "child_process" {
|
||||
stdin: stream.Writable;
|
||||
stdout: stream.Readable;
|
||||
stderr: stream.Readable;
|
||||
stdio: (stream.Readable|stream.Writable)[];
|
||||
stdio: [stream.Writable, stream.Readable, stream.Readable];
|
||||
pid: number;
|
||||
kill(signal?: string): void;
|
||||
send(message: any, sendHandle?: any): void;
|
||||
@@ -953,39 +954,66 @@ declare module "child_process" {
|
||||
unref(): void;
|
||||
}
|
||||
|
||||
export function spawn(command: string, args?: string[], options?: {
|
||||
export interface SpawnOptions {
|
||||
cwd?: string;
|
||||
stdio?: any;
|
||||
custom?: any;
|
||||
env?: any;
|
||||
stdio?: any;
|
||||
detached?: boolean;
|
||||
}): ChildProcess;
|
||||
export function exec(command: string, options: {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
shell?: boolean | string;
|
||||
}
|
||||
export function spawn(command: string, args?: string[], options?: SpawnOptions): ChildProcess;
|
||||
|
||||
export interface ExecOptions {
|
||||
cwd?: string;
|
||||
stdio?: any;
|
||||
customFds?: any;
|
||||
env?: any;
|
||||
encoding?: string;
|
||||
shell?: string;
|
||||
timeout?: number;
|
||||
maxBuffer?: number;
|
||||
killSignal?: string;
|
||||
}, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string,
|
||||
callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[],
|
||||
callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}
|
||||
export interface ExecOptionsWithStringEncoding extends ExecOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
export interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function exec(command: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
// usage. child_process.exec("tsc", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function exec(command: string, options: ExecOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function exec(command: string, options: ExecOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
|
||||
export interface ExecFileOptions {
|
||||
cwd?: string;
|
||||
stdio?: any;
|
||||
customFds?: any;
|
||||
env?: any;
|
||||
encoding?: string;
|
||||
timeout?: number;
|
||||
maxBuffer?: number;
|
||||
killSignal?: string;
|
||||
}, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function fork(modulePath: string, args?: string[], options?: {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}
|
||||
export interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
export interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function execFile(file: string, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithStringEncoding, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
// usage. child_process.execFile("file.sh", ["foo"], {encoding: null as string}, (err, stdout, stderr) => {});
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptionsWithBufferEncoding, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||
export function execFile(file: string, args?: string[], options?: ExecFileOptions, callback?: (error: Error, stdout: string, stderr: string) =>void ): ChildProcess;
|
||||
|
||||
export interface ForkOptions {
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
execPath?: string;
|
||||
@@ -993,8 +1021,10 @@ declare module "child_process" {
|
||||
silent?: boolean;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}): ChildProcess;
|
||||
export function spawnSync(command: string, args?: string[], options?: {
|
||||
}
|
||||
export function fork(modulePath: string, args?: string[], options?: ForkOptions): ChildProcess;
|
||||
|
||||
export interface SpawnSyncOptions {
|
||||
cwd?: string;
|
||||
input?: string | Buffer;
|
||||
stdio?: any;
|
||||
@@ -1002,42 +1032,83 @@ declare module "child_process" {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
timeout?: number;
|
||||
maxBuffer?: number;
|
||||
killSignal?: string;
|
||||
maxBuffer?: number;
|
||||
encoding?: string;
|
||||
}): {
|
||||
shell?: boolean | string;
|
||||
}
|
||||
export interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
export interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export interface SpawnSyncReturns<T> {
|
||||
pid: number;
|
||||
output: string[];
|
||||
stdout: string | Buffer;
|
||||
stderr: string | Buffer;
|
||||
stdout: T;
|
||||
stderr: T;
|
||||
status: number;
|
||||
signal: string;
|
||||
error: Error;
|
||||
};
|
||||
export function execSync(command: string, options?: {
|
||||
}
|
||||
export function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
|
||||
export interface ExecSyncOptions {
|
||||
cwd?: string;
|
||||
input?: string|Buffer;
|
||||
input?: string | Buffer;
|
||||
stdio?: any;
|
||||
env?: any;
|
||||
shell?: string;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
timeout?: number;
|
||||
killSignal?: string;
|
||||
maxBuffer?: number;
|
||||
encoding?: string;
|
||||
}
|
||||
export interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
export interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function execSync(command: string): Buffer;
|
||||
export function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
||||
export function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
||||
|
||||
export interface ExecFileSyncOptions {
|
||||
cwd?: string;
|
||||
input?: string | Buffer;
|
||||
stdio?: any;
|
||||
env?: any;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
timeout?: number;
|
||||
maxBuffer?: number;
|
||||
killSignal?: string;
|
||||
encoding?: string;
|
||||
}): string | Buffer;
|
||||
export function execFileSync(command: string, args?: string[], options?: {
|
||||
cwd?: string;
|
||||
input?: string|Buffer;
|
||||
stdio?: any;
|
||||
env?: any;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
timeout?: number;
|
||||
maxBuffer?: number;
|
||||
killSignal?: string;
|
||||
encoding?: string;
|
||||
}): string | Buffer;
|
||||
}
|
||||
export interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
export interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
||||
encoding: string; // specify `null`.
|
||||
}
|
||||
export function execFileSync(command: string): Buffer;
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptions): Buffer;
|
||||
}
|
||||
|
||||
declare module "url" {
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for PEG.js
|
||||
// Project: http://pegjs.majda.cz/
|
||||
// Project: http://pegjs.org/
|
||||
// Definitions by: vvakame <https://github.com/vvakame>, Tobias Kahlert <https://github.com/SrTobi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/// <reference path="phonegap-nfc.d.ts"/>
|
||||
|
||||
import nfc = require('nfc');
|
||||
import ndef = require('ndef');
|
||||
import NdefRecord = PhoneGapNfc.NdefRecord;
|
||||
|
||||
nfc.addTagDiscoveredListener(() => {});
|
||||
nfc.addTagDiscoveredListener(() => {},() => {}, () => {});
|
||||
|
||||
nfc.addMimeTypeListener('text/json',() => {});
|
||||
nfc.addMimeTypeListener('text/json',() => {},() => {}, () => {});
|
||||
|
||||
nfc.addNdefListener(() => {});
|
||||
nfc.addNdefListener(() => {}, () => {},() => {});
|
||||
|
||||
nfc.addNdefFormatableListener(() => {});
|
||||
nfc.addNdefFormatableListener(() => {}, () => {}, () => {});
|
||||
|
||||
nfc.write([],() => {}, () => {});
|
||||
|
||||
nfc.makeReadOnly();
|
||||
nfc.makeReadOnly(() => {}, () => {});
|
||||
|
||||
nfc.share([]);
|
||||
nfc.share([],() => {}, () => {});
|
||||
|
||||
nfc.unshare();
|
||||
nfc.unshare(() => {}, () => {});
|
||||
|
||||
nfc.handover('uri',() => {}, () => {});
|
||||
nfc.handover(['uri'],() => {}, () => {});
|
||||
nfc.handover('uri');
|
||||
nfc.handover(['uri']);
|
||||
|
||||
nfc.stopHandover();
|
||||
nfc.stopHandover(() => {}, () => {});
|
||||
|
||||
nfc.erase();
|
||||
nfc.erase(() => {}, () => {});
|
||||
|
||||
nfc.enabled();
|
||||
nfc.enabled(() => {}, () => {});
|
||||
|
||||
nfc.removeTagDiscoveredListener(() => {});
|
||||
nfc.removeTagDiscoveredListener(() => {},() => {},() => {});
|
||||
|
||||
nfc.removeMimeTypeListener('text/json',() => {});
|
||||
nfc.removeMimeTypeListener('text/json',() => {},() => {},() => {});
|
||||
|
||||
nfc.removeNdefListener(() => {});
|
||||
nfc.removeNdefListener(() => {},() => {},() => {});
|
||||
|
||||
nfc.showSettings();
|
||||
nfc.showSettings(() => {},() => {});
|
||||
|
||||
let record:NdefRecord = ndef.record(0x01,[0x0F],[0x0C],[0xFF]);
|
||||
|
||||
record = ndef.textRecord('textRecord','fr',[24,78]);
|
||||
|
||||
record = ndef.uriRecord('uriRecord',[24,78]);
|
||||
|
||||
record = ndef.absoluteUriRecord('uriRecord',[88,142],[24,78]);
|
||||
|
||||
record = ndef.mimeMediaRecord('text/json',[88,142],[24,78]);
|
||||
|
||||
record = ndef.smartPoster([],[88,142]);
|
||||
|
||||
record = ndef.emptyRecord();
|
||||
|
||||
record = ndef.androidApplicationRecord('fr.redfroggy.phonegap');
|
||||
|
||||
let bytes:Array<number> = ndef.encodeMessage([]);
|
||||
|
||||
let records:Array<NdefRecord> = ndef.decodeMessage(bytes);
|
||||
|
||||
let obj:any = ndef.decodeTnf(bytes[0]);
|
||||
|
||||
let tnfByte:number = ndef.encodeTnf(bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5]);
|
||||
|
||||
let tnfString:string = ndef.tnfToString(tnfByte);
|
||||
Vendored
+460
@@ -0,0 +1,460 @@
|
||||
// Type definitions for Phonegap NFC Plugin
|
||||
// Project: https://github.com/chariotsolutions/phonegap-nfc
|
||||
// Definitions by: Michael Desigaud <https://github.com/michaeldesigaud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Document {
|
||||
addEventListener(type: 'deviceready', listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare module PhoneGapNfc {
|
||||
|
||||
/**
|
||||
* Global object NFC.
|
||||
*/
|
||||
interface Window {
|
||||
nfc: Nfc;
|
||||
ndef: Ndef;
|
||||
util:Util;
|
||||
fireNfcTagEvent(event:TagEvent, tagAsJson:string):void;
|
||||
}
|
||||
|
||||
interface Tag {
|
||||
id:Array<number>;
|
||||
techTypes:Array<string>;
|
||||
type:string;
|
||||
date:string;
|
||||
}
|
||||
|
||||
interface NdefRecord {
|
||||
/**
|
||||
* 3-bit TNF (Type Name Format) - use one of the TNF_* constants
|
||||
*/
|
||||
tnf:number;
|
||||
/**
|
||||
* byte array, containing zero to 255 bytes, must not be null
|
||||
*/
|
||||
type:Array<number>;
|
||||
/**
|
||||
* byte array, containing zero to 255 bytes, must not be null
|
||||
*/
|
||||
id:Array<number>;
|
||||
/**
|
||||
* byte array, containing zero to (2 ** 32 - 1) bytes, must not be null
|
||||
*/
|
||||
payload:Array<number>;
|
||||
}
|
||||
|
||||
interface NdefTag extends Tag {
|
||||
canMakeReadOnly:boolean;
|
||||
isWritable:boolean;
|
||||
maxSize:number;
|
||||
records:Array<NdefRecord>;
|
||||
}
|
||||
|
||||
interface TagEvent extends Event {
|
||||
tag:Tag;
|
||||
}
|
||||
|
||||
interface NdefTagEvent extends TagEvent {
|
||||
tag:NdefTag;
|
||||
}
|
||||
|
||||
interface UriHelper {
|
||||
/**
|
||||
* URI identifier codes from URI Record Type Definition NFCForum-TS-RTD_URI_1.0 2006-07-24
|
||||
* index in array matches code in the spec
|
||||
*/
|
||||
protocols:Array<string>;
|
||||
|
||||
/**
|
||||
* Decode a URI payload bytes
|
||||
* @param data
|
||||
*/
|
||||
decodePayload(data:any):string;
|
||||
|
||||
/**
|
||||
* shorten a URI with standard prefix
|
||||
* @param uri
|
||||
*/
|
||||
encodePayload(uri:string):Array<number>;
|
||||
}
|
||||
|
||||
interface TextHelper {
|
||||
|
||||
/**
|
||||
* Decode a URI payload bytes
|
||||
* @param data
|
||||
*/
|
||||
decodePayload(data:any):string;
|
||||
|
||||
/**
|
||||
* Encode text payload
|
||||
* @param text
|
||||
* @param lang
|
||||
* @param encoding
|
||||
*/
|
||||
encodePayload(text:string, lang:string, encoding:string):Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Ndef object.
|
||||
*/
|
||||
interface Ndef {
|
||||
|
||||
TNF_EMPTY:number;
|
||||
TNF_WELL_KNOWN: number;
|
||||
TNF_MIME_MEDIA: number;
|
||||
TNF_ABSOLUTE_URI: number;
|
||||
TNF_EXTERNAL_TYPE: number;
|
||||
TNF_UNKNOWN: number;
|
||||
TNF_UNCHANGED: number;
|
||||
TNF_RESERVED: number;
|
||||
|
||||
RTD_TEXT: Array<number>; // "T"
|
||||
RTD_URI: Array<number>; // "U"
|
||||
RTD_SMART_POSTER: Array<number>; // "Sp"
|
||||
RTD_ALTERNATIVE_CARRIER: Array<number>; // "ac"
|
||||
RTD_HANDOVER_CARRIER: Array<number>; // "Hc"
|
||||
RTD_HANDOVER_REQUEST: Array<number>; // "Hr"
|
||||
RTD_HANDOVER_SELECT: Array<number>; // "Hs"
|
||||
|
||||
uriHelper:UriHelper;
|
||||
textHelper:TextHelper;
|
||||
/**
|
||||
* Creates a JSON representation of a NdefRecord.
|
||||
*
|
||||
* @param tnf 3-bit TNF (Type Name Format) - use one of the TNF_* constants
|
||||
* @param type array, containing zero to 255 bytes, must not be null
|
||||
* @param id byte array, containing zero to 255 bytes, must not be null
|
||||
* @param payload byte array, containing zero to (2 ** 32 - 1) bytes, must not be null
|
||||
*
|
||||
* @return NdefRecord
|
||||
*
|
||||
* @see Ndef.textRecord, Ndef.uriRecord and Ndef.mimeMediaRecord for examples
|
||||
*/
|
||||
record(tnf:number, type:Array<number>, id:Array<number>, payload:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates an NdefRecord containing plain text.
|
||||
*
|
||||
* @param text String of text to encode
|
||||
* @paramlanguageCode ISO/IANA language code. Examples: “fi”, “en-US”, “fr- CA”, “jp”. (optional)
|
||||
* @param id byte[] (optional)
|
||||
*
|
||||
* @return NdefRecord
|
||||
*/
|
||||
textRecord(text:string, languageCode:string, id:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates a NdefRecord containing a URI.
|
||||
*
|
||||
* @param uri String
|
||||
* @param id byte[] (optional)
|
||||
*
|
||||
* @return NdefRecord
|
||||
*/
|
||||
uriRecord(uri:string, id:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates a NdefRecord containing an absolute URI.
|
||||
*
|
||||
* An Absolute URI record means the URI describes the payload of the record.
|
||||
*
|
||||
* For example a SOAP message could use "http://schemas.xmlsoap.org/soap/envelope/"
|
||||
* as the type and XML content for the payload.
|
||||
*
|
||||
* Absolute URI can also be used to write LaunchApp records for Windows.
|
||||
*
|
||||
* See 2.4.2 Payload Type of the NDEF Specification
|
||||
* http://www.nfc-forum.org/specs/spec_list#ndefts
|
||||
*
|
||||
* Note that by default, Android will open the URI defined in the type
|
||||
* field of an Absolute URI record (TNF=3) and ignore the payload.
|
||||
* BlackBerry and Windows do not open the browser for TNF=3.
|
||||
*
|
||||
* To write a URI as the payload use ndef.uriRecord(uri)
|
||||
*
|
||||
* @param uri String
|
||||
* @param payload byte[] or String
|
||||
* @param id byte[] (optional)
|
||||
*
|
||||
* @return NdefRecord
|
||||
*/
|
||||
absoluteUriRecord(uri:string, payload:Array<number>, id:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates a NdefRecordcontaining an mimeMediaRecord.
|
||||
*
|
||||
* @param mimeType String
|
||||
* @param payload byte[]
|
||||
* @param id byte[] (optional)
|
||||
*/
|
||||
mimeMediaRecord(mimeType:string, payload:Array<number>, id:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates an NDEF record containing an Smart Poster.
|
||||
*
|
||||
* @param ndefRecords array of NdefRecord
|
||||
* @param id byte[] (optional)
|
||||
*
|
||||
* @return NdefRecord
|
||||
*/
|
||||
smartPoster(ndefRecords:Array<NdefRecord>, id:Array<number>):NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates an empty NdefRecord.
|
||||
*
|
||||
*/
|
||||
emptyRecord():NdefRecord;
|
||||
|
||||
/**
|
||||
* Helper that creates an Android Application Record (AAR).
|
||||
* http://developer.android.com/guide/topics/connectivity/nfc/nfc.html#aar
|
||||
* @param packageName android package name
|
||||
*
|
||||
*/
|
||||
androidApplicationRecord(packageName:string):NdefRecord;
|
||||
|
||||
/**
|
||||
* Encodes an NDEF Message into bytes that can be written to a NFC tag.
|
||||
*
|
||||
* @param ndefRecords an Array of NdefRecord
|
||||
*
|
||||
* @return Array<number>
|
||||
*
|
||||
* @see NFC Data Exchange Format (NDEF) http://www.nfc-forum.org/specs/spec_list/
|
||||
*/
|
||||
encodeMessage(ndefRecords:Array<NdefRecord>):Array<number>;
|
||||
|
||||
/**
|
||||
* Decodes an array bytes into an NDEF Message
|
||||
*
|
||||
* @param bytes Array<number> read from a NFC tag
|
||||
*
|
||||
* @return array of NdefRecord
|
||||
*
|
||||
* @see NFC Data Exchange Format (NDEF) http://www.nfc-forum.org/specs/spec_list/
|
||||
*/
|
||||
decodeMessage(bytes:Array<number>):Array<NdefRecord>;
|
||||
|
||||
/**
|
||||
* Decode the bit flags from a TNF Byte.
|
||||
*
|
||||
* @return object with decoded data
|
||||
*
|
||||
* See NFC Data Exchange Format (NDEF) Specification Section 3.2 RecordLayout
|
||||
*/
|
||||
decodeTnf(tnf_byte:number):any;
|
||||
|
||||
/**
|
||||
* Encode NDEF bit flags into a TNF Byte.
|
||||
*
|
||||
* @return tnf byte
|
||||
*
|
||||
* See NFC Data Exchange Format (NDEF) Specification Section 3.2 RecordLayout
|
||||
*/
|
||||
encodeTnf(mb:number, me:number, cf:number, sr:number, il:number, tnf:number):number;
|
||||
|
||||
/**
|
||||
* Convert TNF to String for user friendly display
|
||||
*
|
||||
*@param tnf tnf byte
|
||||
*/
|
||||
tnfToString(tnf:number):string;
|
||||
}
|
||||
|
||||
interface Util {
|
||||
/**
|
||||
* Convert bytes to string
|
||||
* @param bytes
|
||||
*/
|
||||
bytesToString(bytes:Array<number>):string;
|
||||
|
||||
/**
|
||||
* Convert string to bytes
|
||||
* @param string
|
||||
*/
|
||||
stringToBytes(string:string):Array<number>;
|
||||
|
||||
/**
|
||||
* Convert bytes to hexadecimal string
|
||||
* @param bytes
|
||||
*/
|
||||
bytesToHexString(bytes:Array<number>):string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Nfc object.
|
||||
*/
|
||||
interface Nfc extends Util {
|
||||
/**
|
||||
* Function nfc.addTagDiscoveredListener registers the callback for tag events.
|
||||
* This event occurs when any tag is detected by the phone
|
||||
* @param callback The callback that is called when a tag is detected.
|
||||
* @param win The callback that is called when the listener is added.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
addTagDiscoveredListener(callback:(event:TagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.addMimeTypeListener registers the callback for ndef-mime events.
|
||||
* A ndef-mime event occurs when a Ndef.TNF_MIME_MEDIA tag is read and matches the specified MIME type.
|
||||
* This function can be called multiple times to register different MIME types. You should use the same handler for all MIME messages.
|
||||
* @param mimeType The MIME type to filter for messages.
|
||||
* @param callback The callback that is called when an NDEF tag matching the MIME type is read.
|
||||
* @param win The callback that is called when the listener is added.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
addMimeTypeListener(mimeType:string, callback:() => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.addNdefListener registers the callback for ndef events.
|
||||
* A ndef event is fired when a NDEF tag is read.
|
||||
* For BlackBerry 10, you must configure the type of tags your application will read with an invoke-target in config.xml.
|
||||
* On Android registered mimeTypeListeners takes precedence over this more generic NDEF listener.
|
||||
* @param callback The callback that is called when an NDEF tag is read.
|
||||
* @param win The callback that is called when the listener is added.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
addNdefListener(callback:(event:NdefTagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.addNdefFormatableListener registers the callback for ndef-formatable events.
|
||||
* A ndef-formatable event occurs when a tag is read that can be NDEF formatted.
|
||||
* This is not fired for tags that are already formatted as NDEF.
|
||||
* The ndef-formatable event will not contain an NdefMessage.
|
||||
* @param callback The callback that is called when NDEF formatable tag is read.
|
||||
* @param win The callback that is called when the listener is added.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
addNdefFormatableListener(callback:(event:NdefTagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.write writes an NdefMessage to a NFC tag.
|
||||
* On Android this method must be called from within an NDEF TagEvent Handler.
|
||||
* On Windows this method may be called from within the NDEF TagEvent Handler.
|
||||
* On Windows Phone 8.1 this method should be called outside the NDEF TagEvent Handler,
|
||||
* otherwise Windows tries to read the tag contents as you are writing to the tag.
|
||||
* @param ndefMessage An array of NDEF Records.
|
||||
* @param win The callback that is called when the tag is written.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
write(ndefMessage:Array<NdefRecord>, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.makeReadOnly make a NFC tag read only.
|
||||
* Warning this is permanent and can not be undone.
|
||||
* On Android this method must be called from within an NDEF TagEvent Handler.
|
||||
* @param win The callback that is called when the tag is locked.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
makeReadOnly(win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.share writes an NdefMessage via peer-to-peer.
|
||||
* This should appear as an NFC tag to another device.
|
||||
* @param ndefMessage An array of NDEF Records.
|
||||
* @param win The callback that is called when the message is pushed.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
share(ndefMessage:Array<NdefRecord>, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.unshare stops sharing data via peer-to-peer.
|
||||
* @param win The callback that is called when sharing stops.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
unshare(win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.handover shares files to a NFC peer using handover. Files are sent by specifying a file:// or context:// URI or a list of URIs.
|
||||
* The file transfer is initiated with NFC but the transfer is completed with over Bluetooth or WiFi which is handled by a NFC handover request.
|
||||
* The Android code is responsible for building the handover NFC Message.
|
||||
* This is Android only, but it should be possible to add implementations for other platforms.
|
||||
* @param uris A URI as a String, or an array of URIs.
|
||||
* @param win The callback that is called when the message is pushed.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
handover(uris:string|Array<string>, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.stopHandover stops sharing data via peer-to-peer.
|
||||
* @param win The callback that is called when sharing stops.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
stopHandover(win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.erase erases a tag by writing an empty message.
|
||||
* Will format unformatted tags before writing.
|
||||
* This method must be called from within an NDEF TagEvent Handler.
|
||||
* @param win The callback that is called when sharing stops.
|
||||
* @param fail The callback that is called if there was an error.
|
||||
*/
|
||||
erase(win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function nfc.enabled explicitly checks to see if the phone has NFC and if NFC is enabled.
|
||||
* If everything is OK, the success callback is called.
|
||||
* If there is a problem, the failure callback will be called with a reason code.
|
||||
* The reason will be NO_NFC if the device doesn't support NFC and NFC_DISABLED if the user has disabled NFC.
|
||||
* Note: that on Android the NFC status is checked before every API call NO_NFC or NFC_DISABLED can be returned in any failure function.
|
||||
* Windows will return NO_NFC_OR_NFC_DISABLED when NFC is not present or disabled.
|
||||
* If the user disabled NFC after the application started, Windows may return NFC_DISABLED.
|
||||
* Windows checks the NFC status before most API calls, but there are some cases when the NFC state can not be determined.
|
||||
* @param win The callback that is called when NFC is enabled.
|
||||
* @param fail The callback that is called when NFC is disabled or missing.
|
||||
*/
|
||||
enabled(win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Removes the previously registered event listener added via nfc.addTagDiscoveredListener
|
||||
* @param callback The previously registered callback.
|
||||
* @param win The callback that is called when the listener is successfully removed.
|
||||
* @param fail The callback that is called if there was an error during removal.
|
||||
*/
|
||||
removeTagDiscoveredListener(callback:(event:TagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Removes the previously registered event listener added via nfc.addMimeTypeListener
|
||||
* @param mimeType The MIME type to filter for messages.
|
||||
* @param callback The previously registered callback.
|
||||
* @param win The callback that is called when the listener is successfully removed.
|
||||
* @param fail The callback that is called if there was an error during removal.
|
||||
*/
|
||||
removeMimeTypeListener(mimeType:string, callback:(event:TagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Removes the previously registered event listener for NDEF tags added via nfc.addNdefListener.
|
||||
* @param callback The previously registered callback.
|
||||
* @param win The callback that is called when the listener is successfully removed.
|
||||
* @param fail The callback that is called if there was an error during removal.
|
||||
*/
|
||||
removeNdefListener(callback:(event:TagEvent) => void, win?:() => void, fail?:() => void):void;
|
||||
|
||||
/**
|
||||
* Function showSettings opens the NFC settings for the operating system.
|
||||
* @param win Success callback function
|
||||
* @param fail Error callback function, invoked when error occurs.
|
||||
*/
|
||||
showSettings(win?:() => void, fail?:() => void):void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'nfc' {
|
||||
var nfc:PhoneGapNfc.Nfc;
|
||||
export = nfc;
|
||||
}
|
||||
|
||||
declare module 'ndef' {
|
||||
var ndef:PhoneGapNfc.Ndef;
|
||||
export = ndef;
|
||||
}
|
||||
|
||||
declare module 'util' {
|
||||
var util:PhoneGapNfc.Util;
|
||||
export = util;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ module Board {
|
||||
};
|
||||
|
||||
render() {
|
||||
var squares: React.DOMElement<React.HTMLAttributes>[] = [];
|
||||
var squares: React.ReactHTMLElement<HTMLDivElement>[] = [];
|
||||
for (let i = 0; i < 64; i++) {
|
||||
squares.push(this._renderSquare(i));
|
||||
}
|
||||
|
||||
Vendored
+31
-21
@@ -5,33 +5,43 @@
|
||||
|
||||
///<reference path='../react/react.d.ts' />
|
||||
|
||||
declare module "react-dropzone" {
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
namespace reactDropzone {
|
||||
|
||||
declare module ReactDropzone {
|
||||
import React = __React;
|
||||
interface DropzoneProps {
|
||||
onDrop?: Function;
|
||||
onDropAccepted?: Function;
|
||||
onDropRejected?: Function;
|
||||
onDragEnter?: Function;
|
||||
onDragLeave?: Function;
|
||||
style?: Object;
|
||||
activeStyle?: Object;
|
||||
className?: string;
|
||||
activeClassName?: string;
|
||||
rejectClassName?: string;
|
||||
disableClick?: boolean;
|
||||
multiple?: boolean;
|
||||
accept?: string;
|
||||
onDrop?: Function;
|
||||
onDropAccepted?: Function;
|
||||
onDropRejected?: Function;
|
||||
onDragEnter?: Function;
|
||||
onDragLeave?: Function;
|
||||
style?: Object;
|
||||
activeStyle?: Object;
|
||||
className?: string;
|
||||
activeClassName?: string;
|
||||
rejectClassName?: string;
|
||||
/**
|
||||
* Clicking the <Dropzone> brings up the browser file picker. To disable, set to true.
|
||||
*/
|
||||
disableClick?: boolean;
|
||||
/**
|
||||
* To accept only a single file, set this to false.
|
||||
*/
|
||||
multiple?: boolean;
|
||||
/**
|
||||
* Filters the file types that are valid. It should have a valid MIME type according to input element, for example:
|
||||
* application/pdf
|
||||
* image/*
|
||||
* audio/aiff,audio/midi
|
||||
*/
|
||||
accept?: string;
|
||||
}
|
||||
|
||||
export class Dropzone extends React.Component<DropzoneProps, {}> {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export = reactDropzone.Dropzone;
|
||||
declare module "react-dropzone" {
|
||||
const Dropzone: typeof ReactDropzone.Dropzone;
|
||||
export = Dropzone;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ declare module "react-holder" {
|
||||
|
||||
import React = __React;
|
||||
|
||||
interface ReactHolderProp extends React.HTMLProps<ReactHolder> {
|
||||
interface ReactHolderProp extends React.HTMLAttributes {
|
||||
width: string | number;
|
||||
height: string | number;
|
||||
updateOnResize: boolean;
|
||||
|
||||
@@ -76,7 +76,6 @@ declare module reactInputCalendar {
|
||||
}
|
||||
interface ReactInputCalendarState { }
|
||||
export class ReactInputCalendar extends __React.Component<ReactInputCalendarProps, ReactInputCalendarState> {
|
||||
render(): __React.DOMElement<any>;
|
||||
}
|
||||
}
|
||||
declare var ReactInputCalendar: typeof reactInputCalendar.ReactInputCalendar
|
||||
|
||||
@@ -94,6 +94,7 @@ interface TodoProps {
|
||||
}
|
||||
interface DispatchProps {
|
||||
addTodo(userId: number, text: string): void;
|
||||
action: Function;
|
||||
}
|
||||
declare var actionCreators: () => {
|
||||
action: Function;
|
||||
@@ -275,14 +276,6 @@ class NonComponent {}
|
||||
// this doesn't compile
|
||||
//connect()(NonComponent);
|
||||
|
||||
// connect()(SomeClass) has the same constructor as SomeClass itself
|
||||
class SomeClass extends Component<any, any> {
|
||||
constructor(public foo: string) { super() }
|
||||
public bar: number;
|
||||
}
|
||||
let bar: number = new (connect()(SomeClass))("foo").bar;
|
||||
|
||||
|
||||
// stateless functions
|
||||
interface HelloMessageProps { name: string; }
|
||||
function HelloMessage(props: HelloMessageProps) {
|
||||
|
||||
Vendored
+53
-17
@@ -7,39 +7,75 @@
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
|
||||
declare module "react-redux" {
|
||||
import { ComponentClass, Component, StatelessComponent } from 'react';
|
||||
import { ComponentClass, Component, StatelessComponent, Props, ReactNode } from 'react';
|
||||
import { Store, Dispatch, ActionCreator } from 'redux';
|
||||
|
||||
export interface ComponentConstructDecorator<P> {
|
||||
<TComponentConstruct extends (ComponentClass<P>|StatelessComponent<P>)>(component: TComponentConstruct): TComponentConstruct
|
||||
interface ComponentDecorator<TOriginalProps extends Props<any>, TOwnProps extends Props<any>> {
|
||||
(component: ComponentClass<TOriginalProps>): ComponentClass<TOwnProps>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorator that infers the type from the original component
|
||||
*
|
||||
* Can't use the above decorator because it would default the type to {}
|
||||
*/
|
||||
export interface InferableComponentDecorator {
|
||||
<P, TComponentConstruct extends (ComponentClass<P>|StatelessComponent<P>)>(component: TComponentConstruct): TComponentConstruct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects a React component to a Redux store.
|
||||
*
|
||||
* - Without arguments, just wraps the component, without changing the behavior / props
|
||||
*
|
||||
* - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior
|
||||
* is to override ownProps (as stated in the docs), so what remains is everything that's
|
||||
* not a state or dispatch prop
|
||||
*
|
||||
* - When 3rd param is passed, we don't know if ownProps propagate and whether they
|
||||
* should be valid component props, because it depends on mergeProps implementation.
|
||||
* As such, it is the user's responsibility to extend ownProps interface from state or
|
||||
* dispatch props or both when applicable
|
||||
*
|
||||
* @param mapStateToProps
|
||||
* @param mapDispatchToProps
|
||||
* @param mergeProps
|
||||
* @param options
|
||||
*/
|
||||
export function connect<P>(mapStateToProps?: MapStateToProps,
|
||||
mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject,
|
||||
mergeProps?: MergeProps,
|
||||
options?: Options): ComponentConstructDecorator<P>;
|
||||
*/
|
||||
export function connect(): InferableComponentDecorator;
|
||||
export function connect<
|
||||
TStateProps extends Props<any>,
|
||||
TDispatchProps extends Props<any>,
|
||||
TOwnProps extends Props<any>
|
||||
>(
|
||||
mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps?: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
export function connect<
|
||||
TStateProps extends Props<any>,
|
||||
TDispatchProps extends Props<any>,
|
||||
TOwnProps extends Props<any>
|
||||
>(
|
||||
mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps>,
|
||||
options?: Options
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
interface MapStateToProps {
|
||||
(state: any, ownProps?: any): any;
|
||||
interface MapStateToProps<TStateProps, TOwnProps> {
|
||||
(state: any, ownProps?: TOwnProps): TStateProps;
|
||||
}
|
||||
|
||||
interface MapDispatchToPropsFunction {
|
||||
(dispatch: Dispatch, ownProps?: any): any;
|
||||
interface MapDispatchToPropsFunction<TDispatchProps, TOwnProps> {
|
||||
(dispatch: Dispatch, ownProps?: TOwnProps): TDispatchProps;
|
||||
}
|
||||
|
||||
interface MapDispatchToPropsObject {
|
||||
[name: string]: ActionCreator;
|
||||
}
|
||||
|
||||
interface MergeProps {
|
||||
(stateProps: any, dispatchProps: any, ownProps: any): any;
|
||||
interface MergeProps<TStateProps, TDispatchProps, TOwnProps> {
|
||||
(stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps): TStateProps & TDispatchProps;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
@@ -53,16 +89,16 @@ declare module "react-redux" {
|
||||
pure: boolean;
|
||||
}
|
||||
|
||||
export interface Property {
|
||||
export interface ProviderProps extends Props<Provider> {
|
||||
/**
|
||||
* The single Redux store in your application.
|
||||
*/
|
||||
store?: Store;
|
||||
children?: Function;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the Redux store available to the connect() calls in the component hierarchy below.
|
||||
*/
|
||||
export class Provider extends Component<Property, {}> { }
|
||||
export class Provider extends Component<ProviderProps, {}> { }
|
||||
}
|
||||
|
||||
Vendored
+12
-1
@@ -395,6 +395,14 @@ declare module "react-router/lib/match" {
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/useRouterHistory" {
|
||||
interface CreateRouterHistory {
|
||||
(options?: HistoryModule.HistoryOptions): HistoryModule.History & HistoryModule.HistoryQueries;
|
||||
}
|
||||
|
||||
export default function useRouterHistory<T>(createHistory: HistoryModule.CreateHistory<T>): CreateRouterHistory;
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router" {
|
||||
|
||||
@@ -434,6 +442,8 @@ declare module "react-router" {
|
||||
|
||||
import match from "react-router/lib/match"
|
||||
|
||||
import useRouterHistory from "react-router/lib/useRouterHistory";
|
||||
|
||||
// PlainRoute is defined in the API documented at:
|
||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||
// but not included in any of the .../lib modules above.
|
||||
@@ -472,7 +482,8 @@ declare module "react-router" {
|
||||
formatPattern,
|
||||
RouterContext,
|
||||
PropTypes,
|
||||
match
|
||||
match,
|
||||
useRouterHistory
|
||||
}
|
||||
|
||||
export default Router
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="../react/react-dom.d.ts" />
|
||||
/// <reference path="./react-select-0.9.10.d.ts" />
|
||||
|
||||
import * as React from "react"
|
||||
import * as ReactDOM from "react-dom"
|
||||
|
||||
import Select from "react-select"
|
||||
|
||||
class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Select />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Select.Async />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// Type definitions for react-select v0.9.10
|
||||
// Project: https://github.com/JedWatson/react-select
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../react/react.d.ts"/>
|
||||
|
||||
// Typings for https://github.com/JedWatson/react-select
|
||||
//***Usage***
|
||||
// import ReactSelect = require('react-select');
|
||||
// <ReactSelect options={this.options} name="form-field-name" onChange={this._onSelect} value={this.state.Type} />
|
||||
|
||||
declare module "react-select" {
|
||||
// Import React
|
||||
import React = require("react");
|
||||
|
||||
interface Option{
|
||||
label : string;
|
||||
value : string;
|
||||
}
|
||||
|
||||
interface ReactSelectProps extends React.Props<ReactSelectClass>{
|
||||
addLabelText? : string;
|
||||
allowCreate? : boolean;
|
||||
autoload? : boolean;
|
||||
backspaceRemoves? : boolean;
|
||||
cacheAsyncResults? : boolean;
|
||||
className? : string;
|
||||
clearable? : boolean;
|
||||
clearAllText? : string;
|
||||
clearValueText? : string;
|
||||
delimiter? : string;
|
||||
disabled? : boolean;
|
||||
filterOption? : (option : Option,filterString : string)=>Option;
|
||||
filterOptions? : (options:Array<Option>,filterString : string,values : Array<Object>)=>Array<Option>;
|
||||
ignoreCase? : boolean; // default true whether to perform case-insensitive filtering
|
||||
inputProps? : Object;
|
||||
isLoading? : boolean;
|
||||
labelKey? : string;
|
||||
matchPos? : string;
|
||||
matchProp? : string;
|
||||
multi? : boolean;
|
||||
name? : string;
|
||||
newOptionCreator? : ()=>Option;
|
||||
noResultsText? : string;
|
||||
onBlur? : (event : Event)=>void;
|
||||
onChange? : (newValue : string)=>void;
|
||||
onFocus? : (event : Event)=>void;
|
||||
onInputChange? : (inputValue : string)=>void;
|
||||
onOptionLabelClick? : (value : string, event : Event)=>void;
|
||||
optionRenderer? : ()=>void;
|
||||
options? : Array<Option>;
|
||||
placeholder? : string;
|
||||
searchable? : boolean;
|
||||
searchingText? : string;
|
||||
searchPromptText? : string;
|
||||
value? : Option;
|
||||
valueKey? : string;
|
||||
valueRenderer? : ()=>void;
|
||||
}
|
||||
|
||||
interface ReactAsyncSelectProps extends React.Props<ReactSelectClass>{
|
||||
cache? : any;
|
||||
loadOptions? : ()=>void;
|
||||
ignoreAccents? : boolean;
|
||||
isLoading? : boolean;
|
||||
loadingPlaceholder? : string;
|
||||
}
|
||||
|
||||
interface ReactSelect extends React.ReactElement<ReactSelectProps> { }
|
||||
interface ReactSelectClass extends React.ComponentClass<ReactSelectProps>{}
|
||||
|
||||
interface SelectWithAsync extends ReactSelectClass {
|
||||
Async? : ReactAsyncSelectProps;
|
||||
}
|
||||
|
||||
var ReactSelect: SelectWithAsync;
|
||||
|
||||
export default ReactSelect;
|
||||
}
|
||||
@@ -6,24 +6,25 @@
|
||||
import * as React from "react"
|
||||
import * as ReactDOM from "react-dom"
|
||||
|
||||
import Select from "react-select"
|
||||
import * as Select from "react-select"
|
||||
|
||||
class SelectTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Select />
|
||||
</div>
|
||||
}
|
||||
render() {
|
||||
const options: ReactSelect.Option[] = [{ label: "Foo", value: "bar" }]
|
||||
return <div>
|
||||
<Select options={options} />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Select.Async />
|
||||
</div>
|
||||
}
|
||||
render() {
|
||||
return <div>
|
||||
<Select.Async />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+214
-73
@@ -1,80 +1,221 @@
|
||||
// Type definitions for react-select v0.9.10
|
||||
// Type definitions for react-select v1.0.0
|
||||
// Project: https://github.com/JedWatson/react-select
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>
|
||||
// Definitions by: ESQUIBET Hugo <https://github.com/Hesquibet/>, Gilad Gray <https://github.com/giladgray/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../react/react.d.ts"/>
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
|
||||
// Typings for https://github.com/JedWatson/react-select
|
||||
//***Usage***
|
||||
// import ReactSelect = require('react-select');
|
||||
// <ReactSelect options={this.options} name="form-field-name" onChange={this._onSelect} value={this.state.Type} />
|
||||
declare namespace ReactSelect {
|
||||
interface Option {
|
||||
/** Text for rendering */
|
||||
label: string;
|
||||
/** Value for searching */
|
||||
value: string | number;
|
||||
/**
|
||||
* Allow this option to be cleared
|
||||
* @default true
|
||||
*/
|
||||
clearableValue?: boolean;
|
||||
}
|
||||
|
||||
interface ReactSelectProps extends __React.Props<ReactSelect> {
|
||||
/**
|
||||
* text to display when `allowCreate` is true.
|
||||
* @default 'Add "{label}"?'
|
||||
*/
|
||||
addLabelText?: string;
|
||||
/**
|
||||
* blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices.
|
||||
* @default false
|
||||
*/
|
||||
autoBlur?: boolean;
|
||||
/**
|
||||
* allow new options to be created in multi mode (displays an "Add <option> ?" item
|
||||
* when a value not already in the options array is entered)
|
||||
* @default false
|
||||
*/
|
||||
allowCreate?: boolean;
|
||||
/**
|
||||
* whether to auto-load the default async options set
|
||||
* @default true
|
||||
*/
|
||||
autoload?: boolean;
|
||||
/**
|
||||
* whether pressing backspace removes the last item when there is no input value
|
||||
* @default true
|
||||
*/
|
||||
backspaceRemoves?: boolean;
|
||||
/**
|
||||
* enables the options cache for `asyncOptions`
|
||||
* @default true
|
||||
*/
|
||||
cacheAsyncResults?: boolean;
|
||||
/**
|
||||
* CSS className for the outer element
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* whether it is possible to reset value. if enabled, an X button will appear at the right side.
|
||||
* @default true
|
||||
*/
|
||||
clearable?: boolean;
|
||||
/**
|
||||
* title for the "clear" control when `multi` is true
|
||||
* @default "Clear all"
|
||||
*/
|
||||
clearAllText?: string;
|
||||
/**
|
||||
* title for the "clear" control
|
||||
* @default "Clear value"
|
||||
*/
|
||||
clearValueText?: string;
|
||||
/**
|
||||
* delimiter to use to join multiple values
|
||||
* @default ","
|
||||
*/
|
||||
delimiter?: string;
|
||||
/**
|
||||
* whether the Select is disabled or not
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* method to filter a single option
|
||||
*/
|
||||
filterOption?: (option: Option, filter: string) => Option;
|
||||
/**
|
||||
* method to filter the options array
|
||||
*/
|
||||
filterOptions?: (options: Array<Option>, filter: string, currentValues: (string | number)[]) => Array<Option>;
|
||||
/**
|
||||
* whether to perform case-insensitive filtering
|
||||
* @default true
|
||||
*/
|
||||
ignoreCase?: boolean;
|
||||
/**
|
||||
* custom attributes for the Input (in the Select-control) e.g: {'data-foo': 'bar'}
|
||||
* @default {}
|
||||
*/
|
||||
inputProps?: Object;
|
||||
/**
|
||||
* whether the Select is loading externally or not (such as options being loaded).
|
||||
* if true, a loading spinner will be shown at the right side.
|
||||
* @default false
|
||||
*/
|
||||
isLoading?: boolean;
|
||||
/**
|
||||
* the option property to use for the label
|
||||
* @default "label"
|
||||
*/
|
||||
labelKey?: string;
|
||||
/**
|
||||
* function that calls a callback with the options
|
||||
*/
|
||||
loadOptions?: (input: string, callback: (options: Option[]) => any) => any;
|
||||
/**
|
||||
* (any, start) match the start or entire string when filtering
|
||||
* @default "any"
|
||||
*/
|
||||
matchPos?: string;
|
||||
/**
|
||||
* (any, label, value) which option property to filter on
|
||||
* @default "any"
|
||||
*/
|
||||
matchProp?: string;
|
||||
/**
|
||||
* buffer of px between the base of the dropdown and the viewport to shift if menu doesnt fit in viewport
|
||||
* @default 0
|
||||
*/
|
||||
menuBuffer?: number;
|
||||
/**
|
||||
* multi-value input
|
||||
* @default false
|
||||
*/
|
||||
multi?: boolean;
|
||||
/**
|
||||
* field name, for hidden `<input>` tag
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* factory to create new options when `allowCreate` is true
|
||||
* @default false
|
||||
*/
|
||||
newOptionCreator?: (input: string) => Option;
|
||||
/**
|
||||
* placeholder displayed when there are no matching search results or a falsy value to hide it
|
||||
* @default "No results found"
|
||||
*/
|
||||
noResultsText?: string;
|
||||
onBlur?: __React.FocusEventHandler;
|
||||
/**
|
||||
* whether to clear input on blur or not
|
||||
* @default true
|
||||
*/
|
||||
onBlurResetsInput?: boolean;
|
||||
onChange?: (newValue: Option | Option[]) => void;
|
||||
onFocus?: __React.FocusEventHandler;
|
||||
onInputChange?: (inputValue: string) => void;
|
||||
onOptionLabelClick?: (value: string, event: Event) => void;
|
||||
/**
|
||||
* function which returns a custom way to render the options in the menu
|
||||
*/
|
||||
optionRenderer?: () => void;
|
||||
/**
|
||||
* array of Select options
|
||||
* @default false
|
||||
*/
|
||||
options?: Array<Option>;
|
||||
/**
|
||||
* field placeholder, displayed when there's no value
|
||||
* @default "Select..."
|
||||
*/
|
||||
placeholder?: string;
|
||||
/**
|
||||
* whether to enable searching feature or not
|
||||
* @default true;
|
||||
*/
|
||||
searchable?: boolean;
|
||||
/**
|
||||
* message to display whilst options are loading via asyncOptions, or when `isLoading` is true
|
||||
* @default "Searching..."
|
||||
*/
|
||||
searchingText?: string;
|
||||
/**
|
||||
* label to prompt for search input
|
||||
* @default "Type to search"
|
||||
*/
|
||||
searchPromptText?: string;
|
||||
/**
|
||||
* initial field value
|
||||
*/
|
||||
value?: Option | Option[];
|
||||
/**
|
||||
* the option property to use for the value
|
||||
* @default "value"
|
||||
*/
|
||||
valueKey?: string;
|
||||
/**
|
||||
* function which returns a custom way to render the value selected
|
||||
* @default false
|
||||
*/
|
||||
valueRenderer?: () => void;
|
||||
}
|
||||
|
||||
interface ReactAsyncSelectProps extends __React.Props<ReactSelect> {
|
||||
cache?: any;
|
||||
loadOptions?: () => void;
|
||||
ignoreAccents?: boolean;
|
||||
isLoading?: boolean;
|
||||
loadingPlaceholder?: string;
|
||||
}
|
||||
|
||||
interface ReactSelect extends __React.ReactElement<ReactSelectProps> { }
|
||||
interface ReactSelectClass extends __React.ComponentClass<ReactSelectProps> {
|
||||
Async: __React.ComponentClass<ReactAsyncSelectProps>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-select" {
|
||||
// Import React
|
||||
import React = require("react");
|
||||
|
||||
interface Option{
|
||||
label : string;
|
||||
value : string;
|
||||
}
|
||||
|
||||
interface ReactSelectProps extends React.Props<ReactSelectClass>{
|
||||
addLabelText? : string;
|
||||
allowCreate? : boolean;
|
||||
autoload? : boolean;
|
||||
backspaceRemoves? : boolean;
|
||||
cacheAsyncResults? : boolean;
|
||||
className? : string;
|
||||
clearable? : boolean;
|
||||
clearAllText? : string;
|
||||
clearValueText? : string;
|
||||
delimiter? : string;
|
||||
disabled? : boolean;
|
||||
filterOption? : (option : Option,filterString : string)=>Option;
|
||||
filterOptions? : (options:Array<Option>,filterString : string,values : Array<Object>)=>Array<Option>;
|
||||
ignoreCase? : boolean; // default true whether to perform case-insensitive filtering
|
||||
inputProps? : Object;
|
||||
isLoading? : boolean;
|
||||
labelKey? : string;
|
||||
matchPos? : string;
|
||||
matchProp? : string;
|
||||
multi? : boolean;
|
||||
name? : string;
|
||||
newOptionCreator? : ()=>Option;
|
||||
noResultsText? : string;
|
||||
onBlur? : (event : Event)=>void;
|
||||
onChange? : (newValue : string)=>void;
|
||||
onFocus? : (event : Event)=>void;
|
||||
onInputChange? : (inputValue : string)=>void;
|
||||
onOptionLabelClick? : (value : string, event : Event)=>void;
|
||||
optionRenderer? : ()=>void;
|
||||
options? : Array<Option>;
|
||||
placeholder? : string;
|
||||
searchable? : boolean;
|
||||
searchingText? : string;
|
||||
searchPromptText? : string;
|
||||
value? : Option;
|
||||
valueKey? : string;
|
||||
valueRenderer? : ()=>void;
|
||||
}
|
||||
|
||||
interface ReactAsyncSelectProps extends React.Props<ReactSelectClass>{
|
||||
cache? : any;
|
||||
loadOptions? : ()=>void;
|
||||
ignoreAccents? : boolean;
|
||||
isLoading? : boolean;
|
||||
loadingPlaceholder? : string;
|
||||
}
|
||||
|
||||
interface ReactSelect extends React.ReactElement<ReactSelectProps> { }
|
||||
interface ReactSelectClass extends React.ComponentClass<ReactSelectProps>{}
|
||||
|
||||
interface SelectWithAsync extends ReactSelectClass {
|
||||
Async? : ReactAsyncSelectProps;
|
||||
}
|
||||
|
||||
var ReactSelect: SelectWithAsync;
|
||||
|
||||
export default ReactSelect;
|
||||
var select: ReactSelect.ReactSelectClass;
|
||||
export = select;
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -113,7 +113,6 @@ declare module rswf {
|
||||
flashvars?: Object | string
|
||||
}
|
||||
export class ReactSWF extends __React.Component<Props, State>{
|
||||
render(): __React.DOMElement<any>
|
||||
/**
|
||||
* Returns the Flash Player object DOM node.
|
||||
* Should be prefered over `React.findDOMNode`.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="react-swipeable-views.d.ts"/>
|
||||
|
||||
import * as React from 'react';
|
||||
import SwipeableViews from 'react-swipeable-views';
|
||||
|
||||
const onChangeIndex = (indexNew:number, indexLatest:number) => {
|
||||
console.log('New index: ' + indexNew + ', latest index' + indexLatest);
|
||||
};
|
||||
|
||||
const onSwitching = (index:number) => {
|
||||
console.log('Switching to ' + index);
|
||||
};
|
||||
|
||||
const style:React.CSSProperties = {
|
||||
height: 300
|
||||
};
|
||||
|
||||
React.createElement(SwipeableViews, {
|
||||
containerStyle: style,
|
||||
disabled: false,
|
||||
index: 0,
|
||||
onChangeIndex: onChangeIndex,
|
||||
onSwitching: onSwitching,
|
||||
resistance: false,
|
||||
slideStyle: style,
|
||||
style: style,
|
||||
threshold: 100
|
||||
});
|
||||
|
||||
|
||||
React.createElement(SwipeableViews, {});
|
||||
@@ -0,0 +1,37 @@
|
||||
// Type definitions for react-swipeable-views
|
||||
// Project: https://github.com/oliviertassinari/react-swipeable-views
|
||||
// Definitions by: Michael Ledin <https://github.com/mxl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path='../react/react.d.ts' />
|
||||
|
||||
declare namespace ReactSwipeableViews {
|
||||
import React = __React;
|
||||
|
||||
export interface SwipeableViewsProps extends React.Props<SwipeableViews> {
|
||||
containerStyle?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
index?: number;
|
||||
onChangeIndex?: (indexNew:number, indexLatest:number) => void;
|
||||
onSwitching?: (index:number) => void;
|
||||
resistance?: boolean;
|
||||
slideStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
threshold?: number;
|
||||
}
|
||||
|
||||
interface SwipeableViewsState {
|
||||
indexCurrent?: number;
|
||||
indexLatest?: number;
|
||||
isDragging?: boolean;
|
||||
isFirstRender?: boolean;
|
||||
heightLatest?: number;
|
||||
}
|
||||
|
||||
export class SwipeableViews extends React.Component<SwipeableViewsProps, SwipeableViewsState> {
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'react-swipeable-views' {
|
||||
export default ReactSwipeableViews.SwipeableViews;
|
||||
}
|
||||
+79
-3
@@ -1,5 +1,81 @@
|
||||
# React v0.14.2 Type Definitions
|
||||
# React v0.14.4 Type Definitions
|
||||
|
||||
If you are using modules you should use `react.d.ts`, `react-dom.d.ts` and any of the `react-addon-*.d.ts` definition files.
|
||||
This directory contains type definitions for the following React packages:
|
||||
- `react`
|
||||
- `react-addons-create-fragment`
|
||||
- `react-addons-css-transition-group`
|
||||
- `react-addons-linked-state-mixin`
|
||||
- `react-addons-perf`
|
||||
- `react-addons-pure-render-mixin`
|
||||
- `react-addons-shallow-compare`
|
||||
- `react-addons-test-utils`
|
||||
- `react-addons-transition-group`
|
||||
- `react-addons-update`
|
||||
- `react-dom`
|
||||
|
||||
If you are using the global `React` variable, you should use `react-global.d.ts`.
|
||||
## Getting Started
|
||||
If you are using modules you should use `react.d.ts`, `react-dom.d.ts` or any of the `react-addons-*.d.ts` definition files. If `React` is in your global namespace, you should use `react-global.d.ts`.
|
||||
|
||||
## Known Problems & Workarounds
|
||||
|
||||
### **The type of `setState` is incorrect.**
|
||||
The `setState(state)` method on `React.Component<P, S>` takes an object with a subset of the properties on `S`, but there's no way to express this in TypeScript currently. The workaround is simple: make all properties on `S` optional. There are a number of [proposals](https://github.com/Microsoft/TypeScript/issues/2710) on [ways](https://github.com/Microsoft/TypeScript/issues/4889) to [solve](https://github.com/Microsoft/TypeScript/issues/7355) this problem, but nothing seems to have been approved yet.
|
||||
|
||||
### **The type of `cloneElement` is incorrect.**
|
||||
This is similar to the `setState` problem, in that `cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. There is an additional complication, however—React attributes, such as `key` and `ref`, should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with
|
||||
```ts
|
||||
declare function cloneElement<P extends Q, Q>(
|
||||
element: ReactElement<P>,
|
||||
props?: Q & Attributes,
|
||||
...children: ReactNode[]): ReactElement<P>;
|
||||
```
|
||||
However, type inference for `Q` defaults to `{}` when [intersected with another type](https://github.com/Microsoft/TypeScript/pull/5738#issuecomment-181904905). And since any object is assignable to `{}`, we would lose the type safety of the `P extends Q` constraint. Therefore, the type of `props` is left as `Q`, which should work for most cases. If you need to call `cloneElement` with `key` or `ref`, you'll need a type cast:
|
||||
```ts
|
||||
interface ButtonProps {
|
||||
label: string,
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
var element: React.CElement<ButtonProps, Button>;
|
||||
|
||||
React.cloneElement(element, { label: "label" });
|
||||
|
||||
// cloning with optional props requires a cast
|
||||
React.cloneElement(element, <{ isDisabled?: boolean }>{ isDisabled: true });
|
||||
|
||||
// cloning with key or ref requires a cast
|
||||
React.cloneElement(element, <React.ClassAttributes<Button>>{ ref: button => button.reset() });
|
||||
React.cloneElement(element, <{ isDisabled?: boolean } & React.Attributes>{
|
||||
key: "disabledButton",
|
||||
isDisabled: true
|
||||
});
|
||||
```
|
||||
|
||||
### **`React.Component<P, S>` subclass members aren't contextually typed.**
|
||||
This problem manifests itself in two ways. It should be fixed in [TypeScript 2.0](https://github.com/Microsoft/TypeScript/pull/6118).
|
||||
|
||||
- You might expect `componentDidUpdate(prevProps, prevState)` to have `prevProps` and `prevState` contextually typed as `P` and `S` respectively, but currently that is not the case. You must explicitly type-annotate both arguments.
|
||||
|
||||
- You may get a cryptic error message when either `React.createElement` or `React.createFactory` doesn't recognize the `type` argument that you passed in as a valid `React.Component` subclass, because you overrode one of the static or instance members with a type that's not compatible with the superclass property's type. For example, with the following code:
|
||||
```ts
|
||||
import * as React from "react";
|
||||
|
||||
class MyComponent extends React.Component<Props, {}> {
|
||||
static contextTypes = {
|
||||
someValue: React.PropTypes.string
|
||||
};
|
||||
}
|
||||
|
||||
React.createFactory(MyComponent);
|
||||
```
|
||||
you might get this error:
|
||||
```
|
||||
error TS2345: Argument of type 'typeof MyComponent' is not assignable to parameter of type 'string | ComponentClass<Props> | StatelessComponent<Props>'
|
||||
Type 'typeof ModernComponent' is not assignable to type 'StatelessComponent<Props>'.
|
||||
Types of property 'contextTypes' are incompatible.
|
||||
Type '{ someValue: Requireable<any>; }' is not assignable to type 'ValidationMap<any>'.
|
||||
Index signature is missing in type '{ someValue: Requireable<any>; }'.
|
||||
```
|
||||
The work around is to add an explicit type annotation:
|
||||
```ts
|
||||
static contextTypes: React.ValidationMap<any> = ...
|
||||
```
|
||||
|
||||
Vendored
+23
-15
@@ -94,23 +94,31 @@ declare namespace __React {
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
export function renderIntoDocument<T extends Element>(
|
||||
element: DOMElement<any, T>): T;
|
||||
export function renderIntoDocument(
|
||||
element: DOMElement<any>): Element;
|
||||
element: SFCElement<any>): void;
|
||||
export function renderIntoDocument<T extends Component<any, any>>(
|
||||
element: CElement<any, T>): T;
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
element: ReactElement<P>): Component<P, {}> | Element | void;
|
||||
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
|
||||
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isDOMComponent(instance: ReactInstance): boolean;
|
||||
export function isCompositeComponent(instance: ReactInstance): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: ReactInstance,
|
||||
type: ComponentClass<any>): boolean;
|
||||
export function isElementOfType<T extends HTMLElement>(
|
||||
element: ReactElement<any>, type: string): element is ReactHTMLElement<T>;
|
||||
export function isElementOfType<P extends DOMAttributes, T extends Element>(
|
||||
element: ReactElement<any>, type: string): element is DOMElement<P, T>;
|
||||
export function isElementOfType<P>(
|
||||
element: ReactElement<any>, type: SFC<P>): element is SFCElement<P>;
|
||||
export function isElementOfType<P, T extends Component<P, {}>, C extends ComponentClass<P>>(
|
||||
element: ReactElement<any>, type: ClassType<P, T, C>): element is CElement<P, T>;
|
||||
|
||||
export function isDOMComponent(instance: ReactInstance): instance is Element;
|
||||
export function isCompositeComponent(instance: ReactInstance): instance is Component<any, any>;
|
||||
export function isCompositeComponentWithType<T extends Component<any, any>, C extends ComponentClass<any>>(
|
||||
instance: ReactInstance, type: ClassType<any, T, C>): T;
|
||||
|
||||
export function findAllInRenderedTree(
|
||||
root: Component<any, any>,
|
||||
@@ -130,13 +138,13 @@ declare namespace __React {
|
||||
root: Component<any, any>,
|
||||
tagName: string): Element;
|
||||
|
||||
export function scryRenderedComponentsWithType<T extends Component<{}, {}>>(
|
||||
export function scryRenderedComponentsWithType<T extends Component<{}, {}>, C extends ComponentClass<{}>>(
|
||||
root: Component<any, any>,
|
||||
type: { new(): T }): T[];
|
||||
type: ClassType<any, T, C>): T[];
|
||||
|
||||
export function findRenderedComponentWithType<T extends Component<{}, {}>>(
|
||||
export function findRenderedComponentWithType<T extends Component<{}, {}>, C extends ComponentClass<{}>>(
|
||||
root: Component<any, any>,
|
||||
type: { new(): T }): T;
|
||||
type: ClassType<any, T, C>): T;
|
||||
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
|
||||
Vendored
+28
-19
@@ -10,18 +10,22 @@ declare namespace __React {
|
||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||
function findDOMNode(instance: ReactInstance): Element;
|
||||
|
||||
function render<P extends DOMAttributes, T extends Element>(
|
||||
element: DOMElement<P, T>,
|
||||
container: Element,
|
||||
callback?: (element: T) => any): T;
|
||||
function render<P>(
|
||||
element: DOMElement<P>,
|
||||
element: SFCElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function render<P, S>(
|
||||
element: ClassicElement<P>,
|
||||
callback?: () => any): void;
|
||||
function render<P, T extends Component<P, {}>>(
|
||||
element: CElement<P, T>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function render<P, S>(
|
||||
callback?: (component: T) => any): T;
|
||||
function render<P>(
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
callback?: (component?: Component<P, {}> | Element) => any): Component<P, {}> | Element | void;
|
||||
|
||||
function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
@@ -31,21 +35,26 @@ declare namespace __React {
|
||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
function unstable_batchedUpdates(callback: () => any): void;
|
||||
|
||||
function unstable_renderSubtreeIntoContainer<P extends DOMAttributes, T extends Element>(
|
||||
parentComponent: Component<any, any>,
|
||||
element: DOMElement<P, T>,
|
||||
container: Element,
|
||||
callback?: (element: T) => any): T;
|
||||
function unstable_renderSubtreeIntoContainer<P, T extends Component<P, {}>>(
|
||||
parentComponent: Component<any, any>,
|
||||
element: CElement<P, T>,
|
||||
container: Element,
|
||||
callback?: (component: T) => any): T;
|
||||
function render<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
element: SFCElement<P>,
|
||||
container: Element,
|
||||
callback?: () => any): void;
|
||||
function unstable_renderSubtreeIntoContainer<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: DOMElement<P>,
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
callback?: (component?: Component<P, {}> | Element) => any): Component<P, {}> | Element | void;
|
||||
}
|
||||
|
||||
namespace __DOMServer {
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
/// <reference path="react-global.d.ts" />
|
||||
|
||||
interface Props extends React.Props<MyComponent> {
|
||||
interface Props {
|
||||
hello: string;
|
||||
world?: string;
|
||||
foo: number;
|
||||
@@ -24,7 +24,7 @@ interface MyComponent extends React.Component<Props, State> {
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
var props: Props = {
|
||||
var props: Props & React.ClassAttributes<{}> = {
|
||||
key: 42,
|
||||
ref: "myComponent42",
|
||||
hello: "world",
|
||||
@@ -115,9 +115,9 @@ class ModernComponent extends React.Component<Props, State>
|
||||
}
|
||||
|
||||
// React.createFactory
|
||||
var factory: React.Factory<Props> =
|
||||
var factory: React.CFactory<Props, ModernComponent> =
|
||||
React.createFactory(ModernComponent);
|
||||
var factoryElement: React.ReactElement<Props> =
|
||||
var factoryElement: React.CElement<Props, ModernComponent> =
|
||||
factory(props);
|
||||
|
||||
var classicFactory: React.ClassicFactory<Props> =
|
||||
@@ -125,25 +125,25 @@ var classicFactory: React.ClassicFactory<Props> =
|
||||
var classicFactoryElement: React.ClassicElement<Props> =
|
||||
classicFactory(props);
|
||||
|
||||
var domFactory: React.DOMFactory<any> =
|
||||
var domFactory: React.DOMFactory<React.DOMAttributes, Element> =
|
||||
React.createFactory("foo");
|
||||
var domFactoryElement: React.DOMElement<any> =
|
||||
var domFactoryElement: React.DOMElement<React.DOMAttributes, Element> =
|
||||
domFactory();
|
||||
|
||||
// React.createElement
|
||||
var element: React.ReactElement<Props> =
|
||||
var element: React.CElement<Props, ModernComponent> =
|
||||
React.createElement(ModernComponent, props);
|
||||
var classicElement: React.ClassicElement<Props> =
|
||||
React.createElement(ClassicComponent, props);
|
||||
var domElement: React.ReactHTMLElement =
|
||||
var domElement: React.ReactHTMLElement<HTMLDivElement> =
|
||||
React.createElement("div");
|
||||
|
||||
// React.cloneElement
|
||||
var clonedElement: React.ReactElement<Props> =
|
||||
var clonedElement: React.CElement<Props, ModernComponent> =
|
||||
React.cloneElement(element, props);
|
||||
var clonedClassicElement: React.ClassicElement<Props> =
|
||||
React.cloneElement(classicElement, props);
|
||||
var clonedDOMElement: React.ReactHTMLElement =
|
||||
var clonedDOMElement: React.ReactHTMLElement<HTMLDivElement> =
|
||||
React.cloneElement(domElement);
|
||||
|
||||
// React.render
|
||||
|
||||
+54
-26
@@ -23,7 +23,7 @@ import TestUtils = require("react-addons-test-utils");
|
||||
import TransitionGroup = require("react-addons-transition-group");
|
||||
import update = require("react-addons-update");
|
||||
|
||||
interface Props extends React.Props<MyComponent> {
|
||||
interface Props {
|
||||
hello: string;
|
||||
world?: string;
|
||||
foo: number;
|
||||
@@ -46,7 +46,7 @@ interface MyComponent extends React.Component<Props, State> {
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
var props: Props = {
|
||||
var props: Props & React.ClassAttributes<{}> = {
|
||||
key: 42,
|
||||
ref: "myComponent42",
|
||||
hello: "world",
|
||||
@@ -138,31 +138,35 @@ class ModernComponent extends React.Component<Props, State>
|
||||
}
|
||||
}
|
||||
|
||||
interface SCProps extends React.Props<{}> {
|
||||
interface SCProps {
|
||||
foo?: number;
|
||||
}
|
||||
|
||||
var StatelessComponent = (props: SCProps) => {
|
||||
function StatelessComponent(props: SCProps) {
|
||||
return React.DOM.div(null, props.foo);
|
||||
};
|
||||
namespace StatelessComponent {
|
||||
export var displayName = "StatelessComponent";
|
||||
export var defaultProps = { foo: 42 };
|
||||
}
|
||||
|
||||
// Must explicitly type-annotate to add displayName/defaultProps/contextTypes
|
||||
var StatelessComponent2: React.StatelessComponent<SCProps> =
|
||||
(props: SCProps) => React.DOM.div(null, props.foo);
|
||||
var StatelessComponent2: React.SFC<SCProps> =
|
||||
// props is contextually typed
|
||||
props => React.DOM.div(null, props.foo);
|
||||
StatelessComponent2.displayName = "StatelessComponent2";
|
||||
StatelessComponent2.defaultProps = {
|
||||
foo: 42
|
||||
};
|
||||
|
||||
// React.createFactory
|
||||
var factory: React.Factory<Props> =
|
||||
var factory: React.CFactory<Props, ModernComponent> =
|
||||
React.createFactory(ModernComponent);
|
||||
var factoryElement: React.ReactElement<Props> =
|
||||
var factoryElement: React.CElement<Props, ModernComponent> =
|
||||
factory(props);
|
||||
|
||||
var statelessFactory: React.Factory<SCProps> =
|
||||
var statelessFactory: React.SFCFactory<SCProps> =
|
||||
React.createFactory(StatelessComponent);
|
||||
var statelessElement: React.ReactElement<SCProps> =
|
||||
var statelessElement: React.SFCElement<SCProps> =
|
||||
statelessFactory(props);
|
||||
|
||||
var classicFactory: React.ClassicFactory<Props> =
|
||||
@@ -170,37 +174,47 @@ var classicFactory: React.ClassicFactory<Props> =
|
||||
var classicFactoryElement: React.ClassicElement<Props> =
|
||||
classicFactory(props);
|
||||
|
||||
var domFactory: React.DOMFactory<any> =
|
||||
var domFactory: React.DOMFactory<React.DOMAttributes, Element> =
|
||||
React.createFactory("foo");
|
||||
var domFactoryElement: React.DOMElement<any> =
|
||||
var domFactoryElement: React.DOMElement<React.DOMAttributes, Element> =
|
||||
domFactory();
|
||||
|
||||
// React.createElement
|
||||
var element: React.ReactElement<Props> =
|
||||
var element: React.CElement<Props, ModernComponent> =
|
||||
React.createElement(ModernComponent, props);
|
||||
var statelessElement: React.ReactElement<SCProps> =
|
||||
var statelessElement: React.SFCElement<SCProps> =
|
||||
React.createElement(StatelessComponent, props);
|
||||
var classicElement: React.ClassicElement<Props> =
|
||||
React.createElement(ClassicComponent, props);
|
||||
var domElement: React.ReactHTMLElement =
|
||||
var domElement: React.ReactHTMLElement<HTMLDivElement> =
|
||||
React.createElement("div");
|
||||
|
||||
// React.cloneElement
|
||||
var clonedElement: React.ReactElement<Props> =
|
||||
var clonedElement: React.CElement<Props, ModernComponent> =
|
||||
React.cloneElement(element, { foo: 43 });
|
||||
var clonedStatelessElement: React.ReactElement<SCProps> =
|
||||
var clonedElement2: React.CElement<Props, ModernComponent> =
|
||||
// known problem: cloning with key or ref requires cast
|
||||
React.cloneElement(element, <React.ClassAttributes<ModernComponent>>{
|
||||
ref: c => c.reset()
|
||||
});
|
||||
var clonedElement3: React.CElement<Props, ModernComponent> =
|
||||
React.cloneElement(element, <{ foo: number } & React.Attributes>{
|
||||
key: "8eac7",
|
||||
foo: 55
|
||||
});
|
||||
var clonedStatelessElement: React.SFCElement<SCProps> =
|
||||
// known problem: cloning with optional props don't work properly
|
||||
// workaround: cast to actual props type
|
||||
React.cloneElement(statelessElement, <SCProps>{ foo: 44 });
|
||||
var clonedClassicElement: React.ClassicElement<Props> =
|
||||
React.cloneElement(classicElement, props);
|
||||
var clonedDOMElement: React.ReactHTMLElement =
|
||||
var clonedDOMElement: React.ReactHTMLElement<HTMLDivElement> =
|
||||
React.cloneElement(domElement, {
|
||||
className: "clonedElement"
|
||||
});
|
||||
|
||||
// React.render
|
||||
var component: React.Component<Props, any> =
|
||||
var component: ModernComponent =
|
||||
ReactDOM.render(element, container);
|
||||
var classicComponent: React.ClassicComponent<Props, any> =
|
||||
ReactDOM.render(classicElement, container);
|
||||
@@ -220,9 +234,12 @@ domNode = ReactDOM.findDOMNode(domNode);
|
||||
// React Elements
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var type = element.type;
|
||||
var type: React.ComponentClass<Props> = element.type;
|
||||
var elementProps: Props = element.props;
|
||||
var key = element.key;
|
||||
var key: React.Key = element.key;
|
||||
|
||||
var t: React.ReactType;
|
||||
var name = typeof t === "string" ? t : t.displayName;
|
||||
|
||||
//
|
||||
// React Components
|
||||
@@ -250,12 +267,9 @@ myComponent.reset();
|
||||
|
||||
//
|
||||
// Refs
|
||||
// NB: to infer the correct type for callback refs, your component's Props
|
||||
// interface must extend React.Props<T> where T is your component type (or
|
||||
// an interface that it implements).
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
interface RCProps extends React.Props<RefComponent> {
|
||||
interface RCProps {
|
||||
}
|
||||
|
||||
class RefComponent extends React.Component<RCProps, {}> {
|
||||
@@ -546,6 +560,20 @@ var foundComponent: ModernComponent = TestUtils.findRenderedComponentWithType(
|
||||
var foundComponents: ModernComponent[] = TestUtils.scryRenderedComponentsWithType(
|
||||
inst, ModernComponent);
|
||||
|
||||
// ReactTestUtils custom type guards
|
||||
|
||||
var emptyElement: React.ReactElement<{}>;
|
||||
if (TestUtils.isElementOfType(emptyElement, StatelessComponent)) {
|
||||
emptyElement.props.foo;
|
||||
}
|
||||
|
||||
var anyInstance: Element | React.Component<any, any>;
|
||||
if (TestUtils.isDOMComponent(anyInstance)) {
|
||||
anyInstance.getAttribute("className");
|
||||
} else if (TestUtils.isCompositeComponent(anyInstance)) {
|
||||
anyInstance.props;
|
||||
}
|
||||
|
||||
//
|
||||
// TransitionGroup addon
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
Vendored
+234
-170
@@ -10,32 +10,44 @@ declare namespace __React {
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type ReactType = string | ComponentClass<any> | StatelessComponent<any>;
|
||||
|
||||
type Key = string | number;
|
||||
type Ref<T> = string | ((instance: T) => any);
|
||||
|
||||
interface ReactElement<P extends Props<any>> {
|
||||
type: string | ComponentClass<P> | StatelessComponent<P>;
|
||||
interface Attributes {
|
||||
key?: Key;
|
||||
}
|
||||
interface ClassAttributes<T> extends Attributes {
|
||||
ref?: Ref<T>;
|
||||
}
|
||||
|
||||
interface ReactElement<P> {
|
||||
type: string | ComponentClass<P> | SFC<P>;
|
||||
props: P;
|
||||
key: Key;
|
||||
ref: Ref<Component<P, any> | Element>;
|
||||
key?: Key;
|
||||
}
|
||||
|
||||
interface ClassicElement<P> extends ReactElement<P> {
|
||||
type: ClassicComponentClass<P>;
|
||||
ref: Ref<ClassicComponent<P, any>>;
|
||||
interface SFCElement<P> extends ReactElement<P> {
|
||||
type: SFC<P>;
|
||||
}
|
||||
|
||||
interface DOMElement<P extends Props<Element>> extends ReactElement<P> {
|
||||
type CElement<P, T extends Component<P, {}>> = ComponentElement<P, T>;
|
||||
interface ComponentElement<P, T extends Component<P, {}>> extends ReactElement<P> {
|
||||
type: ComponentClass<P>;
|
||||
ref?: Ref<T>;
|
||||
}
|
||||
|
||||
type ClassicElement<P> = CElement<P, ClassicComponent<P, {}>>;
|
||||
|
||||
interface DOMElement<P extends DOMAttributes, T extends Element> extends ReactElement<P> {
|
||||
type: string;
|
||||
ref: Ref<Element>;
|
||||
ref: Ref<T>;
|
||||
}
|
||||
|
||||
interface ReactHTMLElement extends DOMElement<HTMLProps<HTMLElement>> {
|
||||
ref: Ref<HTMLElement>;
|
||||
interface ReactHTMLElement<T extends HTMLElement> extends DOMElement<HTMLAttributes, T> {
|
||||
}
|
||||
|
||||
interface ReactSVGElement extends DOMElement<SVGProps> {
|
||||
ref: Ref<SVGElement>;
|
||||
interface ReactSVGElement extends DOMElement<SVGAttributes, SVGElement> {
|
||||
}
|
||||
|
||||
//
|
||||
@@ -43,19 +55,29 @@ declare namespace __React {
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface Factory<P> {
|
||||
(props?: P, ...children: ReactNode[]): ReactElement<P>;
|
||||
(props?: P & Attributes, ...children: ReactNode[]): ReactElement<P>;
|
||||
}
|
||||
|
||||
interface ClassicFactory<P> extends Factory<P> {
|
||||
(props?: P, ...children: ReactNode[]): ClassicElement<P>;
|
||||
interface SFCFactory<P> {
|
||||
(props?: P & Attributes, ...children: ReactNode[]): SFCElement<P>;
|
||||
}
|
||||
|
||||
interface DOMFactory<P extends Props<Element>> extends Factory<P> {
|
||||
(props?: P, ...children: ReactNode[]): DOMElement<P>;
|
||||
interface ComponentFactory<P, T extends Component<P, {}>> {
|
||||
(props?: P & ClassAttributes<T>, ...children: ReactNode[]): CElement<P, T>;
|
||||
}
|
||||
|
||||
type HTMLFactory = DOMFactory<HTMLProps<HTMLElement>>;
|
||||
type SVGFactory = DOMFactory<SVGProps>;
|
||||
type CFactory<P, T extends Component<P, {}>> = ComponentFactory<P, T>;
|
||||
type ClassicFactory<P> = CFactory<P, ClassicComponent<P, {}>>;
|
||||
|
||||
interface DOMFactory<P extends DOMAttributes, T extends Element> {
|
||||
(props?: P & ClassAttributes<T>, ...children: ReactNode[]): DOMElement<P, T>;
|
||||
}
|
||||
|
||||
interface HTMLFactory<T extends HTMLElement> extends DOMFactory<HTMLAttributes, T> {
|
||||
}
|
||||
|
||||
interface SVGFactory extends DOMFactory<SVGAttributes, SVGElement> {
|
||||
}
|
||||
|
||||
//
|
||||
// React Nodes
|
||||
@@ -75,41 +97,54 @@ declare namespace __React {
|
||||
|
||||
function createClass<P, S>(spec: ComponentSpec<P, S>): ClassicComponentClass<P>;
|
||||
|
||||
function createFactory<P>(type: string): DOMFactory<P>;
|
||||
function createFactory<P>(type: ClassicComponentClass<P>): ClassicFactory<P>;
|
||||
function createFactory<P>(type: ComponentClass<P> | StatelessComponent<P>): Factory<P>;
|
||||
function createFactory<P extends DOMAttributes, T extends Element>(
|
||||
type: string): DOMFactory<P, T>;
|
||||
function createFactory<P>(type: SFC<P>): SFCFactory<P>;
|
||||
function createFactory<P>(
|
||||
type: ClassType<P, ClassicComponent<P, {}>, ClassicComponentClass<P>>): CFactory<P, ClassicComponent<P, {}>>;
|
||||
function createFactory<P, T extends Component<P, {}>, C extends ComponentClass<P>>(
|
||||
type: ClassType<P, T, C>): CFactory<P, T>;
|
||||
function createFactory<P>(type: ComponentClass<P> | SFC<P>): Factory<P>;
|
||||
|
||||
function createElement<P>(
|
||||
function createElement<P extends DOMAttributes, T extends Element>(
|
||||
type: string,
|
||||
props?: P,
|
||||
...children: ReactNode[]): DOMElement<P>;
|
||||
props?: P & ClassAttributes<T>,
|
||||
...children: ReactNode[]): DOMElement<P, T>;
|
||||
function createElement<P>(
|
||||
type: ClassicComponentClass<P>,
|
||||
props?: P,
|
||||
...children: ReactNode[]): ClassicElement<P>;
|
||||
type: SFC<P>,
|
||||
props?: P & Attributes,
|
||||
...children: ReactNode[]): SFCElement<P>;
|
||||
function createElement<P>(
|
||||
type: ComponentClass<P> | StatelessComponent<P>,
|
||||
props?: P,
|
||||
type: ClassType<P, ClassicComponent<P, {}>, ClassicComponentClass<P>>,
|
||||
props?: P & ClassAttributes<ClassicComponent<P, {}>>,
|
||||
...children: ReactNode[]): CElement<P, ClassicComponent<P, {}>>;
|
||||
function createElement<P, T extends Component<P, {}>, C extends ComponentClass<P>>(
|
||||
type: ClassType<P, T, C>,
|
||||
props?: P & ClassAttributes<T>,
|
||||
...children: ReactNode[]): CElement<P, T>;
|
||||
function createElement<P>(
|
||||
type: ComponentClass<P> | SFC<P>,
|
||||
props?: P & Attributes,
|
||||
...children: ReactNode[]): ReactElement<P>;
|
||||
|
||||
function cloneElement(
|
||||
element: ReactHTMLElement,
|
||||
props?: HTMLProps<HTMLElement>,
|
||||
...children: ReactNode[]): ReactHTMLElement;
|
||||
function cloneElement(
|
||||
element: ReactSVGElement,
|
||||
props?: SVGProps,
|
||||
...children: ReactNode[]): ReactSVGElement;
|
||||
function cloneElement<P extends DOMAttributes, T extends Element>(
|
||||
element: DOMElement<P, T>,
|
||||
props?: P & ClassAttributes<T>,
|
||||
...children: ReactNode[]): DOMElement<P, T>;
|
||||
function cloneElement<P extends Q, Q>(
|
||||
element: ClassicElement<P>,
|
||||
props?: Q,
|
||||
...children: ReactNode[]): ClassicElement<P>;
|
||||
element: SFCElement<P>,
|
||||
props?: Q, // should be Q & Attributes, but then Q is inferred as {}
|
||||
...children: ReactNode[]): SFCElement<P>;
|
||||
function cloneElement<P extends Q, Q, T extends Component<P, {}>>(
|
||||
element: CElement<P, T>,
|
||||
props?: Q, // should be Q & ClassAttributes<T>
|
||||
...children: ReactNode[]): CElement<P, T>;
|
||||
function cloneElement<P extends Q, Q>(
|
||||
element: ReactElement<P>,
|
||||
props?: Q,
|
||||
props?: Q, // should be Q & Attributes
|
||||
...children: ReactNode[]): ReactElement<P>;
|
||||
|
||||
function isValidElement(object: {}): boolean;
|
||||
function isValidElement<P>(object: {}): object is ReactElement<P>;
|
||||
|
||||
var DOM: ReactDOM;
|
||||
var PropTypes: ReactPropTypes;
|
||||
@@ -128,7 +163,13 @@ declare namespace __React {
|
||||
setState(state: S, callback?: () => any): void;
|
||||
forceUpdate(callBack?: () => any): void;
|
||||
render(): JSX.Element;
|
||||
props: P;
|
||||
|
||||
// React.Props<T> is now deprecated, which means that the `children`
|
||||
// property is not available on `P` by default, even though you can
|
||||
// always pass children as variadic arguments to `createElement`.
|
||||
// In the future, if we can define its call signature conditionallly
|
||||
// on the existence of `children` in `P`, then we should remove this.
|
||||
props: P & { children?: ReactNode };
|
||||
state: S;
|
||||
context: {};
|
||||
refs: {
|
||||
@@ -150,6 +191,7 @@ declare namespace __React {
|
||||
// Class Interfaces
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type SFC<P> = StatelessComponent<P>;
|
||||
interface StatelessComponent<P> {
|
||||
(props?: P, context?: any): ReactElement<any>;
|
||||
propTypes?: ValidationMap<P>;
|
||||
@@ -159,19 +201,29 @@ declare namespace __React {
|
||||
}
|
||||
|
||||
interface ComponentClass<P> {
|
||||
new(props?: P, context?: any): Component<P, any>;
|
||||
new(props?: P, context?: any): Component<P, {}>;
|
||||
propTypes?: ValidationMap<P>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
childContextTypes?: ValidationMap<any>;
|
||||
defaultProps?: P;
|
||||
displayName?: string;
|
||||
}
|
||||
|
||||
interface ClassicComponentClass<P> extends ComponentClass<P> {
|
||||
new(props?: P, context?: any): ClassicComponent<P, any>;
|
||||
new(props?: P, context?: any): ClassicComponent<P, {}>;
|
||||
getDefaultProps?(): P;
|
||||
displayName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* We use an intersection type to infer multiple type parameters from
|
||||
* a single argument, which is useful for many top-level API defs.
|
||||
* See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
|
||||
*/
|
||||
type ClassType<P, T extends Component<P, {}>, C extends ComponentClass<P>> =
|
||||
C &
|
||||
(new() => T) &
|
||||
(new() => { props: P });
|
||||
|
||||
//
|
||||
// Component Specs and Lifecycle
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -325,19 +377,34 @@ declare namespace __React {
|
||||
// Props / DOM Attributes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @deprecated. This was used to allow clients to pass `ref` and `key`
|
||||
* to `createElement`, which is no longer necessary due to intersection
|
||||
* types. If you need to declare a props object before passing it to
|
||||
* `createElement` or a factory, use `ClassAttributes<T>`:
|
||||
*
|
||||
* ```ts
|
||||
* var b: Button;
|
||||
* var props: ButtonProps & ClassAttributes<Button> = {
|
||||
* ref: b => button = b, // ok!
|
||||
* label: "I'm a Button"
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
interface Props<T> {
|
||||
children?: ReactNode;
|
||||
key?: Key;
|
||||
ref?: Ref<T>;
|
||||
}
|
||||
|
||||
interface HTMLProps<T> extends HTMLAttributes, Props<T> {
|
||||
interface HTMLProps<T> extends HTMLAttributes, ClassAttributes<T> {
|
||||
}
|
||||
|
||||
interface SVGProps extends SVGAttributes, Props<SVGElement> {
|
||||
interface SVGProps extends SVGAttributes, ClassAttributes<SVGElement> {
|
||||
}
|
||||
|
||||
interface DOMAttributes {
|
||||
children?: ReactNode;
|
||||
dangerouslySetInnerHTML?: {
|
||||
__html: string;
|
||||
};
|
||||
@@ -1898,6 +1965,7 @@ declare namespace __React {
|
||||
multiple?: boolean;
|
||||
muted?: boolean;
|
||||
name?: string;
|
||||
nonce?: string;
|
||||
noValidate?: boolean;
|
||||
open?: boolean;
|
||||
optimum?: number;
|
||||
@@ -1909,6 +1977,7 @@ declare namespace __React {
|
||||
readOnly?: boolean;
|
||||
rel?: string;
|
||||
required?: boolean;
|
||||
reversed?: boolean;
|
||||
role?: string;
|
||||
rows?: number;
|
||||
rowSpan?: number;
|
||||
@@ -2033,119 +2102,119 @@ declare namespace __React {
|
||||
|
||||
interface ReactDOM {
|
||||
// HTML
|
||||
a: HTMLFactory;
|
||||
abbr: HTMLFactory;
|
||||
address: HTMLFactory;
|
||||
area: HTMLFactory;
|
||||
article: HTMLFactory;
|
||||
aside: HTMLFactory;
|
||||
audio: HTMLFactory;
|
||||
b: HTMLFactory;
|
||||
base: HTMLFactory;
|
||||
bdi: HTMLFactory;
|
||||
bdo: HTMLFactory;
|
||||
big: HTMLFactory;
|
||||
blockquote: HTMLFactory;
|
||||
body: HTMLFactory;
|
||||
br: HTMLFactory;
|
||||
button: HTMLFactory;
|
||||
canvas: HTMLFactory;
|
||||
caption: HTMLFactory;
|
||||
cite: HTMLFactory;
|
||||
code: HTMLFactory;
|
||||
col: HTMLFactory;
|
||||
colgroup: HTMLFactory;
|
||||
data: HTMLFactory;
|
||||
datalist: HTMLFactory;
|
||||
dd: HTMLFactory;
|
||||
del: HTMLFactory;
|
||||
details: HTMLFactory;
|
||||
dfn: HTMLFactory;
|
||||
dialog: HTMLFactory;
|
||||
div: HTMLFactory;
|
||||
dl: HTMLFactory;
|
||||
dt: HTMLFactory;
|
||||
em: HTMLFactory;
|
||||
embed: HTMLFactory;
|
||||
fieldset: HTMLFactory;
|
||||
figcaption: HTMLFactory;
|
||||
figure: HTMLFactory;
|
||||
footer: HTMLFactory;
|
||||
form: HTMLFactory;
|
||||
h1: HTMLFactory;
|
||||
h2: HTMLFactory;
|
||||
h3: HTMLFactory;
|
||||
h4: HTMLFactory;
|
||||
h5: HTMLFactory;
|
||||
h6: HTMLFactory;
|
||||
head: HTMLFactory;
|
||||
header: HTMLFactory;
|
||||
hgroup: HTMLFactory;
|
||||
hr: HTMLFactory;
|
||||
html: HTMLFactory;
|
||||
i: HTMLFactory;
|
||||
iframe: HTMLFactory;
|
||||
img: HTMLFactory;
|
||||
input: HTMLFactory;
|
||||
ins: HTMLFactory;
|
||||
kbd: HTMLFactory;
|
||||
keygen: HTMLFactory;
|
||||
label: HTMLFactory;
|
||||
legend: HTMLFactory;
|
||||
li: HTMLFactory;
|
||||
link: HTMLFactory;
|
||||
main: HTMLFactory;
|
||||
map: HTMLFactory;
|
||||
mark: HTMLFactory;
|
||||
menu: HTMLFactory;
|
||||
menuitem: HTMLFactory;
|
||||
meta: HTMLFactory;
|
||||
meter: HTMLFactory;
|
||||
nav: HTMLFactory;
|
||||
noscript: HTMLFactory;
|
||||
object: HTMLFactory;
|
||||
ol: HTMLFactory;
|
||||
optgroup: HTMLFactory;
|
||||
option: HTMLFactory;
|
||||
output: HTMLFactory;
|
||||
p: HTMLFactory;
|
||||
param: HTMLFactory;
|
||||
picture: HTMLFactory;
|
||||
pre: HTMLFactory;
|
||||
progress: HTMLFactory;
|
||||
q: HTMLFactory;
|
||||
rp: HTMLFactory;
|
||||
rt: HTMLFactory;
|
||||
ruby: HTMLFactory;
|
||||
s: HTMLFactory;
|
||||
samp: HTMLFactory;
|
||||
script: HTMLFactory;
|
||||
section: HTMLFactory;
|
||||
select: HTMLFactory;
|
||||
small: HTMLFactory;
|
||||
source: HTMLFactory;
|
||||
span: HTMLFactory;
|
||||
strong: HTMLFactory;
|
||||
style: HTMLFactory;
|
||||
sub: HTMLFactory;
|
||||
summary: HTMLFactory;
|
||||
sup: HTMLFactory;
|
||||
table: HTMLFactory;
|
||||
tbody: HTMLFactory;
|
||||
td: HTMLFactory;
|
||||
textarea: HTMLFactory;
|
||||
tfoot: HTMLFactory;
|
||||
th: HTMLFactory;
|
||||
thead: HTMLFactory;
|
||||
time: HTMLFactory;
|
||||
title: HTMLFactory;
|
||||
tr: HTMLFactory;
|
||||
track: HTMLFactory;
|
||||
u: HTMLFactory;
|
||||
ul: HTMLFactory;
|
||||
"var": HTMLFactory;
|
||||
video: HTMLFactory;
|
||||
wbr: HTMLFactory;
|
||||
a: HTMLFactory<HTMLAnchorElement>;
|
||||
abbr: HTMLFactory<HTMLElement>;
|
||||
address: HTMLFactory<HTMLElement>;
|
||||
area: HTMLFactory<HTMLAreaElement>;
|
||||
article: HTMLFactory<HTMLElement>;
|
||||
aside: HTMLFactory<HTMLElement>;
|
||||
audio: HTMLFactory<HTMLAudioElement>;
|
||||
b: HTMLFactory<HTMLElement>;
|
||||
base: HTMLFactory<HTMLBaseElement>;
|
||||
bdi: HTMLFactory<HTMLElement>;
|
||||
bdo: HTMLFactory<HTMLElement>;
|
||||
big: HTMLFactory<HTMLElement>;
|
||||
blockquote: HTMLFactory<HTMLElement>;
|
||||
body: HTMLFactory<HTMLBodyElement>;
|
||||
br: HTMLFactory<HTMLBRElement>;
|
||||
button: HTMLFactory<HTMLButtonElement>;
|
||||
canvas: HTMLFactory<HTMLCanvasElement>;
|
||||
caption: HTMLFactory<HTMLElement>;
|
||||
cite: HTMLFactory<HTMLElement>;
|
||||
code: HTMLFactory<HTMLElement>;
|
||||
col: HTMLFactory<HTMLTableColElement>;
|
||||
colgroup: HTMLFactory<HTMLTableColElement>;
|
||||
data: HTMLFactory<HTMLElement>;
|
||||
datalist: HTMLFactory<HTMLDataListElement>;
|
||||
dd: HTMLFactory<HTMLElement>;
|
||||
del: HTMLFactory<HTMLElement>;
|
||||
details: HTMLFactory<HTMLElement>;
|
||||
dfn: HTMLFactory<HTMLElement>;
|
||||
dialog: HTMLFactory<HTMLElement>;
|
||||
div: HTMLFactory<HTMLDivElement>;
|
||||
dl: HTMLFactory<HTMLDListElement>;
|
||||
dt: HTMLFactory<HTMLElement>;
|
||||
em: HTMLFactory<HTMLElement>;
|
||||
embed: HTMLFactory<HTMLEmbedElement>;
|
||||
fieldset: HTMLFactory<HTMLFieldSetElement>;
|
||||
figcaption: HTMLFactory<HTMLElement>;
|
||||
figure: HTMLFactory<HTMLElement>;
|
||||
footer: HTMLFactory<HTMLElement>;
|
||||
form: HTMLFactory<HTMLFormElement>;
|
||||
h1: HTMLFactory<HTMLHeadingElement>;
|
||||
h2: HTMLFactory<HTMLHeadingElement>;
|
||||
h3: HTMLFactory<HTMLHeadingElement>;
|
||||
h4: HTMLFactory<HTMLHeadingElement>;
|
||||
h5: HTMLFactory<HTMLHeadingElement>;
|
||||
h6: HTMLFactory<HTMLHeadingElement>;
|
||||
head: HTMLFactory<HTMLHeadElement>;
|
||||
header: HTMLFactory<HTMLElement>;
|
||||
hgroup: HTMLFactory<HTMLElement>;
|
||||
hr: HTMLFactory<HTMLHRElement>;
|
||||
html: HTMLFactory<HTMLHtmlElement>;
|
||||
i: HTMLFactory<HTMLElement>;
|
||||
iframe: HTMLFactory<HTMLIFrameElement>;
|
||||
img: HTMLFactory<HTMLImageElement>;
|
||||
input: HTMLFactory<HTMLInputElement>;
|
||||
ins: HTMLFactory<HTMLModElement>;
|
||||
kbd: HTMLFactory<HTMLElement>;
|
||||
keygen: HTMLFactory<HTMLElement>;
|
||||
label: HTMLFactory<HTMLLabelElement>;
|
||||
legend: HTMLFactory<HTMLLegendElement>;
|
||||
li: HTMLFactory<HTMLLIElement>;
|
||||
link: HTMLFactory<HTMLLinkElement>;
|
||||
main: HTMLFactory<HTMLElement>;
|
||||
map: HTMLFactory<HTMLMapElement>;
|
||||
mark: HTMLFactory<HTMLElement>;
|
||||
menu: HTMLFactory<HTMLElement>;
|
||||
menuitem: HTMLFactory<HTMLElement>;
|
||||
meta: HTMLFactory<HTMLMetaElement>;
|
||||
meter: HTMLFactory<HTMLElement>;
|
||||
nav: HTMLFactory<HTMLElement>;
|
||||
noscript: HTMLFactory<HTMLElement>;
|
||||
object: HTMLFactory<HTMLObjectElement>;
|
||||
ol: HTMLFactory<HTMLOListElement>;
|
||||
optgroup: HTMLFactory<HTMLOptGroupElement>;
|
||||
option: HTMLFactory<HTMLOptionElement>;
|
||||
output: HTMLFactory<HTMLElement>;
|
||||
p: HTMLFactory<HTMLParagraphElement>;
|
||||
param: HTMLFactory<HTMLParamElement>;
|
||||
picture: HTMLFactory<HTMLElement>;
|
||||
pre: HTMLFactory<HTMLPreElement>;
|
||||
progress: HTMLFactory<HTMLProgressElement>;
|
||||
q: HTMLFactory<HTMLQuoteElement>;
|
||||
rp: HTMLFactory<HTMLElement>;
|
||||
rt: HTMLFactory<HTMLElement>;
|
||||
ruby: HTMLFactory<HTMLElement>;
|
||||
s: HTMLFactory<HTMLElement>;
|
||||
samp: HTMLFactory<HTMLElement>;
|
||||
script: HTMLFactory<HTMLElement>;
|
||||
section: HTMLFactory<HTMLElement>;
|
||||
select: HTMLFactory<HTMLSelectElement>;
|
||||
small: HTMLFactory<HTMLElement>;
|
||||
source: HTMLFactory<HTMLSourceElement>;
|
||||
span: HTMLFactory<HTMLSpanElement>;
|
||||
strong: HTMLFactory<HTMLElement>;
|
||||
style: HTMLFactory<HTMLStyleElement>;
|
||||
sub: HTMLFactory<HTMLElement>;
|
||||
summary: HTMLFactory<HTMLElement>;
|
||||
sup: HTMLFactory<HTMLElement>;
|
||||
table: HTMLFactory<HTMLTableElement>;
|
||||
tbody: HTMLFactory<HTMLTableSectionElement>;
|
||||
td: HTMLFactory<HTMLTableDataCellElement>;
|
||||
textarea: HTMLFactory<HTMLTextAreaElement>;
|
||||
tfoot: HTMLFactory<HTMLTableSectionElement>;
|
||||
th: HTMLFactory<HTMLTableHeaderCellElement>;
|
||||
thead: HTMLFactory<HTMLTableSectionElement>;
|
||||
time: HTMLFactory<HTMLElement>;
|
||||
title: HTMLFactory<HTMLTitleElement>;
|
||||
tr: HTMLFactory<HTMLTableRowElement>;
|
||||
track: HTMLFactory<HTMLTrackElement>;
|
||||
u: HTMLFactory<HTMLElement>;
|
||||
ul: HTMLFactory<HTMLUListElement>;
|
||||
"var": HTMLFactory<HTMLElement>;
|
||||
video: HTMLFactory<HTMLVideoElement>;
|
||||
wbr: HTMLFactory<HTMLElement>;
|
||||
|
||||
// SVG
|
||||
svg: SVGFactory;
|
||||
@@ -2256,13 +2325,8 @@ declare namespace JSX {
|
||||
}
|
||||
interface ElementAttributesProperty { props: {}; }
|
||||
|
||||
interface IntrinsicAttributes {
|
||||
key?: React.Key;
|
||||
}
|
||||
|
||||
interface IntrinsicClassAttributes<T> {
|
||||
ref?: React.Ref<T>;
|
||||
}
|
||||
interface IntrinsicAttributes extends React.Attributes { }
|
||||
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
|
||||
|
||||
interface IntrinsicElements {
|
||||
// HTML
|
||||
|
||||
@@ -1157,6 +1157,7 @@ new Sequelize( 'sequelize', null, null, {
|
||||
} );
|
||||
|
||||
s.model( 'Project' );
|
||||
s.models['Project'];
|
||||
s.define( 'Project', {
|
||||
name : Sequelize.STRING
|
||||
} );
|
||||
|
||||
Vendored
+8
@@ -5395,6 +5395,9 @@ declare module "sequelize" {
|
||||
}
|
||||
|
||||
interface QueryOptionsTransactionRequired { }
|
||||
interface ModelsHashInterface {
|
||||
[name: string]: Model<any, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the main class, the entry point to sequelize. To use it, you just need to
|
||||
@@ -5415,6 +5418,11 @@ declare module "sequelize" {
|
||||
*/
|
||||
Sequelize: SequelizeStatic;
|
||||
|
||||
/**
|
||||
* Defined models.
|
||||
*/
|
||||
models: ModelsHashInterface;
|
||||
|
||||
/**
|
||||
* Returns the specified dialect.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/// <reference path="serve-static.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
import * as express from 'express';
|
||||
import * as serveStatic from 'serve-static';
|
||||
|
||||
Vendored
+2
-2
@@ -10,11 +10,11 @@
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../express-serve-static-core/express-serve-static-core.d.ts" />
|
||||
/// <reference path="../mime/mime.d.ts" />
|
||||
|
||||
declare module "serve-static" {
|
||||
import * as express from "express";
|
||||
import * as express from "express-serve-static-core";
|
||||
|
||||
/**
|
||||
* Create a new middleware function to serve files from within a given root directory.
|
||||
|
||||
Vendored
+2
-1
@@ -169,12 +169,13 @@ declare namespace SignalR {
|
||||
protocol: string;
|
||||
host: string;
|
||||
}
|
||||
|
||||
|
||||
interface Connection {
|
||||
clientProtocol: string;
|
||||
ajaxDataType: string;
|
||||
contentType: string;
|
||||
id: string;
|
||||
json: JSON;
|
||||
logging: boolean;
|
||||
url: string;
|
||||
qs: string | Object;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="soap.d.ts" />
|
||||
|
||||
import * as soap from 'soap';
|
||||
import * as events from 'events';
|
||||
|
||||
const url = 'http://example.com/wsdl?wsdl';
|
||||
const wsdlOptions = { name: 'value' };
|
||||
@@ -15,5 +16,8 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) {
|
||||
client['create']({ name: 'value' }, function(err, result) {
|
||||
// result is an object
|
||||
}, {});
|
||||
client.on('request', function(obj: any) {
|
||||
//obj is an object
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -3,11 +3,15 @@
|
||||
// Definitions by: Nicole Wang <https://github.com/nicoleWjie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path='../node/node.d.ts' />
|
||||
|
||||
declare module 'soap' {
|
||||
import * as events from 'events';
|
||||
|
||||
class WSSecurity {
|
||||
constructor(username: string, password: string, options: any);
|
||||
}
|
||||
interface Client {
|
||||
interface Client extends events.EventEmitter {
|
||||
setSecurity(s: WSSecurity): void;
|
||||
[method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void;
|
||||
addSoapHeader(headJSON: any): void;
|
||||
|
||||
Vendored
+2
-3
@@ -7,8 +7,6 @@
|
||||
// TODO sets
|
||||
// TODO gradients
|
||||
|
||||
declare var SVG:svgjs.Library;
|
||||
|
||||
declare module svgjs {
|
||||
|
||||
export interface LinkedHTMLElement extends HTMLElement {
|
||||
@@ -272,6 +270,7 @@ declare module svgjs {
|
||||
}
|
||||
}
|
||||
|
||||
declare var SVG:svgjs.Library;
|
||||
declare module "svg.js" {
|
||||
export = svgjs
|
||||
export = SVG
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ if (process.argv.slice(2)[0] === 'completion') {
|
||||
if (/^-\w?/.test(data.last)) return tabtab.log(['n', 'o', 'd', 'e'], data, '-');
|
||||
tabtab.log(['list', 'of', 'commands'], data);
|
||||
|
||||
child_process.exec('rake -H', function(err, stdout, stderr) {
|
||||
child_process.exec('rake -H', {encoding: null as string}, function(err, stdout, stderr) {
|
||||
if (err) return;
|
||||
var decoder = new string_decoder.StringDecoder('utf8');
|
||||
var parsed = tabtab.parseOut(decoder.write(stdout));
|
||||
@@ -21,7 +21,7 @@ if (process.argv.slice(2)[0] === 'completion') {
|
||||
if (/^-\w?/.test(data.last)) return tabtab.log(parsed.shorts, data, '-');
|
||||
});
|
||||
|
||||
child_process.exec('cake', function(err, stdout, stderr) {
|
||||
child_process.exec('cake', {encoding: null as string}, function(err, stdout, stderr) {
|
||||
if (err) return;
|
||||
var decoder = new string_decoder.StringDecoder('utf8');
|
||||
var tasks = tabtab.parseTasks(decoder.write(stdout), 'cake');
|
||||
|
||||
Vendored
+3
@@ -1631,8 +1631,11 @@ declare module THREE {
|
||||
|
||||
export interface Intersection {
|
||||
distance: number;
|
||||
distanceToRay: number;
|
||||
point: Vector3;
|
||||
index: number;
|
||||
face: Face3;
|
||||
faceIndex: number;
|
||||
object: Object3D;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -10017,7 +10017,7 @@ declare module Windows {
|
||||
removableDevices: Windows.Storage.StorageFolder;
|
||||
videosLibrary: Windows.Storage.StorageFolder;
|
||||
}
|
||||
export class StorageFolder implements Windows.Storage.IStorageFolder, Windows.Storage.IStorageItem, Windows.Storage.Search.IStorageFolderQueryOperations, Windows.Storage.IStorageItemProperties {
|
||||
export class StorageFolder implements Windows.Storage.IStorageFolder, Windows.Storage.IStorageFolder2, Windows.Storage.IStorageItem, Windows.Storage.Search.IStorageFolderQueryOperations, Windows.Storage.IStorageItemProperties {
|
||||
attributes: Windows.Storage.FileAttributes;
|
||||
dateCreated: Date;
|
||||
name: string;
|
||||
@@ -10063,6 +10063,7 @@ declare module Windows {
|
||||
getThumbnailAsync(mode: Windows.Storage.FileProperties.ThumbnailMode, requestedSize: number): Windows.Foundation.IAsyncOperation<Windows.Storage.FileProperties.StorageItemThumbnail>;
|
||||
getThumbnailAsync(mode: Windows.Storage.FileProperties.ThumbnailMode, requestedSize: number, options: Windows.Storage.FileProperties.ThumbnailOptions): Windows.Foundation.IAsyncOperation<Windows.Storage.FileProperties.StorageItemThumbnail>;
|
||||
static getFolderFromPathAsync(path: string): Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFolder>;
|
||||
tryGetItemAsync(name: string): Windows.Foundation.IAsyncOperation<IStorageItem>;
|
||||
}
|
||||
export class KnownFolders {
|
||||
static documentsLibrary: Windows.Storage.StorageFolder;
|
||||
@@ -10212,6 +10213,9 @@ declare module Windows {
|
||||
getItemsAsync(): Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Storage.IStorageItem>>;
|
||||
getItemsAsync(startIndex: number, maxItemsToRetrieve: number): Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Storage.IStorageItem>>;
|
||||
}
|
||||
export interface IStorageFolder2 {
|
||||
tryGetItemAsync(name: string): Windows.Foundation.IAsyncOperation<IStorageItem>;
|
||||
}
|
||||
export interface IStorageFile extends Windows.Storage.IStorageItem, Windows.Storage.Streams.IRandomAccessStreamReference, Windows.Storage.Streams.IInputStreamReference {
|
||||
contentType: string;
|
||||
fileType: string;
|
||||
|
||||
@@ -158,9 +158,9 @@ profiler.start = new Date();
|
||||
let testRewriter : winston.MetadataRewriter;
|
||||
testRewriter = function(level: string, msg: string, meta: any) {
|
||||
return meta;
|
||||
}
|
||||
};
|
||||
|
||||
winston.addRewriter(testRewriter);
|
||||
logger.rewriters.push(testRewriter);
|
||||
/**
|
||||
* New Logger instances with transports tests:
|
||||
*/
|
||||
|
||||
Vendored
+57
-6
@@ -7,6 +7,10 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
///******************
|
||||
/// Winston v2.2.x
|
||||
///******************
|
||||
|
||||
declare module "winston" {
|
||||
export var transports: Transports;
|
||||
export var Transport: TransportStatic;
|
||||
@@ -15,6 +19,8 @@ declare module "winston" {
|
||||
export var loggers: ContainerInstance;
|
||||
export var defaultLogger: LoggerInstance;
|
||||
|
||||
export var exception: Exception;
|
||||
|
||||
export var exitOnError: boolean;
|
||||
export var level: string;
|
||||
|
||||
@@ -46,17 +52,65 @@ declare module "winston" {
|
||||
export function addColors(target: any): any;
|
||||
export function setLevels(target: any): any;
|
||||
export function cli(): LoggerInstance;
|
||||
export function addRewriter(rewriter: MetadataRewriter): void;
|
||||
export function close(): void;
|
||||
|
||||
export interface ExceptionProcessInfo {
|
||||
pid: number;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
cwd: string;
|
||||
execPath: string;
|
||||
version: string;
|
||||
argv: string;
|
||||
memoryUsage: NodeJS.MemoryUsage;
|
||||
}
|
||||
|
||||
export interface ExceptionOsInfo {
|
||||
loadavg: [number, number, number];
|
||||
uptime: number;
|
||||
}
|
||||
|
||||
export interface ExceptionTrace {
|
||||
column: number;
|
||||
file: string;
|
||||
"function": string;
|
||||
line: number;
|
||||
method: string;
|
||||
native: boolean;
|
||||
}
|
||||
|
||||
export interface ExceptionAllInfo {
|
||||
date: Date;
|
||||
process: ExceptionProcessInfo;
|
||||
os: ExceptionOsInfo;
|
||||
trace: Array<ExceptionTrace>;
|
||||
stack: Array<string>;
|
||||
}
|
||||
|
||||
export interface Exception {
|
||||
getAllInfo(err: Error): ExceptionAllInfo;
|
||||
getProcessInfo(): ExceptionProcessInfo;
|
||||
getOsInfo(): ExceptionOsInfo;
|
||||
getTrace(err: Error): Array<ExceptionTrace>;
|
||||
}
|
||||
|
||||
export interface MetadataRewriter {
|
||||
(level: string, msg: string, meta: any): any;
|
||||
}
|
||||
|
||||
export interface MetadataFilter {
|
||||
(level: string, msg: string, meta: any): string | {msg: any; meta: any;};
|
||||
}
|
||||
|
||||
export interface LoggerStatic {
|
||||
new (options?: LoggerOptions): LoggerInstance;
|
||||
}
|
||||
|
||||
export interface LoggerInstance extends NodeJS.EventEmitter {
|
||||
rewriters: Array<MetadataRewriter>;
|
||||
filters: Array<MetadataFilter>;
|
||||
transports: Array<TransportInstance>;
|
||||
|
||||
extend(target: any): LoggerInstance;
|
||||
|
||||
log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
@@ -81,7 +135,6 @@ declare module "winston" {
|
||||
handleExceptions(...transports: TransportInstance[]): void;
|
||||
unhandleExceptions(...transports: TransportInstance[]): void;
|
||||
add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance;
|
||||
addRewriter(rewriter: MetadataRewriter): void;
|
||||
clear(): void;
|
||||
remove(transport: TransportInstance): LoggerInstance;
|
||||
startTimer(): ProfileHandler;
|
||||
@@ -129,6 +182,7 @@ declare module "winston" {
|
||||
|
||||
export interface FileTransportInstance extends TransportInstance {
|
||||
new (options?: FileTransportOptions): FileTransportInstance;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export interface HttpTransportInstance extends TransportInstance {
|
||||
@@ -269,10 +323,7 @@ declare module "winston" {
|
||||
start?: number;
|
||||
from?: Date;
|
||||
until?: Date;
|
||||
/**
|
||||
* 'asc' or 'desc'
|
||||
*/
|
||||
order?: string;
|
||||
order?: "asc" | "desc";
|
||||
fields: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="./xdomain.d.ts" />
|
||||
|
||||
xdomain.masters({
|
||||
'http://abc.example.com': '/api/*'
|
||||
});
|
||||
|
||||
xdomain.slaves({
|
||||
"http://xyz.example.com": "/proxy.html"
|
||||
});
|
||||
|
||||
xdomain.debug = true;
|
||||
xdomain.on("log", (msg) => console.log(msg));
|
||||
xdomain.on("timeout", () => console.log("timeout"));
|
||||
xdomain.cookies.master = "MASTER";
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// Type definitions for xdomain v0.7.5
|
||||
// Project: http://jpillora.com/xdomain/
|
||||
// Definitions by: Dan Chao <http://dchao.co/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare interface XDomainCookies {
|
||||
master: string;
|
||||
slave: string;
|
||||
}
|
||||
|
||||
declare interface IXDomain {
|
||||
/**
|
||||
* Will initialize as a master
|
||||
*
|
||||
* Each of the slaves must be defined as: origin: proxy file
|
||||
*
|
||||
* The slaves object is used as a list slaves to force one proxy file per origin.
|
||||
* @param slaveObj
|
||||
*/
|
||||
slaves (slaveObj: Object): void;
|
||||
/**
|
||||
* Will initialize as a slave
|
||||
*
|
||||
* Each of the masters must be defined as: origin: path
|
||||
*
|
||||
* origin and path are converted to a regular expression by escaping all non-alphanumeric chars, then converting * into .* and finally wrapping it with ^ and $. path can also be a RegExp literal.
|
||||
*
|
||||
* Requests that do not match both the origin and the path regular expressions will be blocked.
|
||||
* @param masterObj
|
||||
*/
|
||||
masters (masterObj: Object): void;
|
||||
origin: string;
|
||||
/**
|
||||
* When true, XDomain will log actions to console
|
||||
*/
|
||||
debug: boolean;
|
||||
/**
|
||||
* event may be log, warn or timeout. When listening for log and warn events, handler with contain the message as
|
||||
* the first parameter. The timeout event fires when an iframe exeeds the xdomain.timeout time limit.
|
||||
* @param event
|
||||
* @param handler
|
||||
*/
|
||||
on (event: "log"|"warn"|"timeout", handler: (message?: string) => any): void;
|
||||
cookies: XDomainCookies;
|
||||
}
|
||||
|
||||
declare var xdomain: IXDomain;
|
||||
|
||||
declare module "xdomain" {
|
||||
export const xdomain: IXDomain;
|
||||
}
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare module Xrm.Page
|
||||
*
|
||||
* @sa Control
|
||||
*/
|
||||
export interface KbSearchControl extends Control
|
||||
export interface KbSearchControl extends Xrm.Page.Control
|
||||
{
|
||||
/**
|
||||
* Use this method to add an event handler to the OnResultOpened event.
|
||||
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
/// <reference path="xrm.d.ts" />
|
||||
/// <reference path="parature.d.ts" />
|
||||
|
||||
/// Demonstrate usage in the browser's window object
|
||||
|
||||
window.Xrm.Utility.alertDialog( "message", () => {} );
|
||||
parent.Xrm.Page.context.getOrgLcid();
|
||||
|
||||
/// Demonstrate clientglobalcontext.d.ts
|
||||
|
||||
function _getContext()
|
||||
@@ -91,7 +96,7 @@ Xrm.Page.data.entity.addOnSave(( context ) =>
|
||||
{
|
||||
var eventArgs = context.getEventArgs();
|
||||
|
||||
if ( eventArgs.getSaveMode() === Xrm.Page.SaveMode.AutoSave || eventArgs.getSaveMode() === Xrm.Page.SaveMode.SaveAndClose )
|
||||
if ( eventArgs.getSaveMode() === XrmEnum.SaveMode.AutoSave || eventArgs.getSaveMode() === XrmEnum.SaveMode.SaveAndClose )
|
||||
eventArgs.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
Vendored
+446
-403
@@ -1,10 +1,215 @@
|
||||
// Type definitions for Microsoft Dynamics xRM API v7.1
|
||||
// Type definitions for Microsoft Dynamics xRM API v7.1
|
||||
// Project: http://www.microsoft.com/en-us/download/details.aspx?id=44567
|
||||
// Definitions by: David Berry <https://github.com/6ix4our/>, Matt Ngan <https://github.com/mattngan/>
|
||||
// Definitions by: David Berry <https://github.com/6ix4our/>, Matt Ngan <https://github.com/mattngan/>, Markus Mauch <https://github.com/markusmauch/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var Xrm: Xrm.XrmStatic;
|
||||
declare function GetGlobalContext(): Xrm.Context;
|
||||
|
||||
interface Window
|
||||
{
|
||||
Xrm: Xrm.XrmStatic;
|
||||
GetGlobalContext(): Xrm.Context;
|
||||
}
|
||||
|
||||
declare module Xrm
|
||||
{
|
||||
/**
|
||||
* Static xRM object.
|
||||
*/
|
||||
export interface XrmStatic
|
||||
{
|
||||
/**
|
||||
* Provides a namespace container for the context, data and ui objects.
|
||||
*/
|
||||
Page: {
|
||||
/**
|
||||
* Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page.
|
||||
*/
|
||||
context: Context;
|
||||
|
||||
/**
|
||||
* Provides methods to work with the form.
|
||||
*/
|
||||
data: Data;
|
||||
|
||||
/**
|
||||
* Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form.
|
||||
*/
|
||||
ui: Ui;
|
||||
|
||||
/**
|
||||
* Gets all attributes.
|
||||
*
|
||||
* @return An array of attributes.
|
||||
*/
|
||||
getAttribute(): Page.Attribute[];
|
||||
|
||||
/**
|
||||
* Gets an attribute matching attributeName.
|
||||
*
|
||||
* @tparam T An Attribute type.
|
||||
* @param {string} attributeName Name of the attribute.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
getAttribute<T extends Page.Attribute>( attributeName: string ): T;
|
||||
|
||||
/**
|
||||
* Gets an attribute matching attributeName.
|
||||
*
|
||||
* @param {string} attributeName Name of the attribute.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
getAttribute( attributeName: string ): Page.Attribute;
|
||||
|
||||
/**
|
||||
* Gets an attribute by index.
|
||||
*
|
||||
* @param {number} index The attribute index.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
getAttribute( index: number ): Page.Attribute;
|
||||
|
||||
/**
|
||||
* Gets an attribute.
|
||||
*
|
||||
* @param {Collection.MatchingDelegate{Attribute}} delegateFunction A matching delegate function
|
||||
*
|
||||
* @return An array of attribute.
|
||||
*/
|
||||
getAttribute( delegateFunction: Collection.MatchingDelegate<Page.Attribute> ): Page.Attribute[];
|
||||
|
||||
/**
|
||||
* Gets all controls.
|
||||
*
|
||||
* @return An array of controls.
|
||||
*/
|
||||
getControl(): Page.Control[];
|
||||
|
||||
/**
|
||||
* Gets a control matching controlName.
|
||||
*
|
||||
* @tparam T A Control type
|
||||
* @param {string} controlName Name of the control.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
getControl<T extends Page.Control>( controlName: string ): T;
|
||||
|
||||
/**
|
||||
* Gets a control matching controlName.
|
||||
*
|
||||
* @param {string} controlName Name of the control.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
getControl( controlName: string ): Page.Control;
|
||||
|
||||
/**
|
||||
* Gets a control by index.
|
||||
*
|
||||
* @param {number} index The control index.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
getControl( index: number ): Page.Control;
|
||||
|
||||
/**
|
||||
* Gets a control.
|
||||
*
|
||||
* @param {Collection.MatchingDelegate{Control}} delegateFunction A matching delegate function.
|
||||
*
|
||||
* @return An array of control.
|
||||
*/
|
||||
getControl( delegateFunction: Collection.MatchingDelegate<Page.Control> ): Page.Control[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a container for useful functions not directly related to the current page.
|
||||
*/
|
||||
Utility: {
|
||||
/**
|
||||
* Displays an alert dialog, with an "OK" button.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {function()} onCloseCallback The "OK" callback.
|
||||
*/
|
||||
alertDialog( message: string, onCloseCallback: () => void ): void;
|
||||
|
||||
/**
|
||||
* Displays a confirmation dialog, with "OK" and "Cancel" buttons.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {function()} yesCloseCallback The "OK" callback.
|
||||
* @param {function()} noCloseCallback The "Cancel" callback.
|
||||
*/
|
||||
confirmDialog( message: string, yesCloseCallback: () => void, noCloseCallback: () => void ): void;
|
||||
|
||||
/**
|
||||
* Query if 'entityType' is an Activity entity.
|
||||
*
|
||||
* @param {string} entityType Type of the entity.
|
||||
*
|
||||
* @return true if the entity is an Activity, false if not.
|
||||
*/
|
||||
isActivityType( entityType: string ): boolean;
|
||||
|
||||
/**
|
||||
* Opens quick create.
|
||||
*
|
||||
* @param {Function} callback The function that will be called when a record is created. This
|
||||
* function is passed a LookupValue object as a parameter.
|
||||
* @param {string} entityLogicalName The logical name of the entity to create.
|
||||
* @param {Page.LookupValue} createFromEntity (Optional) Designates a record that will provide default values
|
||||
* based on mapped attribute values.
|
||||
* @param {OpenParameters} parameters (Optional) A dictionary object that passes extra query string
|
||||
* parameters to the form. Invalid query string parameters will cause an
|
||||
* error.
|
||||
*/
|
||||
openQuickCreate(
|
||||
callback: ( recordReference: Page.LookupValue ) => void,
|
||||
entityLogicalName: string,
|
||||
createFromEntity?: Page.LookupValue,
|
||||
parameters?: Utility.OpenParameters ): void;
|
||||
|
||||
/**
|
||||
* Opens an entity form.
|
||||
*
|
||||
* @param {string} name The entity's logical name.
|
||||
* @param {string} id (Optional) The unique identifier for the record.
|
||||
* @param {FormParameters} parameters (Optional) A dictionary object that passes extra query string parameters to the form.
|
||||
* @param {WindowOptions} windowOptions (Optional) Options for controlling the window.
|
||||
*/
|
||||
openEntityForm( name: string, id?: string, parameters?: Utility.FormOpenParameters, windowOptions?: Utility.WindowOptions ): void;
|
||||
|
||||
/**
|
||||
* Opens an HTML Web Resource in a new browser window.
|
||||
*
|
||||
* @param {string} webResourceName Name of the HTML web resource. Can be used to pass URL
|
||||
* parameters. See Remarks.
|
||||
* @param {string} webResourceData (Optional) Data to pass into the Web Resource's data parameter.
|
||||
* It is advised to use encodeURIcomponent() to encode the value.
|
||||
* @param {number} width (Optional) The width of the new window.
|
||||
* @param {number} height (Optional) The height of the new window.
|
||||
*
|
||||
* @return A Window reference, containing the opened Web Resource.
|
||||
*
|
||||
* @remarks This function will not work with Microsoft Dynamics CRM for tablets.
|
||||
* Valid WebResource URL Parameters: typename
|
||||
* type
|
||||
* id
|
||||
* orgname
|
||||
* userlcid
|
||||
* data (identical to this method's webResourceData parameter)
|
||||
* formid
|
||||
*/
|
||||
openWebResource( webResourceName: string, webResourceData?: string, width?: number, height?: number ): Window;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the client context.
|
||||
*/
|
||||
@@ -28,7 +233,7 @@ declare module Xrm
|
||||
/**
|
||||
* Interface for the xRM application context.
|
||||
*/
|
||||
export interface Context
|
||||
interface Context
|
||||
{
|
||||
/**
|
||||
* The client's context instance.
|
||||
@@ -139,6 +344,170 @@ declare module Xrm
|
||||
prependOrgName( sPath: string ): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the Xrm.Page.data object.
|
||||
*/
|
||||
export interface Data
|
||||
{
|
||||
/**
|
||||
* Asynchronously refreshes data on the form, without reloading the page.
|
||||
*
|
||||
* @param {boolean} save true to save the record, after the refresh.
|
||||
*
|
||||
* @return An Async.XrmPromise.
|
||||
*/
|
||||
refresh( save: boolean ): Async.XrmPromise;
|
||||
|
||||
/**
|
||||
* Asynchronously saves the record.
|
||||
*
|
||||
* @return An Async.XrmPromise.
|
||||
*/
|
||||
save(): Async.XrmPromise;
|
||||
|
||||
/**
|
||||
* The record context of the form.
|
||||
*/
|
||||
entity: Page.Entity;
|
||||
|
||||
/**
|
||||
* The process API for Xrm.Page.data.
|
||||
*
|
||||
* @remarks This member may be undefined when Process Flows are not used by the current entity.
|
||||
*/
|
||||
process: Page.data.ProcessManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the Xrm.Page.ui object.
|
||||
*/
|
||||
export interface Ui
|
||||
{
|
||||
/**
|
||||
* Clears the form notification described by uniqueId.
|
||||
*
|
||||
* @param {string} uniqueId Unique identifier.
|
||||
*
|
||||
* @return true if it succeeds, otherwise false.
|
||||
*/
|
||||
clearFormNotification( uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Closes the form.
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* Gets form type.
|
||||
*
|
||||
* @return The form type.
|
||||
*
|
||||
* @remarks Values returned are: 0 Undefined
|
||||
* 1 Create
|
||||
* 2 Update
|
||||
* 3 Read Only
|
||||
* 4 Disabled
|
||||
* 6 Bulk Edit
|
||||
* Deprecated values are 5 (Quick Create), and 11 (Read Optimized)
|
||||
*/
|
||||
getFormType(): XrmEnum.FormType;
|
||||
|
||||
/**
|
||||
* Gets view port height.
|
||||
*
|
||||
* @return The view port height, in pixels.
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
getViewPortHeight(): number;
|
||||
|
||||
/**
|
||||
* Gets view port width.
|
||||
*
|
||||
* @return The view port width, in pixels.
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
getViewPortWidth(): number;
|
||||
|
||||
/**
|
||||
* Re-evaluates the ribbon's configured EnableRules
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
refreshRibbon(): void;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"ERROR"} level An error message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
setFormNotification( message: string, level: "ERROR", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"WARNING"} level A warning message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
setFormNotification( message: string, level: "WARNING", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"INFO"} level An informational message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
setFormNotification( message: string, level: "INFO", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {string} level The level, as either "ERROR", "WARNING", or "INFO".
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, otherwise false.
|
||||
*/
|
||||
setFormNotification( message: string, level: string, uniqueId: string ): boolean;
|
||||
|
||||
process: Page.data.ProcessManager;
|
||||
|
||||
/**
|
||||
* A reference to the collection of controls on the form.
|
||||
*/
|
||||
controls: Collection.ItemCollection<Page.Control>;
|
||||
|
||||
/**
|
||||
* The form selector API.
|
||||
*
|
||||
* @remarks This API does not exist with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
formSelector: Page.FormSelector;
|
||||
|
||||
/**
|
||||
* The navigation API.
|
||||
*
|
||||
* @remarks This API does not exist with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
navigation: Page.Navigation;
|
||||
|
||||
/**
|
||||
* A reference to the collection of tabs on the form.
|
||||
*/
|
||||
tabs: Collection.ItemCollection<Page.Tab>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A definition module for asynchronous interface declarations.
|
||||
*/
|
||||
@@ -277,63 +646,6 @@ declare module Xrm
|
||||
*/
|
||||
export module Page
|
||||
{
|
||||
/**
|
||||
* Enumeration of entity form states/types.
|
||||
*/
|
||||
export const enum FormType
|
||||
{
|
||||
Undefined = 0,
|
||||
Create = 1,
|
||||
Update = 2,
|
||||
ReadOnly = 3,
|
||||
Disabled = 4,
|
||||
BulkEdit = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of entity form save modes.
|
||||
*/
|
||||
export const enum SaveMode
|
||||
{
|
||||
Save = 1,
|
||||
SaveAndClose = 2,
|
||||
SaveAndNew = 59,
|
||||
AutoSave = 70,
|
||||
SaveAsCompleted = 58,
|
||||
Deactivate = 5,
|
||||
Reactivate = 6,
|
||||
Assign = 47,
|
||||
Send = 7,
|
||||
Qualify = 16,
|
||||
Disqualify = 15
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of stage categories.
|
||||
*/
|
||||
export const enum StageCategory
|
||||
{
|
||||
Qualify = 0,
|
||||
Develop = 1,
|
||||
Propose = 2,
|
||||
Close = 3,
|
||||
Identify = 4,
|
||||
Research = 5,
|
||||
Resolve = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of grid control context resolutions.
|
||||
*/
|
||||
export const enum GridControlContext
|
||||
{
|
||||
Unknown = 0,
|
||||
RibbonContextForm = 1,
|
||||
RibbonContextListing = 2,
|
||||
FormContextUnrelated = 3,
|
||||
FormContextRelated = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for a CRM Business Process Flow instance.
|
||||
*/
|
||||
@@ -381,7 +693,7 @@ declare module Xrm
|
||||
*
|
||||
* @return The stage category.
|
||||
*/
|
||||
getCategory(): { getValue(): StageCategory };
|
||||
getCategory(): { getValue(): XrmEnum.StageCategory };
|
||||
|
||||
/**
|
||||
* Returns the logical name of the entity associated with the stage.
|
||||
@@ -486,7 +798,7 @@ declare module Xrm
|
||||
*
|
||||
* @return The event source.
|
||||
*/
|
||||
getEventSource(): Xrm.Page.Attribute | Xrm.Page.Entity;
|
||||
getEventSource(): Page.Attribute | Page.Entity;
|
||||
|
||||
/**
|
||||
* Gets the shared variable with the specified key.
|
||||
@@ -1164,7 +1476,7 @@ declare module Xrm
|
||||
* 16 Qualify (Lead)
|
||||
* 15 Disqualify (Lead)
|
||||
*/
|
||||
getSaveMode(): SaveMode;
|
||||
getSaveMode(): XrmEnum.SaveMode;
|
||||
|
||||
/**
|
||||
* Returns a boolean value to indicate if the record's save has been prevented.
|
||||
@@ -1302,34 +1614,6 @@ declare module Xrm
|
||||
* Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof.
|
||||
*/
|
||||
export type ProcessDictionary = { [index: string]: string };
|
||||
|
||||
/**
|
||||
* Asynchronously refreshes data on the form, without reloading the page.
|
||||
*
|
||||
* @param {boolean} save true to save the record, after the refresh.
|
||||
*
|
||||
* @return An Async.XrmPromise.
|
||||
*/
|
||||
export function refresh( save: boolean ): Async.XrmPromise;
|
||||
|
||||
/**
|
||||
* Asynchronously saves the record.
|
||||
*
|
||||
* @return An Async.XrmPromise.
|
||||
*/
|
||||
export function save(): Async.XrmPromise;
|
||||
|
||||
/**
|
||||
* The record context of the form.
|
||||
*/
|
||||
export var entity: Entity;
|
||||
|
||||
/**
|
||||
* The process API for Xrm.Page.data.
|
||||
*
|
||||
* @remarks This member may be undefined when Process Flows are not used by the current entity.
|
||||
*/
|
||||
export var process: ProcessManager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1612,7 +1896,7 @@ declare module Xrm
|
||||
*
|
||||
* @return The context type.
|
||||
*/
|
||||
getContextType(): GridControlContext;
|
||||
getContextType(): XrmEnum.GridControlContext;
|
||||
|
||||
/**
|
||||
* Use this method to get the logical name of the entity data displayed in the grid.
|
||||
@@ -1767,7 +2051,7 @@ declare module Xrm
|
||||
*
|
||||
* @return The parent.
|
||||
*/
|
||||
getParent(): typeof ui;
|
||||
getParent(): Ui;
|
||||
|
||||
/**
|
||||
* Sets display state of the tab.
|
||||
@@ -1996,130 +2280,6 @@ declare module Xrm
|
||||
*/
|
||||
getEntityReference(): LookupValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the form notification described by uniqueId.
|
||||
*
|
||||
* @param {string} uniqueId Unique identifier.
|
||||
*
|
||||
* @return true if it succeeds, otherwise false.
|
||||
*/
|
||||
export function clearFormNotification( uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Closes the form.
|
||||
*/
|
||||
export function close(): void;
|
||||
|
||||
/**
|
||||
* Gets form type.
|
||||
*
|
||||
* @return The form type.
|
||||
*
|
||||
* @remarks Values returned are: 0 Undefined
|
||||
* 1 Create
|
||||
* 2 Update
|
||||
* 3 Read Only
|
||||
* 4 Disabled
|
||||
* 6 Bulk Edit
|
||||
* Deprecated values are 5 (Quick Create), and 11 (Read Optimized)
|
||||
*/
|
||||
export function getFormType(): FormType;
|
||||
|
||||
/**
|
||||
* Gets view port height.
|
||||
*
|
||||
* @return The view port height, in pixels.
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
export function getViewPortHeight(): number;
|
||||
|
||||
/**
|
||||
* Gets view port width.
|
||||
*
|
||||
* @return The view port width, in pixels.
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
export function getViewPortWidth(): number;
|
||||
|
||||
/**
|
||||
* Re-evaluates the ribbon's configured EnableRules
|
||||
*
|
||||
* @remarks This method does not work with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
export function refreshRibbon(): void;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"ERROR"} level An error message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
export function setFormNotification( message: string, level: "ERROR", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"WARNING"} level A warning message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
export function setFormNotification( message: string, level: "WARNING", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {"INFO"} level An informational message.
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, false if it fails.
|
||||
*/
|
||||
export function setFormNotification( message: string, level: "INFO", uniqueId: string ): boolean;
|
||||
|
||||
/**
|
||||
* Sets a form-level notification.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {string} level The level, as either "ERROR", "WARNING", or "INFO".
|
||||
* @param {string} uniqueId A unique identifier for the message.
|
||||
*
|
||||
* @return true if it succeeds, otherwise false.
|
||||
*/
|
||||
export function setFormNotification( message: string, level: string, uniqueId: string ): boolean;
|
||||
|
||||
export var process: ProcessManager;
|
||||
|
||||
/**
|
||||
* A reference to the collection of controls on the form.
|
||||
*/
|
||||
export var controls: Collection.ItemCollection<Control>;
|
||||
|
||||
/**
|
||||
* The form selector API.
|
||||
*
|
||||
* @remarks This API does not exist with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
export var formSelector: FormSelector;
|
||||
|
||||
/**
|
||||
* The navigation API.
|
||||
*
|
||||
* @remarks This API does not exist with Microsoft Dynamics CRM for tablets.
|
||||
*/
|
||||
export var navigation: Navigation;
|
||||
|
||||
/**
|
||||
* A reference to the collection of tabs on the form.
|
||||
*/
|
||||
export var tabs: Collection.ItemCollection<Tab>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2193,99 +2353,6 @@ declare module Xrm
|
||||
*/
|
||||
items: Collection.ItemCollection<FormItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A reference to the xRM application context.
|
||||
*/
|
||||
export var context: Context;
|
||||
|
||||
/**
|
||||
* Gets all attributes.
|
||||
*
|
||||
* @return An array of attributes.
|
||||
*/
|
||||
export function getAttribute(): Attribute[];
|
||||
|
||||
/**
|
||||
* Gets an attribute matching attributeName.
|
||||
*
|
||||
* @tparam T An Attribute type.
|
||||
* @param {string} attributeName Name of the attribute.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
export function getAttribute<T extends Attribute>( attributeName: string ): T;
|
||||
|
||||
/**
|
||||
* Gets an attribute matching attributeName.
|
||||
*
|
||||
* @param {string} attributeName Name of the attribute.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
export function getAttribute( attributeName: string ): Attribute;
|
||||
|
||||
/**
|
||||
* Gets an attribute by index.
|
||||
*
|
||||
* @param {number} index The attribute index.
|
||||
*
|
||||
* @return The attribute.
|
||||
*/
|
||||
export function getAttribute( index: number ): Attribute;
|
||||
|
||||
/**
|
||||
* Gets an attribute.
|
||||
*
|
||||
* @param {Collection.MatchingDelegate{Attribute}} delegateFunction A matching delegate function
|
||||
*
|
||||
* @return An array of attribute.
|
||||
*/
|
||||
export function getAttribute( delegateFunction: Collection.MatchingDelegate<Attribute> ): Attribute[];
|
||||
|
||||
/**
|
||||
* Gets all controls.
|
||||
*
|
||||
* @return An array of controls.
|
||||
*/
|
||||
export function getControl(): Control[];
|
||||
|
||||
/**
|
||||
* Gets a control matching controlName.
|
||||
*
|
||||
* @tparam T A Control type
|
||||
* @param {string} controlName Name of the control.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
export function getControl<T extends Control>( controlName: string ): T;
|
||||
|
||||
/**
|
||||
* Gets a control matching controlName.
|
||||
*
|
||||
* @param {string} controlName Name of the control.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
export function getControl( controlName: string ): Control;
|
||||
|
||||
/**
|
||||
* Gets a control by index.
|
||||
*
|
||||
* @param {number} index The control index.
|
||||
*
|
||||
* @return The control.
|
||||
*/
|
||||
export function getControl( index: number ): Control;
|
||||
|
||||
/**
|
||||
* Gets a control.
|
||||
*
|
||||
* @param {Collection.MatchingDelegate{Control}} delegateFunction A matching delegate function.
|
||||
*
|
||||
* @return An array of control.
|
||||
*/
|
||||
export function getControl( delegateFunction: Collection.MatchingDelegate<Control> ): Control[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2295,15 +2362,6 @@ declare module Xrm
|
||||
*/
|
||||
export module Url
|
||||
{
|
||||
/**
|
||||
* An enumeration for view types.
|
||||
*/
|
||||
export const enum ViewType
|
||||
{
|
||||
SystemView = 1039,
|
||||
UserView = 4230
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for defining parameters on a request to open a form with main.aspx (as with
|
||||
* window.open). Useful for parsing the keys and values into a string of the format:
|
||||
@@ -2376,7 +2434,7 @@ declare module Xrm
|
||||
* @remarks Accepted values are: 1039 System View
|
||||
* 4230 User View.
|
||||
*/
|
||||
viewtype: ViewType;
|
||||
viewtype: XrmEnum.ViewType;
|
||||
|
||||
/**
|
||||
* Controls whether the command bar is displayed.
|
||||
@@ -2506,89 +2564,74 @@ declare module Xrm
|
||||
*/
|
||||
openInNewWindow: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an alert dialog, with an "OK" button.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {function()} onCloseCallback The "OK" callback.
|
||||
*/
|
||||
export function alertDialog( message: string, onCloseCallback: () => void ): void;
|
||||
|
||||
/**
|
||||
* Displays a confirmation dialog, with "OK" and "Cancel" buttons.
|
||||
*
|
||||
* @param {string} message The message.
|
||||
* @param {function()} yesCloseCallback The "OK" callback.
|
||||
* @param {function()} noCloseCallback The "Cancel" callback.
|
||||
*/
|
||||
export function confirmDialog( message: string, yesCloseCallback: () => void, noCloseCallback: () => void ): void;
|
||||
|
||||
/**
|
||||
* Query if 'entityType' is an Activity entity.
|
||||
*
|
||||
* @param {string} entityType Type of the entity.
|
||||
*
|
||||
* @return true if the entity is an Activity, false if not.
|
||||
*/
|
||||
export function isActivityType( entityType: string ): boolean;
|
||||
|
||||
/**
|
||||
* Opens an entity form.
|
||||
*
|
||||
* @param {string} name The entity's logical name.
|
||||
* @param {string} id (Optional) The unique identifier for the record.
|
||||
* @param {FormParameters} parameters (Optional) A dictionary object that passes extra query string parameters to the form.
|
||||
* @param {WindowOptions} windowOptions (Optional) Options for controlling the window.
|
||||
*/
|
||||
export function openEntityForm( name: string, id?: string, parameters?: FormOpenParameters, windowOptions?: WindowOptions ): void;
|
||||
|
||||
/**
|
||||
* Opens quick create.
|
||||
*
|
||||
* @param {Function} callback The function that will be called when a record is created. This
|
||||
* function is passed a LookupValue object as a parameter.
|
||||
* @param {string} entityLogicalName The logical name of the entity to create.
|
||||
* @param {Page.LookupValue} createFromEntity (Optional) Designates a record that will provide default values
|
||||
* based on mapped attribute values.
|
||||
* @param {OpenParameters} parameters (Optional) A dictionary object that passes extra query string
|
||||
* parameters to the form. Invalid query string parameters will cause an
|
||||
* error.
|
||||
*/
|
||||
export function openQuickCreate( callback: ( recordReference: Page.LookupValue ) => void,
|
||||
entityLogicalName: string,
|
||||
createFromEntity?: Page.LookupValue,
|
||||
parameters?: OpenParameters ): void;
|
||||
|
||||
/**
|
||||
* Opens an HTML Web Resource in a new browser window.
|
||||
*
|
||||
* @param {string} webResourceName Name of the HTML web resource. Can be used to pass URL
|
||||
* parameters. See Remarks.
|
||||
* @param {string} webResourceData (Optional) Data to pass into the Web Resource's data parameter.
|
||||
* It is advised to use encodeURIcomponent() to encode the value.
|
||||
* @param {number} width (Optional) The width of the new window.
|
||||
* @param {number} height (Optional) The height of the new window.
|
||||
*
|
||||
* @return A Window reference, containing the opened Web Resource.
|
||||
*
|
||||
* @remarks This function will not work with Microsoft Dynamics CRM for tablets.
|
||||
* Valid WebResource URL Parameters: typename
|
||||
* type
|
||||
* id
|
||||
* orgname
|
||||
* userlcid
|
||||
* data (identical to this method's webResourceData parameter)
|
||||
* formid
|
||||
*/
|
||||
export function openWebResource( webResourceName: string, webResourceData?: string, width?: number, height?: number ): Window;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the xRM application context, for HTML web resources, included by ClientGlobalContext.js.aspx
|
||||
* @returns {Xrm.Context} The application context for the user's current session.
|
||||
* @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will
|
||||
* cancel the onselectstart, contextmenu, and ondragstart events.
|
||||
*/
|
||||
declare function GetGlobalContext(): Xrm.Context;
|
||||
declare module XrmEnum
|
||||
{
|
||||
/**
|
||||
* Enumeration of entity form states/types.
|
||||
*/
|
||||
export const enum FormType
|
||||
{
|
||||
Undefined = 0,
|
||||
Create = 1,
|
||||
Update = 2,
|
||||
ReadOnly = 3,
|
||||
Disabled = 4,
|
||||
BulkEdit = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of entity form save modes.
|
||||
*/
|
||||
export const enum SaveMode
|
||||
{
|
||||
Save = 1,
|
||||
SaveAndClose = 2,
|
||||
SaveAndNew = 59,
|
||||
AutoSave = 70,
|
||||
SaveAsCompleted = 58,
|
||||
Deactivate = 5,
|
||||
Reactivate = 6,
|
||||
Assign = 47,
|
||||
Send = 7,
|
||||
Qualify = 16,
|
||||
Disqualify = 15
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of stage categories.
|
||||
*/
|
||||
export const enum StageCategory
|
||||
{
|
||||
Qualify = 0,
|
||||
Develop = 1,
|
||||
Propose = 2,
|
||||
Close = 3,
|
||||
Identify = 4,
|
||||
Research = 5,
|
||||
Resolve = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of grid control context resolutions.
|
||||
*/
|
||||
export const enum GridControlContext
|
||||
{
|
||||
Unknown = 0,
|
||||
RibbonContextForm = 1,
|
||||
RibbonContextListing = 2,
|
||||
FormContextUnrelated = 3,
|
||||
FormContextRelated = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration for view types.
|
||||
*/
|
||||
export const enum ViewType
|
||||
{
|
||||
SystemView = 1039,
|
||||
UserView = 4230
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user